mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
Merge branch 'master' of https://github.com/baidu/amis
This commit is contained in:
commit
a8ae10be7e
@ -847,7 +847,9 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
this.hooks['validate'] || [],
|
||||
forceValidate,
|
||||
throwErrors,
|
||||
__(filter(messages && messages.validateFailed, store.data))
|
||||
typeof messages?.validateFailed === 'string'
|
||||
? __(filter(messages.validateFailed, store.data))
|
||||
: undefined
|
||||
)
|
||||
.then((result: boolean) => {
|
||||
if (result) {
|
||||
@ -892,7 +894,9 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
return store.submit(
|
||||
fn,
|
||||
this.hooks['validate'] || [],
|
||||
__(filter(messages && messages.validateFailed, store.data)),
|
||||
typeof messages?.validateFailed === 'string'
|
||||
? __(filter(messages.validateFailed, store.data))
|
||||
: undefined,
|
||||
validateErrCb,
|
||||
throwErrors
|
||||
);
|
||||
@ -1172,8 +1176,14 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
|
||||
return store
|
||||
.saveRemote(action.api || (api as Api), values, {
|
||||
successMessage: filter(saveSuccess, store.data),
|
||||
errorMessage: filter(saveFailed, store.data),
|
||||
successMessage:
|
||||
typeof saveSuccess === 'string'
|
||||
? filter(saveSuccess, store.data)
|
||||
: undefined,
|
||||
errorMessage:
|
||||
typeof saveFailed === 'string'
|
||||
? filter(saveFailed, store.data)
|
||||
: undefined,
|
||||
onSuccess: async (result: Payload) => {
|
||||
// result为提交接口返回的内容
|
||||
const dispatcher = await dispatchEvent(
|
||||
@ -1303,20 +1313,21 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
if (!isEffectiveApi(action.api)) {
|
||||
return env.alert(__(`当 actionType 为 ajax 时,请设置 api 属性`));
|
||||
}
|
||||
let successMsg =
|
||||
(action.messages && action.messages.success) || saveSuccess;
|
||||
let failMsg = (action.messages && action.messages.failed) || saveFailed;
|
||||
|
||||
return store
|
||||
.saveRemote(action.api as Api, data, {
|
||||
successMessage: __(
|
||||
filter(
|
||||
(action.messages && action.messages.success) || saveSuccess,
|
||||
store.data
|
||||
)
|
||||
typeof successMsg === 'string'
|
||||
? filter(successMsg, store.data)
|
||||
: undefined
|
||||
),
|
||||
errorMessage: __(
|
||||
filter(
|
||||
(action.messages && action.messages.failed) || saveFailed,
|
||||
store.data
|
||||
)
|
||||
typeof failMsg === 'string'
|
||||
? filter(failMsg, store.data)
|
||||
: undefined
|
||||
)
|
||||
})
|
||||
.then(async response => {
|
||||
|
Loading…
Reference in New Issue
Block a user