From 8dc3b6fe90094de9e7b2b6020a1c1f4c533a2f5d Mon Sep 17 00:00:00 2001 From: wzy-warehouse <18135009705@163.com> Date: Tue, 28 Apr 2026 10:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E5=8C=96=E9=9A=90=E6=82=A3=E7=82=B9?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.ts | 157 ++++++++++++------ src/api/hidden-danger-spots.ts | 5 +- .../rain-earthquake/BasicComponent.vue | 68 ++++++-- .../basic/DebrisFlowComponent.vue | 118 +++++++++++++ ...tComponent.vue => FlashFloodComponent.vue} | 74 ++++----- .../basic/LandslideComponent.vue | 118 +++++++++++++ .../basic/WaterLoggingComponent.vue | 118 +++++++++++++ src/config/config.json | 5 +- .../earthquake/useEarthquakeDisasterChain.ts | 18 +- src/hooks/map/useMap.ts | 26 ++- src/hooks/rain-earthquake/useHiddenPoint.ts | 7 +- src/hooks/rain-earthquake/useLayerControl.ts | 50 ++++-- src/hooks/rainstorm/useRainDisasterChain.ts | 30 ++++ src/stores/useLoadingInformation.ts | 67 ++++++-- src/stores/useStatusStore.ts | 45 ++++- src/types/common/DisasterType.ts | 13 +- src/types/common/LoadingResourceType.ts | 24 ++- 17 files changed, 794 insertions(+), 149 deletions(-) create mode 100644 src/component/rain-earthquake/basic/DebrisFlowComponent.vue rename src/component/rain-earthquake/basic/{HiddenPointComponent.vue => FlashFloodComponent.vue} (58%) create mode 100644 src/component/rain-earthquake/basic/LandslideComponent.vue create mode 100644 src/component/rain-earthquake/basic/WaterLoggingComponent.vue diff --git a/src/api/api.ts b/src/api/api.ts index 11bc77d..ddeca55 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,25 +1,57 @@ -import type { DisasterType } from '@/types/common/DisasterType.ts' -import { getSm2PublicKey } from './crypto' -import { getBasePoints as getHiddenDangerBasePoints, getPointDetailById as getHiddenDangerPointDetailById} from './hidden-danger-spots' -import { getBasePoints as getRiskBasePoints, getPointDetailById as getRiskPointDetailById} from './risk-spots' -import { getBasePoints as getHospitalsBasePoints, getPointDetailById as getHospitalsPointDetailById} from './hospitals' -import { getBasePoints as getDangerousSourceBasePoints, getPointDetailById as getDangerousSourcePointDetailById} from './dangerous-source' -import { getBasePoints as getEmergencyShelterBasePoints, getPointDetailById as getEmergencyShelterPointDetailById} from './emergency-shelter' -import { getBasePoints as getFirefighterBasePoints, getPointDetailById as getFirefighterPointDetailById} from './firefighter' -import { getBasePoints as getStorePointsBasePoints, getPointDetailById as getStorePointsPointDetailById} from './store-points' -import { getBasePoints as getSchoolsBasePoints, getPointDetailById as getSchoolsPointDetailById} from './schools' -import { getBasePoints as getBridgesBasePoints, getPointDetailById as getBridgesPointDetailById} from './bridges' -import { getBasePoints as getReservoirsBasePoints, getPointDetailById as getReservoirsPointDetailById} from './reservoirs' -import { getBasePoints as getSubwayStationsBasePoints, getPointDetailById as getSubwayStationsPointDetailById} from './subway-stations' -import type { ApiResponse } from '@/types/ApiResponse' -import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots' -import type { XianRiskSpots } from '@/types/base/XianRiskSpots' -import type { XianHospitals } from '@/types/base/XianHospitals' -import type { XianDangerousSource } from '@/types/base/XianDangerousSource' -import type { XianEmergencyShelter } from '@/types/base/XianEmergencyShelter' -import type { XianFirefighter } from '@/types/base/XianFirefighter' -import type { XianStorePoints } from '@/types/base/XianStorePoints' -import type { XianSchool } from '@/types/base/XianSchool' +import { getSm2PublicKey } from './crypto'; +import { + getBasePoints as getHiddenDangerBasePoints, + getPointDetailById as getHiddenDangerPointDetailById, +} from './hidden-danger-spots'; +import { + getBasePoints as getRiskBasePoints, + getPointDetailById as getRiskPointDetailById, +} from './risk-spots'; +import { + getBasePoints as getHospitalsBasePoints, + getPointDetailById as getHospitalsPointDetailById, +} from './hospitals'; +import { + getBasePoints as getDangerousSourceBasePoints, + getPointDetailById as getDangerousSourcePointDetailById, +} from './dangerous-source'; +import { + getBasePoints as getEmergencyShelterBasePoints, + getPointDetailById as getEmergencyShelterPointDetailById, +} from './emergency-shelter'; +import { + getBasePoints as getFirefighterBasePoints, + getPointDetailById as getFirefighterPointDetailById, +} from './firefighter'; +import { + getBasePoints as getStorePointsBasePoints, + getPointDetailById as getStorePointsPointDetailById, +} from './store-points'; +import { + getBasePoints as getSchoolsBasePoints, + getPointDetailById as getSchoolsPointDetailById, +} from './schools'; +import { + getBasePoints as getBridgesBasePoints, + getPointDetailById as getBridgesPointDetailById, +} from './bridges'; +import { + getBasePoints as getReservoirsBasePoints, + getPointDetailById as getReservoirsPointDetailById, +} from './reservoirs'; +import { + getBasePoints as getSubwayStationsBasePoints, + getPointDetailById as getSubwayStationsPointDetailById, +} from './subway-stations'; +import type { ApiResponse } from '@/types/ApiResponse'; +import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'; +import type { XianRiskSpots } from '@/types/base/XianRiskSpots'; +import type { XianHospitals } from '@/types/base/XianHospitals'; +import type { XianDangerousSource } from '@/types/base/XianDangerousSource'; +import type { XianEmergencyShelter } from '@/types/base/XianEmergencyShelter'; +import type { XianFirefighter } from '@/types/base/XianFirefighter'; +import type { XianStorePoints } from '@/types/base/XianStorePoints'; +import type { XianSchool } from '@/types/base/XianSchool'; import type { XianBridge } from '@/types/base/XianBridge.ts'; import type { XianReservoirList } from '@/types/base/XianReservoirList'; import type { XianSubwayStations } from '@/types/base/XianSubwayStations'; @@ -28,7 +60,6 @@ import type { XianSubwayStations } from '@/types/base/XianSubwayStations'; * API接口统一导出对象 */ export const $api = { - // 加密模块 crypto: { /** @@ -42,17 +73,23 @@ export const $api = { hiddenDangerSpots: { /** * 获取所有基础隐患点 - * @param disasterType - 灾害类型 + * @param disasterType - 灾害类型(landslide, debris_flow, water_logging, flash_flood) * @returns 隐患点数据数组 */ - getBasePoints: (disasterType: DisasterType): Promise> => getHiddenDangerBasePoints(disasterType), + getBasePoints: ( + disasterType: string + ): Promise> => + getHiddenDangerBasePoints(disasterType), /** * 根据id获取隐患点详情 * @param id - 隐患点id * @returns 隐患点详情 */ - getPointDetailById: (id: number): Promise> => getHiddenDangerPointDetailById(id), + getPointDetailById: ( + id: number + ): Promise> => + getHiddenDangerPointDetailById(id), }, // 风险点信息 @@ -61,14 +98,16 @@ export const $api = { * 获取所有基础风险点 * @returns 风险点数据数组 */ - getBasePoints: (): Promise> => getRiskBasePoints(), + getBasePoints: (): Promise> => + getRiskBasePoints(), /** * 根据id获取风险点详情 * @param id - 风险点id * @returns 风险点详情 */ - getPointDetailById: (id: number): Promise> => getRiskPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getRiskPointDetailById(id), }, // 医院信息 @@ -77,14 +116,16 @@ export const $api = { * 获取所有基础医院 * @returns 医院数据数组 */ - getBasePoints: (): Promise> => getHospitalsBasePoints(), + getBasePoints: (): Promise> => + getHospitalsBasePoints(), /** * 根据id获取医院详情 * @param id - 医院id * @returns 医院详情 */ - getPointDetailById: (id: number): Promise> => getHospitalsPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getHospitalsPointDetailById(id), }, // 危险源信息 @@ -93,14 +134,18 @@ export const $api = { * 获取所有基础危险源 * @returns 危险源数据数组 */ - getBasePoints: (): Promise> => getDangerousSourceBasePoints(), + getBasePoints: (): Promise> => + getDangerousSourceBasePoints(), /** * 根据id获取危险源详情 * @param id - 危险源id * @returns 危险源详情 */ - getPointDetailById: (id: number): Promise> => getDangerousSourcePointDetailById(id), + getPointDetailById: ( + id: number + ): Promise> => + getDangerousSourcePointDetailById(id), }, // 避难所信息 @@ -109,14 +154,18 @@ export const $api = { * 获取所有基础避难所 * @returns 避难所数据数组 */ - getBasePoints: (): Promise> => getEmergencyShelterBasePoints(), + getBasePoints: (): Promise> => + getEmergencyShelterBasePoints(), /** * 根据id获取避难所详情 * @param id - 避难所id * @returns 避难所详情 */ - getPointDetailById: (id: number): Promise> => getEmergencyShelterPointDetailById(id), + getPointDetailById: ( + id: number + ): Promise> => + getEmergencyShelterPointDetailById(id), }, // 消防站信息 @@ -125,14 +174,16 @@ export const $api = { * 获取所有基础消防站 * @returns 消防站数据数组 */ - getBasePoints: (): Promise> => getFirefighterBasePoints(), + getBasePoints: (): Promise> => + getFirefighterBasePoints(), /** * 根据id获取消防站详情 * @param id - 消防站id * @returns 消防站详情 */ - getPointDetailById: (id: number): Promise> => getFirefighterPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getFirefighterPointDetailById(id), }, // 物资储备点信息 @@ -141,14 +192,16 @@ export const $api = { * 获取所有基础物资储备点 * @returns 物资储备点数据数组 */ - getBasePoints: (): Promise> => getStorePointsBasePoints(), + getBasePoints: (): Promise> => + getStorePointsBasePoints(), /** * 根据id获取物资储备点详情 * @param id - 物资储备点id * @returns 物资储备点详情 */ - getPointDetailById: (id: number): Promise> => getStorePointsPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getStorePointsPointDetailById(id), }, // 学校信息 @@ -157,14 +210,16 @@ export const $api = { * 获取所有基础学校 * @returns 学校数据数组 */ - getBasePoints: (): Promise> => getSchoolsBasePoints(), + getBasePoints: (): Promise> => + getSchoolsBasePoints(), /** * 根据id获取学校详情 * @param id - 学校id * @returns 学校详情 */ - getPointDetailById: (id: number): Promise> => getSchoolsPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getSchoolsPointDetailById(id), }, // 桥梁信息 @@ -173,14 +228,16 @@ export const $api = { * 获取所有基础桥梁 * @returns 桥梁数据数组 */ - getBasePoints: (): Promise> => getBridgesBasePoints(), + getBasePoints: (): Promise> => + getBridgesBasePoints(), /** * 根据id获取桥梁详情 * @param id - 桥梁id * @returns 桥梁详情 */ - getPointDetailById: (id: number): Promise> => getBridgesPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getBridgesPointDetailById(id), }, // 水库信息 @@ -189,14 +246,16 @@ export const $api = { * 获取所有基础水库 * @returns 水库数据数组 */ - getBasePoints: (): Promise> => getReservoirsBasePoints(), + getBasePoints: (): Promise> => + getReservoirsBasePoints(), /** * 根据id获取水库详情 * @param id - 水库id * @returns 水库详情 */ - getPointDetailById: (id: number): Promise> => getReservoirsPointDetailById(id), + getPointDetailById: (id: number): Promise> => + getReservoirsPointDetailById(id), }, // 地铁站点信息 @@ -205,13 +264,17 @@ export const $api = { * 获取所有基础地铁站点 * @returns 地铁站点数据数组 */ - getBasePoints: (): Promise> => getSubwayStationsBasePoints(), + getBasePoints: (): Promise> => + getSubwayStationsBasePoints(), /** * 根据id获取地铁站点详情 * @param id - 地铁站点id * @returns 地铁站点详情 */ - getPointDetailById: (id: number): Promise> => getSubwayStationsPointDetailById(id), + getPointDetailById: ( + id: number + ): Promise> => + getSubwayStationsPointDetailById(id), }, -} +}; diff --git a/src/api/hidden-danger-spots.ts b/src/api/hidden-danger-spots.ts index 3619332..8002aba 100644 --- a/src/api/hidden-danger-spots.ts +++ b/src/api/hidden-danger-spots.ts @@ -1,14 +1,13 @@ import type { ApiResponse } from "@/types/ApiResponse" import type { XianHiddenDangerSpots } from "@/types/base/XianHiddenDangerSpots" -import type { DisasterType } from "@/types/common/DisasterType.ts" import httpInstance from "@/utils/request/http" /** * 获取隐患点基础数据 - * @param disasterType - 灾害类型 + * @param disasterType - 灾害类型(landslide, debris_flow, water_logging, flash_flood) * @returns 隐患点数据数组 */ -export const getBasePoints = (disasterType: DisasterType): Promise> => { +export const getBasePoints = (disasterType: string): Promise> => { return httpInstance.get('/hidden-danger-spots/base-points', { params: { disasterType diff --git a/src/component/rain-earthquake/BasicComponent.vue b/src/component/rain-earthquake/BasicComponent.vue index 6d4940b..3cfb592 100644 --- a/src/component/rain-earthquake/BasicComponent.vue +++ b/src/component/rain-earthquake/BasicComponent.vue @@ -4,14 +4,59 @@ - - + + + + + import MapComponent from '@/component/map/MapComponent.vue'; - import type { DisasterType } from '@/types/common/DisasterType.ts'; - import HiddenPointComponent from '@/component/rain-earthquake/basic/HiddenPointComponent.vue'; + import { DisasterType } from '@/types/common/DisasterType.ts'; import RiskPointComponent from '@/component/rain-earthquake/basic/RiskPointComponent.vue'; + import LandslideComponent from '@/component/rain-earthquake/basic/LandslideComponent.vue'; + import DebrisFlowComponent from '@/component/rain-earthquake/basic/DebrisFlowComponent.vue'; + import WaterLoggingComponent from '@/component/rain-earthquake/basic/WaterLoggingComponent.vue'; + import FlashFloodComponent from '@/component/rain-earthquake/basic/FlashFloodComponent.vue'; import { useStatusStore } from '@/stores/useStatusStore'; // 获取父组件传递德数据 diff --git a/src/component/rain-earthquake/basic/DebrisFlowComponent.vue b/src/component/rain-earthquake/basic/DebrisFlowComponent.vue new file mode 100644 index 0000000..06722f1 --- /dev/null +++ b/src/component/rain-earthquake/basic/DebrisFlowComponent.vue @@ -0,0 +1,118 @@ + + + + + + diff --git a/src/component/rain-earthquake/basic/HiddenPointComponent.vue b/src/component/rain-earthquake/basic/FlashFloodComponent.vue similarity index 58% rename from src/component/rain-earthquake/basic/HiddenPointComponent.vue rename to src/component/rain-earthquake/basic/FlashFloodComponent.vue index 5d65edd..bcd45e4 100644 --- a/src/component/rain-earthquake/basic/HiddenPointComponent.vue +++ b/src/component/rain-earthquake/basic/FlashFloodComponent.vue @@ -1,73 +1,68 @@ - + + diff --git a/src/component/rain-earthquake/basic/LandslideComponent.vue b/src/component/rain-earthquake/basic/LandslideComponent.vue new file mode 100644 index 0000000..15506cf --- /dev/null +++ b/src/component/rain-earthquake/basic/LandslideComponent.vue @@ -0,0 +1,118 @@ + + + + + + diff --git a/src/component/rain-earthquake/basic/WaterLoggingComponent.vue b/src/component/rain-earthquake/basic/WaterLoggingComponent.vue new file mode 100644 index 0000000..e22ec14 --- /dev/null +++ b/src/component/rain-earthquake/basic/WaterLoggingComponent.vue @@ -0,0 +1,118 @@ + + + + + + diff --git a/src/config/config.json b/src/config/config.json index d318915..63a4daf 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -34,7 +34,10 @@ "min": 1000 }, "prefix": { - "hiddenDangerPointId": "hidden-danger-point-", + "landslideHiddenPointId": "landslide-hidden-point-", + "debrisFlowHiddenPointId": "debris-flow-hidden-point-", + "waterLoggingHiddenPointId": "water-logging-hidden-point-", + "flashFloodHiddenPointId": "flash-flood-hidden-point-", "riskPointId": "risk-point-", "hospitalPointId": "hospital-point-", "dangerousSourcePointId": "dangerous-source-point-", diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index c57e59e..2f5a1b0 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -178,10 +178,22 @@ export const useEarthquakeDisasterChain = () => { return [ { - name: '显示隐患点', + name: '显示滑坡隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showLandslideHiddenPoint' as const, + callback: layerControl.clickLandslideHiddenPoint, + }, + { + name: '显示泥石流隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showDebrisFlowHiddenPoint' as const, + callback: layerControl.clickDebrisFlowHiddenPoint, + }, + { + name: '显示风险点', statusStore: statusStore.mapLayers, - statusKey: 'hiddenDangerPointShow' as const, - callback: layerControl.clickHiddenDangerPoint, + statusKey: 'riskPointShow' as const, + callback: layerControl.clickRiskPoint, }, { name: '显示医院', diff --git a/src/hooks/map/useMap.ts b/src/hooks/map/useMap.ts index 6f76716..0453771 100644 --- a/src/hooks/map/useMap.ts +++ b/src/hooks/map/useMap.ts @@ -23,7 +23,10 @@ export const useMap = () => { // 当id改变时候,重置状态 if ( - useLoadingInformationStore().hiddenPoint.id !== id && + useLoadingInformationStore().landslideHiddenPoint.id !== id && + useLoadingInformationStore().debrisFlowHiddenPoint.id !== id && + useLoadingInformationStore().waterLoggingHiddenPoint.id !== id && + useLoadingInformationStore().flashFloodHiddenPoint.id !== id && useLoadingInformationStore().riskPoint.id !== id && useLoadingInformationStore().hospital.id !== id ) { @@ -35,9 +38,24 @@ export const useMap = () => { useLoadingInformationStore().clickObject.primitive = pickedObject.primitive; - // 隐患点 - if (pickedObject.id.startsWith(config.prefix.hiddenDangerPointId)) { - useLoadingInformationStore().hiddenPoint.id = id; + // 滑坡隐患点 + if (pickedObject.id.startsWith(config.prefix.landslideHiddenPointId)) { + useLoadingInformationStore().landslideHiddenPoint.id = id; + } + + // 泥石流隐患点 + else if (pickedObject.id.startsWith(config.prefix.debrisFlowHiddenPointId)) { + useLoadingInformationStore().debrisFlowHiddenPoint.id = id; + } + + // 内涝隐患点 + else if (pickedObject.id.startsWith(config.prefix.waterLoggingHiddenPointId)) { + useLoadingInformationStore().waterLoggingHiddenPoint.id = id; + } + + // 山洪隐患点 + else if (pickedObject.id.startsWith(config.prefix.flashFloodHiddenPointId)) { + useLoadingInformationStore().flashFloodHiddenPoint.id = id; } // 风险点 diff --git a/src/hooks/rain-earthquake/useHiddenPoint.ts b/src/hooks/rain-earthquake/useHiddenPoint.ts index 275911d..88e9d98 100644 --- a/src/hooks/rain-earthquake/useHiddenPoint.ts +++ b/src/hooks/rain-earthquake/useHiddenPoint.ts @@ -24,17 +24,22 @@ export const useHiddenPoint = () => { /** * 根据灾害类型获取对应图标 - * @param disasterType - 灾害类型 + * @param disasterType - 灾害类型(支持中英文) * @returns 图标路径 */ function getDisasterIcon(disasterType?: string): string { + // 支持英文和中文两种格式 switch (disasterType) { + case 'landslide': case '滑坡': return landslideIcon; + case 'debris_flow': case '泥石流': return debrisFlowIcon; + case 'water_logging': case '内涝': return waterLoggingIcon; + case 'flash_flood': case '山洪': return flashFloodIcon; default: diff --git a/src/hooks/rain-earthquake/useLayerControl.ts b/src/hooks/rain-earthquake/useLayerControl.ts index 71c9a80..183369e 100644 --- a/src/hooks/rain-earthquake/useLayerControl.ts +++ b/src/hooks/rain-earthquake/useLayerControl.ts @@ -4,15 +4,6 @@ import { useStatusStore } from '@/stores/useStatusStore.ts'; * 控制面板显示隐藏逻辑 */ export const useLayerControl = () => { - /** - * 点击显示隐藏隐患点 - * @param status - 显示隐藏状态 - */ - const clickHiddenDangerPoint = (status: unknown) => { - // 改变风险点显示状态 - useStatusStore().mapLayers.riskPointShow.show = status as boolean; - }; - /** * 点击显示医院 */ @@ -116,8 +107,43 @@ export const useLayerControl = () => { useStatusStore().poiLayers.showSubwayStation.loading = true; }; + /** + * 显示滑坡隐患点 + */ + const clickLandslideHiddenPoint = () => { + useStatusStore().poiLayers.showLandslideHiddenPoint.loading = true; + }; + + /** + * 显示泥石流隐患点 + */ + const clickDebrisFlowHiddenPoint = () => { + useStatusStore().poiLayers.showDebrisFlowHiddenPoint.loading = true; + }; + + /** + * 显示内涝隐患点 + */ + const clickWaterLoggingHiddenPoint = () => { + useStatusStore().poiLayers.showWaterLoggingHiddenPoint.loading = true; + }; + + /** + * 显示山洪隐患点 + */ + const clickFlashFloodHiddenPoint = () => { + useStatusStore().poiLayers.showFlashFloodHiddenPoint.loading = true; + }; + + /** + * 显示风险点 + */ + const clickRiskPoint = () => { + useStatusStore().mapLayers.riskPointShow.loading = true; + }; + return { - clickHiddenDangerPoint, + clickRiskPoint, clickHospital, clickDangerousSource, clickEmergencyShelter, @@ -132,5 +158,9 @@ export const useLayerControl = () => { clickBridge, clickReservoir, clickSubwayStation, + clickLandslideHiddenPoint, + clickDebrisFlowHiddenPoint, + clickWaterLoggingHiddenPoint, + clickFlashFloodHiddenPoint, }; }; diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 5deb628..b52cbe5 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -206,6 +206,36 @@ export const useRainDisasterChain = () => { const layerControl = useLayerControl(); return [ + { + name: '显示滑坡隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showLandslideHiddenPoint' as const, + callback: layerControl.clickLandslideHiddenPoint, + }, + { + name: '显示泥石流隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showDebrisFlowHiddenPoint' as const, + callback: layerControl.clickDebrisFlowHiddenPoint, + }, + { + name: '显示内涝隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showWaterLoggingHiddenPoint' as const, + callback: layerControl.clickWaterLoggingHiddenPoint, + }, + { + name: '显示山洪隐患点', + statusStore: statusStore.poiLayers, + statusKey: 'showFlashFloodHiddenPoint' as const, + callback: layerControl.clickFlashFloodHiddenPoint, + }, + { + name: '显示风险点', + statusStore: statusStore.mapLayers, + statusKey: 'riskPointShow' as const, + callback: layerControl.clickRiskPoint, + }, { name: '显示医院', statusStore: statusStore.poiLayers, diff --git a/src/stores/useLoadingInformation.ts b/src/stores/useLoadingInformation.ts index bcf090c..28ac7a6 100644 --- a/src/stores/useLoadingInformation.ts +++ b/src/stores/useLoadingInformation.ts @@ -18,16 +18,6 @@ export const useLoadingInformationStore = defineStore( // ============================ 隐患点加载状态 ================================ - /** - * 隐患点加载信息状态 - */ - const hiddenPoint = reactive({ - /** 加载状态 */ - loading: false, - /** 隐患点ID */ - id: -1, - }); - // ============================ 风险点加载状态 ================================ /** @@ -116,6 +106,38 @@ export const useLoadingInformationStore = defineStore( id: -1, }); + // ============================== 滑坡隐患点状态 ================================ + const landslideHiddenPoint = reactive({ + /** 加载状态 */ + loading: false, + /** 滑坡隐患点ID */ + id: -1, + }); + + // ============================== 泥石流隐患点状态 ================================ + const debrisFlowHiddenPoint = reactive({ + /** 加载状态 */ + loading: false, + /** 泥石流隐患点ID */ + id: -1, + }); + + // ============================== 内涝隐患点状态 ================================ + const waterLoggingHiddenPoint = reactive({ + /** 加载状态 */ + loading: false, + /** 内涝隐患点ID */ + id: -1, + }); + + // ============================== 山洪隐患点状态 ================================ + const flashFloodHiddenPoint = reactive({ + /** 加载状态 */ + loading: false, + /** 山洪隐患点ID */ + id: -1, + }); + /** * 重置所有状态 */ @@ -124,10 +146,6 @@ export const useLoadingInformationStore = defineStore( clickObject.id = ''; clickObject.primitive = null; - // 隐患点状态重置 - hiddenPoint.loading = false; - hiddenPoint.id = -1; - // 风险点状态重置 riskPoint.loading = false; riskPoint.id = -1; @@ -167,11 +185,26 @@ export const useLoadingInformationStore = defineStore( // 地铁站点状态重置 subwayStation.loading = false; subwayStation.id = -1; + + // 滑坡隐患点状态重置 + landslideHiddenPoint.loading = false; + landslideHiddenPoint.id = -1; + + // 泥石流隐患点状态重置 + debrisFlowHiddenPoint.loading = false; + debrisFlowHiddenPoint.id = -1; + + // 内涝隐患点状态重置 + waterLoggingHiddenPoint.loading = false; + waterLoggingHiddenPoint.id = -1; + + // 山洪隐患点状态重置 + flashFloodHiddenPoint.loading = false; + flashFloodHiddenPoint.id = -1; }; return { clickObject, - hiddenPoint, riskPoint, hospital, dangerousSource, @@ -182,6 +215,10 @@ export const useLoadingInformationStore = defineStore( bridge, reservoir, subwayStation, + landslideHiddenPoint, + debrisFlowHiddenPoint, + waterLoggingHiddenPoint, + flashFloodHiddenPoint, resetStatue, }; diff --git a/src/stores/useStatusStore.ts b/src/stores/useStatusStore.ts index 3a06023..84cbe51 100644 --- a/src/stores/useStatusStore.ts +++ b/src/stores/useStatusStore.ts @@ -54,11 +54,6 @@ export const useStatusStore = defineStore('status', () => { show: true, loading: true, }, - /** 隐患点显示状态 */ - hiddenDangerPointShow: { - show: true, - loading: true, - }, /** 风险点显示状态 */ riskPointShow: { show: true, @@ -115,6 +110,26 @@ export const useStatusStore = defineStore('status', () => { show: false, loading: false, }, + /** 显示滑坡隐患点 */ + showLandslideHiddenPoint: { + show: true, + loading: true, + }, + /** 显示泥石流隐患点 */ + showDebrisFlowHiddenPoint: { + show: true, + loading: true, + }, + /** 显示内涝隐患点 */ + showWaterLoggingHiddenPoint: { + show: true, + loading: true, + }, + /** 显示山洪隐患点 */ + showFlashFloodHiddenPoint: { + show: true, + loading: true, + }, }); /** @@ -207,10 +222,6 @@ export const useStatusStore = defineStore('status', () => { show: true, loading: true, }; - mapLayers.hiddenDangerPointShow = { - show: true, - loading: true, - }; mapLayers.riskPointShow = { show: true, loading: true, @@ -249,6 +260,22 @@ export const useStatusStore = defineStore('status', () => { show: false, loading: false, }; + poiLayers.showLandslideHiddenPoint = { + show: true, + loading: true, + }; + poiLayers.showDebrisFlowHiddenPoint = { + show: true, + loading: true, + }; + poiLayers.showWaterLoggingHiddenPoint = { + show: true, + loading: true, + }; + poiLayers.showFlashFloodHiddenPoint = { + show: true, + loading: true, + }; // 基础设施图层显示状态重置 infrastructureLayers.showNetworkSystem = { diff --git a/src/types/common/DisasterType.ts b/src/types/common/DisasterType.ts index 487d547..3df9660 100644 --- a/src/types/common/DisasterType.ts +++ b/src/types/common/DisasterType.ts @@ -9,7 +9,7 @@ export enum DisasterType { } /** - * 点型枚举 + * 点型枚举(用于UI显示) */ export enum PointType { /** 滑坡 */ @@ -23,3 +23,14 @@ export enum PointType { /** 风险区 */ RISK_AREA = '风险区', } + +/** + * 隐患点类型映射(中文 -> 后端英文参数) + */ +export const HiddenDangerPointTypeMap: Record = { + [PointType.LANDSLIDE]: 'landslide', + [PointType.DEBRIS_FLOW]: 'debris_flow', + [PointType.WATER_LOGGING]: 'water_logging', + [PointType.FLASH_FLOOD]: 'flash_flood', + [PointType.RISK_AREA]: 'risk_area', +}; diff --git a/src/types/common/LoadingResourceType.ts b/src/types/common/LoadingResourceType.ts index 8e33227..2af50ce 100644 --- a/src/types/common/LoadingResourceType.ts +++ b/src/types/common/LoadingResourceType.ts @@ -1,9 +1,4 @@ export enum LoadingResource { - /** - * 隐患点 - */ - HIDDEN_DANGER_POINT = 'HIDDEN_DANGER_POINT', - /** * 风险点 */ @@ -47,5 +42,24 @@ export enum LoadingResource { */ SUBWAY_STATION = 'SUBWAY_STATION', + /** + * 滑坡隐患点 + */ + LANDSLIDE_HIDDEN_POINT = 'LANDSLIDE_HIDDEN_POINT', + + /** + * 泥石流隐患点 + */ + DEBRIS_FLOW_HIDDEN_POINT = 'DEBRIS_FLOW_HIDDEN_POINT', + + /** + * 内涝隐患点 + */ + WATER_LOGGING_HIDDEN_POINT = 'WATER_LOGGING_HIDDEN_POINT', + + /** + * 山洪隐患点 + */ + FLASH_FLOOD_HIDDEN_POINT = 'FLASH_FLOOD_HIDDEN_POINT', }