feat(web): 增加循环节点子节点的循环入参
This commit is contained in:
@@ -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,
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user