From 59bbb8358cf068efaf0737d8409652fda6760d68 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Sat, 9 Dec 2023 23:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bim/bimHome/components/DeviceTree.vue | 13 +- .../bim/bimHome/components/ThreeView.vue | 251 +++++++++++++++--- 2 files changed, 222 insertions(+), 42 deletions(-) diff --git a/src/views/bim/bimHome/components/DeviceTree.vue b/src/views/bim/bimHome/components/DeviceTree.vue index 3fa55d6..a16ebc1 100644 --- a/src/views/bim/bimHome/components/DeviceTree.vue +++ b/src/views/bim/bimHome/components/DeviceTree.vue @@ -48,6 +48,7 @@ const data = reactive({ type: '生产设备', status: '启用' }, + children: [] }, { @@ -59,6 +60,7 @@ const data = reactive({ type: '生产设备', status: '启用' }, + children: [] }, { label: '设备三', @@ -69,6 +71,7 @@ const data = reactive({ type: '空调设备', status: '启用' }, + children: [] }, { label: '设备四', @@ -79,6 +82,7 @@ const data = reactive({ type: '安防设备', status: '启用' }, + children: [] }, ], } @@ -89,15 +93,16 @@ const { deviceValue, treeData, checkedkeys } = toRefs(data); const emit = defineEmits(['handleNodeClick']) onMounted(() => { nextTick(() => { - checkedkeys.value = treeData.value[0].children[0].id; - handleNodeClick(treeData.value[0].children[0]); + checkedkeys.value = treeData.value[0].id; + handleNodeClick(treeData.value[0]); }) }); const handleNodeClick = (value) => { bimStore().setActivateDeviceTree(value); - emit('handleNodeClick', value); + const isParent = value.children.length > 0; + emit('handleNodeClick', value, isParent); setTimeout(() => { - Bus.emit('clickDevice'); + Bus.emit('clickDevice', isParent); }, 100) } diff --git a/src/views/bim/bimHome/components/ThreeView.vue b/src/views/bim/bimHome/components/ThreeView.vue index 8e47efc..9fea329 100644 --- a/src/views/bim/bimHome/components/ThreeView.vue +++ b/src/views/bim/bimHome/components/ThreeView.vue @@ -1,9 +1,18 @@ - \ No newline at end of file