|
@@ -189,11 +189,15 @@ export default {
|
|
|
expandedKeys: [-1]
|
|
|
}
|
|
|
},
|
|
|
- created: function () {
|
|
|
- let keyWords = ""
|
|
|
+ created () {
|
|
|
+ let keyWords = "";
|
|
|
+ const treeEx = sessionStorage.getItem('authTreeDatas');
|
|
|
if (this.$route.query.keyWords) {
|
|
|
keyWords = this.$route.query.keyWords;
|
|
|
}
|
|
|
+ if (treeEx) {
|
|
|
+ this.expandedKeys = JSON.parse(treeEx);
|
|
|
+ }
|
|
|
this.getAuthTree(keyWords);
|
|
|
},
|
|
|
watch: {
|
|
@@ -205,7 +209,7 @@ export default {
|
|
|
deep: true
|
|
|
},
|
|
|
currentKey: {
|
|
|
- handler(val) {
|
|
|
+ handler (val) {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.tree.setCurrentKey(val)
|
|
|
})
|
|
@@ -235,17 +239,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 节点展开
|
|
|
- handleExpand(obj) {
|
|
|
+ handleExpand (obj) {
|
|
|
this.expandedKeys.push(obj.AuthId)
|
|
|
+ sessionStorage.setItem('authTreeDatas', JSON.stringify(this.expandedKeys))
|
|
|
},
|
|
|
// 节点收起
|
|
|
- handleCollapse(obj) {
|
|
|
+ handleCollapse (obj) {
|
|
|
const { AuthId, children } = obj
|
|
|
children.length && this.collapseChilren(children)
|
|
|
this.expandedKeys = this.expandedKeys.filter(key => key !== AuthId)
|
|
|
+ sessionStorage.setItem('authTreeDatas', JSON.stringify(this.expandedKeys))
|
|
|
},
|
|
|
// 收起子节点
|
|
|
- collapseChilren(children) {
|
|
|
+ collapseChilren (children) {
|
|
|
children.forEach(child => {
|
|
|
const { AuthId, children } = child
|
|
|
children.length && this.collapseChilren(children)
|
|
@@ -325,7 +331,7 @@ export default {
|
|
|
return arr
|
|
|
},
|
|
|
// 更改下级状态
|
|
|
- setChildrenStatus(id, flag) {
|
|
|
+ setChildrenStatus (id, flag) {
|
|
|
this.dataArr.forEach(data => {
|
|
|
if (data.UpAuthId === id) {
|
|
|
data.Status = flag ? 1 : 0
|