Files
xian_vue_new/src/hooks/rain-earthquake/useLayerControl.ts
T

229 lines
5.0 KiB
TypeScript
Raw Normal View History

2026-05-06 17:44:30 +08:00
import { useLeftLegendStore } from '@/stores/useLeftLegendStore';
import { useStatusStore } from '@/stores/useStatusStore.ts';
2026-04-16 09:09:00 +08:00
/**
* 控制面板显示隐藏逻辑
*/
export const useLayerControl = () => {
/**
* 点击显示医院
*/
2026-04-18 17:34:46 +08:00
const clickHospital = () => {
// 加载状态为true
useStatusStore().poiLayers.showHospital.loading = true;
};
2026-04-18 19:03:06 +08:00
/**
* 点击显示危险源
*/
const clickDangerousSource = () => {
// 加载状态为true
useStatusStore().poiLayers.showDangerSource.loading = true;
};
2026-04-18 20:10:54 +08:00
/**
* 点击显示避难所
*/
const clickEmergencyShelter = () => {
// 加载状态为true
useStatusStore().poiLayers.showRefugeeShelter.loading = true;
};
2026-04-18 20:48:01 +08:00
/**
* 点击显示消防站
*/
const clickFireStation = () => {
// 加载状态为true
useStatusStore().poiLayers.showFireStation.loading = true;
};
2026-04-18 22:35:49 +08:00
/**
* 点击显示物资储备点
*/
const clickStorePoints = () => {
// 加载状态为true
useStatusStore().poiLayers.showReservePoint.loading = true;
};
2026-04-21 20:56:25 +08:00
/**
* 点击显示学校
*/
const clickSchool = () => {
// 加载状态为true
useStatusStore().poiLayers.showSchool.loading = true;
};
2026-04-21 15:49:56 +08:00
/**
* 点击显示人口网格
*/
const clickPopulationGrid = () => {
// 加载状态为true
useStatusStore().poiLayers.showPopulationGrid.loading = true;
2026-05-06 17:44:30 +08:00
if (useStatusStore().poiLayers.showPopulationGrid.show) {
// 显示图例
useStatusStore().uiComponents.leftLegend.loading = true;
useStatusStore().uiComponents.leftLegend.show = true;
useLeftLegendStore().legendListInfo.title = '人口密度图例';
useLeftLegendStore().legendListInfo.list = [
{
label: 'Min-0 < 100',
color: '#b1fe02',
},
{
label: '100 ≤ X < 500',
color: '#6bf700',
},
{
label: '500 ≤ X < 1000',
color: '#fcf600',
},
{
label: '1000 ≤ X < 2000',
color: '#fecb02',
},
{
label: '2000 ≤ X < 4000',
color: '#fc9e00',
},
{
label: '4000 ≤ X < 8000',
color: '#fe7004',
},
{
label: '8000 ≤ X < 10000',
color: '#fb3f02',
},
{
label: '10000 ≤ X < Max',
color: '#ff0000',
},
];
} else {
// 隐藏图例
useStatusStore().uiComponents.leftLegend.show = false;
}
2026-04-21 15:49:56 +08:00
};
2026-04-21 16:05:26 +08:00
/**
* 显示管网
*/
const clickWaterPipe = () => {
useStatusStore().infrastructureLayers.showNetworkSystem.loading = true;
};
2026-04-24 20:41:41 +08:00
/**
* 显示交通道路
*/
const clickTrafficRoad = () => {
useStatusStore().infrastructureLayers.showTrafficRoad.loading = true;
};
2026-04-25 21:05:59 +08:00
/**
* 显示高速
*/
const clickHighway = () => {
useStatusStore().infrastructureLayers.showHighway.loading = true;
};
/**
* 显示国道
*/
const clickNationRoad = () => {
useStatusStore().infrastructureLayers.showMainRoad.loading = true;
};
2026-04-27 14:14:39 +08:00
/**
* 显示桥梁
*/
const clickBridge = () => {
useStatusStore().infrastructureLayers.showBridge.loading = true;
};
2026-04-25 21:05:59 +08:00
2026-04-27 14:51:50 +08:00
/**
* 显示水库
*/
const clickReservoir = () => {
useStatusStore().infrastructureLayers.showReservoir.loading = true;
};
2026-04-27 15:04:59 +08:00
/**
* 显示地铁站点
*/
const clickSubwayStation = () => {
useStatusStore().poiLayers.showSubwayStation.loading = true;
};
2026-04-28 10:05:49 +08:00
/**
* 显示滑坡隐患点
*/
const clickLandslideHiddenPoint = () => {
useStatusStore().poiLayers.showLandslideHiddenPoint.loading = true;
};
/**
* 显示泥石流隐患点
*/
const clickDebrisFlowHiddenPoint = () => {
useStatusStore().poiLayers.showDebrisFlowHiddenPoint.loading = true;
};
/**
* 显示内涝隐患点
*/
const clickWaterLoggingHiddenPoint = () => {
useStatusStore().poiLayers.showWaterLoggingHiddenPoint.loading = true;
};
/**
* 显示山洪隐患点
*/
const clickFlashFloodHiddenPoint = () => {
useStatusStore().poiLayers.showFlashFloodHiddenPoint.loading = true;
};
/**
* 显示风险点
*/
const clickRiskPoint = () => {
useStatusStore().mapLayers.riskPointShow.loading = true;
};
2026-05-04 21:46:36 +08:00
/**
* 显示断裂带
*/
const clickFault = () => {
useStatusStore().mapLayers.faultShow.loading = true;
};
/**
* 显示降雨栅格
*/
const clickRainfallGrid = () => {
useStatusStore().weatherLayers.showRainfallGrid.loading = true;
};
2026-04-18 20:10:54 +08:00
return {
2026-04-28 10:05:49 +08:00
clickRiskPoint,
2026-05-04 21:46:36 +08:00
clickFault,
2026-04-18 20:10:54 +08:00
clickHospital,
clickDangerousSource,
clickEmergencyShelter,
2026-04-18 20:48:01 +08:00
clickFireStation,
2026-04-18 22:35:49 +08:00
clickStorePoints,
2026-04-21 20:56:25 +08:00
clickSchool,
2026-04-21 15:49:56 +08:00
clickPopulationGrid,
2026-04-21 16:05:26 +08:00
clickWaterPipe,
2026-04-25 21:05:59 +08:00
clickTrafficRoad,
clickHighway,
2026-04-27 14:14:39 +08:00
clickNationRoad,
clickBridge,
2026-04-27 14:51:50 +08:00
clickReservoir,
2026-04-27 15:04:59 +08:00
clickSubwayStation,
2026-04-28 10:05:49 +08:00
clickLandslideHiddenPoint,
clickDebrisFlowHiddenPoint,
clickWaterLoggingHiddenPoint,
clickFlashFloodHiddenPoint,
clickRainfallGrid,
2026-04-18 20:10:54 +08:00
};
2026-04-16 09:09:00 +08:00
};