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?.options;
delete action.args?.messages; 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', 'adaptor',
'responseAdaptor', 'responseAdaptor',
'requestAdaptor', 'requestAdaptor',
'responseData', 'responseData'
'condition' ];
].includes(key) if (targetComponent?.props?.type === 'input-table') {
); return [...ignoreKey, 'condition'].includes(key);
} else {
return ignoreKey.includes(key);
}
});
const afterMappingData = dataMapping(action.data, mergeData); const afterMappingData = dataMapping(action.data, mergeData);
// 动作数据 // 动作数据
@ -325,6 +334,7 @@ export const runAction = async (
{ {
...action, ...action,
args, args,
component: targetComponent,
data: action.actionType === 'reload' ? actionData : data, // 如果是刷新动作则只传action.data data: action.actionType === 'reload' ? actionData : data, // 如果是刷新动作则只传action.data
...key ...key
}, },

View File

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