From a8b8b40b8b849def3a02cd3d655bdfd449d1c44f Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 31 Jan 2026 17:21:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue |  123 +++++++++++++++++++++++++++++++----------
 1 files changed, 93 insertions(+), 30 deletions(-)

diff --git a/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue b/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
index 457bf65..446ff64 100644
--- a/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
+++ b/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
@@ -21,9 +21,13 @@
 			</div>
 
 			<div class="right-container">
-				<div class="header">{{ formTitle }}</div>
+				<div class="header">
+					<span>{{ formTitle }}</span>
 
-				<div class="dialog-container" v-if="dialogReadonly">
+					<el-icon class="close-btn" @click.stop="visible = false"><Close /></el-icon>
+				</div>
+
+				<div class="content" v-if="dialogReadonly">
 					<el-row>
 						<el-col :span="24">
 							<div class="label">侦测设备</div>
@@ -31,7 +35,7 @@
 						</el-col>
 						<el-col :span="24">
 							<div class="label">设备类型</div>
-							<div class="val">{{ getDeviceTypeLabel(formData.deviceType) }}</div>
+							<div class="val">{{ getDictLabel(formData.deviceType, dictObj.deviceType) }}</div>
 						</el-col>
 						<el-col :span="24">
 							<div class="label">设备位置</div>
@@ -59,6 +63,7 @@
 							popper-class="command-select-popper"
 							v-model="formData.deviceId"
 							placeholder="请选择"
+							:disabled="dialogMode === 'edit'"
 							clearable
 							@change="handleDeviceChange"
 						>
@@ -70,6 +75,7 @@
 							class="command-select"
 							popper-class="command-select-popper"
 							v-model="formData.deviceType"
+							disabled
 							placeholder="请选择"
 							clearable
 						>
@@ -82,46 +88,34 @@
 						</el-select>
 					</el-form-item>
 					<el-form-item label="设备位置" prop="deployLocation">
-						<el-input
-							class="command-input"
-							v-model="formData.deployLocation"
-							disabled
-							placeholder="请选择位置"
-						>
+						<el-input class="command-input" v-model="formData.deployLocation" disabled placeholder="请选择位置">
 							<template #suffix>
 								<span class="suffix-action">地图选点</span>
 							</template>
 						</el-input>
 					</el-form-item>
 					<el-form-item label="设备编号" prop="deviceSn">
-						<el-input
-							class="command-input"
-							v-model="formData.deviceSn"
-							placeholder="请输入"
-							clearable
-						/>
+						<el-input class="command-input" v-model="formData.deviceSn" disabled placeholder="请输入" clearable />
 					</el-form-item>
 					<el-form-item label="设备型号" prop="deviceModel">
-						<el-input
-							class="command-input"
-							v-model="formData.deviceModel"
-							placeholder="请输入"
-							clearable
-						/>
+						<el-input class="command-input" v-model="formData.deviceModel" disabled placeholder="请输入" clearable />
 					</el-form-item>
 					<el-form-item label="覆盖范围(m)" prop="effectiveRangeKm">
 						<el-input-number
 							class="command-input"
 							v-model="formData.effectiveRangeKm"
 							:min="0"
-							:precision="2"
+							:precision="0"
+							:step="1"
 							:controls="false"
 							placeholder="请输入"
 						/>
 					</el-form-item>
 				</el-form>
 				<div class="footer">
-					<el-button color="#2B2B4C" @click="handleCancel">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
+					<el-button v-if="dialogMode != 'view'" color="#2B2B4C" @click="handleCancel">
+						{{ dialogReadonly ? '关闭' : '取消' }}
+					</el-button>
 					<el-button
 						color="#284FE3"
 						v-if="!dialogReadonly"
@@ -139,6 +133,10 @@
 </template>
 
 <script setup>
+import { getDictLabel } from '@ztzf/utils'
+
+import { Close } from '@element-plus/icons-vue'
+
 import { computed, inject, nextTick, ref, watch } from 'vue'
 import { ElMessage } from 'element-plus'
 import {
@@ -148,8 +146,11 @@
 } from '@/api/detectionCountermeasure/detectionRange'
 import CommonCesiumMap from '@/components/map-container/common-cesium-map.vue'
 import * as Cesium from 'cesium'
+import { saveOperationLog } from '@ztzf/apis'
+import { useRoute } from 'vue-router'
+import { MapTooltip } from '@ztzf/utils'
 
