From 7aad3e5c225defc06556c8ff666f06db2c2d0eca Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 03 Feb 2026 09:59:25 +0800
Subject: [PATCH] feat:区域划分,关联派出所支持搜索

---
 applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue |   67 ++++++++++++++++++++++++++++-----
 applications/drone-command/env/.env.development                          |    4 +-
 2 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/applications/drone-command/env/.env.development b/applications/drone-command/env/.env.development
index 70af9b9..e005479 100644
--- a/applications/drone-command/env/.env.development
+++ b/applications/drone-command/env/.env.development
@@ -2,7 +2,7 @@
  # @Author       : yuan
  # @Date         : 2026-01-31 14:34:31
  # @LastEditors  : yuan
- # @LastEditTime : 2026-02-02 16:39:41
+ # @LastEditTime : 2026-02-03 09:34:48
  # @FilePath     : \applications\drone-command\env\.env.development
  # @Description  : 
  # Copyright 2026 OBKoro1, All Rights Reserved. 
@@ -16,7 +16,7 @@
 
 #开发环境代理地址(推荐本地新建文件 .env.development.local 来进行覆盖)
 # VITE_APP_URL=https://wrj.shuixiongit.com/api
-VITE_APP_URL=http://192.168.1.33
+VITE_APP_URL=http://192.168.1.168
 
 #新大屏地址
 VITE_APP_DASHBOARD_URL='https://wrj.shuixiongit.com/command-center-dashboard/'
diff --git a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
index 81a4a34..3c51a03 100644
--- a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
+++ b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -160,7 +160,8 @@
 					</el-form-item>
 					<el-form-item label="关联派出所" prop="policeStationId">
 						<el-select class="command-select" popper-class="command-select-popper"
-							v-model="formData.policeStationId" placeholder="请选择" clearable>
+							v-model="formData.policeStationId" placeholder="请选择" clearable filterable remote
+							:remote-method="handlePoliceStationSearch" :loading="policeStationLoading">
 							<el-option v-for="item in policeStationOptions" :key="item.id" :label="item.stationName"
 								:value="item.id" />
 						</el-select>
@@ -285,6 +286,10 @@
 const searchName = ref('')
 const selectedDeviceRows = ref([])
 const policeStationOptions = ref([]) // 关联派出所
+const policeStationAllOptions = ref([])
+const policeStationLoading = ref(false)
+const policeStationSearchTimer = ref(null)
+const policeStationSearchKeyword = ref('')
 const deviceOptions = ref([]) // 关联设备
 const dictObj = inject('dictObj')
 const mapRef = ref(null)
@@ -421,6 +426,10 @@
 			if (deviceListTimer) {
 				clearTimeout(deviceListTimer)
 				deviceListTimer = null
+			}
+			if (policeStationSearchTimer.value) {
+				clearTimeout(policeStationSearchTimer.value)
+				policeStationSearchTimer.value = null
 			}
 			viewEntity && viewer?.entities?.remove(viewEntity)
 			viewEntity = null
@@ -1191,17 +1200,45 @@
 }
 
 // 获取派出所列表
-async function getPoliceStationList () {
+async function getPoliceStationList (keyword = '') {
 	if (!visible.value) return
-	const res = await fwPoliceStationListApi()
-	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 = ''
+	policeStationLoading.value = true
+	try {
+		const res = await fwPoliceStationListApi({
+			stationName: keyword || undefined,
+		})
+		const list = res?.data?.data ?? []
+		policeStationOptions.value = list
+		if (!keyword) {
+			policeStationAllOptions.value = list
+		}
+		await nextTick()
+		if (!keyword) {
+			const matched = policeStationOptions.value.find(
+				item => String(item.id) === String(formData.value.policeStationId)
+			)
+			if (!matched) {
+				formData.value.policeStationId = ''
+			}
+		}
+	} finally {
+		policeStationLoading.value = false
 	}
+}
+
+function handlePoliceStationSearch (query) {
+	policeStationSearchKeyword.value = (query || '').trim()
+	if (!policeStationSearchKeyword.value) {
+		policeStationOptions.value = [...policeStationAllOptions.value]
+		return
+	}
+	if (policeStationSearchTimer.value) {
+		clearTimeout(policeStationSearchTimer.value)
+	}
+	policeStationSearchTimer.value = setTimeout(() => {
+		policeStationSearchTimer.value = null
+		void getPoliceStationList(policeStationSearchKeyword.value)
+	}, 300)
 }
 
 // 获取设备列表
@@ -1306,6 +1343,12 @@
 	selectedDeviceRows.value = []
 	deviceOptions.value = []
 	policeStationOptions.value = []
+	policeStationAllOptions.value = []
+	policeStationSearchKeyword.value = ''
+	if (policeStationSearchTimer.value) {
+		clearTimeout(policeStationSearchTimer.value)
+		policeStationSearchTimer.value = null
+	}
 	shapeList.value = []
 	activeShapeId.value = null
 	activeAreaType.value = ''
@@ -1363,6 +1406,10 @@
 		clearTimeout(deviceListTimer)
 		deviceListTimer = null
 	}
+	if (policeStationSearchTimer.value) {
+		clearTimeout(policeStationSearchTimer.value)
+		policeStationSearchTimer.value = null
+	}
 	hideTypePanel()
 })
 

--
Gitblit v1.9.3