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