This commit is contained in:
yangsy
2025-08-26 04:20:44 +08:00
parent 9a050f08f6
commit b17e7b589a
4 changed files with 13 additions and 13 deletions

View File

@@ -13,8 +13,8 @@ import { toRefs, computed, ref } from 'vue';
interface Props {
station: Station;
stationDevices: StationDevices;
stationAlarms: StationAlarms;
stationDevices?: StationDevices;
stationAlarms?: StationAlarms;
}
const props = defineProps<Props>();
@@ -26,7 +26,7 @@ const { code, name, online } = toRefs(station.value);
const offlineDeviceCount = computed(() => {
let count = 0;
Object.values(DeviceType).forEach((deviceType) => {
const offlineDeviceList = stationDevices.value[deviceType].filter((device) => device.deviceStatus === '20');
const offlineDeviceList = stationDevices.value?.[deviceType].filter((device) => device.deviceStatus === '20') ?? [];
count += offlineDeviceList.length;
});
return count;
@@ -34,14 +34,14 @@ const offlineDeviceCount = computed(() => {
const deviceCount = computed(() => {
let count = 0;
Object.values(DeviceType).forEach((deviceType) => {
count += stationDevices.value[deviceType].length;
count += stationDevices.value?.[deviceType].length ?? 0;
});
return count;
});
const devicAlarmCount = computed(() => {
let count = 0;
Object.values(DeviceType).forEach((deviceType) => {
count += stationAlarms.value[deviceType].length;
count += stationAlarms.value?.[deviceType].length ?? 0;
});
return count;
});