部门编辑

This commit is contained in:
禺狨 2023-03-07 13:53:31 +08:00
parent 05bc285d2f
commit 7762b72b53
2 changed files with 14 additions and 6 deletions

View File

@ -52,7 +52,7 @@ export const DepartmentCreatePage: React.FC = () => {
const onFinish = (values: any) => {
department
.storeDepartment(values.name, parent_id, values.sort)
.storeDepartment(values.name, parent_id || 0, values.sort)
.then((res: any) => {
message.success("保存成功!");
navigate(-1);
@ -64,8 +64,12 @@ export const DepartmentCreatePage: React.FC = () => {
};
const handleChange = (value: any) => {
if (value !== undefined) {
let it = value[value.length - 1];
setParentId(it);
} else {
setParentId(0);
}
};
const displayRender = (label: any, selectedOptions: any) => {

View File

@ -75,7 +75,7 @@ export const DepartmentUpdatePage: React.FC = () => {
const onFinish = (values: any) => {
let id = Number(params.depId);
department
.updateDepartment(id, values.name, parent_id, values.sort)
.updateDepartment(id, values.name, parent_id || 0, values.sort)
.then((res: any) => {
message.success("保存成功!");
navigate(-1);
@ -87,8 +87,12 @@ export const DepartmentUpdatePage: React.FC = () => {
};
const handleChange = (value: any) => {
if (value !== undefined) {
let it = value[value.length - 1];
setParentId(it);
} else {
setParentId(0);
}
};
const displayRender = (label: any, selectedOptions: any) => {