吉安感知网项目-前端
罗广辉
2026-01-27 7319ec49da9f1490ad35f47e0da62546d1cc7ff4
applications/task-work-order/src/views/orderView/flyingHand/FlyingHandDialog.vue
@@ -199,7 +199,8 @@
})
const formRef = ref(null)
const formData = reactive({
const initForm = () => ({
   flyerName: '',
   flyerId: '',
   flyerPhone: '',
@@ -208,7 +209,22 @@
   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: [
@@ -243,10 +259,11 @@
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 }
)
@@ -260,8 +277,9 @@
// 处理选择飞手姓名
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 || [])
}
@@ -270,7 +288,7 @@
function resetForm() {
   formRef.value?.resetFields()
   // 重置为默认值
   Object.assign(formData, {
   Object.assign(formData.value, {
      flyerName: '',
      flyerPhone: '',
      flightHours: 0,
@@ -290,10 +308,10 @@
   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')