Files
xian_vue_new/src/stores/useLoadingInformation.ts
T

240 lines
6.1 KiB
TypeScript
Raw Normal View History

import type { ClickObject } from '@/types/cesium/ClickObject';
import { defineStore } from 'pinia';
import { reactive } from 'vue';
2026-04-11 18:58:43 +08:00
/**
* 加载信息弹窗相关状态管理
* @returns 点击对象、隐患点/风险点/医院状态及相关方法
2026-04-11 18:58:43 +08:00
*/
export const useLoadingInformationStore = defineStore(
'loadingInformation',
() => {
// ============================ 点击对象状态 ================================
/**
* 点击的对象
*/
const clickObject = reactive<ClickObject>({ id: '', primitive: null });
// ============================ 隐患点加载状态 ================================
2026-04-11 18:58:43 +08:00
// ============================ 风险点加载状态 ================================
2026-04-11 18:58:43 +08:00
/**
* 风险点加载信息状态
*/
const riskPoint = reactive({
/** 加载状态 */
loading: false,
/** 风险点ID */
id: -1,
});
// ============================ 医院加载状态 ================================
/**
* 医院加载信息状态
*/
const hospital = reactive({
/** 加载状态 */
loading: false,
/** 医院ID */
id: -1,
});
2026-04-11 18:58:43 +08:00
2026-04-18 19:03:06 +08:00
// ============================== 危险源加载状态 ================================
const dangerousSource = reactive({
/** 加载状态 */
loading: false,
/** 危险源ID */
id: -1,
});
2026-04-18 20:10:54 +08:00
// ============================== 避难所状态 ================================
const emergencyShelter = reactive({
/** 加载状态 */
loading: false,
/** 避难所ID */
id: -1,
});
2026-04-18 20:48:01 +08:00
// ============================== 消防站状态 ================================
const fireStation = reactive({
/** 加载状态 */
loading: false,
/** 消防站ID */
id: -1,
});
2026-04-18 22:35:49 +08:00
// ============================== 物资储备点状态 ================================
const storePoints = reactive({
/** 加载状态 */
loading: false,
/** 物资储备点ID */
id: -1,
});
2026-04-21 20:56:25 +08:00
// ============================== 学校状态 ================================
const school = reactive({
/** 加载状态 */
loading: false,
/** 学校ID */
id: -1,
});
2026-04-27 14:14:39 +08:00
// ============================== 桥梁状态 ================================
const bridge = reactive({
/** 加载状态 */
loading: false,
/** 桥梁ID */
id: -1,
});
2026-04-27 14:51:50 +08:00
// ============================== 水库状态 ================================
const reservoir = reactive({
/** 加载状态 */
loading: false,
/** 水库ID */
id: -1,
});
2026-04-27 15:04:59 +08:00
// ============================== 地铁站点状态 ================================
const subwayStation = reactive({
/** 加载状态 */
loading: false,
/** 地铁站点ID */
id: -1,
});
2026-04-28 10:05:49 +08:00
// ============================== 滑坡隐患点状态 ================================
const landslideHiddenPoint = reactive({
/** 加载状态 */
loading: false,
/** 滑坡隐患点ID */
id: -1,
});
2026-06-16 10:19:02 +08:00
// ============================== 崩塌隐患点状态 ================================
const collapseHiddenPoint = reactive({
/** 加载状态 */
loading: false,
/** 崩塌隐患点ID */
id: -1,
});
2026-04-28 10:05:49 +08:00
// ============================== 泥石流隐患点状态 ================================
const debrisFlowHiddenPoint = reactive({
/** 加载状态 */
loading: false,
/** 泥石流隐患点ID */
id: -1,
});
// ============================== 内涝隐患点状态 ================================
const waterLoggingHiddenPoint = reactive({
/** 加载状态 */
loading: false,
/** 内涝隐患点ID */
id: -1,
});
// ============================== 山洪隐患点状态 ================================
const flashFloodHiddenPoint = reactive({
/** 加载状态 */
loading: false,
/** 山洪隐患点ID */
id: -1,
});
/**
* 重置所有状态
*/
2026-04-11 18:58:43 +08:00
const resetStatue = () => {
// 点击对象重置
clickObject.id = '';
clickObject.primitive = null;
2026-04-11 18:58:43 +08:00
// 风险点状态重置
riskPoint.loading = false;
riskPoint.id = -1;
// 医院状态重置
hospital.loading = false;
hospital.id = -1;
2026-04-18 19:03:06 +08:00
// 危险源状态重置
dangerousSource.loading = false;
dangerousSource.id = -1;
2026-04-18 20:10:54 +08:00
// 避难所状态重置
emergencyShelter.loading = false;
emergencyShelter.id = -1;
2026-04-18 20:48:01 +08:00
// 消防站状态重置
fireStation.loading = false;
fireStation.id = -1;
2026-04-18 22:35:49 +08:00
// 物资储备点状态重置
storePoints.loading = false;
storePoints.id = -1;
2026-04-21 20:56:25 +08:00
// 学校状态重置
school.loading = false;
school.id = -1;
2026-04-27 14:14:39 +08:00
// 桥梁状态重置
bridge.loading = false;
bridge.id = -1;
2026-04-27 14:51:50 +08:00
// 水库状态重置
reservoir.loading = false;
reservoir.id = -1;
2026-04-27 15:04:59 +08:00
// 地铁站点状态重置
subwayStation.loading = false;
subwayStation.id = -1;
2026-04-28 10:05:49 +08:00
// 滑坡隐患点状态重置
landslideHiddenPoint.loading = false;
landslideHiddenPoint.id = -1;
2026-06-16 10:19:02 +08:00
// 崩塌隐患点状态重置
collapseHiddenPoint.loading = false;
collapseHiddenPoint.id = -1;
2026-04-28 10:05:49 +08:00
// 泥石流隐患点状态重置
debrisFlowHiddenPoint.loading = false;
debrisFlowHiddenPoint.id = -1;
// 内涝隐患点状态重置
waterLoggingHiddenPoint.loading = false;
waterLoggingHiddenPoint.id = -1;
// 山洪隐患点状态重置
flashFloodHiddenPoint.loading = false;
flashFloodHiddenPoint.id = -1;
};
2026-04-11 18:58:43 +08:00
return {
clickObject,
riskPoint,
hospital,
2026-04-18 19:03:06 +08:00
dangerousSource,
2026-04-18 20:10:54 +08:00
emergencyShelter,
2026-04-18 20:48:01 +08:00
fireStation,
2026-04-18 22:35:49 +08:00
storePoints,
2026-04-21 20:56:25 +08:00
school,
2026-04-27 14:14:39 +08:00
bridge,
2026-04-27 14:51:50 +08:00
reservoir,
2026-04-27 15:04:59 +08:00
subwayStation,
2026-04-28 10:05:49 +08:00
landslideHiddenPoint,
2026-06-16 10:19:02 +08:00
collapseHiddenPoint,
2026-04-28 10:05:49 +08:00
debrisFlowHiddenPoint,
waterLoggingHiddenPoint,
flashFloodHiddenPoint,
resetStatue,
2026-04-27 14:14:39 +08:00
};
}
);