diff --git a/src/components/dashboard-page/device-alarm-detail-modal.vue b/src/components/dashboard-page/device-alarm-detail-modal.vue index f9401a4..b8b72d8 100644 --- a/src/components/dashboard-page/device-alarm-detail-modal.vue +++ b/src/components/dashboard-page/device-alarm-detail-modal.vue @@ -5,7 +5,7 @@ import { ndmDeviceAlarmLogDefaultExportByTemplate, postNdmDeviceAlarmLogPage } f import type { StationAlarmCounts } from '@/composables/query'; 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 { useQueryControlStore } from '@/stores/query-control'; import { downloadByData } from '@/utils/download'; import { useMutation } from '@tanstack/vue-query'; @@ -57,7 +57,9 @@ const tableColumns: DataTableColumns = [ title: '设备类型', key: 'deviceType', render: (rowData) => { - return DeviceTypeName[getDeviceTypeVal(rowData.deviceType)]; + const deviceTypeVal = tryGetDeviceTypeVal(rowData.deviceType); + if (!deviceTypeVal) return '-'; + return DeviceTypeName[deviceTypeVal]; }, filter: true, filterMultiple: true, diff --git a/src/components/dashboard-page/offline-device-detail-modal.vue b/src/components/dashboard-page/offline-device-detail-modal.vue index 78fedfb..409b824 100644 --- a/src/components/dashboard-page/offline-device-detail-modal.vue +++ b/src/components/dashboard-page/offline-device-detail-modal.vue @@ -2,7 +2,7 @@ import type { Station } from '@/apis/domains'; import type { NdmDeviceVO } from '@/apis/models'; import type { StationDevices } from '@/composables/query'; -import { DeviceType, DeviceTypeName, getDeviceTypeVal } from '@/enums/device-type'; +import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums/device-type'; import { useQueryControlStore } from '@/stores/query-control'; import { NButton, NCol, NInput, NModal, NRow, NStatistic, NTree } from 'naive-ui'; import type { TreeOption, TreeOverrideNodeClickBehavior, TreeProps } from 'naive-ui'; @@ -83,7 +83,7 @@ const treeData = computed(() => { path: '/device', query: { stationCode: station.value?.code, - deviceType: getDeviceTypeVal(dev.deviceType), + deviceType: tryGetDeviceTypeVal(dev.deviceType), deviceDBId: dev.id, from: route.path, }, @@ -117,7 +117,7 @@ const nodeProps: TreeProps['nodeProps'] = ({ option }) => { path: '/device', query: { stationCode: station.value?.code, - deviceType: getDeviceTypeVal(device.deviceType), + deviceType: tryGetDeviceTypeVal(device.deviceType), deviceDBId: device.id, from: route.path, }, diff --git a/src/components/device-page/device-card/current-diag-card/device-header-card.vue b/src/components/device-page/device-card/current-diag-card/device-header-card.vue index aefab1c..4856433 100644 --- a/src/components/device-page/device-card/current-diag-card/device-header-card.vue +++ b/src/components/device-page/device-card/current-diag-card/device-header-card.vue @@ -1,6 +1,6 @@