| | |
| | | edit(row) { |
| | | this.$refs.form.clearValidate() |
| | | this.role = { ...row } |
| | | var this_ = this |
| | | if (this.role.menuIds) { |
| | | this.$refs.permsTree.setCheckedKeys(this.role.menuIds.split(',')) |
| | | var deptIdArrStr = [] |
| | | this.role.menuIds.split(',').forEach(element => { |
| | | const thisNode = this_.$refs.permsTree.getNode(element) // 获取当前节点 |
| | | if (thisNode.childNodes.length === 0) { |
| | | deptIdArrStr.push(thisNode.data.id) |
| | | return |
| | | } |
| | | }) |
| | | this.$refs.permsTree.setCheckedKeys(deptIdArrStr) |
| | | // this.$refs.permsTree.setCheckedKeys(this.role.menuIds.split(',')) |
| | | } else { |
| | | this.$refs.permsTree.setCheckedKeys([]) |
| | | } |
| | |
| | | } |
| | | } |
| | | </style> |
| | | |