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/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue b/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
index 31337cb..a939219 100644
--- a/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
+++ b/applications/drone-command/src/views/detectionCountermeasure/detectionRange/DetectionRangeDialog.vue
@@ -122,14 +122,15 @@
 							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"
@@ -160,6 +161,8 @@
 } 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 equipment from '@/assets/images/dataCockpit/legend/equipment.png'
 
@@ -183,6 +186,7 @@
 const deviceOptions = ref([])
 const dialogReadonly = computed(() => dialogMode.value === 'view')
 const mapRef = ref(null)
+const route = useRoute()
 let viewer
 let redPointEntity
 let rangeCircleEntity
@@ -224,7 +228,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)
 }
 
 // 关闭弹框
@@ -239,16 +250,26 @@
 	submitting.value = true
 	try {
 		const {longitude, latitude} = parseDeployLocation(formData.value.deployLocation)
+		const normalizedRange = normalizeRange(formData.value.effectiveRangeKm)
 
 		const payload = {
 			id: formData.value.id || formData.value.deviceId || undefined,
-			effectiveRangeKmIsNotNull: formData.value.effectiveRangeKm ? 1 : 2,
-			effectiveRangeKm: formData.value.effectiveRangeKm,
+			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')
@@ -269,6 +290,7 @@
 		current: 1,
 		size: 200,
 		effectiveRangeKmIsNotNull: 2,
+		isTrack: 1
 	})
 	const records = res?.data?.data?.records ?? []
 	deviceOptions.value = records.map(item => ({
@@ -421,9 +443,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