forked from p96170835/amis
wizard 最后一步的处理逻辑不正确,应该终止 form 中后续逻辑,实际上没有。
This commit is contained in:
parent
f306a59a09
commit
ebc5edbdff
|
@ -603,7 +603,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|||
store.setCurrentAction(action);
|
||||
return this.submit((values): any => {
|
||||
if (onSubmit && onSubmit(values, action) === false) {
|
||||
return Promise.resolve(values);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
if (target) {
|
||||
|
@ -665,6 +665,11 @@ export default class Form extends React.Component<FormProps, object> {
|
|||
return Promise.resolve(values);
|
||||
})
|
||||
.then(values => {
|
||||
// 有可能 onSubmit return false 了,那么后面的就不应该再执行了。
|
||||
if (values === false) {
|
||||
return store.data;
|
||||
}
|
||||
|
||||
if (onFinished && onFinished(values, action) === false) {
|
||||
return values;
|
||||
}
|
||||
|
|
|
@ -552,12 +552,14 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
|||
return value;
|
||||
}
|
||||
|
||||
const finalRedirect = redirect && filter(redirect, store.data);
|
||||
const finalRedirect =
|
||||
(action.redirect || redirect) &&
|
||||
filter(action.redirect || redirect, store.data);
|
||||
|
||||
if (finalRedirect) {
|
||||
env.jumpTo(finalRedirect, action);
|
||||
} else if (reload) {
|
||||
this.reloadTarget(reload, store.data);
|
||||
} else if (action.reload || reload) {
|
||||
this.reloadTarget(action.reload || reload, store.data);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -335,7 +335,7 @@ export const FormStore = ServiceStore.named('FormStore')
|
|||
|
||||
if (fn) {
|
||||
const diff = difference(self.data, self.pristine);
|
||||
yield fn(
|
||||
const result = yield fn(
|
||||
createObject(
|
||||
createObject(self.data.__super, {
|
||||
diff: diff,
|
||||
|
@ -345,12 +345,13 @@ export const FormStore = ServiceStore.named('FormStore')
|
|||
self.data
|
||||
)
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
self.submiting = false;
|
||||
return result ?? self.data;
|
||||
}
|
||||
|
||||
return self.data;
|
||||
} finally {
|
||||
self.submiting = false;
|
||||
}
|
||||
});
|
||||
|
||||
const validate: (
|
||||
|
|
Loading…
Reference in New Issue