|
@@ -23,7 +23,6 @@
|
|
|
:props="defaultProps"
|
|
|
node-key="authorityId"
|
|
|
:default-expanded-keys="defaultExpand[index]"
|
|
|
- :default-checked-keys="defaultChecked"
|
|
|
:ref="'tree-'+index"
|
|
|
show-checkbox>
|
|
|
</el-tree>
|
|
@@ -55,7 +54,6 @@
|
|
|
]
|
|
|
},
|
|
|
defaultExpand: [],
|
|
|
- defaultChecked: [],
|
|
|
treeData: [],
|
|
|
defaultProps: {
|
|
|
children: 'data',
|
|
@@ -88,15 +86,27 @@
|
|
|
GetRoleDetail(this.$route.params.id).then(res => {
|
|
|
if(res.code == 200) {
|
|
|
this.form.roleName = res.data.Rows[0].role_name
|
|
|
- this.defaultChecked = res.data.Rows[0].authority.split(",")
|
|
|
+ let checkedKeys = res.data.Rows[0].authority.split(",").map(Number)
|
|
|
+ const treeDataTimer = setInterval(() => {
|
|
|
+ if(this.treeData.length!==0) {
|
|
|
+ for(let i=0; i<this.treeData.length; i++) {
|
|
|
+ checkedKeys.forEach(key => {
|
|
|
+ this.$refs[`tree-${i}`][0].setChecked(key, true, false)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ clearInterval(treeDataTimer)
|
|
|
+ }
|
|
|
+ }, 200);
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
save() {
|
|
|
let checkedTemp = []
|
|
|
for(let i=0; i<this.treeData.length; i++) {
|
|
|
+ checkedTemp.push(...this.$refs[`tree-${i}`][0].getHalfCheckedKeys())
|
|
|
checkedTemp.push(...this.$refs[`tree-${i}`][0].getCheckedKeys())
|
|
|
}
|
|
|
+ console.log(checkedTemp)
|
|
|
if(!this.isNew) {
|
|
|
UpdateRoleAuthority(this.$route.params.id, checkedTemp).then(res => {
|
|
|
if(res.code == 200) {
|