From bcb34e720eb55bc1f9d03d4b4bca557a4b93d4e5 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Wed, 28 Jan 2026 11:31:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue |   75 ++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 30 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue b/applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue
index b9b3618..a844f9f 100644
--- a/applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue
+++ b/applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue
@@ -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>
@@ -302,6 +303,7 @@
 let viewPlane
 const hasPatrolTaskList = computed(() => ['30', '40', '50', '60'].includes(String(formData.value.workOrderStatus)))
 import droneIcon from '@/assets/images/orderView/orderManage/drone.png'
+import droneActiveIcon from '@/assets/images/orderView/orderManage/droneActive.png'
 
 const gdStatusObj = {
 	'10': { reason: '拒绝原因', operationType: '2' },
@@ -346,7 +348,7 @@
 async function requestModification() {
 	suddenlyEdit.value = true
 	dialogMode.value = 'edit'
-	await getDeviceList(true)
+	await getDeviceList()
 	nextTick(() => {
 		syncSelection()
 		viewPlane && viewer.entities.remove(viewPlane)
@@ -386,15 +388,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 +404,10 @@
 }
 
 // 设备需求变化
-function loadDemandChange() {
+async function loadDemandChange() {
 	formData.value.recommendDeviceIds = ''
 	selectedDevices.value = []
-	getDeviceList()
+	await getDeviceList()
 	syncSelection()
 }
 
@@ -441,15 +442,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 +533,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 +553,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 +562,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 +573,11 @@
 		hasPatrolTaskList.value && gdPatrolTaskPage()
 		dialogMode.value === 'edit' ? editPolygon() : viewPolygon()
 	}
-	setMapDevice()
+
 	await nextTick()
 	await getDeviceList()
 	syncSelection()
+	highlightSelectedDevices()
 }
 
 // 初始化地图实例
@@ -599,6 +587,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()
 }

--
Gitblit v1.9.3