refactor: tryGetDeviceTypeVal
This commit is contained in:
@@ -8,7 +8,7 @@ import { computed } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { DeviceType, getDeviceTypeVal } from '@/enums/device-type';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
import type { StationAlarmCounts } from './domains';
|
||||
import { runTask } from '@/utils/run-task';
|
||||
|
||||
@@ -88,7 +88,10 @@ function useStationAlarmCountsMutation() {
|
||||
signal,
|
||||
);
|
||||
for (const alarm of alarmList) {
|
||||
stationAlarmCounts[getDeviceTypeVal(alarm.deviceType)]++;
|
||||
const deviceTypeVal = tryGetDeviceTypeVal(alarm.deviceType);
|
||||
if (deviceTypeVal) {
|
||||
stationAlarmCounts[deviceTypeVal]++;
|
||||
}
|
||||
}
|
||||
stationAlarmCounts.unclassified = parseInt(total);
|
||||
return stationAlarmCounts;
|
||||
|
||||
Reference in New Issue
Block a user