添加降雨服务器配置

This commit is contained in:
wzy-warehouse
2026-05-05 17:09:32 +08:00
parent 4982152f0c
commit 96c2cf1e21
8 changed files with 120 additions and 15 deletions
+15
View File
@@ -55,6 +55,9 @@ import type { XianSchool } from '@/types/base/XianSchool';
import type { XianBridge } from '@/types/base/XianBridge.ts'; import type { XianBridge } from '@/types/base/XianBridge.ts';
import type { XianReservoirList } from '@/types/base/XianReservoirList'; import type { XianReservoirList } from '@/types/base/XianReservoirList';
import type { XianSubwayStations } from '@/types/base/XianSubwayStations'; import type { XianSubwayStations } from '@/types/base/XianSubwayStations';
import type { RainfallGridRequest } from '@/types/rainstorm/RainfallGridRequest';
import type { RainfallGridResponse } from '@/types/rainstorm/RainfallGridResponse';
import { getRainfallGrid } from './meteorology';
/** /**
* API接口统一导出对象 * API接口统一导出对象
@@ -277,4 +280,16 @@ export const $api = {
): Promise<ApiResponse<XianSubwayStations>> => ): Promise<ApiResponse<XianSubwayStations>> =>
getSubwayStationsPointDetailById(id), getSubwayStationsPointDetailById(id),
}, },
// 气象信息
meteorology: {
/**
* 获取网格天气信息
* @param request - 请求参数
* @returns 网格天气信息
*/
getRainfallGrid: (
request: RainfallGridRequest
): Promise<ApiResponse<RainfallGridResponse>> => getRainfallGrid(request),
},
}; };
+14
View File
@@ -0,0 +1,14 @@
import type { ApiResponse } from '@/types/ApiResponse';
import type { RainfallGridRequest } from '@/types/rainstorm/RainfallGridRequest';
import type { RainfallGridResponse } from '@/types/rainstorm/RainfallGridResponse';
import httpInstance from '@/utils/request/http';
/**
* 获取降雨栅格数据
* @returns 降雨栅格数据
*/
export const getRainfallGrid = (
request: RainfallGridRequest
): Promise<ApiResponse<RainfallGridResponse>> => {
return httpInstance.post('/algorithm-api/rainfall/grid', request);
};
@@ -47,7 +47,7 @@
// 如果找到了选中的按钮,设置选中状态,同时执行回调函数 // 如果找到了选中的按钮,设置选中状态,同时执行回调函数
if (lastSelectedIndex !== -1) { if (lastSelectedIndex !== -1) {
useButtonSelectedIdStore().rightButtonSelectedId = lastSelectedIndex; useButtonSelectedIdStore().rightButtonSelectedId = lastSelectedIndex;
props.buttonList[lastSelectedIndex].callback(); props.buttonList[lastSelectedIndex].callback(true);
} }
}); });
+2 -1
View File
@@ -2,7 +2,8 @@
"backendBaseUrl": "__BACKEND_BASE_URL__", "backendBaseUrl": "__BACKEND_BASE_URL__",
"apiBaseUrl": "/api", "apiBaseUrl": "/api",
"noEncryptUrls": [ "noEncryptUrls": [
"/crypto/sm2/public-key" "/crypto/sm2/public-key",
"/algorithm-api/rainfall/grid"
], ],
"tdMapToken": [ "tdMapToken": [
"fc6cb1139b8eed4f79439130eb34eb00", "fc6cb1139b8eed4f79439130eb34eb00",
+20 -1
View File
@@ -2,8 +2,27 @@ import { useStatusStore } from '@/stores/useStatusStore.ts';
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts'; import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts';
import config from '@/config/config.json'; import config from '@/config/config.json';
import { useButtonSelectedIdStore } from '@/stores/useButtonSelectedIdStore'; import { useButtonSelectedIdStore } from '@/stores/useButtonSelectedIdStore';
import { $api } from '@/api/api';
export const useRightHandle = () => { export const useRightHandle = () => {
/**
* 暴雨模拟
* @param status - 状态
*/
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);
});
}
};
/** /**
* 重置场景 * 重置场景
*/ */
@@ -22,5 +41,5 @@ export const useRightHandle = () => {
); );
}; };
return { resetScene, resetView }; return { rainstormSimulation, resetScene, resetView };
}; };
+28 -12
View File
@@ -166,9 +166,8 @@ export const useRainDisasterChain = () => {
const rightButtonInfo = [ const rightButtonInfo = [
{ {
name: '暴雨模拟', name: '暴雨模拟',
callback: () => { callback: (status: unknown) =>
console.log('暴雨模拟'); useRightHandle().rainstormSimulation(status),
},
selected: true, selected: true,
}, },
{ {
@@ -222,7 +221,10 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickLandslideHiddenPoint, callback: layerControl.clickLandslideHiddenPoint,
link: landslideIcon, link: landslideIcon,
category: ControlPanelCategory.DISASTER_HAZARD, category: ControlPanelCategory.DISASTER_HAZARD,
count: () => resourceStore.getResourceCount(LoadingResource.LANDSLIDE_HIDDEN_POINT), count: () =>
resourceStore.getResourceCount(
LoadingResource.LANDSLIDE_HIDDEN_POINT
),
}, },
{ {
name: '泥石流隐患点', name: '泥石流隐患点',
@@ -231,7 +233,10 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickDebrisFlowHiddenPoint, callback: layerControl.clickDebrisFlowHiddenPoint,
link: debrisFlowIcon, link: debrisFlowIcon,
category: ControlPanelCategory.DISASTER_HAZARD, category: ControlPanelCategory.DISASTER_HAZARD,
count: () => resourceStore.getResourceCount(LoadingResource.DEBRIS_FLOW_HIDDEN_POINT), count: () =>
resourceStore.getResourceCount(
LoadingResource.DEBRIS_FLOW_HIDDEN_POINT
),
}, },
{ {
name: '内涝隐患点', name: '内涝隐患点',
@@ -240,7 +245,10 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickWaterLoggingHiddenPoint, callback: layerControl.clickWaterLoggingHiddenPoint,
link: waterLoggingIcon, link: waterLoggingIcon,
category: ControlPanelCategory.DISASTER_HAZARD, category: ControlPanelCategory.DISASTER_HAZARD,
count: () => resourceStore.getResourceCount(LoadingResource.WATER_LOGGING_HIDDEN_POINT), count: () =>
resourceStore.getResourceCount(
LoadingResource.WATER_LOGGING_HIDDEN_POINT
),
}, },
{ {
name: '山洪隐患点', name: '山洪隐患点',
@@ -249,7 +257,10 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickFlashFloodHiddenPoint, callback: layerControl.clickFlashFloodHiddenPoint,
link: flashFloodIcon, link: flashFloodIcon,
category: ControlPanelCategory.DISASTER_HAZARD, category: ControlPanelCategory.DISASTER_HAZARD,
count: () => resourceStore.getResourceCount(LoadingResource.FLASH_FLOOD_HIDDEN_POINT), count: () =>
resourceStore.getResourceCount(
LoadingResource.FLASH_FLOOD_HIDDEN_POINT
),
}, },
{ {
name: '风险点', name: '风险点',
@@ -277,7 +288,8 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickDangerousSource, callback: layerControl.clickDangerousSource,
link: dangerousSourceIcon, link: dangerousSourceIcon,
category: ControlPanelCategory.INFRASTRUCTURE, category: ControlPanelCategory.INFRASTRUCTURE,
count: () => resourceStore.getResourceCount(LoadingResource.DANGEROUS_SOURCE), count: () =>
resourceStore.getResourceCount(LoadingResource.DANGEROUS_SOURCE),
}, },
{ {
name: '避难所', name: '避难所',
@@ -286,7 +298,8 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickEmergencyShelter, callback: layerControl.clickEmergencyShelter,
link: emergencyShelterIcon, link: emergencyShelterIcon,
category: ControlPanelCategory.INFRASTRUCTURE, category: ControlPanelCategory.INFRASTRUCTURE,
count: () => resourceStore.getResourceCount(LoadingResource.EMERGENCY_SHELTER), count: () =>
resourceStore.getResourceCount(LoadingResource.EMERGENCY_SHELTER),
}, },
{ {
name: '消防站', name: '消防站',
@@ -295,7 +308,8 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickFireStation, callback: layerControl.clickFireStation,
link: firefighterIcon, link: firefighterIcon,
category: ControlPanelCategory.INFRASTRUCTURE, category: ControlPanelCategory.INFRASTRUCTURE,
count: () => resourceStore.getResourceCount(LoadingResource.FIRE_STATION), count: () =>
resourceStore.getResourceCount(LoadingResource.FIRE_STATION),
}, },
{ {
name: '储备点', name: '储备点',
@@ -304,7 +318,8 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickStorePoints, callback: layerControl.clickStorePoints,
link: storePointsIcon, link: storePointsIcon,
category: ControlPanelCategory.INFRASTRUCTURE, category: ControlPanelCategory.INFRASTRUCTURE,
count: () => resourceStore.getResourceCount(LoadingResource.STORE_POINTS), count: () =>
resourceStore.getResourceCount(LoadingResource.STORE_POINTS),
}, },
{ {
name: '学校', name: '学校',
@@ -340,7 +355,8 @@ export const useRainDisasterChain = () => {
callback: layerControl.clickSubwayStation, callback: layerControl.clickSubwayStation,
link: subwayIcon, link: subwayIcon,
category: ControlPanelCategory.INFRASTRUCTURE, category: ControlPanelCategory.INFRASTRUCTURE,
count: () => resourceStore.getResourceCount(LoadingResource.SUBWAY_STATION), count: () =>
resourceStore.getResourceCount(LoadingResource.SUBWAY_STATION),
}, },
{ {
name: '人口网格', name: '人口网格',
@@ -0,0 +1,10 @@
export interface RainfallGridRequest {
// 开始时间,默认为当前时间
startTime?: string;
// 结束时间,默认为当前时间
endTime?: string;
// 区域id,默认为1
districtId?: number;
// 分辨率,默认为0.01,最小为0,最大为1
resolution?: number;
}
@@ -0,0 +1,30 @@
interface RainfallFeature {
type: 'Feature';
geometry: {
type: 'Polygon';
coordinates: number[][][];
};
properties: {
rainfall: number;
color: string;
};
}
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;
};
};
} | null;
}