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 ++++++++++++++++--
 applications/drone-command/src/views/api.txt                                    |   98 ++++++++------------------------
 applications/drone-command/src/views/areaManage/precinctInfo/precinctInfoApi.js |    9 +++
 3 files changed, 84 insertions(+), 80 deletions(-)

diff --git a/applications/drone-command/src/views/api.txt b/applications/drone-command/src/views/api.txt
index 405987f..c55353c 100644
--- a/applications/drone-command/src/views/api.txt
+++ b/applications/drone-command/src/views/api.txt
@@ -1,9 +1,9 @@
 
 
-## 列表-多边形过滤
+## 根据多边形区域查询派出所
 
 
-**接口地址**:`/device/fwDevice/listByPolygons`
+**接口地址**:`/area/fwPoliceStation/queryByPolygons`
 
 
 **请求方式**:`POST`
@@ -15,7 +15,7 @@
 **响应数据类型**:`*/*`
 
 
-**接口描述**:<p>传入isAreaSelect、areaId、status、isTrack、polygons</p>
+**接口描述**:<p>传入多边形WKT字符串集合</p>
 
 
 
@@ -24,11 +24,9 @@
 
 ```javascript
 {
-  "areaId": 0,
-  "isAreaSelect": 0,
-  "isTrack": 0,
-  "polygons": [],
-  "status": 0
+  "polygons": [
+    "POLYGON((114.96898636473107 27.11156483383477,114.97972069576815 27.111564833834766,114.97972069576815 27.120473921808035,114.96898636473107 27.120473921808035,114.96898636473107 27.11156483383477))"
+  ]
 }
 ```
 
@@ -41,12 +39,8 @@
 
 | 参数名称 | 参数说明 | 请求类型    | 是否必须 | 数据类型 | schema |
 | -------- | -------- | ----- | -------- | -------- | ------ |
-|query|设备列表多边形查询参数|body|true|FwDevicePolygonQueryDTO|FwDevicePolygonQueryDTO|
-|&emsp;&emsp;areaId|区域id||false|integer(int64)||
-|&emsp;&emsp;isAreaSelect|是否区域选择(1过滤)||false|integer(int32)||
-|&emsp;&emsp;isTrack|是否出入库 1已出库 2未出库||false|integer(int32)||
-|&emsp;&emsp;polygons|多边形WKT集合||false|array|string|
-|&emsp;&emsp;status|状态||false|integer(int32)||
+|dto|派出所多边形区域查询入参|body|true|FwPoliceStationPolygonQueryDTO对象|FwPoliceStationPolygonQueryDTO对象|
+|&emsp;&emsp;polygons|多边形WKT字符串集合||true|array|string|
 
 
 **响应状态**:
@@ -54,7 +48,7 @@
 
 | 状态码 | 说明 | schema |
 | -------- | -------- | ----- | 
-|200|OK|R«List«FwDeviceVO»»|
+|200|OK|R«List«FwPoliceStationVO»»|
 |201|Created||
 |401|Unauthorized||
 |403|Forbidden||
@@ -67,41 +61,21 @@
 | 参数名称 | 参数说明 | 类型 | schema |
 | -------- | -------- | ----- |----- | 
 |code|状态码|integer(int32)|integer(int32)|
-|data|承载数据|array|FwDeviceVO|
-|&emsp;&emsp;azimuth|方位角 0-360°|integer(int32)||
-|&emsp;&emsp;batteryPct|电量百分比 0-100|integer(int32)||
-|&emsp;&emsp;belongDept|所属部门id|integer(int64)||
-|&emsp;&emsp;belongDeptName|所属部门名称|string||
-|&emsp;&emsp;charger|负责人|string||
-|&emsp;&emsp;contactPhone|联系电话|string||
+|data|承载数据|array|FwPoliceStationVO|
+|&emsp;&emsp;address|派出所地址|string||
+|&emsp;&emsp;areaCode|区域编码|string||
+|&emsp;&emsp;contactPerson|联系人|string||
+|&emsp;&emsp;contactPhone|联系方式|string||
 |&emsp;&emsp;createDept|创建部门|integer(int64)||
 |&emsp;&emsp;createTime|创建时间|string(date-time)||
 |&emsp;&emsp;createUser|创建人|integer(int64)||
