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, }; });