From b3ba81dfe2f0c1fe2fc9f50c7480de3f1afd7340 Mon Sep 17 00:00:00 2001 From: wzy-warehouse <18135009705@163.com> Date: Thu, 16 Apr 2026 09:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/map/MapComponent.vue | 4 ++-- src/stores/useStatusStore.ts | 36 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/component/map/MapComponent.vue b/src/component/map/MapComponent.vue index 3d72875..7d8cdfb 100644 --- a/src/component/map/MapComponent.vue +++ b/src/component/map/MapComponent.vue @@ -20,8 +20,8 @@ import { useMap } from '@/hooks/map/useMap'; onBeforeMount(() => { - // 初始化为false - useStatusStore().appLoadingCompleted = false; + // 重置所有状态 + useStatusStore().reset(); // 重置状态 useLoadingInformationStore().resetStatue(); diff --git a/src/stores/useStatusStore.ts b/src/stores/useStatusStore.ts index 3e3fb72..e40f72f 100644 --- a/src/stores/useStatusStore.ts +++ b/src/stores/useStatusStore.ts @@ -79,11 +79,47 @@ export const useStatusStore = defineStore('status', () => { showReservoir: false, }); + /** + * 恢复默认值 + */ + const reset = () => { + // 应用加载状态重置 + appLoadingCompleted.value = false; + + // UI 组件显示状态重置 + uiComponents.legendShow = true; + uiComponents.disasterChainPointShow = false; + + // 地图基础图层显示状态重置 + mapLayers.showAdministrativeDivision = true; + mapLayers.hiddenDangerPointShow = true; + mapLayers.riskPointShow = true; + + // POI图层显示状态重置 + poiLayers.showHospital = false; + poiLayers.showDangerSource = false; + poiLayers.showRefugeeShelter = false; + poiLayers.showFireStation = false; + poiLayers.showReservePoint = false; + poiLayers.showSchool = false; + poiLayers.showPopulationGrid = false; + poiLayers.showSubwayStation = false; + + // 基础设施图层显示状态重置 + infrastructureLayers.showNetworkSystem = false; + infrastructureLayers.showTrafficRoad = false; + infrastructureLayers.showBridge = false; + infrastructureLayers.showHighway = false; + infrastructureLayers.showMainRoad = false; + infrastructureLayers.showReservoir = false; + }; + return { appLoadingCompleted, uiComponents, mapLayers, poiLayers, infrastructureLayers, + reset, }; });