- 优化 `车站-设备-告警` 轮询机制 - 改进设备卡片的布局 - 支持修改设备 - 告警轮询中获取完整告警数据 - 车站告警详情支持导出完整的 `今日告警列表` - 支持将状态持久化到 `IndexedDB` - 新增轮询控制 (调试模式) - 新增离线开发模式 (调试模式) - 新增 `IndexedDB` 数据控制 (调试模式)
29 lines
626 B
TypeScript
29 lines
626 B
TypeScript
import type { Station } from '@/apis';
|
|
import { NDM_STATION_STORE_ID } from '@/constants';
|
|
import { defineStore } from 'pinia';
|
|
import { computed, ref } from 'vue';
|
|
|
|
export const useStationStore = defineStore(
|
|
NDM_STATION_STORE_ID,
|
|
() => {
|
|
const stations = ref<Station[]>([]);
|
|
const onlineStations = computed(() => {
|
|
return stations.value.filter((station) => station.online);
|
|
});
|
|
|
|
const setStations = (newStations: Station[]) => {
|
|
stations.value = newStations;
|
|
};
|
|
|
|
return {
|
|
stations,
|
|
onlineStations,
|
|
|
|
setStations,
|
|
};
|
|
},
|
|
{
|
|
persistToIndexedDB: true,
|
|
},
|
|
);
|