From beb95fb5fc166804056abafd70fc01ac27de7621 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 26 Jan 2026 09:11:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue | 94 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue b/applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue
index d90014d..e546c27 100644
--- a/applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue
+++ b/applications/drone-command/src/views/areaManage/sceneConfig/FormDiaLog.vue
@@ -14,10 +14,12 @@
</div>
<div class="right-container">
<div class="header">
- {{ titleEnum[dialogMode] }}
+ <span>{{ titleEnum[dialogMode] }}</span>
+
+ <el-icon class="close-btn" @click.stop="visible = false"><Close /></el-icon>
</div>
- <div class="dialog-container" v-if="readonly">
+ <div class="content" v-if="readonly">
<div class="detail-title">场景详情</div>
<el-row>
<el-col :span="24">
@@ -30,7 +32,7 @@
</el-col>
<el-col :span="24">
<div class="label">场景类型</div>
- <div class="val">{{ getDictLabel(formData.sceneType, dictObj.sceneType) }}</div>
+ <div class="val">{{ getDictLabel(formData.sceneType, dictObj.CommandSceneType) }}</div>
</el-col>
<el-col :span="24">
<div class="label">负责人</div>
@@ -77,7 +79,7 @@
<el-form-item label="场景类型" prop="sceneType">
<el-select class="command-select" popper-class="command-select-popper"
v-model="formData.sceneType" placeholder="请选择" clearable>
- <el-option v-for="item in dictObj.sceneType" :key="item.dictKey" :label="item.dictValue"
+ <el-option v-for="item in dictObj.CommandSceneType" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey" />
</el-select>
</el-form-item>
@@ -115,8 +117,8 @@
:data="areaList.filter(item => item.areaName.includes(searchName))" row-key="id"
@selection-change="handleAreaSelectionChange">
<el-table-column type="selection" width="55" :reserve-selection="true" />
- <el-table-column prop="areaName" label="区域名称" />
- <el-table-column prop="areaType" label="区域类型">
+ <el-table-column prop="areaName" show-overflow-tooltip label="区域名称" />
+ <el-table-column prop="areaType" show-overflow-tooltip label="区域类型">
<template v-slot="{ row }">
{{ getDictLabel(row.areaType, dictObj.areaType) }}
</template>
@@ -127,7 +129,7 @@
</el-form>
<div class="footer">
- <el-button color="#2B2B4C" @click="handleCancel">{{ readonly ? '关闭' : '取消' }}</el-button>
+ <el-button v-if="dialogMode != 'view'" color="#2B2B4C" @click="handleCancel">{{ readonly ? '关闭' : '取消' }}</el-button>
<el-button color="#284FE3" v-if="!readonly" type="primary" :loading="submitting"
:disabled="submitting" @click="handleSubmit">
确定
@@ -139,14 +141,19 @@
</template>
<script setup>
+import { Close } from '@element-plus/icons-vue'
+
import { computed, inject, nextTick, onMounted, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { fwDefenseSceneDetailApi, fwDefenseSceneSubmitApi } from './sceneConfigApi'
import { fieldRules, geomAnalysis, getDictLabel } from '@ztzf/utils'
import CommonCesiumMap from '@/components/map-container/common-cesium-map.vue'
import * as Cesium from 'cesium'
-import { fwAreaDivideListApi } from '../partition/partitionApi'
+import { fwAreaDivideDetailApi, fwAreaDivideListApi } from '../partition/partitionApi'
import { DrawPolygon } from '@/utils/cesium/DrawPolygon'
+import commandPost from '@/assets/images/dataCockpit/legend/command-post.png'
+import { saveOperationLog } from '@ztzf/apis'
+import { useRoute } from 'vue-router'
const initForm = () => ({
sceneName: '', // 场景名称
@@ -175,6 +182,7 @@
const selectedAreaRows = ref([]) //选中列表
const dictObj = inject('dictObj')
const mapRef = ref(null)
+const route = useRoute()
let viewer
let redPointEntity
let leftClickBound = false
@@ -186,7 +194,7 @@
leaderPhone: fieldRules(true, 50),
deviceMode: fieldRules(true),
longitude: fieldRules(true),
- areaDivideIds: fieldRules(true),
+ areaDivideIds: fieldRules(false),
}
// 关闭弹框
@@ -205,6 +213,11 @@
formData.value.areaCount = ids.length
formData.value.defenseArea = calcDefenseArea(selectedAreaRows.value)
await fwDefenseSceneSubmitApi(formData.value)
+ saveOperationLog({
+ requestUri: route.path,
+ title: `${route.name || '场景配置管理'}-${dialogMode.value === 'add' ? '新增' : '编辑'}`,
+ type: 1,
+ })
ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功')
visible.value = false
emit('success')
@@ -228,15 +241,23 @@
}
// 关联区域变更
-function handleAreaSelectionChange (rows) {
- selectedAreaRows.value = rows
- formData.value.areaDivideIds = rows.map(item => item.id)
- formData.value.areaCount = rows.length
- formData.value.defenseArea = calcDefenseArea(rows)
+async function handleAreaSelectionChange (rows) {
+ const selectedRows = await ensureAreaGeom(rows)
+ selectedAreaRows.value = selectedRows
+ const ids = selectedRows.map(item => item.id)
+ formData.value.areaDivideIds = ids.join(',')
+ formData.value.areaCount = ids.length
+ formData.value.defenseArea = calcDefenseArea(selectedRows)
}
// 渲染面
function renderingSurface () {
+ console.log(geometricSource, 11111111)
+
+ if (!geometricSource) {
+ initMap()
+ }
+ if (!geometricSource) return
geometricSource && geometricSource.entities.removeAll()
selectedAreaRows.value.forEach(item => {
if (item.geom) {
@@ -263,14 +284,43 @@
return _.round(total, 2)
}
+async function ensureAreaGeom (rows) {
+ const missingRows = rows.filter(row => row?.id && !row.geom)
+ if (!missingRows.length) return rows
+ const detailList = await Promise.all(
+ missingRows.map(row =>
+ fwAreaDivideDetailApi({ id: row.id })
+ .then(res => res?.data?.data)
+ .catch(() => null)
+ )
+ )
+ const detailMap = new Map(
+ detailList.filter(Boolean).map(item => [String(item.id), item])
+ )
+ if (!detailMap.size) return rows
+ areaList.value = areaList.value.map(item => {
+ const detail = detailMap.get(String(item.id))
+ return detail ? { ...item, ...detail } : item
+ })
+ return rows.map(item => {
+ const detail = detailMap.get(String(item.id))
+ return detail ? { ...item, ...detail } : item
+ })
+}
+
// 同步关联区域
function syncAreaSelection () {
if (!areaTableRef.value) return
areaTableRef.value.clearSelection()
const rows = []
- const arr = formData.value.areaDivideIds.split(',')
+ const areaDivideIds = formData.value.areaDivideIds
+ const arr = Array.isArray(areaDivideIds)
+ ? areaDivideIds.map(item => String(item))
+ : String(areaDivideIds || '')
+ .split(',')
+ .filter(Boolean)
areaList.value.forEach(row => {
- if (arr.includes(row.id)) {
+ if (arr.includes(String(row.id))) {
areaTableRef.value.toggleRowSelection(row, true)
rows.push(row)
}
@@ -326,23 +376,25 @@
if (!redPointEntity) {
redPointEntity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(longitude, latitude),
- point: {
- color: Cesium.Color.RED,
- pixelSize: 10,
+ billboard: {
+ image: commandPost, // 这里替换为你的图片路径或变量 deviceZcImg
+ width: 40,
+ height: 56,
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 设置图片底部对齐坐标点
},
label: {
text: `${longitude.toFixed(6)}, ${latitude.toFixed(6)}`,
font: '14px',
fillColor: Cesium.Color.WHITE,
- backgroundColor: Cesium.Color.BLACK.withAlpha(0.45),
+ backgroundColor: Cesium.Color.BLACK.withAlpha(0.6),
backgroundPadding: new Cesium.Cartesian2(5, 5),
- pixelOffset: new Cesium.Cartesian2(0, -20),
showBackground: true,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.CENTER,
outlineWidth: 1,
outlineColor: Cesium.Color.WHITE,
+ pixelOffset: new Cesium.Cartesian2(0, -72),
eyeOffset: new Cesium.Cartesian3(0, 0, -20),
},
})
--
Gitblit v1.9.3