refactor: tryGetDeviceTypeVal

This commit is contained in:
yangsy
2025-09-30 15:09:12 +08:00
parent 97bf9855c7
commit d0adb869da
11 changed files with 68 additions and 25 deletions

View File

@@ -3,7 +3,7 @@ import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
import { ndmDeviceAlarmLogDefaultExportByTemplate, postNdmDeviceAlarmLogPage } from '@/apis/requests';
import { FaultLevel } from '@/enums/fault-level';
import { AlarmType } from '@/enums/alarm-type';
import { DeviceType, DeviceTypeCode, DeviceTypeName, getDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
import { DeviceType, DeviceTypeCode, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
import { useCurrentAlarmsStore } from '@/stores/current-alarms';
import { useStationStore } from '@/stores/station';
import { downloadByData } from '@/utils/download';
@@ -79,7 +79,9 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
title: '设备类型',
key: 'deviceType',
render: (rowData) => {
return DeviceTypeName[getDeviceTypeVal(rowData.deviceType)];
const deviceTypeVal = tryGetDeviceTypeVal(rowData.deviceType);
if (!deviceTypeVal) return '-';
return DeviceTypeName[deviceTypeVal];
},
},
{ title: '设备名称', key: 'deviceName' },