diff --git a/src/api/api.ts b/src/api/api.ts index 99f802d..f689080 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -6,6 +6,7 @@ import { getBasePoins as getHospitalsBasePoints, getPointDetailById as getHospit 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 type { ApiResponse } from '@/types/ApiResponse' import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots' import type { XianRiskSpots } from '@/types/base/XianRiskSpots' @@ -13,6 +14,7 @@ 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' /** * API接口统一导出对象 @@ -124,4 +126,20 @@ export const $api = { */ getPointDetailById: (id: number): Promise> => getFirefighterPointDetailById(id), }, + + // 物资储备点信息 + storePoints: { + /** + * 获取所有基础物资储备点 + * @returns 物资储备点数据数组 + */ + getBasePoints: (): Promise> => getStorePointsBasePoints(), + + /** + * 根据id获取物资储备点详情 + * @param id - 物资储备点id + * @returns 物资储备点详情 + */ + getPointDetailById: (id: number): Promise> => getStorePointsPointDetailById(id), + }, } diff --git a/src/api/store-points.ts b/src/api/store-points.ts new file mode 100644 index 0000000..a08dfd7 --- /dev/null +++ b/src/api/store-points.ts @@ -0,0 +1,20 @@ +import type { ApiResponse } from "@/types/ApiResponse" +import type { XianStorePoints } from "@/types/base/XianStorePoints" +import httpInstance from "@/utils/request/http" + +/** + * 获取物资储备点基础数据 + * @returns 物资储备点数据数组 + */ +export const getBasePoints = (): Promise> => { + return httpInstance.get('/store-points/base-points') +} + +/** + * 根据id获取物资储备点详情 + * @param id - 物资储备点id + * @returns 物资储备点详情 + */ +export const getPointDetailById = (id: number): Promise> => { + return httpInstance.get(`/store-points/point-detail/${id}`) +} diff --git a/src/assets/images/icon/store-points.jpg b/src/assets/images/icon/store-points.jpg new file mode 100644 index 0000000..dab0c2e Binary files /dev/null and b/src/assets/images/icon/store-points.jpg differ diff --git a/src/component/rain-earthquake/ControlShowDetailComponent.vue b/src/component/rain-earthquake/ControlShowDetailComponent.vue index 2510bf3..9aac60e 100644 --- a/src/component/rain-earthquake/ControlShowDetailComponent.vue +++ b/src/component/rain-earthquake/ControlShowDetailComponent.vue @@ -30,6 +30,14 @@ useStatusStore().poiLayers.showFireStation.loading " /> + + + diff --git a/src/component/rain-earthquake/StorePointsComponent.vue b/src/component/rain-earthquake/StorePointsComponent.vue new file mode 100644 index 0000000..624180f --- /dev/null +++ b/src/component/rain-earthquake/StorePointsComponent.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/config/config.json b/src/config/config.json index b29be8c..ac24a73 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -39,6 +39,7 @@ "hospitalPointId": "hospital-point-", "dangerousSourcePointId": "dangerous-source-point-", "emergencyShelterPointId": "emergency-shelter-point-", - "fireStationPointId": "fire-station-point-" + "fireStationPointId": "fire-station-point-", + "storePointsPointId": "store-points-point-" } } \ No newline at end of file diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 3d4178e..9665e27 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -211,9 +211,7 @@ export const useEarthquakeDisasterChain = () => { name: '显示储备点', statusStore: statusStore.poiLayers, statusKey: 'showReservePoint' as const, - callback: (status: unknown) => { - console.log('显示储备点', status); - }, + callback: layerControl.clickStorePoints, }, { name: '显示学校', diff --git a/src/hooks/map/useMap.ts b/src/hooks/map/useMap.ts index bd1a030..3c43699 100644 --- a/src/hooks/map/useMap.ts +++ b/src/hooks/map/useMap.ts @@ -69,6 +69,11 @@ export const useMap = () => { useLoadingInformationStore().fireStation.id = id; } + // 物资储备点 + else if (pickedObject.id.startsWith(config.prefix.storePointsPointId)) { + useLoadingInformationStore().storePoints.id = id; + } + // 其他 else { // 重置状态 diff --git a/src/hooks/rain-earthquake/useStorePointsPoint.ts b/src/hooks/rain-earthquake/useStorePointsPoint.ts new file mode 100644 index 0000000..ebc7073 --- /dev/null +++ b/src/hooks/rain-earthquake/useStorePointsPoint.ts @@ -0,0 +1,34 @@ +import storePointsIcon from '@/assets/images/icon/store-points.jpg'; + +/** + * 物资储备点相关钩子函数 + * @returns + */ +export const useStorePointsPoint = () => { + /** + * 字段映射配置 + */ + const field = { + name: '储备站点名称', + level: '级别', + type: '储备站类型', + address: '地理位置', + lon: '经度', + lat: '纬度', + volume: '储备站有效库容', + tent: '救援帐篷数', + generator: '发电机数', + unitHead: '负责人', + telephone: '手机号', + }; + + /** + * 获取物资储备点图标 + * @returns 图标路径 + */ + function getDisasterIcon(): string { + return storePointsIcon; + } + + return { field, getDisasterIcon }; +}; diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 9cb5018..3d2981c 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -241,9 +241,7 @@ export const useRainDisasterChain = () => { name: '显示储备点', statusStore: statusStore.poiLayers, statusKey: 'showReservePoint' as const, - callback: (status: unknown) => { - console.log('显示储备点', status); - }, + callback: layerControl.clickStorePoints, }, { name: '显示学校', diff --git a/src/hooks/useLayerControl.ts b/src/hooks/useLayerControl.ts index fe04749..11ffa8b 100644 --- a/src/hooks/useLayerControl.ts +++ b/src/hooks/useLayerControl.ts @@ -45,11 +45,20 @@ export const useLayerControl = () => { useStatusStore().poiLayers.showFireStation.loading = true; }; + /** + * 点击显示物资储备点 + */ + const clickStorePoints = () => { + // 加载状态为true + useStatusStore().poiLayers.showReservePoint.loading = true; + }; + return { clickHiddenDangerPoint, clickHospital, clickDangerousSource, clickEmergencyShelter, clickFireStation, + clickStorePoints, }; }; diff --git a/src/stores/useLoadingInformation.ts b/src/stores/useLoadingInformation.ts index 6a3f320..bb78b59 100644 --- a/src/stores/useLoadingInformation.ts +++ b/src/stores/useLoadingInformation.ts @@ -76,6 +76,14 @@ export const useLoadingInformationStore = defineStore( id: -1, }); + // ============================== 物资储备点状态 ================================ + const storePoints = reactive({ + /** 加载状态 */ + loading: false, + /** 物资储备点ID */ + id: -1, + }); + /** * 重置所有状态 */ @@ -107,6 +115,10 @@ export const useLoadingInformationStore = defineStore( // 消防站状态重置 fireStation.loading = false; fireStation.id = -1; + + // 物资储备点状态重置 + storePoints.loading = false; + storePoints.id = -1; }; return { @@ -117,6 +129,7 @@ export const useLoadingInformationStore = defineStore( dangerousSource, emergencyShelter, fireStation, + storePoints, resetStatue, }; } diff --git a/src/types/base/XianStorePoints.ts b/src/types/base/XianStorePoints.ts new file mode 100644 index 0000000..5ddc854 --- /dev/null +++ b/src/types/base/XianStorePoints.ts @@ -0,0 +1,103 @@ +import type { Point } from './Point'; + +/** + * 西安市物资储备点数据接口 + */ +export interface XianStorePoints extends Point { + /** 储备库名称 */ + name?: string; + /** 详细地址 */ + address?: string; + /** 所属部门 */ + department?: string; + /** 分级 */ + level?: string; + /** 类型 */ + type?: string; + /** 建立时间 */ + standTime?: string; + /** 有效库容 */ + volume?: string; + /** 维护人员 */ + maintenance?: string; + /** 救灾帐篷 */ + tent?: number; + /** 棉被 */ + quilt?: number; + /** 棉衣 */ + clothes?: number; + /** 毛巾被 */ + towelBlanket?: number; + /** 毛毯 */ + blanket?: number; + /** 睡袋 */ + sleepingBed?: number; + /** 折叠床 */ + foldingBed?: number; + /** 简易厕所 */ + wc?: number; + /** 生活类物资折合金额 */ + shlwzzhje?: number; + /** 橡皮船 */ + rubberBoat?: number; + /** 冲锋舟 */ + rescueBoat?: number; + /** 救生船 */ + saveBoat?: number; + /** 救生衣 */ + saveClothes?: number; + /** 救生圈 */ + jsq?: number; + /** 编织袋 */ + bzd?: number; + /** 麻袋 */ + md?: number; + /** 抽水泵 */ + waterPump?: number; + /** 救援类物资折和金额 */ + jylwzzhje?: number; + /** 发电机 */ + generator?: number; + /** 应急灯 */ + emergencyLight?: number; + /** 其他物资折合金额 */ + qtwzzhje?: number; + /** 救灾衣被 */ + saveClo?: number; + /** 救援工具 */ + saveTool?: number; + /** 折合金额 */ + zhje?: string; + /** 市 */ + city?: string; + /** 省 */ + province?: string; + /** 村 */ + village?: string; + /** 上报日期 */ + reportTime?: string; + /** 乡 */ + country?: string; + /** 创建人名称 */ + creatName?: string; + /** 县 */ + county?: string; + /** 单位负责人 */ + unitHead?: string; + /** 填表人 */ + fillName?: string; + /** 联系电话 */ + telephone?: string; + /** 创建时间 */ + createTime?: string; + /** 更新时间 */ + updateTime?: string; + /** 写入时间 */ + overwriteTime?: string; + /** 经度 */ + lon?: number; + /** 纬度 */ + lat?: number; + /** 逻辑删除标识,0未删除,1已删除 */ + isDelete?: number; +} diff --git a/src/types/common/LoadingResourceType.ts b/src/types/common/LoadingResourceType.ts index b5a2461..0e62af9 100644 --- a/src/types/common/LoadingResourceType.ts +++ b/src/types/common/LoadingResourceType.ts @@ -25,4 +25,7 @@ export enum LoadingResource { /** 消防站 */ FIRE_STATION = 'FIRE_STATION', + + /** 物资储备点 */ + STORE_POINTS = 'STORE_POINTS', }