feat(ui): enhance WorkflowNew

This commit is contained in:
Fu Diwei
2025-01-03 21:31:17 +08:00
parent 5ce5a08e41
commit 52ee3863ae
5 changed files with 120 additions and 34 deletions

View File

@@ -56,12 +56,20 @@ const DrawerForm = <T extends NonNullable<unknown> = NonNullable<unknown>>({
} = useAntdForm({
form,
onSubmit: async (values) => {
const ret = await onFinish?.(values);
if (ret != null && !ret) return false;
return true;
try {
const ret = await onFinish?.(values);
if (ret != null && !ret) return false;
return true;
} catch {
return false;
}
},
});
const mergedFormProps = { ...formProps, ...props };
const mergedFormProps = {
preserve: drawerProps?.destroyOnClose ? false : undefined,
...formProps,
...props,
};
const handleOkClick = async () => {
const ret = await submit();

View File

@@ -67,12 +67,20 @@ const ModalForm = <T extends NonNullable<unknown> = NonNullable<unknown>>({
} = useAntdForm({
form,
onSubmit: async (values) => {
const ret = await onFinish?.(values);
if (ret != null && !ret) return false;
return true;
try {
const ret = await onFinish?.(values);
if (ret != null && !ret) return false;
return true;
} catch {
return false;
}
},
});
const mergedFormProps = { ...formProps, ...props };
const mergedFormProps = {
preserve: modalProps?.destroyOnClose ? false : undefined,
...formProps,
...props,
};
const handleOkClick = async () => {
const ret = await submit();