|
@@ -59,8 +59,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onExpand (expandedKeys) {
|
|
|
- // if not set autoExpandParent to false, if children expanded, parent can not collapse.
|
|
|
- // or, you can remove all expanded children keys.
|
|
|
this.expandedKeys = expandedKeys
|
|
|
this.autoExpandParent = false
|
|
|
},
|
|
@@ -103,6 +101,7 @@ export default {
|
|
|
this.id = ''
|
|
|
this.checkedKeys = []
|
|
|
},
|
|
|
+ // 查找叶子节点
|
|
|
findLeaf (data, arr) {
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
const node = data[i]
|
|
@@ -113,6 +112,7 @@ export default {
|
|
|
return item == node.id
|
|
|
})
|
|
|
if (hasNode) {
|
|
|
+ this.expandedKeys.push(node.id)
|
|
|
this.checkedKeys.push(node.id)
|
|
|
}
|
|
|
}
|
|
@@ -134,14 +134,9 @@ export default {
|
|
|
this.roleName = '分配权限' + '(' + this.data.role.name + ')'
|
|
|
if (this.data.role.menuIds) {
|
|
|
const arr = this.data.role.menuIds.split(',')
|
|
|
- const temp = []
|
|
|
- arr.map(item => {
|
|
|
- temp.push(Number(item))
|
|
|
- })
|
|
|
- this.checkedData = temp
|
|
|
- this.expandedKeys = temp
|
|
|
+ this.checkedData = arr
|
|
|
// 找出叶子节点
|
|
|
- this.findLeaf(this.treeData, temp)
|
|
|
+ this.findLeaf(this.treeData, arr)
|
|
|
}
|
|
|
}
|
|
|
} else {
|