diff --git a/src/api/api.ts b/src/api/api.ts index 1f30fe0..7ad30b8 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -3,10 +3,12 @@ import { getSm2PublicKey } from './crypto' import { getBasePoins as getHiddenDangerBasePoints, getPointDetailById as getHiddenDangerPointDetailById} from './hidden-danger-spots' import { getBasePoins as getRiskBasePoints, getPointDetailById as getRiskPointDetailById} from './risk-spots' import { getBasePoins as getHospitalsBasePoints, getPointDetailById as getHospitalsPointDetailById} from './hospitals' +import { getBasePoints as getDangerousSourceBasePoints, getPointDetailById as getDangerousSourcePointDetailById} from './dangerous-source' 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' /** * API接口统一导出对象 @@ -70,4 +72,20 @@ export const $api = { */ getPointDetailById: (id: number): Promise> => getHospitalsPointDetailById(id), }, + + // 危险源信息 + dangerousSource: { + /** + * 获取所有基础危险源 + * @returns 危险源数据数组 + */ + getBasePoints: (): Promise> => getDangerousSourceBasePoints(), + + /** + * 根据id获取危险源详情 + * @param id - 危险源id + * @returns 危险源详情 + */ + getPointDetailById: (id: number): Promise> => getDangerousSourcePointDetailById(id), + }, } diff --git a/src/api/dangerous-source.ts b/src/api/dangerous-source.ts new file mode 100644 index 0000000..f98813e --- /dev/null +++ b/src/api/dangerous-source.ts @@ -0,0 +1,20 @@ +import type { ApiResponse } from "@/types/ApiResponse" +import type { XianDangerousSource } from "@/types/base/XianDangerousSource" +import httpInstance from "@/utils/request/http" + +/** + * 获取危险源基础数据 + * @returns 危险源数据数组 + */ +export const getBasePoints = (): Promise> => { + return httpInstance.get('/dangerous-source/base-points') +} + +/** + * 根据id获取危险源详情 + * @param id - 危险源id + * @returns 危险源详情 + */ +export const getPointDetailById = (id: number): Promise> => { + return httpInstance.get(`/dangerous-source/point-detail/${id}`) +} diff --git a/src/assets/images/icon/dangerous-source.png b/src/assets/images/icon/dangerous-source.png new file mode 100644 index 0000000..1be757c Binary files /dev/null and b/src/assets/images/icon/dangerous-source.png differ diff --git a/src/assets/index.ts b/src/assets/index.ts index 8d4ada1..a65d6df 100644 --- a/src/assets/index.ts +++ b/src/assets/index.ts @@ -7,6 +7,7 @@ export { default as debrisFlowIcon } from '@/assets/images/icon/debris-flow.png' export { default as flashFloodIcon } from '@/assets/images/icon/flash-flood.png'; export { default as riskAreaIcon } from '@/assets/images/icon/risk-area.png'; export { default as hospitalIcon } from '@/assets/images/icon/hospital.png'; +export { default as dangerousSourceIcon } from '@/assets/images/icon/dangerous-source.png'; // 图片 export { default as backgroundImage } from '@/assets/images/background-image.png'; diff --git a/src/component/rain-earthquake/ControlShowDetailComponent.vue b/src/component/rain-earthquake/ControlShowDetailComponent.vue index d4f359a..86a7980 100644 --- a/src/component/rain-earthquake/ControlShowDetailComponent.vue +++ b/src/component/rain-earthquake/ControlShowDetailComponent.vue @@ -6,11 +6,20 @@ useStatusStore().poiLayers.showHospital.loading " /> + + + diff --git a/src/component/rain-earthquake/DangerousSourceComponent.vue b/src/component/rain-earthquake/DangerousSourceComponent.vue new file mode 100644 index 0000000..e412421 --- /dev/null +++ b/src/component/rain-earthquake/DangerousSourceComponent.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/src/config/config.json b/src/config/config.json index 85e9cdd..165865f 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -36,6 +36,7 @@ "prefix": { "hiddenDangerPointId": "hidden-danger-point-", "riskPointId": "risk-point-", - "hospitalPointId": "hospital-point-" + "hospitalPointId": "hospital-point-", + "dangerousSourcePointId": "dangerous-source-point-" } } \ No newline at end of file diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 789f7d4..3a78452 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -193,9 +193,7 @@ export const useEarthquakeDisasterChain = () => { name: '显示危险源', statusStore: statusStore.poiLayers, statusKey: 'showDangerSource' as const, - callback: (status: unknown) => { - console.log('显示危险源', status); - }, + callback: layerControl.clickDangerousSource, }, { name: '显示避难所', diff --git a/src/hooks/map/useMap.ts b/src/hooks/map/useMap.ts index f0a26f7..cf680f5 100644 --- a/src/hooks/map/useMap.ts +++ b/src/hooks/map/useMap.ts @@ -50,6 +50,13 @@ export const useMap = () => { useLoadingInformationStore().hospital.id = id; } + // 危险源 + else if ( + pickedObject.id.startsWith(config.prefix.dangerousSourcePointId) + ) { + useLoadingInformationStore().dangerousSource.id = id; + } + // 其他 else { // 重置状态 diff --git a/src/hooks/rain-earthquake/useDangerousSourcePoint.ts b/src/hooks/rain-earthquake/useDangerousSourcePoint.ts new file mode 100644 index 0000000..0e9dfa9 --- /dev/null +++ b/src/hooks/rain-earthquake/useDangerousSourcePoint.ts @@ -0,0 +1,32 @@ +import { dangerousSourceIcon } from '@/assets'; + +/** + * 危险源相关钩子函数 + * @returns + */ +export const useDangerousSourcePoint = () => { + /** + * 字段映射配置 + */ + const field = { + unitCode: '统一编号', + name: '危险源名称', + level: '级别', + enterpriseType: '危险源类型', + address: '地理位置', + lon: '经度', + lat: '纬度', + unitHead: '负责人', + telephone: '手机号', + }; + + /** + * 获取危险源图标 + * @returns 图标路径 + */ + function getDisasterIcon(): string { + return dangerousSourceIcon; + } + + return { field, getDisasterIcon }; +}; diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index c8b9187..b90bbe5 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -223,9 +223,7 @@ export const useRainDisasterChain = () => { name: '显示危险源', statusStore: statusStore.poiLayers, statusKey: 'showDangerSource' as const, - callback: (status: unknown) => { - console.log('显示危险源', status); - }, + callback: layerControl.clickDangerousSource, }, { name: '显示避难所', diff --git a/src/hooks/useLayerControl.ts b/src/hooks/useLayerControl.ts index e86cd7f..8e88a9f 100644 --- a/src/hooks/useLayerControl.ts +++ b/src/hooks/useLayerControl.ts @@ -21,5 +21,13 @@ export const useLayerControl = () => { useStatusStore().poiLayers.showHospital.loading = true; }; - return { clickHiddenDangerPoint, clickHospital }; + /** + * 点击显示危险源 + */ + const clickDangerousSource = () => { + // 加载状态为true + useStatusStore().poiLayers.showDangerSource.loading = true; + }; + + return { clickHiddenDangerPoint, clickHospital, clickDangerousSource }; }; diff --git a/src/stores/useLoadingInformation.ts b/src/stores/useLoadingInformation.ts index fa6243f..defc85c 100644 --- a/src/stores/useLoadingInformation.ts +++ b/src/stores/useLoadingInformation.ts @@ -52,6 +52,14 @@ export const useLoadingInformationStore = defineStore( id: -1, }); + // ============================== 危险源加载状态 ================================ + const dangerousSource = reactive({ + /** 加载状态 */ + loading: false, + /** 危险源ID */ + id: -1, + }); + /** * 重置所有状态 */ @@ -71,6 +79,10 @@ export const useLoadingInformationStore = defineStore( // 医院状态重置 hospital.loading = false; hospital.id = -1; + + // 危险源状态重置 + dangerousSource.loading = false; + dangerousSource.id = -1; }; return { @@ -78,6 +90,7 @@ export const useLoadingInformationStore = defineStore( hiddenPoint, riskPoint, hospital, + dangerousSource, resetStatue, }; } diff --git a/src/types/base/XianDangerousSource.ts b/src/types/base/XianDangerousSource.ts new file mode 100644 index 0000000..5b94429 --- /dev/null +++ b/src/types/base/XianDangerousSource.ts @@ -0,0 +1,83 @@ +import type { Point } from './Point'; + +/** + * 西安市危险源数据接口 + */ +export interface XianDangerousSource extends Point { + /** 企业名称 */ + name?: string; + /** 全国统一社会信用代码 */ + unitCode?: string; + /** 详细地址 */ + address?: string; + /** 是否位于化工园区 */ + isInchemistry?: string; + /** 开业(成立)时间 */ + standTime?: string; + /** 企业类型 */ + enterpriseType?: string; + /** 等级 */ + level?: string; + /** 安全生产标准化等级 */ + safeProductLevel?: string; + /** 总容积 */ + sumVolume?: string; + /** 储罐类型 */ + tankType?: string; + /** 总容积(其他说明1) */ + sumVolumeOther1?: string; + /** 总容积(其他说明3) */ + sumVolumeOther3?: string; + /** 总容积(其他说明2) */ + sumVolumeOther2?: string; + /** 创建时间 */ + createTime?: string; + /** 填表人 */ + fillName?: string; + /** 空间点坐标 */ + position?: string; + /** 省 */ + province?: string; + /** 市 */ + city?: string; + /** 上报时间 */ + reportTime?: string; + /** 联系电话 */ + telephone?: string; + /** 县 */ + county?: string; + /** 乡 */ + country?: string; + /** 单位负责人 */ + unitHead?: string; + /** 创建人名称 */ + createName?: string; + /** 村 */ + village?: string; + /** 行政区划代码 */ + governmentCode?: string; + /** 街道 */ + street?: string; + /** 统计负责人 */ + statisticsHead?: string; + /** 机构编码 */ + structionCode?: string; + /** 物理主键 */ + physicalKey?: string; + /** 省编码 */ + provinceCode?: string; + /** 市编码 */ + cityCode?: string; + /** 县编码 */ + countyCode?: string; + /** 更新时间 */ + updateTime?: string; + /** 写入时间 */ + writeTime?: string; + /** 经度 */ + lon?: number; + /** 纬度 */ + lat?: number; + /** 逻辑删除标识,0未删除,1已删除 */ + isDelete?: number; +} diff --git a/src/types/common/LoadingResourceType.ts b/src/types/common/LoadingResourceType.ts index fd51f4e..5ff5db3 100644 --- a/src/types/common/LoadingResourceType.ts +++ b/src/types/common/LoadingResourceType.ts @@ -16,4 +16,7 @@ export enum LoadingResource { /** 医院 */ HOSPITAL = 'HOSPITAL', + + /** 危险源 */ + DANGEROUS_SOURCE = 'DANGEROUS_SOURCE', }