fix: 只有input-table才会豁免actions.args.condition

This commit is contained in:
pianruijie 2023-11-23 20:45:10 +08:00
parent be01d6b3e3
commit 035d287650
2 changed files with 18 additions and 12 deletions

View File

@ -285,17 +285,26 @@ export const runAction = async (
delete action.args?.options;
delete action.args?.messages;
}
const cmptFlag = key.componentId || key.componentName;
let targetComponent = cmptFlag
? event.context.scoped?.[
action.componentId ? 'getComponentById' : 'getComponentByName'
](cmptFlag)
: renderer;
// 动作配置
const args = dataMapping(action.args, mergeData, key =>
[
const args = dataMapping(action.args, mergeData, (key: string) => {
const ignoreKey = [
'adaptor',
'responseAdaptor',
'requestAdaptor',
'responseData',
'condition'
].includes(key)
);
'responseData'
];
if (targetComponent?.props?.type === 'input-table') {
return [...ignoreKey, 'condition'].includes(key);
} else {
return ignoreKey.includes(key);
}
});
const afterMappingData = dataMapping(action.data, mergeData);
// 动作数据
@ -325,6 +334,7 @@ export const runAction = async (
{
...action,
args,
component: targetComponent,
data: action.actionType === 'reload' ? actionData : data, // 如果是刷新动作则只传action.data
...key
},

View File

@ -51,11 +51,7 @@ export class CmptAction implements RendererAction {
}
// 如果key没指定则默认是当前组件
let component = key
? event.context.scoped?.[
action.componentId ? 'getComponentById' : 'getComponentByName'
](key)
: renderer;
let component = action.component;
// 如果key指定来但是没找到组件则报错
if (key && !component) {