吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
applications/task-work-order/src/views/orderView/flyingHand/FlyingHandDialog.vue
@@ -7,12 +7,61 @@
      destroy-on-close
      :close-on-click-modal="false"
   >
   <el-row class="detail-row-view" v-if="dialogType === 'view'">
      <el-col :span="12">
        <div class="label">飞手姓名</div>
        <div class="val">{{ formData.flyerName }}</div>
      </el-col>
      <el-col :span="12">
        <div class="label">飞手电话</div>
        <div class="val">{{ formData.flyerPhone }}</div>
      </el-col>
      <el-col :span="12">
        <div class="label">飞行时长</div>
        <div class="val">{{ formData.flightHours }}</div>
      </el-col>
      <el-col :span="12">
        <div class="label">技术特长</div>
        <div class="val">{{ getDictLabel(formData.technicalStrength, dictObj.technicalStrength) }}</div>
      </el-col>
     <el-col :span="12">
        <div class="label">擅长机型</div>
        <div class="val">{{ getDictLabel(formData.skilledUavType, dictObj.skilledUavType) }}</div>
      </el-col>
     <el-col :span="12">
        <div class="label">擅长任务类型</div>
        <div class="val">{{ getDictLabel(formData.skilledTaskType, dictObj.workOrderType) }}</div>
      </el-col>
     <el-col :span="12">
        <div class="label">项目经验</div>
        <div class="val">{{ formData.projectExperience }}</div>
      </el-col>
     <el-col :span="12">
        <div class="label">飞手地址</div>
        <div class="val">{{ formData.flyerAddress }}</div>
      </el-col>
     <el-col :span="24">
        <div class="label">飞手证书</div>
        <div class="val">
         <el-image
            v-for="(item, index) in formData.certification"
            :key="index"
            :src="item"
            :preview-src-list="formData.certification"
            class="gd-image"
            style="width: 100px; height: 100px; margin-right: 10px;"
         />
      </div>
      </el-col>
    </el-row>
      <el-form
         ref="formRef"
         :model="formData"
         :rules="rules"
         class="gd-form"
         class="gd-dialog-form"
         label-width="160px"
         v-else
      >
         <el-row>
            <el-col :span="12">
@@ -104,7 +153,7 @@
                     :disabled="dialogType === 'view'"
                  >
                     <el-option
                        v-for="item in dictObj.skilledTaskType"
                        v-for="item in dictObj.workOrderType"
                        :key="item.dictKey"
                        :label="item.dictValue"
                        :value="item.dictKey"
@@ -124,29 +173,17 @@
                  />
               </el-form-item>
            </el-col>
            <el-col :span="24" v-if="dialogType === 'view'">
               <el-form-item label="飞手证书" prop="certification">
                  <el-image
                     v-for="(item, index) in formData.certification"
                     :key="index"
                     :src="item"
                     :preview-src-list="formData.certification"
                     class="gd-image"
                     style="width: 100px; height: 100px; margin-right: 10px;"
                  />
               </el-form-item>
            </el-col>
         </el-row>
      </el-form>
      <template #footer>
         <el-button color="#F2F3F5" @click="handleClose">取消</el-button>
         <el-button v-if="dialogType !== 'view'" color="#F2F3F5" @click="handleClose">取消</el-button>
         <el-button
            v-if="dialogType !== 'view'"
            type="primary"
            color="#4C34FF"
            @click="handleSubmit"
         >
            确定
            保存
         </el-button>
      </template>
   </el-dialog>
@@ -155,6 +192,7 @@
import { ref, reactive, computed, watch, inject } from 'vue'
import { submitFlyingHand } from './flyingHandApi'
import { ElMessage } from 'element-plus'
import { getDictLabel } from '@ztzf/utils'
import { fieldRules } from '@ztzf/utils'
@@ -188,18 +226,19 @@
const dialogTitle = computed(() => {
   switch (props.dialogType) {
      case 'add':
         return '添加飞手信息'
         return '飞手建档'
      case 'edit':
         return '编辑飞手信息'
         return '编辑'
      case 'view':
         return '查看飞手信息'
         return '查看'
      default:
         return '飞手信息'
   }
})
const formRef = ref(null)
const formData = reactive({
const initForm = () => ({
   flyerName: '',
   flyerId: '',
   flyerPhone: '',
@@ -208,7 +247,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,9 +297,10 @@
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 +315,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 +326,7 @@
function resetForm() {
   formRef.value?.resetFields()
   // 重置为默认值
   Object.assign(formData, {
   Object.assign(formData.value, {
      flyerName: '',
      flyerPhone: '',
      flightHours: 0,
@@ -290,10 +346,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')
@@ -310,4 +366,4 @@
      margin-bottom: 20px;
   }
}
</style>
</style>