-import commandPost from '@/assets/images/dataCockpit/legend/command-post.png'
+import equipment from '@/assets/images/dataCockpit/legend/equipment.png'
 
 const initForm = () => ({
 	deviceId: '', // 侦测设备ID
@@ -171,9 +172,14 @@
 const deviceOptions = ref([])
 const dialogReadonly = computed(() => dialogMode.value === 'view')
 const mapRef = ref(null)
+const route = useRoute()
 let viewer
 let redPointEntity
 let rangeCircleEntity
+let mouseMoveBound = false
+let mapTooltip
+let publicCesium
+const tooltipEventKey = 'detection-range-point-tip'
 const formTitle = computed(() => {
 	if (dialogMode.value === 'edit') {
 		return '编辑侦测范围'
@@ -212,7 +218,14 @@
 
 function formatRange(value) {
 	if (value == null || value === '') return '-'
-	return `${value}`
+	const normalized = normalizeRange(value)
+	return normalized == null ? '-' : `${normalized}`
+}
+
+function normalizeRange(value) {
+	const numeric = Number(value)
+	if (!Number.isFinite(numeric)) return null
+	return Math.trunc(numeric)
 }
 
 // 关闭弹框
@@ -226,13 +239,27 @@
 	if (!isValid) return
 	submitting.value = true
 	try {
+		const { longitude, latitude } = parseDeployLocation(formData.value.deployLocation)
+		const normalizedRange = normalizeRange(formData.value.effectiveRangeKm)
+
 		const payload = {
-			...formData.value,
 			id: formData.value.id || formData.value.deviceId || undefined,
-			effectiveRangeKmIsNotNull: formData.value.effectiveRangeKm ? 1 : 2,
+			effectiveRangeKmIsNotNull: normalizedRange != null ? 1 : 2,
+			effectiveRangeKm: normalizedRange,
+			longitude,
+			latitude,
 		}
+		formData.value.effectiveRangeKm = normalizedRange
 		delete payload.deviceId
 		await detectionRangeSubmitApi(payload)
+
+		const actionText = dialogMode.value === 'add' ? '新增' : '修改'
+		saveOperationLog({
+			requestUri: route.path,
+			title: `${route.name || '侦测范围管理'}-${actionText}`,
+			type: 1,
+		})
+
 		ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功')
 		visible.value = false
 		emit('success')
@@ -253,6 +280,7 @@
 		current: 1,
 		size: 200,
 		effectiveRangeKmIsNotNull: 2,
+		isTrack: 1,
 	})
 	const records = res?.data?.data?.records ?? []
 	deviceOptions.value = records.map(item => ({
@@ -269,6 +297,7 @@
 	viewer = null
 	redPointEntity = null
 	rangeCircleEntity = null
+	clearPointTooltip()
 }
 
 function setMapPoint(longitude, latitude) {
@@ -277,7 +306,7 @@
 		redPointEntity = viewer.entities.add({
 			position: Cesium.Cartesian3.fromDegrees(longitude, latitude),
 			billboard: {
-				image: commandPost, // 这里替换为你的图片路径或变量 deviceZcImg
+				image: equipment, // 这里替换为你的图片路径或变量 deviceZcImg
 				width: 40,
 				height: 56,
 				verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 设置图片底部对齐坐标点
@@ -286,7 +315,7 @@
 				text: `${longitude.toFixed(6)}, ${latitude.toFixed(6)}`,
 				font: '16px',
 				fillColor: Cesium.Color.WHITE,
-				backgroundColor: Cesium.Color.BLACK.withAlpha(0.45),
+				backgroundColor: Cesium.Color.BLACK.withAlpha(0.6),
 				backgroundPadding: new Cesium.Cartesian2(5, 5),
 				showBackground: true,
 				style: Cesium.LabelStyle.FILL_AND_OUTLINE,
@@ -351,8 +380,32 @@
 	const map = mapRef.value?.getMap()
 	if (!map?.viewer) return
 	viewer = map.viewer
+	publicCesium = map.publicCesium
 	if (!dialogReadonly.value) {
 		map.publicCesium?.addLeftClickEvent?.(null, handleMapClick)
+		ensurePointTooltip()
+	}
+}
+
+function ensurePointTooltip() {
+	if (!viewer || !publicCesium || mouseMoveBound) return
+	mapTooltip ||= new MapTooltip(viewer, { offset: { x: 28, y: 24 } })
+	publicCesium.addMouseHandler?.(
+		null,
+		movement => {
+			if (!visible.value || dialogReadonly.value) return
+			mapTooltip?.show('点击地图选择设备位置', movement.endPosition)
+		},
+		tooltipEventKey
+	)
+	mouseMoveBound = true
+}
+
+function clearPointTooltip() {
+	mapTooltip?.hide()
+	if (publicCesium && mouseMoveBound) {
+		publicCesium.removeMouseHandler?.(tooltipEventKey)
+		mouseMoveBound = false
 	}
 }
 
@@ -370,6 +423,7 @@
 // 打开弹框
 async function open({ mode, row } = {}) {
 	dialogMode.value = mode || 'add'
+	clearPointTooltip()
 	await nextTick()
 	initMap()
 	if (dialogMode.value === 'add') {
@@ -405,9 +459,18 @@
 watch(
 	() => formData.value.effectiveRangeKm,
 	value => {
+		const normalized = normalizeRange(value)
+		if (value != null && normalized == null) {
+			formData.value.effectiveRangeKm = null
+			return
+		}
+		if (value != null && normalized !== value) {
+			formData.value.effectiveRangeKm = normalized
+			return
+		}
 		const parsed = parseDeployLocation(formData.value.deployLocation)
 		if (!parsed) return
-		updateRangeCircle(parsed.longitude, parsed.latitude, value)
+		updateRangeCircle(parsed.longitude, parsed.latitude, normalized)
 	}
 )
 </script>

--
Gitblit v1.9.3