优化varinput可选变量的获取逻辑

This commit is contained in:
fofolee
2025-01-07 09:21:53 +08:00
parent 4b3323c5db
commit d3709db4b3
5 changed files with 38 additions and 15 deletions

View File

@@ -43,12 +43,17 @@ export default defineComponent({
// 提供获取当前变量的函数,直接返回解析后的变量列表
const getCurrentVariables = () => {
const variables = [];
for (const cmd of commandFlow.value) {
for (const [index, cmd] of commandFlow.value.entries()) {
if (cmd.saveOutput && cmd.outputVariable) {
variables.push(
...parseVariables(cmd.outputVariable).map((variable) => ({
name: variable,
sourceCommand: cmd,
// 提供来源命令的标志信息
sourceCommand: {
label: cmd.label,
id: cmd.id,
index,
},
}))
);
}