吉安感知网项目-前端
张含笑
2026-01-30 6c4bd2467bb6651c6edcf8a9741dcd4e9b1aa6d3
applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue
@@ -63,7 +63,7 @@
               </el-table>
               <template v-if="hasPatrolTaskList">
                  <div class="detail-title" :style="{ marginTop: pxToRem(20) }">巡查任务名称</div>
                  <el-table class="setHeight" :data="patrolTaskList" row-key="id">
                  <el-table class="setHeight gd-dialog-table" :data="patrolTaskList" row-key="id">
                     <el-table-column prop="patrolTaskName" show-overflow-tooltip label="巡查任务名称" />
                     <el-table-column prop="patrolTaskType" show-overflow-tooltip label="巡查任务类型">
                        <template v-slot="{ row }">
@@ -203,8 +203,8 @@
               >
                  {{ gdStatusObj[gdStatus].reason }}
               </el-button>
               <el-button @click="addDescription" v-if="['20', '24', '25', '50'].includes(gdStatus)" color="#F2F3F5">
                  {{ gdStatus === '50' ? '结算' : '申请取消' }}
               <el-button @click="addDescription" v-if="['20', '24', '25'].includes(gdStatus)" color="#F2F3F5">
                  申请取消
               </el-button>
               <el-button color="#4C34FF" @click="requestModification" v-if="['20', '25'].includes(gdStatus)">
                  申请修改
@@ -224,6 +224,7 @@
            <el-button v-if="['21', '23'].includes(gdStatus)" @click="viewDescription" color="#F2F3F5">
               {{ gdStatusObj[gdStatus].reason }}
            </el-button>
            <el-button v-if="gdStatus === '50'" @click="addDescription" color="#F2F3F5">结算</el-button>
            <el-button v-if="gdStatus === '10'" @click="addDescription" color="#F2F3F5">拒绝接单</el-button>
            <el-button v-if="gdStatus === '10'" @click="statusChange(1)" color="#4C34FF">接单</el-button>
            <el-button v-if="gdStatus === '22'" @click="addDescription" color="#F2F3F5">不同意修改</el-button>
@@ -264,6 +265,9 @@
import CommonCesiumMap from '@/components/map-container/common-cesium-map.vue'
import { gdPatrolTaskPageApi } from '@/views/orderView/orderManage/inspectionRequest/inspectionRequestApi'
import { Check } from '@element-plus/icons-vue'
import droneIcon from '@/assets/images/orderView/orderManage/drone.png'
import droneActiveIcon from '@/assets/images/orderView/orderManage/droneActive.png'
// 初始化表单数据
const initForm = () => ({
   workOrderName: '',
@@ -301,7 +305,6 @@
const processList = ref([])
let viewPlane
const hasPatrolTaskList = computed(() => ['30', '40', '50', '60'].includes(String(formData.value.workOrderStatus)))
import droneIcon from '@/assets/images/orderView/orderManage/drone.png'
const gdStatusObj = {
   '10': { reason: '拒绝原因', operationType: '2' },
@@ -346,7 +349,7 @@
async function requestModification() {
   suddenlyEdit.value = true
   dialogMode.value = 'edit'
   await getDeviceList(true)
   await getDeviceList()
   nextTick(() => {
      syncSelection()
      viewPlane && viewer.entities.remove(viewPlane)
@@ -386,15 +389,14 @@
}
// 获取推荐设备列表
async function getDeviceList(allList) {
   const all = allList || (['11'].includes(gdStatus.value) && requester.value)
async function getDeviceList() {
   try {
      const str = [...pointList.value, pointList.value[0]].map(item => `${item.longitude} ${item.latitude}`).join(',')
      let geom = `POLYGON((${str}))`
      const res = await gdManageDeviceListApi({
         deviceIds: all ? '' : formData.value.recommendDeviceIds,
         devicePayload: dialogMode.value === 'add' ? formData.value.deviceLoadDemand : '',
         geom: dialogMode.value === 'add' ? geom : '',
         deviceIds: dialogMode.value === 'add' ? '' : formData.value.recommendDeviceIds,
         devicePayload: formData.value?.deviceLoadDemand,
         geom: geom,
      })
      deviceList.value = res?.data?.data ?? []
   } catch (error) {
@@ -403,10 +405,10 @@
}
// 设备需求变化
function loadDemandChange() {
async function loadDemandChange() {
   formData.value.recommendDeviceIds = ''
   selectedDevices.value = []
   getDeviceList()
   await getDeviceList()
   syncSelection()
}
@@ -441,15 +443,6 @@
      submitting.value = false
   }
}
watch(
   () => dateRange.value,
   newVal => {
      const range = dateRangeFormat(dateRange.value)
      formData.value.executeStartTime = range[0]
      formData.value.executeEndTime = range[1]
   }
)
// 加载时间线list
function loadList() {
@@ -541,15 +534,8 @@
   })
}
// 渲染所有设备
function setMapDevice() {
   gdManageDeviceListApi().then(res => {
      renderingDevice(res?.data?.data || [])
   })
}
//  渲染
function renderingDevice(list) {
function renderingAllDevice(list) {
   list.forEach(item => {
      const position = Cesium.Cartesian3.fromDegrees(item.longitude || 115.0, item.latitude || 27.11)
      viewer.entities.add({
@@ -568,7 +554,7 @@
            outlineColor: Cesium.Color.WHITE,
            horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
            verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
            pixelOffset: new Cesium.Cartesian2(0, -10),
            pixelOffset: new Cesium.Cartesian2(0, -20),
         },
      })
   })
@@ -577,8 +563,10 @@
// 打开弹框
async function open({ mode = 'add', row } = {}) {
   dialogMode.value = mode
   formData.value = dialogMode.value === 'add' ? initForm() : row
   initMap()
   const allDeviceRes = await gdManageDeviceListApi()
   formData.value = dialogMode.value === 'add' ? initForm() : row
   renderingAllDevice(allDeviceRes?.data?.data || [])
   if (dialogMode.value === 'add') {
      addPolygon()
   } else {
@@ -586,10 +574,11 @@
      hasPatrolTaskList.value && gdPatrolTaskPage()
      dialogMode.value === 'edit' ? editPolygon() : viewPolygon()
   }
   setMapDevice()
   await nextTick()
   await getDeviceList()
   syncSelection()
   highlightSelectedDevices()
}
// 初始化地图实例
@@ -599,6 +588,33 @@
   viewer = map?.viewer || null
}
// 高亮选中的设备
function highlightSelectedDevices() {
   const selectedIds = (formData.value.recommendDeviceIds || '').split(',').filter(Boolean)
   if (!viewer?.entities) return
   viewer.entities.values.forEach(entity => {
      const image = entity.billboard?.image?._value
      if ((image === droneIcon || image === droneActiveIcon) && entity.label) {
         const device = deviceList.value.find(d => d.nickname === entity.label.text._value)
         entity.billboard.image = device && selectedIds.includes(String(device.id))
            ? droneActiveIcon
            : droneIcon
      }
   })
}
watch(() => formData.value.recommendDeviceIds, highlightSelectedDevices)
watch(
   () => dateRange.value,
   newVal => {
      const range = dateRangeFormat(dateRange.value)
      formData.value.executeStartTime = range[0]
      formData.value.executeEndTime = range[1]
   }
)
// 地图加载完毕
function mapReady() {
   dialogMode.value === 'add' && mapRef.value.flyBoundary()
}