吉安感知网项目-前端
chenyao
4 days ago a53ece5036c1fa61a63fe5f9e0cd3519210ab928
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/FormDiaLog.vue
@@ -92,7 +92,7 @@
                        />
                     </template>
                  </el-table-column>
                  <el-table-column prop="patrolTaskType" min-width="100">
                  <el-table-column prop="patrolTaskType" min-width="120">
                     <template #header>
                        <span class="required-star">*</span>
                        巡查任务类型
@@ -103,8 +103,9 @@
                           popper-class="gd-select-popper"
                           v-model="row.patrolTaskType"
                           :options="workOrderTypeXT"
                           :props="taskTypeCascaderProps"
                           :props="{...taskTypeCascaderProps,multiple:true}"
                           placeholder="请选择"
                           collapse-tags
                           @change="handlePatrolTaskTypeChange($index, $event)"
                        />
                     </template>
@@ -160,8 +161,7 @@
                           v-model="row.deviceFlyerId"
                           placeholder="请选择"
                           filterable
                           :disabled="dialogReadonly || !hasTaskTypeValue(taskList[$index].patrolTaskType)"
                           :disabled="dialogReadonly || !taskList[$index].patrolTaskType"
                        >
                           <el-option
                              v-for="item in flyerListMap[$index] || []"
@@ -171,7 +171,7 @@
                           >
                              <template #default>
                              <!-- 匹配区域=1 显示红星号 -->
                              <span v-if="item.areaMatchFlag === 1" style="color: #f56c6c; margin-right: 4px;">*</span>
                              <span v-if="item.taskTypeMatchFlag === 1" style="color: #f56c6c; margin-right: 4px;">*</span>
                              <span>{{ item.flyerName }}</span>
                              </template>
                           </el-option>
@@ -272,10 +272,7 @@
import { airlineListApi, algorithmGroupedApi } from '@/api/zkxt'
import {
   getTaskTypeLabel,
   getTaskTypeLeafValues,
   taskTypeCascaderProps,
   toTaskTypeCascaderValue,
   toTaskTypeRequestValue,
} from '../taskTypeOptions'
// 初始化任务行
@@ -341,14 +338,13 @@
      // 将工单类型赋值给所有子任务行
      const workOrderType = selectedWorkOrder.value?.workOrderType
      if (workOrderType) {
         const patrolTaskType = toTaskTypeCascaderValue(workOrderType)
         taskList.value.forEach((task, index) => {
            taskList.value[index] = {
               ...initTaskRow(),
               patrolTaskType,
               patrolTaskType: workOrderType,
            }
            // 获取对应的飞手列表
            getFlyerList(index, patrolTaskType)
            getFlyerList(index, workOrderType)
         })
      }
   } else {
@@ -376,7 +372,7 @@
   const newTask = initTaskRow()
   // 如果已选择工单,自动填充工单类型
   if (selectedWorkOrder.value?.workOrderType) {
      newTask.patrolTaskType = toTaskTypeCascaderValue(selectedWorkOrder.value.workOrderType)
      newTask.patrolTaskType = selectedWorkOrder.value.workOrderType
   }
   const newIndex = taskList.value.length
   taskList.value.push(newTask)
@@ -440,8 +436,7 @@
// 获取飞手列表
async function getFlyerList(index, skilledTaskType) {
   const leafValues = getTaskTypeLeafValues(skilledTaskType)
   if (!leafValues.length) {
   if (!skilledTaskType.length) {
      flyerListMap.value[index] = []
      return
   }
@@ -449,7 +444,7 @@
   const res = await gdFlyerPageApi({
      size: 999,
      current: 1,
      skilledTaskType: leafValues.join(','),
      skilledTaskType: skilledTaskType.map(item => item[1])?.join?.(','),
      // longitude: obj.longitude || '',
      // latitude: obj.latitude || '',
   })
@@ -476,7 +471,6 @@
function isTaskRowFilled(task) {
   return !!(
      task.patrolTaskName ||
      hasTaskTypeValue(task.patrolTaskType) ||
      task.executeTime ||
      task.patrolRouteUrl ||
      task.deviceFlyerId ||
@@ -484,9 +478,6 @@
   )
}
function hasTaskTypeValue(value) {
   return !!toTaskTypeRequestValue(value).length
}
// 提交新增
async function handleSubmit() {
@@ -508,10 +499,6 @@
      // 已填写的行需要校验完整性
      if (!task.patrolTaskName) {
         ElMessage.warning(`第${i + 1}行: 请输入巡查任务名称`)
         return
      }
      if (!hasTaskTypeValue(task.patrolTaskType)) {
         ElMessage.warning(`第${i + 1}行: 请选择巡查任务类型`)
         return
      }
      if (!task.executeTime) {
@@ -537,7 +524,6 @@
      // 只提交已填写的任务行
      const dataList = filledTasks.map(item => ({
         ...item,
         patrolTaskType: toTaskTypeRequestValue(item.patrolTaskType),
         workOrderId: selectedWorkOrderId.value,
         id: undefined,
      }))
@@ -566,7 +552,7 @@
      // 编辑/查看模式 - 加载已有数据
      selectedWorkOrderId.value = row?.workOrderId
      handleWorkOrderChange(row?.workOrderId)
      taskList.value = [{ ...row, patrolTaskType: toTaskTypeCascaderValue(row?.patrolTaskType) }]
      taskList.value = [{ ...row, patrolTaskType: row?.patrolTaskType || [] }]
      flyerListMap.value = {}
      // 如果有巡查类型,加载对应的飞手列表
      if (row?.patrolTaskType) {