refactor: extend device-type.ts

This commit is contained in:
yangsy
2025-08-27 14:43:04 +08:00
parent 620dfd8a74
commit d948c96047
6 changed files with 53 additions and 26 deletions

View File

@@ -4,7 +4,7 @@ import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
import { ndmDeviceAlarmLogDefaultExportByTemplate } from '@/apis/requests';
import type { StationAlarms } from '@/composables/query';
import { JAVA_INTEGER_MAX_VALUE } from '@/constants';
import { DeviceType, DeviceTypeName, type DeviceTypeVal } from '@/enums/device-type';
import { DeviceType, DeviceTypeName, getDeviceTypeVal } from '@/enums/device-type';
import { useQueryControlStore } from '@/stores/query-control';
import { downloadByData } from '@/utils/download';
import { useMutation } from '@tanstack/vue-query';
@@ -60,12 +60,12 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
title: '设备类型',
key: 'deviceType',
render: (rowData) => {
return DeviceTypeName[(rowData.deviceType ?? DeviceType.Camera) as DeviceTypeVal];
return DeviceTypeName[getDeviceTypeVal(rowData.deviceType)];
},
filterMultiple: true,
filterOptions: Object.values(DeviceType).map((deviceType) => ({ label: DeviceTypeName[deviceType], value: deviceType })),
filter: (filterOptionValue, row) => {
return row.deviceType === filterOptionValue;
return getDeviceTypeVal(row.deviceType) === filterOptionValue;
},
},
{ title: '设备名称', key: 'deviceName' },