各添加、编辑页面的确认loading问题

This commit is contained in:
unknown
2023-09-06 10:11:21 +08:00
parent 84fe2ecab1
commit acc767f11b
10 changed files with 84 additions and 17 deletions

View File

@@ -22,7 +22,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
onCancel,
}) => {
const [form] = Form.useForm();
const [loading, setLoading] = useState(true);
const [loading, setLoading] = useState(false);
const [roles, setRoles] = useState<selRoleModel[]>([]);
useEffect(() => {
@@ -60,6 +60,10 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
};
const onFinish = (values: any) => {
if (loading) {
return;
}
setLoading(true);
adminUser
.storeAdminUser(
values.name,
@@ -69,8 +73,12 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
values.roleIds
)
.then((res: any) => {
setLoading(false);
message.success("保存成功!");
onCancel();
})
.catch((e) => {
setLoading(false);
});
};
@@ -100,6 +108,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
onOk={() => form.submit()}
onCancel={() => onCancel()}
maskClosable={false}
okButtonProps={{ loading: loading }}
>
<div className="float-left mt-24">
<Form