diff --git a/src/api/api.ts b/src/api/api.ts index 32821e8..f343f40 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -10,6 +10,7 @@ import { getBasePoints as getStorePointsBasePoints, getPointDetailById as getSto 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' @@ -21,6 +22,7 @@ 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'; /** * API接口统一导出对象 @@ -196,4 +198,20 @@ export const $api = { */ getPointDetailById: (id: number): Promise> => getReservoirsPointDetailById(id), }, + + // 地铁站点信息 + subwayStations: { + /** + * 获取所有基础地铁站点 + * @returns 地铁站点数据数组 + */ + getBasePoints: (): Promise> => getSubwayStationsBasePoints(), + + /** + * 根据id获取地铁站点详情 + * @param id - 地铁站点id + * @returns 地铁站点详情 + */ + getPointDetailById: (id: number): Promise> => getSubwayStationsPointDetailById(id), + }, } diff --git a/src/api/subway-stations.ts b/src/api/subway-stations.ts new file mode 100644 index 0000000..3540d8c --- /dev/null +++ b/src/api/subway-stations.ts @@ -0,0 +1,20 @@ +import type { ApiResponse } from "@/types/ApiResponse" +import type { XianSubwayStations } from "@/types/base/XianSubwayStations" +import httpInstance from "@/utils/request/http" + +/** + * 获取地铁站点基础数据 + * @returns 地铁站点数据数组 + */ +export const getBasePoints = (): Promise> => { + return httpInstance.get('/subway/base-points') +} + +/** + * 根据id获取地铁站点详情 + * @param id - 地铁站点id + * @returns 地铁站点详情 + */ +export const getPointDetailById = (id: number): Promise> => { + return httpInstance.get(`/subway/point-detail/${id}`) +} diff --git a/src/component/rain-earthquake/ControlShowDetailComponent.vue b/src/component/rain-earthquake/ControlShowDetailComponent.vue index b367771..b191502 100644 --- a/src/component/rain-earthquake/ControlShowDetailComponent.vue +++ b/src/component/rain-earthquake/ControlShowDetailComponent.vue @@ -99,6 +99,14 @@ useStatusStore().infrastructureLayers.showReservoir.loading " /> + + + diff --git a/src/component/rain-earthquake/detail-panels/SubwayStationComponent.vue b/src/component/rain-earthquake/detail-panels/SubwayStationComponent.vue new file mode 100644 index 0000000..d08a706 --- /dev/null +++ b/src/component/rain-earthquake/detail-panels/SubwayStationComponent.vue @@ -0,0 +1,114 @@ + + + + + + diff --git a/src/config/config.json b/src/config/config.json index 15b9ebb..d318915 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -43,6 +43,7 @@ "storePointsPointId": "store-points-point-", "schoolPointId": "school-point-", "bridgePointId": "bridge-point-", - "reservoirPointId": "reservoir-point-" + "reservoirPointId": "reservoir-point-", + "subwayStationPointId": "subway-station-point-" } } \ No newline at end of file diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 91c7743..c57e59e 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -263,11 +263,9 @@ export const useEarthquakeDisasterChain = () => { }, { name: '显示地铁站', - statusStore: statusStore.infrastructureLayers, - statusKey: 'showSubway' as const, - callback: (status: unknown) => { - console.log('显示地铁站', status); - }, + statusStore: statusStore.poiLayers, + statusKey: 'showSubwayStation' as const, + callback: layerControl.clickSubwayStation, }, ]; }; diff --git a/src/hooks/map/useMap.ts b/src/hooks/map/useMap.ts index 3ee884e..6f76716 100644 --- a/src/hooks/map/useMap.ts +++ b/src/hooks/map/useMap.ts @@ -89,6 +89,11 @@ export const useMap = () => { useLoadingInformationStore().reservoir.id = id; } + // 地铁站点 + else if (pickedObject.id.startsWith(config.prefix.subwayStationPointId)) { + useLoadingInformationStore().subwayStation.id = id; + } + // 其他 else { // 重置状态 diff --git a/src/hooks/rain-earthquake/useLayerControl.ts b/src/hooks/rain-earthquake/useLayerControl.ts index bab1c21..71c9a80 100644 --- a/src/hooks/rain-earthquake/useLayerControl.ts +++ b/src/hooks/rain-earthquake/useLayerControl.ts @@ -109,6 +109,13 @@ export const useLayerControl = () => { useStatusStore().infrastructureLayers.showReservoir.loading = true; }; + /** + * 显示地铁站点 + */ + const clickSubwayStation = () => { + useStatusStore().poiLayers.showSubwayStation.loading = true; + }; + return { clickHiddenDangerPoint, clickHospital, @@ -124,5 +131,6 @@ export const useLayerControl = () => { clickNationRoad, clickBridge, clickReservoir, + clickSubwayStation, }; }; diff --git a/src/hooks/rain-earthquake/useSubwayStationPoint.ts b/src/hooks/rain-earthquake/useSubwayStationPoint.ts new file mode 100644 index 0000000..fb775ee --- /dev/null +++ b/src/hooks/rain-earthquake/useSubwayStationPoint.ts @@ -0,0 +1,29 @@ +import { subwayIcon } from '@/assets'; + +/** + * 地铁站点相关钩子函数 + * @returns 字段映射和获取图标方法 + */ +export const useSubwayStationPoint = () => { + /** + * 字段映射配置 + */ + const field = { + stationName: '站点名称', + referToTheWaterAccumulationPoint: '参照积水点', + depthOfAccumulatedWater: '积水深度', + accumulatedWaterAfterAccounting: '核算后积水深度', + lon: '经度', + lat: '纬度', + }; + + /** + * 获取地铁站点图标 + * @returns 图标路径 + */ + function getDisasterIcon(): string { + return subwayIcon; + } + + return { field, getDisasterIcon }; +}; diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 0c408c1..5deb628 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -286,11 +286,9 @@ export const useRainDisasterChain = () => { }, { name: '显示地铁站', - statusStore: statusStore.infrastructureLayers, - statusKey: 'showSubway' as const, - callback: (status: unknown) => { - console.log('显示地铁站', status); - }, + statusStore: statusStore.poiLayers, + statusKey: 'showSubwayStation' as const, + callback: layerControl.clickSubwayStation, }, ]; }; diff --git a/src/stores/useLoadingInformation.ts b/src/stores/useLoadingInformation.ts index 676e738..bcf090c 100644 --- a/src/stores/useLoadingInformation.ts +++ b/src/stores/useLoadingInformation.ts @@ -108,6 +108,14 @@ export const useLoadingInformationStore = defineStore( id: -1, }); + // ============================== 地铁站点状态 ================================ + const subwayStation = reactive({ + /** 加载状态 */ + loading: false, + /** 地铁站点ID */ + id: -1, + }); + /** * 重置所有状态 */ @@ -155,6 +163,10 @@ export const useLoadingInformationStore = defineStore( // 水库状态重置 reservoir.loading = false; reservoir.id = -1; + + // 地铁站点状态重置 + subwayStation.loading = false; + subwayStation.id = -1; }; return { @@ -169,6 +181,7 @@ export const useLoadingInformationStore = defineStore( school, bridge, reservoir, + subwayStation, resetStatue, }; diff --git a/src/types/base/XianSubwayStations.ts b/src/types/base/XianSubwayStations.ts new file mode 100644 index 0000000..2ff4e44 --- /dev/null +++ b/src/types/base/XianSubwayStations.ts @@ -0,0 +1,15 @@ +import type { Point } from './Point'; + +/** + * 西安市地铁站点数据接口 + */ +export interface XianSubwayStations extends Point { + /** 站点名称 */ + stationName?: string; + /** 参照积水点 */ + referToTheWaterAccumulationPoint?: string; + /** 积水深度 */ + depthOfAccumulatedWater?: string; + /** 核算后积水深度 */ + accumulatedWaterAfterAccounting?: string; +} diff --git a/src/types/common/LoadingResourceType.ts b/src/types/common/LoadingResourceType.ts index 26b62bd..8e33227 100644 --- a/src/types/common/LoadingResourceType.ts +++ b/src/types/common/LoadingResourceType.ts @@ -42,5 +42,10 @@ export enum LoadingResource { */ RESERVOIR = 'RESERVOIR', + /** + * 地铁站点 + */ + SUBWAY_STATION = 'SUBWAY_STATION', + }