| | |
| | | } from '@/utils/cesium/deviceRange' |
| | | import * as Cesium from 'cesium' |
| | | import { AREA_TYPE_STYLE_MAP, BUFFER_LEVEL_STYLES, DEFAULT_AREA_STYLE } from '@ztzf/constants' |
| | | import { fwPoliceStationQueryByPolygonsApi } from '@/views/areaManage/precinctInfo/precinctInfoApi' |
| | | import { fwPoliceStationListApi } 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' |
| | |
| | | let deviceRangeRenderToken = 0 |
| | | let deviceListTimer = null |
| | | let deviceListRequestToken = 0 |
| | | let policeStationListTimer = null |
| | | let policeStationRequestToken = 0 |
| | | |
| | | const rules = { |
| | | areaName: fieldRules(true, 50), |
| | |
| | | clearTimeout(deviceListTimer) |
| | | deviceListTimer = null |
| | | } |
| | | if (policeStationListTimer) { |
| | | clearTimeout(policeStationListTimer) |
| | | policeStationListTimer = null |
| | | } |
| | | viewEntity && viewer?.entities?.remove(viewEntity) |
| | | viewEntity = null |
| | | clearActiveTool() |
| | |
| | | () => { |
| | | if (isDialogInitializing.value) return |
| | | queueDeviceListRefresh() |
| | | queuePoliceStationRefresh() |
| | | }, |
| | | { deep: true } |
| | | ) |
| | |
| | | if (deviceTableRef.value) { |
| | | deviceTableRef.value.clearSelection() |
| | | } |
| | | } |
| | | |
| | | function clearPoliceStationState () { |
| | | policeStationOptions.value = [] |
| | | formData.value.policeStationId = '' |
| | | } |
| | | |
| | | function formatWktNumber (value) { |
| | |
| | | } |
| | | |
| | | // 获取派出所列表 |
| | | function queuePoliceStationRefresh () { |
| | | async function getPoliceStationList () { |
| | | 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 |
| | | const res = await fwPoliceStationListApi() |
| | | policeStationOptions.value = res?.data?.data ?? [] |
| | | await nextTick() |
| | | const matched = policeStationOptions.value.find( |
| | |
| | | } |
| | | isDialogInitializing.value = false |
| | | queueDeviceListRefresh() |
| | | queuePoliceStationRefresh() |
| | | void getPoliceStationList() |
| | | } |
| | | |
| | | onBeforeUnmount(() => { |
| | | if (deviceListTimer) { |
| | | clearTimeout(deviceListTimer) |
| | | deviceListTimer = null |
| | | } |
| | | if (policeStationListTimer) { |
| | | clearTimeout(policeStationListTimer) |
| | | policeStationListTimer = null |
| | | } |
| | | hideTypePanel() |
| | | }) |