|
|
|
@ -223,7 +223,8 @@
|
|
|
|
|
isEnable: [{ required: true, message: '是否启用不能为空' }],
|
|
|
|
|
},
|
|
|
|
|
rules2: {
|
|
|
|
|
menuIds: [{ required: true, message: '功能权限不能为空' }],
|
|
|
|
|
menuIds: [{ required: true, message: '系统模块菜单不能为空' }],
|
|
|
|
|
permissionIds: [{ required: true, message: '功能权限不能为空' }],
|
|
|
|
|
},
|
|
|
|
|
rules3: {
|
|
|
|
|
departmentList: [{ required: true, trigger: 'change', message: '绑定组织不能为空' }],
|
|
|
|
@ -277,9 +278,12 @@
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const refsTree2 = ref(null);
|
|
|
|
|
const updateChecked = ref(false);
|
|
|
|
|
const handleCheckDept = async (data, checked, childChecked) => {
|
|
|
|
|
if (!unref(updateChecked)) {
|
|
|
|
|
if (checked || childChecked) {
|
|
|
|
|
formState.form.departmentList.push(data);
|
|
|
|
|
} else {
|
|
|
|
|
formState.form.departmentList.splice(formState.form.departmentList.indexOf(data.id), 1);
|
|
|
|
|
}
|
|
|
|
|
let params =
|
|
|
|
|
checked || childChecked
|
|
|
|
|
? {
|
|
|
|
@ -288,32 +292,14 @@
|
|
|
|
|
roleIds: [formState.form.id],
|
|
|
|
|
}
|
|
|
|
|
: { departmentId: data.id, isDeleteDepartmentOfEmployeeRole: true, roleIds: formState.form.id };
|
|
|
|
|
let res = await store.dispatch('role/updateDept', params);
|
|
|
|
|
if (checked || childChecked) {
|
|
|
|
|
if (res) {
|
|
|
|
|
formState.form.departmentList.push({ ...data });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (res) {
|
|
|
|
|
formState.form.departmentList.splice(
|
|
|
|
|
formState.form.departmentList.findIndex((item) => item.id === data.id),
|
|
|
|
|
1
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
store.dispatch('role/updateDept', params);
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
try {
|
|
|
|
|
unref(refsForm3).validate();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.info(e);
|
|
|
|
|
}
|
|
|
|
|
updateChecked.value = true;
|
|
|
|
|
unref(refsTree2).setCheckedKeys(formState.form.departmentList.map((item) => item.id));
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
updateChecked.value = false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleCreate = (row) => {
|
|
|
|
|
formState.formVisible = true;
|
|
|
|
|