refactor: tryGetDeviceTypeVal
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, NdmNvrResultVO, PageParams } from '@/apis/models';
|
||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { DeviceType, getDeviceTypeVal } from '@/enums/device-type';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDataTable, NPopover, NScrollbar, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
|
||||
@@ -33,7 +33,9 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
|
||||
key: 'faultDescription',
|
||||
render: (rowData) => {
|
||||
const isNvrCluster = (ndmDevice: NdmDeviceResultVO) => {
|
||||
const isNvr = getDeviceTypeVal(ndmDevice.deviceType) === DeviceType.Nvr;
|
||||
const deviceTypeVal = tryGetDeviceTypeVal(ndmDevice.deviceType);
|
||||
if (!deviceTypeVal) return false;
|
||||
const isNvr = deviceTypeVal === DeviceType.Nvr;
|
||||
if (!isNvr) return false;
|
||||
const maybeNvrCluster = ndmDevice as NdmNvrResultVO;
|
||||
return !!maybeNvrCluster.clusterList?.trim() && maybeNvrCluster.clusterList !== maybeNvrCluster.ipAddress;
|
||||
|
||||
Reference in New Issue
Block a user