diff --git a/src/component/rain-earthquake/BasicComponent.vue b/src/component/rain-earthquake/BasicComponent.vue index 3cfb592..23aca90 100644 --- a/src/component/rain-earthquake/BasicComponent.vue +++ b/src/component/rain-earthquake/BasicComponent.vue @@ -65,6 +65,14 @@ useStatusStore().mapLayers.riskPointShow.loading " /> + + + @@ -76,6 +84,7 @@ import DebrisFlowComponent from '@/component/rain-earthquake/basic/DebrisFlowComponent.vue'; import WaterLoggingComponent from '@/component/rain-earthquake/basic/WaterLoggingComponent.vue'; import FlashFloodComponent from '@/component/rain-earthquake/basic/FlashFloodComponent.vue'; + import RainfallGridComponent from '@/component/rain-earthquake/detail-panels/RainfallGridComponent.vue'; import { useStatusStore } from '@/stores/useStatusStore'; // 获取父组件传递德数据 diff --git a/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue b/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue new file mode 100644 index 0000000..8212f38 --- /dev/null +++ b/src/component/rain-earthquake/detail-panels/RainfallGridComponent.vue @@ -0,0 +1,200 @@ + + + + + + diff --git a/src/hooks/rain-earthquake/useLayerControl.ts b/src/hooks/rain-earthquake/useLayerControl.ts index 5ead64a..9887f25 100644 --- a/src/hooks/rain-earthquake/useLayerControl.ts +++ b/src/hooks/rain-earthquake/useLayerControl.ts @@ -149,6 +149,13 @@ export const useLayerControl = () => { useStatusStore().mapLayers.faultShow.loading = true; }; + /** + * 显示降雨栅格 + */ + const clickRainfallGrid = () => { + useStatusStore().weatherLayers.showRainfallGrid.loading = true; + }; + return { clickRiskPoint, clickFault, @@ -170,5 +177,6 @@ export const useLayerControl = () => { clickDebrisFlowHiddenPoint, clickWaterLoggingHiddenPoint, clickFlashFloodHiddenPoint, + clickRainfallGrid, }; }; diff --git a/src/hooks/rain-earthquake/useRightHandle.ts b/src/hooks/rain-earthquake/useRightHandle.ts index 042528a..f4b60f9 100644 --- a/src/hooks/rain-earthquake/useRightHandle.ts +++ b/src/hooks/rain-earthquake/useRightHandle.ts @@ -2,7 +2,6 @@ import { useStatusStore } from '@/stores/useStatusStore.ts'; import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts'; import config from '@/config/config.json'; import { useButtonSelectedIdStore } from '@/stores/useButtonSelectedIdStore'; -import { $api } from '@/api/api'; export const useRightHandle = () => { /** @@ -11,15 +10,12 @@ export const useRightHandle = () => { */ const rainstormSimulation = (status: unknown) => { if (status as boolean) { - // 获取降雨栅格 - $api.meteorology - .getRainfallGrid({ - startTime: '2025-08-20T00:00:00', - endTime: '2025-08-20T00:00:00', - }) - .then((res) => { - console.log(res); - }); + // 开启暴雨模拟:显示降雨栅格图层 + useStatusStore().weatherLayers.showRainfallGrid.loading = true; + useStatusStore().weatherLayers.showRainfallGrid.show = true; + } else { + // 关闭暴雨模拟:隐藏降雨栅格图层 + useStatusStore().weatherLayers.showRainfallGrid.show = false; } }; diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 3e3b7a0..dfced41 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -31,6 +31,11 @@ import { LoadingResource } from '@/types/common/LoadingResourceType.ts'; * @returns */ export const useRainDisasterChain = () => { + // 初始化暴雨模拟状态(因为右侧按钮默认选中) + const statusStore = useStatusStore(); + statusStore.weatherLayers.showRainfallGrid.loading = true; + statusStore.weatherLayers.showRainfallGrid.show = true; + // ================灾害链影响点列表================================ /** * 搜索条件 @@ -168,7 +173,6 @@ export const useRainDisasterChain = () => { name: '暴雨模拟', callback: (status: unknown) => useRightHandle().rainstormSimulation(status), - selected: true, }, { name: '暴雨触发', diff --git a/src/stores/useStatusStore.ts b/src/stores/useStatusStore.ts index d7250cf..8e4513f 100644 --- a/src/stores/useStatusStore.ts +++ b/src/stores/useStatusStore.ts @@ -168,6 +168,17 @@ export const useStatusStore = defineStore('status', () => { }, }); + /** + * 气象图层显示状态 + */ + const weatherLayers = reactive({ + /** 显示降雨栅格 */ + showRainfallGrid: { + show: false, + loading: true, + }, + }); + // ============================ 地图功能显示状态 ================================ const functionStatus = reactive({ aroundAnalysis: { @@ -294,6 +305,12 @@ export const useStatusStore = defineStore('status', () => { loading: false, }; + // 气象图层显示状态重置 + weatherLayers.showRainfallGrid = { + show: false, + loading: true, + }; + // 功能显示状态重置 functionStatus.aroundAnalysis = { show: false, @@ -307,6 +324,7 @@ export const useStatusStore = defineStore('status', () => { mapLayers, poiLayers, infrastructureLayers, + weatherLayers, functionStatus, reset, resetScene, diff --git a/src/types/rainstorm/RainfallGridRequest.ts b/src/types/rainstorm/RainfallGridRequest.ts index 233f248..82d5c45 100644 --- a/src/types/rainstorm/RainfallGridRequest.ts +++ b/src/types/rainstorm/RainfallGridRequest.ts @@ -1,10 +1,6 @@ export interface RainfallGridRequest { - // 开始时间,默认为当前时间 - startTime?: string; - // 结束时间,默认为当前时间 - endTime?: string; - // 区域id,默认为1 - districtId?: number; - // 分辨率,默认为0.01,最小为0,最大为1 + // 时间,默认为当前时间 + time?: string; + // 分辨率,默认为0.01,最小为0,最大为0.1 resolution?: number; } diff --git a/src/types/rainstorm/RainfallGridResponse.ts b/src/types/rainstorm/RainfallGridResponse.ts index 3c3bbd8..dc726b6 100644 --- a/src/types/rainstorm/RainfallGridResponse.ts +++ b/src/types/rainstorm/RainfallGridResponse.ts @@ -1,4 +1,4 @@ -interface RainfallFeature { +export interface RainfallFeature { type: 'Feature'; geometry: { type: 'Polygon'; @@ -11,20 +11,16 @@ interface RainfallFeature { } export interface RainfallGridResponse { - code: number; - message: string; - data: { - type: 'FeatureCollection'; - features: RainfallFeature[]; - metadata: { - resolution: number; - grid_size: number[]; - bounds: { - min_lon: number; - max_lon: number; - min_lat: number; - max_lat: number; - }; + type: 'FeatureCollection'; + features: RainfallFeature[]; + metadata: { + resolution: number; + grid_size: number[]; + bounds: { + min_lon: number; + max_lon: number; + min_lat: number; + max_lat: number; }; - } | null; + }; }