From 3a874e2be02a0dc615d3bb6427153ced10f9ad7f Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 02 Feb 2026 13:41:01 +0800
Subject: [PATCH] feat:关联派出所调整,根据所画区域筛选派出所
---
applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue | 57 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
index a2ee6e4..9083c47 100644
--- a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
+++ b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -226,7 +226,7 @@
<script setup>
import { Close } from '@element-plus/icons-vue'
-import { computed, inject, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
+import { computed, inject, nextTick, onBeforeUnmount, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { fwAreaDivideDetailApi, fwAreaDivideSubmitApi } from './partitionApi'
import { saveOperationLog } from '@ztzf/apis'
@@ -248,7 +248,7 @@
} from '@/utils/cesium/deviceRange'
import * as Cesium from 'cesium'
import { AREA_TYPE_STYLE_MAP, BUFFER_LEVEL_STYLES, DEFAULT_AREA_STYLE } from '@ztzf/constants'
-import { fwPoliceStationListApi } from '@/views/areaManage/precinctInfo/precinctInfoApi'
+import { fwPoliceStationQueryByPolygonsApi } from '@/views/areaManage/precinctInfo/precinctInfoApi'
import { fwDeviceListByPolygonsApi } from '@/views/basicManage/deviceStock/fwDevice'
import polygonIcon from '@/assets/images/areaMap/polygon.png'
import rectIcon from '@/assets/images/areaMap/rect.png'
@@ -312,6 +312,8 @@
let deviceRangeRenderToken = 0
let deviceListTimer = null
let deviceListRequestToken = 0
+let policeStationListTimer = null
+let policeStationRequestToken = 0
const rules = {
areaName: fieldRules(true, 50),
@@ -418,6 +420,10 @@
clearTimeout(deviceListTimer)
deviceListTimer = null
}
+ if (policeStationListTimer) {
+ clearTimeout(policeStationListTimer)
+ policeStationListTimer = null
+ }
viewEntity && viewer?.entities?.remove(viewEntity)
viewEntity = null
clearActiveTool()
@@ -438,6 +444,7 @@
() => {
if (isDialogInitializing.value) return
queueDeviceListRefresh()
+ queuePoliceStationRefresh()
},
{ deep: true }
)
@@ -498,6 +505,11 @@
if (deviceTableRef.value) {
deviceTableRef.value.clearSelection()
}
+}
+
+function clearPoliceStationState () {
+ policeStationOptions.value = []
+ formData.value.policeStationId = ''
}
function formatWktNumber (value) {
@@ -1176,9 +1188,36 @@
}
// 获取派出所列表
-async function getPoliceStationList () {
- const res = await fwPoliceStationListApi()
+function queuePoliceStationRefresh () {
+ if (!visible.value) return
+ if (policeStationListTimer) {
+ clearTimeout(policeStationListTimer)
+ }
+ policeStationListTimer = setTimeout(() => {
+ policeStationListTimer = null
+ void getPoliceStationListByPolygons()
+ }, 200)
+}
+
+async function getPoliceStationListByPolygons () {
+ if (!visible.value) return
+ const polygons = resolveShapePolygonsWkt()
+ if (!polygons.length) {
+ clearPoliceStationState()
+ return
+ }
+ policeStationRequestToken += 1
+ const requestToken = policeStationRequestToken
+ const res = await fwPoliceStationQueryByPolygonsApi({ polygons })
+ if (requestToken !== policeStationRequestToken) return
policeStationOptions.value = res?.data?.data ?? []
+ await nextTick()
+ const matched = policeStationOptions.value.find(
+ item => String(item.id) === String(formData.value.policeStationId)
+ )
+ if (!matched) {
+ formData.value.policeStationId = ''
+ }
}
// 获取设备列表
@@ -1281,6 +1320,7 @@
formData.value = dialogMode.value === 'add' ? initForm() : row
selectedDeviceRows.value = []
deviceOptions.value = []
+ policeStationOptions.value = []
shapeList.value = []
activeShapeId.value = null
activeAreaType.value = ''
@@ -1313,17 +1353,18 @@
}
isDialogInitializing.value = false
queueDeviceListRefresh()
+ queuePoliceStationRefresh()
}
-
-onMounted(() => {
- getPoliceStationList()
-})
onBeforeUnmount(() => {
if (deviceListTimer) {
clearTimeout(deviceListTimer)
deviceListTimer = null
}
+ if (policeStationListTimer) {
+ clearTimeout(policeStationListTimer)
+ policeStationListTimer = null
+ }
hideTypePanel()
})
--
Gitblit v1.9.3