| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="label">擅长任务类型</div> |
| | | <div class="val">{{ getDictLabel(formData.skilledTaskType, dictObj.workOrderType) }}</div> |
| | | <div class="val">{{ getTaskTypeLabel(formData.skilledTaskType, workOrderTypeXT) }}</div> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="label">项目经验</div> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="擅长任务类型" prop="skilledTaskType"> |
| | | <el-select |
| | | class="gd-select" |
| | | popper-class="gd-select-popper" |
| | | <el-cascader |
| | | class="gd-cascader" |
| | | popper-class="gd-cascader-popper" |
| | | v-model="formData.skilledTaskType" |
| | | :options="workOrderTypeXT" |
| | | :props="{ ...taskTypeCascaderProps, multiple: true }" |
| | | placeholder="请选择" |
| | | :disabled="dialogType === 'view'" |
| | | > |
| | | <el-option |
| | | v-for="item in dictObj.workOrderType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | clearable |
| | | collapse-tags |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | |
| | | import { submitFlyingHand } from './flyingHandApi' |
| | | import { ElMessage } from 'element-plus' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { |
| | | getTaskTypeLabel, |
| | | taskTypeCascaderProps, |
| | | } from '../orderManage/taskTypeOptions' |
| | | |
| | | import { fieldRules } from '@ztzf/utils' |
| | | |
| | |
| | | }) |
| | | |
| | | const dictObj = inject('dictObj') // 擅长任务类型 |
| | | const workOrderTypeXT = inject('workOrderTypeXT', ref([])) |
| | | |
| | | const flyingHandList = inject('flyingHandList') // 飞手列表 |
| | | const flyingHandEditList = inject('flyingHandEditList') // 飞手建档列表 |
| | |
| | | projectExperience: '', |
| | | technicalStrength: '', |
| | | skilledUavType: '', |
| | | skilledTaskType: [], |
| | | certification: [], // 证书 |
| | | regionCode: '', // 区域编码 |
| | | flyerAddress: '', // 飞手地址 |
| | |
| | | if (newData) { |
| | | Object.assign(formData.value, newData) |
| | | formData.value.flightHours = Number(newData.flightHours) |
| | | formData.value.skilledTaskType = newData.skilledTaskType || [] |
| | | } |
| | | }, |
| | | { deep: true, immediate: true } |
| | |
| | | projectExperience: '', |
| | | technicalStrength: '', |
| | | skilledUavType: '', |
| | | skilledTaskType: '' |
| | | skilledTaskType: [] |
| | | }) |
| | | } |
| | | |
| | |
| | | <div class="gd-table-toolbar"> |
| | | <el-button :icon="Plus" color="#4C34FF" type="primary" @click="addFlyingHand">飞手建档</el-button> |
| | | </div> |
| | | |
| | | |
| | | <div class="gd-table-content gd-table-content-bg"> |
| | | <el-table class="gd-table" :data="list"> |
| | | <el-table-column type="index" width="64" label="序号" /> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="skilledTaskType" show-overflow-tooltip label="擅长任务类型"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.skilledTaskType, dictObj.workOrderType) }} |
| | | {{ getTaskTypeLabel(row.skilledTaskType, workOrderTypeXT) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" class-name="operation-btns" width="180"> |
| | |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { getFlyingHandPage, removeFlyingHand,getAllFlyerIds } from './flyingHandApi' |
| | | import { deviceFlyerApi,deviceFlyerDetailApi } from '@/api/zkxt' |
| | | import { deviceFlyerApi,deviceFlyerDetailApi, getDictListApi } from '@/api/zkxt' |
| | | import FlyingHandDialog from './FlyingHandDialog.vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { prod } from 'mathjs' |
| | | import { |
| | | getTaskTypeLabel, |
| | | normalizeTaskTypeOptions, |
| | | } from '../orderManage/taskTypeOptions' |
| | | |
| | | // 初始化查询参数 |
| | | const initSearchParams = () => ({ |
| | |
| | | skilledUavType: [], // 擅长机型 |
| | | technicalStrength: [] // 技术特长 |
| | | }) |
| | | const workOrderTypeXT = ref([]) |
| | | |
| | | provide('dictObj', dictObj) |
| | | provide('workOrderTypeXT', workOrderTypeXT) |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | |
| | | getDictionaryByCode('workOrderType,skilledUavType,technicalStrength').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | getDictListApi('task_inspection_type').then(res => { |
| | | workOrderTypeXT.value = normalizeTaskTypeOptions(res.data.data || []) |
| | | }) |
| | | } |
| | | |
| | | // 获取飞手列表 |
| | |
| | | import { |
| | | getTaskTypeLabel, |
| | | taskTypeCascaderProps, |
| | | toTaskTypeCascaderValue, |
| | | } from '../taskTypeOptions' |
| | | |
| | | // 初始化任务行 |
| | |
| | | // 将工单类型赋值给所有子任务行 |
| | | 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 { |
| | |
| | | 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) |
| | |
| | | // 编辑/查看模式 - 加载已有数据 |
| | | 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) { |
| | |
| | | import { queryAirById, airlineListApi, algorithmGroupedApi } from '@/api/zkxt' |
| | | import * as Cesium from 'cesium' |
| | | import { useStore } from 'vuex' |
| | | import { getTaskTypeLabel, taskTypeCascaderProps, toTaskTypeCascaderValue } from '../taskTypeOptions' |
| | | import { getTaskTypeLabel, taskTypeCascaderProps } from '../taskTypeOptions' |
| | | |
| | | // 初始化表单数据 |
| | | const initForm = () => ({ |
| | |
| | | |
| | | const res = await gdPatrolTaskDetailApi({ id: row.id }) |
| | | formData.value = { ...initForm(), ...res.data.data } |
| | | formData.value.patrolTaskType = toTaskTypeCascaderValue(formData.value.patrolTaskType) |
| | | // 确保 algorithmIds 是数组 |
| | | if (formData.value.algorithmIds && typeof formData.value.algorithmIds === 'string') { |
| | | formData.value.algorithmIds = formData.value.algorithmIds.split(',').filter(Boolean) |
| | |
| | | import { |
| | | getTaskTypeLabel, |
| | | taskTypeCascaderProps, |
| | | toTaskTypeCascaderValue, |
| | | } from '../taskTypeOptions' |
| | | const store = useStore() |
| | | const permission = computed(() => store.state.user.permission) |
| | |
| | | loadList() |
| | | const res = await gdWorkOrderDetailApi({ id: formData.value.id }) |
| | | formData.value = res?.data?.data ?? {} |
| | | formData.value.workOrderType = toTaskTypeCascaderValue(formData.value.workOrderType) |
| | | dateRange.value = [formData.value.executeStartTime, formData.value.executeEndTime] |
| | | } |
| | | |
| | |
| | | ) |
| | | } |
| | | |
| | | function parseTaskTypeValue(value) { |
| | | if (typeof value !== 'string') return value |
| | | try { |
| | | const result = JSON.parse(value) |
| | | return Array.isArray(result) ? result : value |
| | | } catch (error) { |
| | | return value |
| | | } |
| | | } |
| | | |
| | | export function toTaskTypeCascaderValue(value) { |
| | | value = parseTaskTypeValue(value) |
| | | if (!value) return [] |
| | | if (typeof value === 'string') return [] |
| | | if (!Array.isArray(value)) return [] |
| | | if (isValidPath(value)) return [value] |
| | | if (value.length === 1 && Array.isArray(value[0]) && !isValidPath(value[0])) { |
| | | value = value[0] |
| | | } |
| | | return value.filter(isValidPath) |
| | | } |
| | | |
| | | |
| | | export function getTaskTypeLabel(value, options = []) { |
| | | if (!value?.length) return '' |
| | | const paths = toTaskTypeCascaderValue(value) |
| | | if (!Array.isArray(value) || !value.length) return '' |
| | | const paths = value.filter(isValidPath) |
| | | if (paths.length) { |
| | | return paths |
| | | .map(path => { |
| | |
| | | .join('、') |
| | | } |
| | | |
| | | if (!value) return '' |
| | | for (const item of options) { |
| | | if (item.dictValue === value) return item.dictLabel |
| | | const child = (item.children || []).find(option => option.dictValue === value) |
| | | if (child) return child.dictLabel |
| | | } |
| | | |
| | | return value |
| | | return '' |
| | | } |
| | | |
| | | export const taskTypeCascaderProps = { |