From d2791ad09396bd8a073f3e73c6e1b61dbb8d3620 Mon Sep 17 00:00:00 2001 From: yangsy Date: Tue, 11 Nov 2025 12:21:12 +0800 Subject: [PATCH] feat(device-tree): expand/fold station node when click it --- src/components/device-page/device-tree.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/device-page/device-tree.vue b/src/components/device-page/device-tree.vue index 569f20b..44aa257 100644 --- a/src/components/device-page/device-tree.vue +++ b/src/components/device-page/device-tree.vue @@ -62,7 +62,21 @@ const selectedKeys = computed(() => (selectedDevice.value?.id ? [selectedDevice. const onSelectDevice = (device: NdmDeviceResultVO, stationCode: string) => { emit('select-device', device, stationCode); }; -const override: TreeOverrideNodeClickBehavior = () => 'none'; +const override: TreeOverrideNodeClickBehavior = ({ option }) => { + const isDeviceNode = !!option['device']; + // 单击车站节点展开/收起设备 + if (!isDeviceNode) { + return 'toggleExpand'; + } else { + // 录像机集群节点的`单击展开/收起`与`双击选择`交互存在冲突 + // 暂不考虑支持 + // const device = option['device'] as NdmDeviceResultVO; + // if (isNvrCluster(device)) { + // return 'toggleExpand'; + // } + return 'none'; + } +}; const nodeProps: TreeProps['nodeProps'] = ({ option }) => { return { onDblclick: (payload: MouseEvent) => {