From ad3ffe91b057cb285f3867e5ba9329e29d71d97e Mon Sep 17 00:00:00 2001 From: wzy-warehouse <18135009705@163.com> Date: Sat, 18 Apr 2026 19:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=B1=E9=99=A9=E6=BA=90=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.ts | 18 +++ src/api/dangerous-source.ts | 20 +++ src/assets/images/icon/dangerous-source.png | Bin 0 -> 2416 bytes src/assets/index.ts | 1 + .../ControlShowDetailComponent.vue | 9 ++ .../DangerousSourceComponent.vue | 120 ++++++++++++++++++ src/config/config.json | 3 +- .../earthquake/useEarthquakeDisasterChain.ts | 4 +- src/hooks/map/useMap.ts | 7 + .../useDangerousSourcePoint.ts | 32 +++++ src/hooks/rainstorm/useRainDisasterChain.ts | 4 +- src/hooks/useLayerControl.ts | 10 +- src/stores/useLoadingInformation.ts | 13 ++ src/types/base/XianDangerousSource.ts | 83 ++++++++++++ src/types/common/LoadingResourceType.ts | 3 + 15 files changed, 319 insertions(+), 8 deletions(-) create mode 100644 src/api/dangerous-source.ts create mode 100644 src/assets/images/icon/dangerous-source.png create mode 100644 src/component/rain-earthquake/DangerousSourceComponent.vue create mode 100644 src/hooks/rain-earthquake/useDangerousSourcePoint.ts create mode 100644 src/types/base/XianDangerousSource.ts 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 0000000000000000000000000000000000000000..1be757c1b5b8c9e0270bbe4bf6ff16301c8f17e9 GIT binary patch literal 2416 zcmY*bdpHw%AK%0<=D1Yua_P8bW|OknTqn)l$R)XKHq2$4*|L~BQRqTcD5R)Ps6&xl z63IbI>FDB;ONnJWsI3rZ&f9a|_xAfYrbN004qJh{cPn z;g(2&L^^+?C01mB@pvbDK>d)$yeJTluyeBm0PdWYStm${VrlxpfOr5vu6s*>PiWUk zq60Y;AAhF5n=2}e7Hdi%(THSI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w>Ph`PV*%Q8d^yAd#Z~B>4=>#H zF89puBVC@h2T%0ZsII=T9;>Hj{c6yztpEfg`jz*T9G#me-P@8&kpK?u3mkQXER_Q9 zG|4Uh#-vY_j?Xm0xoWbF>mft1m)2!~)O!|4(**J<#^AM#8Rous2?nw$K$UC80Vd6y zQ;arsyR;!oZc*H2;gw$Ws2TXfxx-3NTixGIb=@PR$ZPpY@9>C&C%W#^8gE++*rRAS zJN7;gp<8L$c0- z7ztnvIQ@Z1kf*IED^zz!PCj8_Kp@cdhKBuF@@3uk`>Tj{MjtkKJYEq50@+=JGa0Z4 zr}u?FhvwNCW&L@f2B&+rvZ^Y5Vq!u|r$=e($Oq4*?b|f0j+&G>U%R(WxZ06=iBf9x z?%rAamAk#HAjbV8y=M9G_+M4`{sw)BO4|Sc literal 0 HcmV?d00001 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', }