提交 e9404e6d authored 作者: wangjiahao's avatar wangjiahao

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

上级 fa5e0d9e
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
:expand-on-click-node="true" :expand-on-click-node="true"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@node-click="nodeClick" @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 v-if="data.modelInnerType ==='group'" slot-scope="{ node, data }" class="custom-tree-node father">
<span style="display: flex;flex: 1;width: 0;"> <span style="display: flex;flex: 1;width: 0;">
...@@ -673,14 +675,6 @@ export default { ...@@ -673,14 +675,6 @@ export default {
if (data.modelInnerType !== 'group') { if (data.modelInnerType !== 'group') {
this.$emit('switchComponent', { name: 'ChartEdit', param: data }) 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() { back() {
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
highlight-current highlight-current
:expand-on-click-node="true" :expand-on-click-node="true"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
@node-click="nodeClick" @node-click="nodeClick"
> >
<span v-if="data.modelInnerType === 'group'" slot-scope="{ node, data }" class="custom-tree-node father"> <span v-if="data.modelInnerType === 'group'" slot-scope="{ node, data }" class="custom-tree-node father">
...@@ -524,14 +526,6 @@ export default { ...@@ -524,14 +526,6 @@ export default {
if (data.modelInnerType !== 'group') { if (data.modelInnerType !== 'group') {
this.$emit('switchComponent', { name: 'ViewTable', param: data }) 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() { back() {
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<div class="block"> <div class="block">
<el-tree <el-tree
ref="default_panel_tree" ref="default_panel_tree"
:default-expanded-keys="expandedArray"
:data="defaultData" :data="defaultData"
node-key="id" node-key="id"
:highlight-current="activeTree==='system'" :highlight-current="activeTree==='system'"
...@@ -84,6 +83,8 @@ ...@@ -84,6 +83,8 @@
:highlight-current="activeTree==='self'" :highlight-current="activeTree==='self'"
:expand-on-click-node="true" :expand-on-click-node="true"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
@node-click="nodeClick" @node-click="nodeClick"
> >
<span slot-scope="{ node, data }" class="custom-tree-node-list father"> <span slot-scope="{ node, data }" class="custom-tree-node-list father">
...@@ -677,13 +678,15 @@ export default { ...@@ -677,13 +678,15 @@ export default {
bus.$emit('set-panel-show-type', 0) bus.$emit('set-panel-show-type', 0)
}) })
} }
if (node.expanded) { },
nodeExpand(data) {
if (data.id) {
this.expandedArray.push(data.id) this.expandedArray.push(data.id)
} else { }
const index = this.expandedArray.indexOf(data.id) },
if (index > -1) { nodeCollapse(data) {
this.expandedArray.splice(index, 1) if (data.id) {
} this.expandedArray.splice(this.expandedArray.indexOf(data.id), 1)
} }
}, },
back() { back() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论