| | |
| | | :title="titleEnum[dialogMode]" |
| | | @closed="visible = false" |
| | | destroy-on-close |
| | | width="75%" |
| | | width="90%" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div> |
| | |
| | | <div class="info-item"> |
| | | <span class="label">工单类型</span> |
| | | <span class="val" v-if="selectedWorkOrder"> |
| | | {{ getDictLabel(selectedWorkOrder.workOrderType, dictObj.workOrderType) }} |
| | | {{ getTaskTypeLabel(selectedWorkOrder.workOrderType, workOrderTypeXT) }} |
| | | </span> |
| | | <span class="val grayText" v-else>选择工单后自动带出</span> |
| | | </div> |
| | |
| | | /> |
| | | </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> |
| | | 巡查任务类型 |
| | | </template> |
| | | <template v-slot="{ row, $index }"> |
| | | <el-select |
| | | <el-cascader |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | v-model="row.patrolTaskType" |
| | | :options="workOrderTypeXT" |
| | | :props="{...taskTypeCascaderProps,multiple:true}" |
| | | placeholder="请选择" |
| | | collapse-tags |
| | | @change="handlePatrolTaskTypeChange($index, $event)" |
| | | > |
| | | <el-option |
| | | v-for="item in dictObj.workOrderType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="executeTime" width="200"> |
| | |
| | | <el-select |
| | | no-data-text="暂无推荐飞手" |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | popper-class="gd-select-popper" |
| | | v-model="row.deviceFlyerId" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogReadonly || !taskList[$index].patrolTaskType" |
| | | |
| | | > |
| | | <el-option |
| | | v-for="item in flyerListMap[$index] || []" |
| | |
| | | > |
| | | <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> |
| | |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="algorithmIds" min-width="160"> |
| | | <template #header> |
| | | 算法 |
| | | </template> |
| | | <template v-slot="{ row }"> |
| | | <el-tree-select |
| | | class="gd-select" |
| | | popper-class="gd-tree-select-popper" |
| | | v-model="row.algorithmIds" |
| | | :data="algorithmTreeData" |
| | | :props="{ label: 'name', children: 'children', value: 'id' }" |
| | | node-key="id" |
| | | multiple |
| | | collapse-tags |
| | | collapse-tags-tooltip |
| | | check-strictly |
| | | filterable |
| | | placeholder="请选择" |
| | | :disabled="dialogReadonly" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | |
| | | <el-table-column prop="taskDesc" label="巡查任务描述"> |
| | | <template v-slot="{ row }"> |
| | | <el-input class="gd-input" v-model="row.taskDesc" placeholder="请输入" :disabled="dialogReadonly" /> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref, onMounted } from 'vue' |
| | | import { computed, ref, onMounted, inject } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { Plus, Delete } from '@element-plus/icons-vue' |
| | | import { geomAnalysis, getDictLabel } from '@ztzf/utils' |
| | | |
| | | import { gdPatrolTaskSaveApi, gdFlyerPageApi, gdPatrolTaskAuditApi } from './inspectionRequestApi' |
| | | import { gdWorkOrderPageApi } from '../orderManage/orderManageApi' |
| | | import { gdManageDeviceListApi } from '../orderManage/gdManageDeviceApi' |
| | | import { pxToRem } from '@/utils/rem' |
| | | import { airlineListApi } from '@/api/zkxt' |
| | | import { airlineListApi, algorithmGroupedApi } from '@/api/zkxt' |
| | | import { |
| | | getTaskTypeLabel, |
| | | taskTypeCascaderProps, |
| | | } from '../taskTypeOptions' |
| | | |
| | | // 初始化任务行 |
| | | const initTaskRow = () => ({ |
| | | patrolTaskName: '', |
| | | patrolTaskType: '', |
| | | patrolTaskType: [], |
| | | executeTime: '', |
| | | patrolRouteUrl: '', |
| | | deviceFlyerId: '', |
| | | deviceId: null, |
| | | algorithmIds: [], |
| | | taskDesc: '', |
| | | }) |
| | | const dictObj = inject('dictObj') |
| | |
| | | const deviceList = ref([]) // 设备列表 |
| | | const routeOptions = ref([]) // 航线选项(根据工单范围获取) |
| | | const routeLoading = ref(false) // 航线加载中 |
| | | const algorithmTreeData = ref([]) // 算法树形数据 |
| | | const workOrderTypeXT = inject('workOrderTypeXT', ref([])) |
| | | |
| | | // 获取算法分组数据 |
| | | async function getAlgorithmList() { |
| | | try { |
| | | const res = await algorithmGroupedApi() |
| | | const list = res?.data?.data ?? [] |
| | | algorithmTreeData.value = list.map(group => ({ |
| | | id: 'group_' + group.type, |
| | | name: group.type, |
| | | disabled: true, |
| | | children: (group.algorithms || []).map(alg => ({ |
| | | id: alg.id, |
| | | name: alg.name, |
| | | })) |
| | | })) |
| | | } catch (e) { |
| | | console.error('获取算法列表失败', e) |
| | | } |
| | | } |
| | | |
| | | // 子任务列表 |
| | | const taskList = ref([initTaskRow()]) |
| | |
| | | |
| | | // 获取飞手列表 |
| | | async function getFlyerList(index, skilledTaskType) { |
| | | if (!skilledTaskType.length) { |
| | | flyerListMap.value[index] = [] |
| | | return |
| | | } |
| | | const obj = getPolygonCenter(geomAnalysis(selectedWorkOrder.value.geom)) |
| | | const res = await gdFlyerPageApi({ |
| | | size: 999, |
| | | current: 1, |
| | | skilledTaskType, |
| | | skilledTaskType: skilledTaskType.map(item => item[1])?.join?.(','), |
| | | // longitude: obj.longitude || '', |
| | | // latitude: obj.latitude || '', |
| | | }) |
| | |
| | | |
| | | // 判断一行是否已填写(至少填写了任务名称) |
| | | function isTaskRowFilled(task) { |
| | | return !!(task.patrolTaskName || task.executeTime || task.patrolRouteUrl || task.deviceFlyerId || task.deviceId) |
| | | return !!( |
| | | task.patrolTaskName || |
| | | task.executeTime || |
| | | task.patrolRouteUrl || |
| | | task.deviceFlyerId || |
| | | task.deviceId |
| | | ) |
| | | } |
| | | |
| | | |
| | | // 提交新增 |
| | | async function handleSubmit() { |
| | |
| | | // 已填写的行需要校验完整性 |
| | | if (!task.patrolTaskName) { |
| | | ElMessage.warning(`第${i + 1}行: 请输入巡查任务名称`) |
| | | return |
| | | } |
| | | if (!task.patrolTaskType) { |
| | | ElMessage.warning(`第${i + 1}行: 请选择巡查任务类型`) |
| | | return |
| | | } |
| | | if (!task.executeTime) { |
| | |
| | | async function open({ mode = 'add', row } = {}) { |
| | | dialogMode.value = mode |
| | | await getWorkOrderList() |
| | | getAlgorithmList() |
| | | |
| | | if (dialogMode.value === 'add') { |
| | | selectedWorkOrderId.value = null |
| | | selectedWorkOrder.value = null |
| | |
| | | // 编辑/查看模式 - 加载已有数据 |
| | | selectedWorkOrderId.value = row?.workOrderId |
| | | handleWorkOrderChange(row?.workOrderId) |
| | | taskList.value = [{ ...row }] |
| | | taskList.value = [{ ...row, patrolTaskType: row?.patrolTaskType || [] }] |
| | | flyerListMap.value = {} |
| | | // 如果有巡查类型,加载对应的飞手列表 |
| | | if (row?.patrolTaskType) { |
| | | getFlyerList(0, row.patrolTaskType) |
| | | getFlyerList(0, taskList.value[0].patrolTaskType) |
| | | } |
| | | } |
| | | } |