mirror of
https://github.com/PlayEdu/backend
synced 2025-07-03 08:22:44 +08:00
各添加、编辑页面的确认loading问题
This commit is contained in:
parent
84fe2ecab1
commit
acc767f11b
@ -123,6 +123,7 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
<div className="float-left mt-24">
|
<div className="float-left mt-24">
|
||||||
<Form
|
<Form
|
||||||
|
@ -150,6 +150,7 @@ export const DepartmentUpdate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -24,7 +24,7 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<any>([]);
|
const [departments, setDepartments] = useState<any>([]);
|
||||||
const memberDefaultAvatar = useSelector(
|
const memberDefaultAvatar = useSelector(
|
||||||
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
||||||
@ -80,10 +80,14 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
||||||
message.error("请输入正确的身份证号!");
|
message.error("请输入正确的身份证号!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
user
|
user
|
||||||
.storeUser(
|
.storeUser(
|
||||||
values.email,
|
values.email,
|
||||||
@ -94,8 +98,12 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
values.dep_ids
|
values.dep_ids
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +123,7 @@ export const MemberCreate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
<div className="member-form float-left mt-24">
|
<div className="member-form float-left mt-24">
|
||||||
<Form
|
<Form
|
||||||
|
@ -25,7 +25,7 @@ export const MemberUpdate: React.FC<PropInterface> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [init, setInit] = useState(true);
|
const [init, setInit] = useState(true);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<any>([]);
|
const [departments, setDepartments] = useState<any>([]);
|
||||||
const memberDefaultAvatar = useSelector(
|
const memberDefaultAvatar = useSelector(
|
||||||
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
(state: any) => state.systemConfig.value.memberDefaultAvatar
|
||||||
@ -105,11 +105,14 @@ export const MemberUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
if (values.idCard !== "" && !ValidataCredentials(values.idCard)) {
|
||||||
message.error("请输入正确的身份证号!");
|
message.error("请输入正确的身份证号!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
user
|
user
|
||||||
.updateUser(
|
.updateUser(
|
||||||
id,
|
id,
|
||||||
@ -121,8 +124,12 @@ export const MemberUpdate: React.FC<PropInterface> = ({
|
|||||||
values.dep_ids
|
values.dep_ids
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -144,6 +151,7 @@ export const MemberUpdate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -123,6 +123,7 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
|
|||||||
width={416}
|
width={416}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
<div className="float-left mt-24">
|
<div className="float-left mt-24">
|
||||||
<Form
|
<Form
|
||||||
|
@ -148,6 +148,7 @@ export const ResourceCategoryUpdate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -22,7 +22,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [roles, setRoles] = useState<selRoleModel[]>([]);
|
const [roles, setRoles] = useState<selRoleModel[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -60,6 +60,10 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
adminUser
|
adminUser
|
||||||
.storeAdminUser(
|
.storeAdminUser(
|
||||||
values.name,
|
values.name,
|
||||||
@ -69,8 +73,12 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
values.roleIds
|
values.roleIds
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,6 +108,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
<div className="float-left mt-24">
|
<div className="float-left mt-24">
|
||||||
<Form
|
<Form
|
||||||
|
@ -23,7 +23,7 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [init, setInit] = useState(true);
|
const [init, setInit] = useState(true);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [roles, setRoles] = useState<selRoleModel[]>([]);
|
const [roles, setRoles] = useState<selRoleModel[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -70,6 +70,10 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
adminUser
|
adminUser
|
||||||
.updateAdminUser(
|
.updateAdminUser(
|
||||||
id,
|
id,
|
||||||
@ -80,8 +84,12 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
values.roleIds
|
values.roleIds
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,6 +119,7 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
|
|||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
|
okButtonProps={{ loading: loading }}
|
||||||
>
|
>
|
||||||
{init && (
|
{init && (
|
||||||
<div className="float-left text-center mt-30">
|
<div className="float-left text-center mt-30">
|
||||||
|
@ -19,7 +19,7 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [permissions, setPermissions] = useState<Option[]>([]);
|
const [permissions, setPermissions] = useState<Option[]>([]);
|
||||||
const [actions, setActions] = useState<Option[]>([]);
|
const [actions, setActions] = useState<Option[]>([]);
|
||||||
|
|
||||||
@ -126,6 +126,9 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let pids = [];
|
let pids = [];
|
||||||
let aids = [];
|
let aids = [];
|
||||||
if (values.permission_ids.length === 0 && values.action_ids.length === 0) {
|
if (values.permission_ids.length === 0 && values.action_ids.length === 0) {
|
||||||
@ -138,11 +141,18 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
if (values.action_ids) {
|
if (values.action_ids) {
|
||||||
aids = values.action_ids;
|
aids = values.action_ids;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
const params = aids.concat(pids);
|
const params = aids.concat(pids);
|
||||||
adminRole.storeAdminRole(values.name, params).then((res: any) => {
|
adminRole
|
||||||
message.success("保存成功!");
|
.storeAdminRole(values.name, params)
|
||||||
onCancel();
|
.then((res: any) => {
|
||||||
});
|
setLoading(false);
|
||||||
|
message.success("保存成功!");
|
||||||
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
@ -160,7 +170,11 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
footer={
|
footer={
|
||||||
<Space className="j-r-flex">
|
<Space className="j-r-flex">
|
||||||
<Button onClick={() => onCancel()}>取 消</Button>
|
<Button onClick={() => onCancel()}>取 消</Button>
|
||||||
<Button onClick={() => form.submit()} type="primary">
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
确 认
|
确 认
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
@ -31,7 +31,7 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [init, setInit] = useState(true);
|
const [init, setInit] = useState(true);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [permissions, setPermissions] = useState<Option[]>([]);
|
const [permissions, setPermissions] = useState<Option[]>([]);
|
||||||
const [actions, setActions] = useState<Option[]>([]);
|
const [actions, setActions] = useState<Option[]>([]);
|
||||||
|
|
||||||
@ -152,6 +152,9 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let pids = [];
|
let pids = [];
|
||||||
let aids = [];
|
let aids = [];
|
||||||
if (values.permission_ids.length === 0 && values.action_ids.length === 0) {
|
if (values.permission_ids.length === 0 && values.action_ids.length === 0) {
|
||||||
@ -164,11 +167,18 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
if (values.action_ids) {
|
if (values.action_ids) {
|
||||||
aids = values.action_ids;
|
aids = values.action_ids;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
const params = aids.concat(pids);
|
const params = aids.concat(pids);
|
||||||
adminRole.updateAdminRole(id, values.name, params).then((res: any) => {
|
adminRole
|
||||||
message.success("保存成功!");
|
.updateAdminRole(id, values.name, params)
|
||||||
onCancel();
|
.then((res: any) => {
|
||||||
});
|
setLoading(false);
|
||||||
|
message.success("保存成功!");
|
||||||
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
@ -186,7 +196,11 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
footer={
|
footer={
|
||||||
<Space className="j-r-flex">
|
<Space className="j-r-flex">
|
||||||
<Button onClick={() => onCancel()}>取 消</Button>
|
<Button onClick={() => onCancel()}>取 消</Button>
|
||||||
<Button onClick={() => form.submit()} type="primary">
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
确 认
|
确 认
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user