feat(web): 增加循环节点子节点的循环入参

This commit is contained in:
2025-07-14 22:41:27 +08:00
parent 04bc9a2c16
commit c7e0b56850

View File

@@ -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,
]