diff --git a/service-web/client/src/components/flow/Helper.tsx b/service-web/client/src/components/flow/Helper.tsx index 3666fda..a5bff2f 100644 --- a/service-web/client/src/components/flow/Helper.tsx +++ b/service-web/client/src/components/flow/Helper.tsx @@ -47,7 +47,19 @@ export const generateAllIncomerOutputVariablesFormOptions: (id: string, inputSch value: key, })) + let currentNode = find(nodes, n => isEqual(id, n.id)) + if (!currentNode) { + return [] + } + let incomerIds = getAllIncomerNodeById(id, nodes, edges) + if (currentNode.parentId) { + incomerIds = [ + ...incomerIds, + ...getAllIncomerNodeById(currentNode.parentId, nodes, edges), + ] + } + let incomerVariables: InputFormOptionsGroup[] = [] for (const incomerId of incomerIds) { let nodeData = data[incomerId] ?? {} @@ -74,6 +86,21 @@ export const generateAllIncomerOutputVariablesFormOptions: (id: string, inputSch variables: inputSchemaVariables, }, ]), + ...(currentNode.parentId ? [ + { + group: '循环入参', + variables: [ + { + label: 'loopIndex (当前迭代索引)', + value: 'loopIndex', + }, + { + label: 'loopItem (当前迭代对象)', + value: 'loopItem', + } + ] + } + ] : []), ...incomerVariables, ]