refactor: tryGetDeviceTypeVal

This commit is contained in:
yangsy
2025-09-30 15:09:12 +08:00
parent 97bf9855c7
commit d0adb869da
11 changed files with 68 additions and 25 deletions

View File

@@ -12,7 +12,7 @@ const deviceTabPanes = Object.keys(DeviceType).map((key) => {
import type { Station } from '@/apis/domains';
import type { NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models';
import type { LineDevices } from '@/composables/query';
import { DeviceType, DeviceTypeName, getDeviceTypeVal, type DeviceTypeKey, type DeviceTypeVal } from '@/enums/device-type';
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeKey, type DeviceTypeVal } from '@/enums/device-type';
import { destr } from 'destr';
import {
NButton,
@@ -216,8 +216,9 @@ const onClickLocateDeviceTree = () => {
const stationCode = selectedStationCode.value;
const device = selectedDevice.value;
if (!stationCode || !device?.id) return;
if (device.deviceType) {
activeTab.value = getDeviceTypeVal(device.deviceType);
const deviceTypeVal = tryGetDeviceTypeVal(device.deviceType);
if (!!deviceTypeVal) {
activeTab.value = deviceTypeVal;
}
const expanded = [stationCode];