From dd57e0e9a989e7ee8b3e3473a7ee6a1dff06a4ae Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 27 Jan 2026 17:19:04 +0800
Subject: [PATCH] feat:调整加载
---
applications/task-work-order/src/views/orderView/orderManage/orderManage/FormDiaLog.vue | 79 +++++++++++++++++++++++----------------
1 files changed, 46 insertions(+), 33 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 fb17ce2..dcb6764 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
@@ -56,7 +56,7 @@
</el-col>
</el-row>
<div class="detail-title" :style="{ marginTop: pxToRem(20) }">已选设备</div>
- <el-table class="setHeight" ref="deviceTableRef" :data="deviceList" row-key="id">
+ <el-table class="setHeight gd-dialog-table" ref="deviceTableRef" :data="deviceList" row-key="id">
<el-table-column prop="nickname" label="设备名称" />
<el-table-column prop="deviceName" label="设备型号" />
<el-table-column prop="devicePayload" label="设备负载" />
@@ -206,7 +206,7 @@
<el-button @click="addDescription" v-if="['20', '24', '25', '50'].includes(gdStatus)" color="#F2F3F5">
{{ gdStatus === '50' ? '结算' : '申请取消' }}
</el-button>
- <el-button @click="requestModification" v-if="['20', '25'].includes(gdStatus)" color="#4C34FF">
+ <el-button color="#4C34FF" @click="requestModification" v-if="['20', '25'].includes(gdStatus)">
申请修改
</el-button>
</template>
@@ -302,6 +302,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 +347,7 @@
async function requestModification() {
suddenlyEdit.value = true
dialogMode.value = 'edit'
- await getDeviceList(true)
+ await getDeviceList()
nextTick(() => {
syncSelection()
viewPlane && viewer.entities.remove(viewPlane)
@@ -386,15 +387,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 +403,10 @@
}
// 设备需求变化
-function loadDemandChange() {
+async function loadDemandChange() {
formData.value.recommendDeviceIds = ''
selectedDevices.value = []
- getDeviceList()
+ await getDeviceList()
syncSelection()
}
@@ -441,15 +441,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 +532,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 +552,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 +561,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 +572,11 @@
hasPatrolTaskList.value && gdPatrolTaskPage()
dialogMode.value === 'edit' ? editPolygon() : viewPolygon()
}
- setMapDevice()
+
await nextTick()
await getDeviceList()
syncSelection()
+ highlightSelectedDevices()
}
// 初始化地图实例
@@ -599,6 +586,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()
}
@@ -610,7 +624,7 @@
.content {
display: flex;
gap: 0 20px;
- height: 900px;
+ height: 680px;
.leftBox {
width: 0;
@@ -621,7 +635,7 @@
.gd-cesium {
width: 100%;
- min-height: 400px;
+ min-height: 380px;
flex: 1;
}
}
@@ -636,7 +650,6 @@
}
.processBox {
- margin-right: 20px;
padding: 24px 0;
width: 312px;
border: 1px solid #e4e4e4;
--
Gitblit v1.9.3