<template>
	<a-c-form :createForm="createForm">
		<a-form-item label="英语" name="english">
			<a-c-select :dict="2008" placeholder="请选择掌握程度" @saveSelect="saveEnglish"></a-c-select>
		</a-form-item>
		<a-form-item label="国语" name="mandarin">
			<a-c-select :dict="2008" placeholder="请选择掌握程度" @saveSelect="saveMandarin"></a-c-select>
		</a-form-item>
		<a-form-item label="粤语" name="cantonese">
			<a-c-select :dict="2008" placeholder="请选择掌握程度" @saveSelect="saveCantonese"></a-c-select>
		</a-form-item>
		<a-form-item label="第二外语" name="other_language">
			<a-c-select :dict="2007" placeholder="请选择掌握程度" @saveSelect="saveOtherLanguage"></a-c-select>
		</a-form-item>
		<a-form-item label="计算机能力" name="computer_skills">
			<a-input v-model:value="createForm.computer_skills" placeholder="请输入计算机能力" />
		</a-form-item>
		<a-form-item :wrapper-col="{ span: 14, offset: 4 }">
			<a-button type="primary" @click="onSubmit">保存</a-button>
			<a-button style="margin-left: 10px">重置</a-button>
		</a-form-item>
		
	</a-c-form>
</template>

<script lang="ts" setup>
	import { ref, onMounted, watch, computed } from 'vue';
	let createForm = ref({
		english: 0,
		mandarin: 0,
		cantonese: 0,
		other_language: 0,
		computer_skills: ""
	})

	const resetForm = () => {
		createForm.value = {
			english: 0,
			mandarin: 0,
			cantonese: 0,
			other_language: 0,
			computer_skills: ""
		}
	}
	
	// 英语
	const saveEnglish = (data) => {
		createForm.value.english = data.val;
	}
	
	// 国语
	const saveMandarin = (data) => {
		createForm.value.mandarin = data.val;
	}
	
	// 粤语
	const saveCantonese = (data) => {
		createForm.value.cantonese = data.val;
	}
	
	// 第二外语
	const saveOtherLanguage = (data) => {
		createForm.value.english = data.val;
	}
</script>

<style>
</style>