From c7e0b5685036695f14b7ceb81d929105c3318989 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Mon, 14 Jul 2025 22:41:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E5=A2=9E=E5=8A=A0=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E8=8A=82=E7=82=B9=E5=AD=90=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=85=A5=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/src/components/flow/Helper.tsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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, ]