fix: 修复对树形结构操作时,可能有其他节点展开的问题

This commit is contained in:
wangjiahao 2021-12-06 11:54:34 +08:00
parent e509c020cf
commit 5f46845bc2
3 changed files with 14 additions and 23 deletions

View File

@ -44,6 +44,8 @@
:expand-on-click-node="true"
:filter-node-method="filterNode"
@node-click="nodeClick"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
>
<span v-if="data.modelInnerType ==='group'" slot-scope="{ node, data }" class="custom-tree-node father">
<span style="display: flex;flex: 1;width: 0;">
@ -673,14 +675,6 @@ export default {
if (data.modelInnerType !== 'group') {
this.$emit('switchComponent', { name: 'ChartEdit', param: data })
}
if (node.expanded) {
this.expandedArray.push(data.id)
} else {
const index = this.expandedArray.indexOf(data.id)
if (index > -1) {
this.expandedArray.splice(index, 1)
}
}
},
back() {

View File

@ -45,6 +45,8 @@
highlight-current
:expand-on-click-node="true"
:filter-node-method="filterNode"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
@node-click="nodeClick"
>
<span v-if="data.modelInnerType === 'group'" slot-scope="{ node, data }" class="custom-tree-node father">
@ -524,14 +526,6 @@ export default {
if (data.modelInnerType !== 'group') {
this.$emit('switchComponent', { name: 'ViewTable', param: data })
}
if (node.expanded) {
this.expandedArray.push(data.id)
} else {
const index = this.expandedArray.indexOf(data.id)
if (index > -1) {
this.expandedArray.splice(index, 1)
}
}
},
back() {

View File

@ -29,7 +29,6 @@
<div class="block">
<el-tree
ref="default_panel_tree"
:default-expanded-keys="expandedArray"
:data="defaultData"
node-key="id"
:highlight-current="activeTree==='system'"
@ -84,6 +83,8 @@
:highlight-current="activeTree==='self'"
:expand-on-click-node="true"
:filter-node-method="filterNode"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
@node-click="nodeClick"
>
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
@ -677,13 +678,15 @@ export default {
bus.$emit('set-panel-show-type', 0)
})
}
if (node.expanded) {
},
nodeExpand(data) {
if (data.id) {
this.expandedArray.push(data.id)
} else {
const index = this.expandedArray.indexOf(data.id)
if (index > -1) {
this.expandedArray.splice(index, 1)
}
}
},
nodeCollapse(data) {
if (data.id) {
this.expandedArray.splice(this.expandedArray.indexOf(data.id), 1)
}
},
back() {