import type { ClickObject } from '@/types/cesium/ClickObject'; import { defineStore } from 'pinia'; import { reactive } from 'vue'; /** * 加载信息弹窗相关状态管理 * @returns 点击对象、隐患点/风险点/医院状态及相关方法 */ export const useLoadingInformationStore = defineStore( 'loadingInformation', () => { // ============================ 点击对象状态 ================================ /** * 点击的对象 */ const clickObject = reactive({ id: '', primitive: null }); // ============================ 隐患点加载状态 ================================ // ============================ 风险点加载状态 ================================ /** * 风险点加载信息状态 */ const riskPoint = reactive({ /** 加载状态 */ loading: false, /** 风险点ID */ id: -1, }); // ============================ 医院加载状态 ================================ /** * 医院加载信息状态 */ const hospital = reactive({ /** 加载状态 */ loading: false, /** 医院ID */ id: -1, }); // ============================== 危险源加载状态 ================================ const dangerousSource = reactive({ /** 加载状态 */ loading: false, /** 危险源ID */ id: -1, }); // ============================== 避难所状态 ================================ const emergencyShelter = reactive({ /** 加载状态 */ loading: false, /** 避难所ID */ id: -1, }); // ============================== 消防站状态 ================================ const fireStation = reactive({ /** 加载状态 */ loading: false, /** 消防站ID */ id: -1, }); // ============================== 物资储备点状态 ================================ const storePoints = reactive({ /** 加载状态 */ loading: false, /** 物资储备点ID */ id: -1, }); // ============================== 学校状态 ================================ const school = reactive({ /** 加载状态 */ loading: false, /** 学校ID */ id: -1, }); // ============================== 桥梁状态 ================================ const bridge = reactive({ /** 加载状态 */ loading: false, /** 桥梁ID */ id: -1, }); // ============================== 水库状态 ================================ const reservoir = reactive({ /** 加载状态 */ loading: false, /** 水库ID */ id: -1, }); // ============================== 地铁站点状态 ================================ const subwayStation = reactive({ /** 加载状态 */ loading: false, /** 地铁站点ID */ id: -1, }); // ============================== 滑坡隐患点状态 ================================ const landslideHiddenPoint = reactive({ /** 加载状态 */ loading: false, /** 滑坡隐患点ID */ id: -1, }); // ============================== 崩塌隐患点状态 ================================ const collapseHiddenPoint = reactive({ /** 加载状态 */ loading: false, /** 崩塌隐患点ID */ id: -1, }); // ============================== 泥石流隐患点状态 ================================ const debrisFlowHiddenPoint = reactive({ /** 加载状态 */ loading: false, /** 泥石流隐患点ID */ id: -1, }); // ============================== 内涝隐患点状态 ================================ const waterLoggingHiddenPoint = reactive({ /** 加载状态 */ loading: false, /** 内涝隐患点ID */ id: -1, }); // ============================== 山洪隐患点状态 ================================ const flashFloodHiddenPoint = reactive({ /** 加载状态 */ loading: false, /** 山洪隐患点ID */ id: -1, }); /** * 重置所有状态 */ const resetStatue = () => { // 点击对象重置 clickObject.id = ''; clickObject.primitive = null; // 风险点状态重置 riskPoint.loading = false; riskPoint.id = -1; // 医院状态重置 hospital.loading = false; hospital.id = -1; // 危险源状态重置 dangerousSource.loading = false; dangerousSource.id = -1; // 避难所状态重置 emergencyShelter.loading = false; emergencyShelter.id = -1; // 消防站状态重置 fireStation.loading = false; fireStation.id = -1; // 物资储备点状态重置 storePoints.loading = false; storePoints.id = -1; // 学校状态重置 school.loading = false; school.id = -1; // 桥梁状态重置 bridge.loading = false; bridge.id = -1; // 水库状态重置 reservoir.loading = false; reservoir.id = -1; // 地铁站点状态重置 subwayStation.loading = false; subwayStation.id = -1; // 滑坡隐患点状态重置 landslideHiddenPoint.loading = false; landslideHiddenPoint.id = -1; // 崩塌隐患点状态重置 collapseHiddenPoint.loading = false; collapseHiddenPoint.id = -1; // 泥石流隐患点状态重置 debrisFlowHiddenPoint.loading = false; debrisFlowHiddenPoint.id = -1; // 内涝隐患点状态重置 waterLoggingHiddenPoint.loading = false; waterLoggingHiddenPoint.id = -1; // 山洪隐患点状态重置 flashFloodHiddenPoint.loading = false; flashFloodHiddenPoint.id = -1; }; return { clickObject, riskPoint, hospital, dangerousSource, emergencyShelter, fireStation, storePoints, school, bridge, reservoir, subwayStation, landslideHiddenPoint, collapseHiddenPoint, debrisFlowHiddenPoint, waterLoggingHiddenPoint, flashFloodHiddenPoint, resetStatue, }; } );