|
@@ -60,9 +60,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onExpand (expandedKeys) {
|
|
|
- console.log('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
|
|
|
},
|
|
@@ -74,7 +71,6 @@ export default {
|
|
|
this.clear()
|
|
|
this.$emit('close')
|
|
|
},
|
|
|
-
|
|
|
// 保存提交
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
@@ -85,9 +81,7 @@ export default {
|
|
|
return this.$message.warning('请先选择菜单')
|
|
|
}
|
|
|
const arr = this.checkedData.join(',')
|
|
|
- console.log({ id: this.id, menuIds: arr })
|
|
|
addMenuPower({ id: this.id, menuIds: arr }).then(res => {
|
|
|
- console.log(res, 'res--save')
|
|
|
if (res.status + '' === '200') {
|
|
|
this.$message.success(res.message ? res.message : '保存成功')
|
|
|
this.$emit('refresh')
|
|
@@ -110,7 +104,9 @@ export default {
|
|
|
this.roleName = ''
|
|
|
this.id = ''
|
|
|
this.checkedKeys = []
|
|
|
+ this.expandedKeys = []
|
|
|
},
|
|
|
+ // 查找叶子节点
|
|
|
findLeaf (data, arr) {
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
const node = data[i]
|
|
@@ -121,14 +117,13 @@ export default {
|
|
|
return item == node.id
|
|
|
})
|
|
|
if (hasNode) {
|
|
|
+ this.expandedKeys.push(node.id)
|
|
|
this.checkedKeys.push(node.id)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
- },
|
|
|
beforeCreate () {
|
|
|
this.form = this.$form.createForm(this, { name: 'menuModal' })
|
|
|
},
|
|
@@ -144,16 +139,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)
|
|
|
- // console.log(this.checkedKeys, 'this.checkedKeys----')
|
|
|
- // console.log(this.checkedData, 'this.checkedData')
|
|
|
+ this.findLeaf(this.treeData, arr)
|
|
|
}
|
|
|
}
|
|
|
} else {
|