fix: 资源列表树,如果子目录展开后没有收起,那么上层目录点击收起无响应

This commit is contained in:
dataeaseShu 2023-11-10 17:05:09 +08:00
parent 352dc49877
commit a9654bbd45
2 changed files with 14 additions and 4 deletions

View File

@ -390,11 +390,15 @@ const menuList = [
const expandedKey = ref([])
const nodeExpand = data => {
expandedKey.value.push(data.id)
if (data.id) {
expandedKey.value.push(data.id)
}
}
const nodeCollapse = data => {
expandedKey.value = expandedKey.value.filter(ele => ele !== data.id)
if (data.id) {
expandedKey.value.splice(expandedKey.value.indexOf(data.id), 1)
}
}
const datasetTypeList = [
@ -490,6 +494,8 @@ const getMenuList = (val: boolean) => {
node-key="id"
:data="state.datasetTree"
:filter-node-method="filterNode"
expand-on-click-node
highlight-current
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
:default-expanded-keys="expandedKey"

View File

@ -512,11 +512,15 @@ const updateApiDs = () => {
}
const nodeExpand = data => {
expandedKey.value.push(data.id)
if (data.id) {
expandedKey.value.push(data.id)
}
}
const nodeCollapse = data => {
expandedKey.value = expandedKey.value.filter(ele => ele !== data.id)
if (data.id) {
expandedKey.value.splice(expandedKey.value.indexOf(data.id), 1)
}
}
const filterNode = (value: string, data: BusiTreeNode) => {