用户角色选择时优化细节

This commit is contained in:
shiziyuan9527 2020-05-21 22:40:01 +08:00
parent d3b3b6e1fb
commit 37648bb560
1 changed files with 16 additions and 10 deletions

View File

@ -514,17 +514,23 @@
})
},
addRole() {
let roleInfo = {};
roleInfo.selects = [];
let ids = this.form.roles.map(r => r.id);
ids.forEach(id => {
roleInfo.selects.push(id);
this.$refs['createUserForm'].validate(valid => {
if (valid) {
let roleInfo = {};
roleInfo.selects = [];
let ids = this.form.roles.map(r => r.id);
ids.forEach(id => {
roleInfo.selects.push(id);
})
let roles = this.form.roles;
roles.push(roleInfo);
if (this.form.roles.length > this.userRole.length - 1) {
this.btnAddRole = true;
}
} else {
return false;
}
})
let roles = this.form.roles;
roles.push(roleInfo);
if (this.form.roles.length > this.userRole.length - 1) {
this.btnAddRole = true;
}
},
removeRole(item) {
let index = this.form.roles.indexOf(item);