设备树折叠面板切换问题修改

This commit is contained in:
zhujiyan
2024-10-09 11:29:20 +08:00
parent 135901d473
commit 6e8987d4ae
2 changed files with 31 additions and 22 deletions

View File

@@ -44,7 +44,7 @@
default-expand-all
v-bind="$attrs"
:data="zlDeviceData"
style="overflow: auto;"
style="overflow: auto"
>
<template #default="{ node, data }">
<span class="custom-tree-node">
@@ -70,7 +70,7 @@
node-key="id"
:data="bxsDeviceData"
v-bind="$attrs"
style="overflow: auto;"
style="overflow: auto"
>
<template #default="{ node, data }">
<span class="custom-tree-node">
@@ -139,13 +139,6 @@ watch(
})
}
})
if (zlDeviceData.value.length != 0) {
activeName.value = '0'
} else if (bxsDeviceData.value.length != 0) {
activeName.value = '1'
} else {
activeName.value = ''
}
}
},
{
@@ -206,7 +199,18 @@ const treeRef1 = ref<InstanceType<typeof ElTree>>()
const treeRef2 = ref<InstanceType<typeof ElTree>>()
defineExpose({ treeRef1, treeRef2 })
onMounted(() => {
changeDevice(activeName.value)
setTimeout(() => {
if (zlDeviceData.value.length != 0) {
activeName.value = '0'
}
if (zlDeviceData.value.length === 0 && bxsDeviceData.value.length != 0) {
activeName.value = '1'
}
if (!zlDeviceData.value && !bxsDeviceData.value) {
activeName.value = ''
}
changeDevice(activeName.value)
}, 500)
})
</script>