-|&emsp;&emsp;detectTargetCnt|侦测目标数量|integer(int32)||
-|&emsp;&emsp;deviceAtt|设备属性(无线电/光电/雷达)|string||
-|&emsp;&emsp;deviceModel|型号|string||
-|&emsp;&emsp;deviceName|设备名称|string||
-|&emsp;&emsp;deviceSn|设备sn|string||
-|&emsp;&emsp;deviceSpecification|规格|string||
-|&emsp;&emsp;deviceType|设备类型(察打一体/便捷侦测箱/反制枪)|string||
-|&emsp;&emsp;effectiveRangeKm|有效范围 km|number||
-|&emsp;&emsp;elevation|俯仰角 -90-+90°|integer(int32)||
-|&emsp;&emsp;id|主键|integer(int64)||
-|&emsp;&emsp;isShared|是否被共享给当前机构|boolean||
-|&emsp;&emsp;latitude|纬度|string||
-|&emsp;&emsp;longitude|经度|string||
-|&emsp;&emsp;manufacturer|生产厂商|string||
-|&emsp;&emsp;outTarget|出库去向|string||
-|&emsp;&emsp;purpose|用途|string||
-|&emsp;&emsp;remark|备注|string||
-|&emsp;&emsp;sceneName|场景名称|string||
-|&emsp;&emsp;shareId|共享记录ID|integer(int64)||
-|&emsp;&emsp;source|来源|string||
-|&emsp;&emsp;status|运行状态(0:在线/1:离线/2:故障/3:报废)|integer(int32)||
-|&emsp;&emsp;trackStatus|设备出入库状态 0未出库1已出库|integer(int32)||
+|&emsp;&emsp;id|主键id|integer(int64)||
+|&emsp;&emsp;latitude|纬度|number(double)||
+|&emsp;&emsp;longitude|经度|number(double)||
+|&emsp;&emsp;stationName|派出所名称|string||
+|&emsp;&emsp;status|状态(0正常 1停用)|integer(int32)||
 |&emsp;&emsp;updateTime|更新时间|string(date-time)||
 |&emsp;&emsp;updateUser|更新人|integer(int64)||
-|&emsp;&emsp;workMode|工作模式:1.侦测中/2.信号干扰中/3.诱导驱离中/4.待机|string||
 |msg|返回消息|string||
 |success|是否成功|boolean||
 
@@ -112,40 +86,20 @@
 	"code": 0,
 	"data": [
 		{
-			"azimuth": 0,
-			"batteryPct": 0,
-			"belongDept": 0,
-			"belongDeptName": "",
-			"charger": "",
+			"address": "",
+			"areaCode": "",
+			"contactPerson": "",
 			"contactPhone": "",
 			"createDept": 0,
 			"createTime": "",
 			"createUser": 0,
-			"detectTargetCnt": 0,
-			"deviceAtt": "",
-			"deviceModel": "",
-			"deviceName": "",
-			"deviceSn": "",
-			"deviceSpecification": "",
-			"deviceType": "",
-			"effectiveRangeKm": 0,
-			"elevation": 0,
 			"id": 0,
-			"isShared": true,
-			"latitude": "",
-			"longitude": "",
-			"manufacturer": "",
-			"outTarget": "",
-			"purpose": "",
-			"remark": "",
-			"sceneName": "",
-			"shareId": 0,
-			"source": "",
+			"latitude": 0,
+			"longitude": 0,
+			"stationName": "",
 			"status": 0,
-			"trackStatus": 0,
 			"updateTime": "",
-			"updateUser": 0,
-			"workMode": ""
+			"updateUser": 0
 		}
 	],
 	"msg": "",
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()
 })
 
diff --git a/applications/drone-command/src/views/areaManage/precinctInfo/precinctInfoApi.js b/applications/drone-command/src/views/areaManage/precinctInfo/precinctInfoApi.js
index de2022d..629abf3 100644
--- a/applications/drone-command/src/views/areaManage/precinctInfo/precinctInfoApi.js
+++ b/applications/drone-command/src/views/areaManage/precinctInfo/precinctInfoApi.js
@@ -18,6 +18,15 @@
 	})
 }
 
+// 多边形区域查询派出所
+export const fwPoliceStationQueryByPolygonsApi = data => {
+	return request({
+		url: `/drone-fw/area/fwPoliceStation/queryByPolygons`,
+		method: 'post',
+		data,
+	})
+}
+
 // 增加或更新
 export const fwPoliceStationSubmitApi = data => {
 	return request({

--
Gitblit v1.9.3