fix
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user