feat: support searching device id

This commit is contained in:
yangsy
2025-08-20 23:28:27 +08:00
parent 1707d2c66f
commit c4c7d0f7a6
2 changed files with 6 additions and 7 deletions

View File

@@ -210,14 +210,13 @@ const searchPattern = computed(() => {
const searchFilter = (pattern: string, node: TreeOption): boolean => {
const { search, status } = destr<{ search: string; status: string }>(pattern);
const device = node['device'] as NdmDeviceResultVO | undefined;
const { name, ipAddress, deviceStatus } = device ?? {};
const searchMatched = (name ?? '').includes(search) || (ipAddress ?? '').includes(search);
const { name, ipAddress, deviceId, deviceStatus } = device ?? {};
const searchMatched = (name ?? '').includes(search) || (ipAddress ?? '').includes(search) || (deviceId ?? '').includes(search);
const statusMatched = status === '' || status === deviceStatus;
return searchMatched && statusMatched;
};
// ========== 设备树交互 ==========
// 将多实例改为单实例,便于直接获取 Tree 实例
const deviceTreeInst = useTemplateRef<TreeInst>('deviceTreeInst');
const onClickLocateDeviceTree = () => {
selectedTab.value = (selectedDevice.value?.deviceType ?? selectedTab.value) as DeviceTypeCode;
@@ -249,7 +248,7 @@ const scrollDeviceTreeToSelectedDevice = (timeout: number = 500) => {
<NLayoutSider bordered :width="600" :collapsed-width="0" show-trigger="bar">
<div style="height: 100%; display: flex; flex-direction: column">
<div style="flex-shrink: 0; padding: 12px">
<NInput v-model:value="searchInput" placeholder="搜索设备名称或IP地址" clearable />
<NInput v-model:value="searchInput" placeholder="搜索设备名称、设备ID或IP地址" clearable />
<NFlex justify="space-between" align="center">
<NRadioGroup v-model:value="statusInput">
<NRadio value="">全部</NRadio>