refactor: extend device-type.ts
This commit is contained in:
@@ -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' },
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models';
|
||||
import type { LineDevices } from '@/composables/query/device/use-line-devices-query';
|
||||
import { DeviceType, DeviceTypeName, type DeviceTypeKey, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import { DeviceType, DeviceTypeName, getDeviceTypeVal, type DeviceTypeKey, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import destr from 'destr';
|
||||
import { NButton, NButtonGroup, NFlex, NInput, NRadio, NRadioGroup, NTab, NTabs, NTag, NTree, type TagProps, type TreeInst, type TreeOption, type TreeOverrideNodeClickBehavior } from 'naive-ui';
|
||||
import { computed, h, ref, toRefs, useTemplateRef } from 'vue';
|
||||
@@ -165,7 +165,8 @@ const selectedStationCode = defineModel<string>('selected-station-code');
|
||||
const expandedKeys = ref<string[]>();
|
||||
const deviceTreeInst = useTemplateRef<TreeInst>('deviceTreeInst');
|
||||
const onClickLocateDeviceTree = () => {
|
||||
selectedTab.value = (selectedDevice.value?.deviceType ?? selectedTab.value) as DeviceTypeVal;
|
||||
// FIXME
|
||||
selectedTab.value = getDeviceTypeVal(selectedDevice.value?.deviceType ?? selectedTab.value);
|
||||
selectedKeys.value = selectedDevice.value?.id ? [selectedDevice.value.id] : undefined;
|
||||
|
||||
let expanded: string[] | undefined = selectedStationCode.value ? [selectedStationCode.value] : undefined;
|
||||
|
||||
@@ -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 } from '@/enums/device-type';
|
||||
import { DeviceType, DeviceTypeName, getDeviceTypeVal } 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 } from 'naive-ui';
|
||||
@@ -83,7 +83,7 @@ const treeData = computed<TreeOption[]>(() => {
|
||||
path: '/device',
|
||||
query: {
|
||||
stationCode: station.value.code,
|
||||
deviceType: dev.deviceType,
|
||||
deviceType: getDeviceTypeVal(dev.deviceType),
|
||||
deviceDBId: dev.id,
|
||||
from: route.path,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user