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