| | |
| | | clearable |
| | | filterable |
| | | :disabled="dialogMode !== 'add'" |
| | | @change="handleWorkOrderChange" |
| | | > |
| | | <el-option v-for="item in workOrderList" :key="item.id" :label="item.workOrderName" :value="item.id" /> |
| | | </el-select> |
| | |
| | | v-model="row.patrolRouteUrl" |
| | | placeholder="请选择" |
| | | :disabled="dialogReadonly" |
| | | :loading="routeLoading" |
| | | no-data-text="暂无航线" |
| | | > |
| | | <el-option v-for="item in routeOptions" :key="item.id" :label="item.name" :value="item.id" /> |
| | | </el-select> |
| | |
| | | import { computed, ref, onMounted } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { Plus, Delete } from '@element-plus/icons-vue' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { geomAnalysis, getDictLabel } from '@ztzf/utils' |
| | | import { gdPatrolTaskSaveApi, gdFlyerPageApi, gdPatrolTaskAuditApi } from './inspectionRequestApi' |
| | | import { gdWorkOrderPageApi } from '../orderManage/orderManageApi' |
| | | import { gdManageDeviceListApi } from '../orderManage/gdManageDeviceApi' |
| | |
| | | // 下拉选项 |
| | | const flyerListMap = ref({}) // 飞手列表,按行索引存储 |
| | | const deviceList = ref([]) // 设备列表 |
| | | const routeOptions = inject('routeOptions') |
| | | const routeOptions = ref([]) // 航线选项(根据工单范围获取) |
| | | const routeLoading = ref(false) // 航线加载中 |
| | | |
| | | // 子任务列表 |
| | | const taskList = ref([initTaskRow(), initTaskRow(), initTaskRow(), initTaskRow(), initTaskRow()]) |
| | | const taskList = ref([initTaskRow()]) |
| | | |
| | | // 处理工单选择变化 |
| | | function handleWorkOrderChange(val) { |
| | | if (val) { |
| | | selectedWorkOrder.value = workOrderList.value.find(item => item.id === val) |
| | | // 根据工单范围获取航线列表 |
| | | getAirListByGeom() |
| | | // 将工单类型赋值给所有子任务行 |
| | | const workOrderType = selectedWorkOrder.value?.workOrderType |
| | | if (workOrderType) { |
| | |
| | | } |
| | | } else { |
| | | selectedWorkOrder.value = null |
| | | routeOptions.value = [] |
| | | } |
| | | } |
| | | |
| | | // 根据工单geom范围获取航线列表 |
| | | function getAirListByGeom() { |
| | | const geom = selectedWorkOrder.value?.geom |
| | | if (!geom) return |
| | | const coordinates = geomAnalysis(geom) |
| | | if (!coordinates || !coordinates.length) return |
| | | routeLoading.value = true |
| | | airlineListApi(coordinates).then(res => { |
| | | routeOptions.value = res.data.data || [] |
| | | }).finally(() => { |
| | | routeLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | // 添加任务行 |
| | |
| | | await getFlyerList(index, skilledTaskType) |
| | | } |
| | | |
| | | import * as turf from '@turf/turf' |
| | | |
| | | function getPolygonCenter(rawData) { |
| | | const coordinates = [rawData.map(p => [p.longitude, p.latitude])]; |
| | | const polygon = turf.polygon(coordinates); |
| | | const center = turf.centroid(polygon); |
| | | const [centerLon, centerLat] = center.geometry.coordinates; |
| | | return {longitude: centerLon, latitude: centerLat}; |
| | | } |
| | | |
| | | |
| | | // 获取飞手列表 |
| | | async function getFlyerList(index, skilledTaskType) { |
| | | const obj = getPolygonCenter(geomAnalysis(selectedWorkOrder.value.geom)) |
| | | const res = await gdFlyerPageApi({ |
| | | size: 999, |
| | | current: 1, |
| | | skilledTaskType, |
| | | longitude: obj.longitude || '', |
| | | latitude: obj.latitude || '', |
| | | }) |
| | | flyerListMap.value[index] = res?.data?.data?.records ?? [] |
| | | } |
| | |
| | | color: #f56c6c; |
| | | margin-right: 4px; |
| | | } |
| | | :deep(.el-table__header th) { |
| | | font-weight: normal !important; |
| | | } |
| | | |
| | | .grayText { |
| | | color: #9f9f9f !important; |