From d71112e1d37abbc1bfa275c6257ed7914c461fc8 Mon Sep 17 00:00:00 2001 From: wzy-warehouse <18135009705@163.com> Date: Tue, 21 Apr 2026 15:49:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=8F=A3=E7=BD=91=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 7 ++- .env.production | 8 ++- env.d.ts | 53 ++++++++++--------- src/component/map/MapComponent.vue | 9 +--- .../ControlShowDetailComponent.vue | 9 ++++ .../rain-earthquake/LoadingGeoserverLayer.vue | 48 +++++++++++++++++ .../PopulationGridComponent.vue | 38 +++++++++++++ .../earthquake/useEarthquakeDisasterChain.ts | 4 +- src/hooks/map/useMap.ts | 1 + src/hooks/rainstorm/useRainDisasterChain.ts | 4 +- src/hooks/useLayerControl.ts | 9 ++++ src/types/cesium/LayerConfig.ts | 2 +- 12 files changed, 149 insertions(+), 43 deletions(-) create mode 100644 src/component/rain-earthquake/LoadingGeoserverLayer.vue create mode 100644 src/component/rain-earthquake/PopulationGridComponent.vue diff --git a/.env.development b/.env.development index 4d67a05..4efbfb0 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,10 @@ NEW_FILE_CODE +# 后端地址 VITE_BACKEND_BASE_URL=http://localhost:8081 -START_PORT=81 \ No newline at end of file +# 启动端口 +START_PORT=81 + +# geoserver地址 +VITE_GEOSERVER_BASE_URL=http://47.92.216.173:4019/geoserver/xian \ No newline at end of file diff --git a/.env.production b/.env.production index 0bcd24d..4e01127 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,10 @@ NEW_FILE_CODE + +# 后端地址 VITE_BACKEND_BASE_URL=http://localhost:8080 -START_PORT=80 \ No newline at end of file +# 启动端口 +START_PORT=80 + +# geoserver地址 +VITE_GEOSERVER_BASE_URL=http://10.22.245.246/geoserver/xian \ No newline at end of file diff --git a/env.d.ts b/env.d.ts index efb8d29..288cc92 100644 --- a/env.d.ts +++ b/env.d.ts @@ -1,60 +1,61 @@ -NEW_FILE_CODE +NEW_FILE_CODE; /// declare module '*.vue' { - import type { DefineComponent } from 'vue' - const component: DefineComponent<{}, {}, any> - export default component + import type { DefineComponent } from 'vue'; + const component: DefineComponent<{}, {}, any>; + export default component; } // 声明环境变量类型 interface ImportMetaEnv { - readonly VITE_BACKEND_BASE_URL: string - readonly START_PORT: number - readonly MODE: string - readonly DEV: boolean - readonly PROD: boolean - readonly SSR: boolean + readonly VITE_BACKEND_BASE_URL: string; + readonly START_PORT: number; + readonly VITE_GEOSERVER_BASE_URL: string; + readonly MODE: string; + readonly DEV: boolean; + readonly PROD: boolean; + readonly SSR: boolean; } interface ImportMeta { - readonly env: ImportMetaEnv, - readonly glob + readonly env: ImportMetaEnv; + readonly glob; } // 声明 CSS 模块类型 declare module '*.css' { - const content: Record - export default content + const content: Record; + export default content; } // 声明静态资源类型 declare module '*.svg' { - const content: string - export default content + const content: string; + export default content; } declare module '*.png' { - const content: string - export default content + const content: string; + export default content; } declare module '*.jpg' { - const content: string - export default content + const content: string; + export default content; } declare module '*.jpeg' { - const content: string - export default content + const content: string; + export default content; } declare module '*.gif' { - const content: string - export default content + const content: string; + export default content; } declare module '*.webp' { - const content: string - export default content + const content: string; + export default content; } diff --git a/src/component/map/MapComponent.vue b/src/component/map/MapComponent.vue index c99c689..08b5029 100644 --- a/src/component/map/MapComponent.vue +++ b/src/component/map/MapComponent.vue @@ -19,7 +19,7 @@ import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils'; import { xiAn } from '@/assets'; - import { Color, UrlTemplateImageryProvider } from 'cesium'; + import { Color } from 'cesium'; import type { GeoJsonFileType } from '@/types/cesium/GeoJsonFileType'; import config from '@/config/config.json'; import { useMap } from '@/hooks/map/useMap'; @@ -65,13 +65,6 @@ CesiumUtilsSingleton.viewToTarget( config.defaultPosition as [number, number, number] ); - - const mvtProvider = new UrlTemplateImageryProvider({ - url: 'http://localhost:8081/people/{z}/{x}/{y}.mvt', - }); - CesiumUtilsSingleton.getViewer()!.imageryLayers.addImageryProvider( - mvtProvider - ); }); diff --git a/src/component/rain-earthquake/ControlShowDetailComponent.vue b/src/component/rain-earthquake/ControlShowDetailComponent.vue index 9aac60e..35f666f 100644 --- a/src/component/rain-earthquake/ControlShowDetailComponent.vue +++ b/src/component/rain-earthquake/ControlShowDetailComponent.vue @@ -38,6 +38,14 @@ useStatusStore().poiLayers.showReservePoint.loading " /> + + + diff --git a/src/component/rain-earthquake/LoadingGeoserverLayer.vue b/src/component/rain-earthquake/LoadingGeoserverLayer.vue new file mode 100644 index 0000000..df513f1 --- /dev/null +++ b/src/component/rain-earthquake/LoadingGeoserverLayer.vue @@ -0,0 +1,48 @@ + + + + + + diff --git a/src/component/rain-earthquake/PopulationGridComponent.vue b/src/component/rain-earthquake/PopulationGridComponent.vue new file mode 100644 index 0000000..ddd861e --- /dev/null +++ b/src/component/rain-earthquake/PopulationGridComponent.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 9665e27..9e7cd6d 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -225,9 +225,7 @@ export const useEarthquakeDisasterChain = () => { name: '显示人口网格', statusStore: statusStore.poiLayers, statusKey: 'showPopulationGrid' as const, - callback: (status: unknown) => { - console.log('显示人口网格', status); - }, + callback: layerControl.clickPopulationGrid, }, { name: '显示管网系统', diff --git a/src/hooks/map/useMap.ts b/src/hooks/map/useMap.ts index 3c43699..a6f34a6 100644 --- a/src/hooks/map/useMap.ts +++ b/src/hooks/map/useMap.ts @@ -80,6 +80,7 @@ export const useMap = () => { useLoadingInformationStore().resetStatue(); } } else { + console.log(pickedObject); // 重置状态 useLoadingInformationStore().resetStatue(); } diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 3d2981c..211258c 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -255,9 +255,7 @@ export const useRainDisasterChain = () => { name: '显示人口网格', statusStore: statusStore.poiLayers, statusKey: 'showPopulationGrid' as const, - callback: (status: unknown) => { - console.log('显示人口网格', status); - }, + callback: layerControl.clickPopulationGrid, }, { name: '显示管网系统', diff --git a/src/hooks/useLayerControl.ts b/src/hooks/useLayerControl.ts index 11ffa8b..dec08d3 100644 --- a/src/hooks/useLayerControl.ts +++ b/src/hooks/useLayerControl.ts @@ -53,6 +53,14 @@ export const useLayerControl = () => { useStatusStore().poiLayers.showReservePoint.loading = true; }; + /** + * 点击显示人口网格 + */ + const clickPopulationGrid = () => { + // 加载状态为true + useStatusStore().poiLayers.showPopulationGrid.loading = true; + }; + return { clickHiddenDangerPoint, clickHospital, @@ -60,5 +68,6 @@ export const useLayerControl = () => { clickEmergencyShelter, clickFireStation, clickStorePoints, + clickPopulationGrid, }; }; diff --git a/src/types/cesium/LayerConfig.ts b/src/types/cesium/LayerConfig.ts index 95e19ec..8bbc485 100644 --- a/src/types/cesium/LayerConfig.ts +++ b/src/types/cesium/LayerConfig.ts @@ -27,5 +27,5 @@ export interface LayerConfig { credit?: string; /** 图层参数 */ - parameters?: Record; + parameters?: Record; }