refactor:
- extend NdmDeviceAlarmLogVO - only query alarm counts - separate request and store update in useQuery - refactor station card and alarm modal, data fetching is now inside modal - optimize device tree - optimize query station list - make export size follow page size - fix query sequence and make them follow stations -> devices -> alarms
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { DeviceType } from '@/enums/device-type';
|
||||
import { type StationAlarms, type StationDevices } from '@/composables/query';
|
||||
import { type StationAlarmCounts, type StationDevices } from '@/composables/query';
|
||||
import { ControlOutlined } from '@vicons/antd';
|
||||
import { Video as VideoIcon } from '@vicons/carbon';
|
||||
import axios from 'axios';
|
||||
@@ -11,7 +11,7 @@ import { toRefs, computed } from 'vue';
|
||||
interface Props {
|
||||
station: Station;
|
||||
stationDevices?: StationDevices;
|
||||
stationAlarms?: StationAlarms;
|
||||
stationAlarmCounts?: StationAlarmCounts;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@@ -22,7 +22,7 @@ const emit = defineEmits<{
|
||||
'open-device-params-config-modal': [station: Station];
|
||||
}>();
|
||||
|
||||
const { station, stationDevices, stationAlarms } = toRefs(props);
|
||||
const { station, stationDevices, stationAlarmCounts } = toRefs(props);
|
||||
|
||||
// 计算总离线设备数量
|
||||
const offlineDeviceCount = computed(() => {
|
||||
@@ -40,12 +40,8 @@ const deviceCount = computed(() => {
|
||||
});
|
||||
return count;
|
||||
});
|
||||
const devicAlarmCount = computed(() => {
|
||||
let count = 0;
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
count += stationAlarms.value?.[deviceType].length ?? 0;
|
||||
});
|
||||
return count;
|
||||
const alarmCount = computed(() => {
|
||||
return stationAlarmCounts.value?.unclassified ?? 0;
|
||||
});
|
||||
|
||||
// 打开对话框
|
||||
@@ -148,7 +144,7 @@ const theme = useThemeVars();
|
||||
<span class="font-xx-small" :class="[station.online ? 'clickable' : '']" @click="openDeviceAlarmTreeModal">告警记录</span>
|
||||
</template>
|
||||
<template #default>
|
||||
<span class="font-small">{{ devicAlarmCount }}</span>
|
||||
<span class="font-small">{{ alarmCount }}</span>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<span class="font-xx-small">条</span>
|
||||
|
||||
Reference in New Issue
Block a user