mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 19:17:54 +08:00
可视化选择请求结果数据、状态、提示
Change-Id: I048017d1772e31e20cab183f5a5ba46fcf7e9801
This commit is contained in:
parent
4fbd0e3a25
commit
f106e0ac45
@ -453,7 +453,13 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
|
||||
mode: 'inline',
|
||||
className: 'm-r-none',
|
||||
value: false,
|
||||
remark: BaseLabelMark('勾选后,服务请求将以静默模式发送,即不会弹出成功或报错提示。')
|
||||
remark: {
|
||||
className: 'ae-BaseRemark',
|
||||
icon: 'fa fa-question-circle',
|
||||
shape: "circle",
|
||||
placement: "left",
|
||||
content: '勾选后,服务请求将以静默模式发送,即不会弹出成功或报错提示。'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -471,7 +477,26 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
outputVarDataSchema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
'event.data.${outputVar}.responseData': {
|
||||
type: 'object',
|
||||
title: '数据'
|
||||
},
|
||||
'event.data.${outputVar}.responseStatus': {
|
||||
type: 'number',
|
||||
title: '状态标识'
|
||||
},
|
||||
'event.data.${outputVar}.responseMsg': {
|
||||
type: 'string',
|
||||
title: '提示信息'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
actionLabel: '下载文件',
|
||||
|
@ -446,7 +446,7 @@ export class EventControl extends React.Component<
|
||||
// 收集当前事件已有ajax动作的请求返回结果作为事件变量
|
||||
let oldActions = onEvent[activeData.actionData!.eventKey].actions;
|
||||
if (activeData.type === 'update') {
|
||||
// 编辑的时候只能拿到当前动作前面动作的时间变量
|
||||
// 编辑的时候只能拿到当前动作前面动作的事件变量
|
||||
oldActions = oldActions.slice(0, activeData.actionData!.actionIndex);
|
||||
}
|
||||
|
||||
@ -459,27 +459,21 @@ export class EventControl extends React.Component<
|
||||
pluginActions,
|
||||
commonActions
|
||||
);
|
||||
const dataSchemaJson = getPropOfAcion(
|
||||
item,
|
||||
'outputVarDataSchema',
|
||||
actionTree,
|
||||
pluginActions,
|
||||
commonActions
|
||||
);
|
||||
const dataSchema = new DataSchema(dataSchemaJson || []);
|
||||
return {
|
||||
label: `${item.outputVar ? item.outputVar + `(${actionLabel}结果)` : `${actionLabel}结果`}`,
|
||||
tag: 'object',
|
||||
children: [
|
||||
{
|
||||
label: `请求结果数据`,
|
||||
tag: 'object',
|
||||
type: 'object',
|
||||
value: `${item.outputVar ? ('event.data.' + item.outputVar) : 'event.data.responseResult'}.data`
|
||||
},
|
||||
{
|
||||
label: `请求结果状态`,
|
||||
tag: 'number',
|
||||
value: `${item.outputVar ? ('event.data.' + item.outputVar) : 'event.data.responseResult'}.status`
|
||||
},
|
||||
{
|
||||
label: `请求结果消息`,
|
||||
tag: 'string',
|
||||
value: `${item.outputVar ? ('event.data.' + item.outputVar) : 'event.data.responseResult'}.msg`
|
||||
}
|
||||
]
|
||||
children: dataSchema.getDataPropsAsOptions()?.map(variable => ({
|
||||
...variable,
|
||||
value: variable.value.replace('${outputVar}', item.outputVar)
|
||||
}))
|
||||
};
|
||||
});
|
||||
const eventVariables: ContextVariables[] = [
|
||||
|
Loading…
Reference in New Issue
Block a user