refactor import

This commit is contained in:
yangsy
2025-11-10 20:35:55 +08:00
parent 940f42f66a
commit 19297c2870

View File

@@ -1,4 +1,4 @@
import type { NdmDeviceAlarmLogVO, NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models'; import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models';
import { AlarmType } from '@/enums/alarm-type'; import { AlarmType } from '@/enums/alarm-type';
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums/device-type'; import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums/device-type';
import { FaultLevel } from '@/enums/fault-level'; import { FaultLevel } from '@/enums/fault-level';
@@ -6,17 +6,17 @@ import dayjs from 'dayjs';
import { NButton, NPopover, NScrollbar, NTag, type TagProps } from 'naive-ui'; import { NButton, NPopover, NScrollbar, NTag, type TagProps } from 'naive-ui';
import { h } from 'vue'; import { h } from 'vue';
export const renderAlarmDateCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => { export const renderAlarmDateCell = (rowData: NdmDeviceAlarmLogResultVO) => {
return dayjs(Number(rowData.alarmDate ?? 0)).format('YYYY-MM-DD HH:mm:ss'); return dayjs(Number(rowData.alarmDate ?? 0)).format('YYYY-MM-DD HH:mm:ss');
}; };
export const renderDeviceTypeCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => { export const renderDeviceTypeCell = (rowData: NdmDeviceAlarmLogResultVO) => {
const deviceTypeVal = tryGetDeviceTypeVal(rowData.deviceType); const deviceTypeVal = tryGetDeviceTypeVal(rowData.deviceType);
if (!deviceTypeVal) return '-'; if (!deviceTypeVal) return '-';
return DeviceTypeName[deviceTypeVal]; return DeviceTypeName[deviceTypeVal];
}; };
export const renderAlarmTypeCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => { export const renderAlarmTypeCell = (rowData: NdmDeviceAlarmLogResultVO) => {
const { alarmType } = rowData; const { alarmType } = rowData;
if (!alarmType) { if (!alarmType) {
return ''; return '';
@@ -24,7 +24,7 @@ export const renderAlarmTypeCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => {
return h(NTag, { type: 'default' }, { default: () => AlarmType[alarmType] }); return h(NTag, { type: 'default' }, { default: () => AlarmType[alarmType] });
}; };
export const renderFaultLevelCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => { export const renderFaultLevelCell = (rowData: NdmDeviceAlarmLogResultVO) => {
const { faultLevel } = rowData; const { faultLevel } = rowData;
if (!faultLevel) { if (!faultLevel) {
return ''; return '';
@@ -40,7 +40,7 @@ export const renderFaultLevelCell = (rowData: Partial<NdmDeviceAlarmLogVO>) => {
return h(NTag, { type }, { default: () => FaultLevel[faultLevel] }); return h(NTag, { type }, { default: () => FaultLevel[faultLevel] });
}; };
export const renderFaultDescriptionCell = (rowData: Partial<NdmDeviceAlarmLogVO>, ndmDevice: NdmDeviceResultVO) => { export const renderFaultDescriptionCell = (rowData: NdmDeviceAlarmLogResultVO, ndmDevice: NdmDeviceResultVO) => {
const isNvrCluster = (ndmDevice: NdmDeviceResultVO) => { const isNvrCluster = (ndmDevice: NdmDeviceResultVO) => {
const deviceTypeVal = tryGetDeviceTypeVal(ndmDevice.deviceType); const deviceTypeVal = tryGetDeviceTypeVal(ndmDevice.deviceType);
if (!deviceTypeVal) return false; if (!deviceTypeVal) return false;