mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #7253 from miaoxinyu01/feat-event-action-stop
feat:【事件动作】发送请求动作,阻断条件支持获取请求结果数据
This commit is contained in:
commit
0eac2f5182
@ -239,14 +239,6 @@ export const runAction = async (
|
||||
false
|
||||
);
|
||||
}
|
||||
let stopPropagation = false;
|
||||
if (actionConfig.stopPropagation) {
|
||||
stopPropagation = await evalExpressionWithConditionBuilder(
|
||||
actionConfig.stopPropagation,
|
||||
mergeData,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
let key = {
|
||||
componentId: dataMapping(actionConfig.componentId, mergeData),
|
||||
@ -288,7 +280,7 @@ export const runAction = async (
|
||||
console.group?.(`run action ${actionConfig.actionType}`);
|
||||
console.debug(`[${actionConfig.actionType}] action args, data`, args, data);
|
||||
|
||||
let stoped = false;
|
||||
let stopped = false;
|
||||
const actionResult = await actionInstrance.run(
|
||||
{
|
||||
...actionConfig,
|
||||
@ -302,7 +294,16 @@ export const runAction = async (
|
||||
);
|
||||
// 二次确认弹窗如果取消,则终止后续动作
|
||||
if (actionConfig?.actionType === 'confirmDialog' && !actionResult) {
|
||||
stoped = true;
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
let stopPropagation = false;
|
||||
if (actionConfig.stopPropagation) {
|
||||
stopPropagation = await evalExpressionWithConditionBuilder(
|
||||
actionConfig.stopPropagation,
|
||||
mergeData,
|
||||
false
|
||||
);
|
||||
}
|
||||
console.debug(`[${actionConfig.actionType}] action end event`, event);
|
||||
console.groupEnd?.();
|
||||
@ -310,5 +311,5 @@ export const runAction = async (
|
||||
// 阻止原有动作执行
|
||||
preventDefault && event.preventDefault();
|
||||
// 阻止后续动作执行
|
||||
(stopPropagation || stoped) && event.stopPropagation();
|
||||
(stopPropagation || stopped) && event.stopPropagation();
|
||||
};
|
||||
|
@ -502,9 +502,9 @@ export class EventControl extends React.Component<
|
||||
// 收集当前事件动作出参
|
||||
let actions = onEvent[data.actionData!.eventKey].actions;
|
||||
|
||||
// 编辑的时候只能拿到当前动作前面动作的事件变量
|
||||
// 编辑的时候只能拿到当前动作前面动作的事件变量以及当前动作事件
|
||||
if (data.type === 'update') {
|
||||
actions = actions.slice(0, data.actionData!.actionIndex);
|
||||
actions = actions.slice(0, data.actionData!.actionIndex !== undefined ? data.actionData!.actionIndex + 1 : 0);
|
||||
}
|
||||
|
||||
let jsonSchema = {...(eventConfig?.dataSchema?.[0] ?? {})};
|
||||
|
Loading…
Reference in New Issue
Block a user