| | |
| | | }) |
| | | |
| | | const formRef = ref(null) |
| | | const formData = reactive({ |
| | | |
| | | const initForm = () => ({ |
| | | flyerName: '', |
| | | flyerId: '', |
| | | flyerPhone: '', |
| | |
| | | technicalStrength: '', |
| | | skilledUavType: '', |
| | | certification: [], // 证书 |
| | | regionCode: '', // 区域编码 |
| | | }) |
| | | |
| | | const formData = ref(initForm()) // 表单数据 |
| | | |
| | | |
| | | // const rules = { |
| | | // flyerId: fieldRules(true), |
| | | // flyerPhone: fieldRules(true, 50), |
| | | // flightHours: fieldRules(true, 50), |
| | | // technicalSkills: fieldRules(true, 50), |
| | | // skilledTaskType: fieldRules(true), |
| | | // projectExperience: fieldRules(true), |
| | | // technicalStrength: fieldRules(true), |
| | | // skilledUavType: fieldRules(true, 50), |
| | | // } |
| | | |
| | | const rules = { |
| | | flyerId: [ |
| | |
| | | watch( |
| | | () => props.flyingHandData, |
| | | (newData) => { |
| | | formData.value = initForm() |
| | | if (newData) { |
| | | Object.assign(formData, newData) |
| | | formData.flightHours = Number(newData.flightHours) |
| | | } |
| | | Object.assign(formData.value, newData) |
| | | formData.value.flightHours = Number(newData.flightHours) |
| | | } |
| | | }, |
| | | { deep: true, immediate: true } |
| | | ) |
| | |
| | | // 处理选择飞手姓名 |
| | | function handleChange(val) { |
| | | const result = flyingHandList.value.find(item => item.id === val) || [] |
| | | formData.flyerName = result.name |
| | | formData.certification = formData.certification.concat(result.licenseFrontFileUrl || [], result.licenseBackFileUrl || []) |
| | | formData.value.flyerName = result.name |
| | | formData.value.regionCode = result.regionCode |
| | | formData.value.certification = formData.value.certification.concat(result.licenseFrontFileUrl || [], result.licenseBackFileUrl || []) |
| | | } |
| | | |
| | | |
| | |
| | | function resetForm() { |
| | | formRef.value?.resetFields() |
| | | // 重置为默认值 |
| | | Object.assign(formData, { |
| | | Object.assign(formData.value, { |
| | | flyerName: '', |
| | | flyerPhone: '', |
| | | flightHours: 0, |
| | |
| | | |
| | | try { |
| | | if (props.dialogType === 'add') { |
| | | await submitFlyingHand(formData) |
| | | await submitFlyingHand(formData.value) |
| | | ElMessage.success('添加成功') |
| | | } else if (props.dialogType === 'edit') { |
| | | await submitFlyingHand(formData) |
| | | await submitFlyingHand(formData.value) |
| | | ElMessage.success('编辑成功') |
| | | } |
| | | emit('confirm') |