diff --git a/src/pages/system/list/staff.vue b/src/pages/system/list/staff.vue index 7e295ac..f2ad4b5 100644 --- a/src/pages/system/list/staff.vue +++ b/src/pages/system/list/staff.vue @@ -52,7 +52,7 @@ - + e.roleId); this.roleList.forEach(i => { let obj = { roleId: "", roleName: "", cascaderValue: [] }; - if (value.includes(i.id)) { + if (value.includes(i.id) && !ids.includes(i.id)) { obj.roleId = i.id; obj.roleName = i.roleName; this.teacherForm.roleAndDeptList.push(obj); @@ -421,6 +420,12 @@ export default { this.teacherForm.roleAndDeptList.splice(0); } }, + roleRemove(value) { // 处理移除角色 + let index = this.teacherForm.roleAndDeptList.findIndex(i => i.roleId === value); + if (index !== -1) { + this.teacherForm.roleAndDeptList.splice(index, 1); + } + }, async saveSure(teacherForm) { this.$refs[teacherForm].validate((valid) => { if (valid) {