diff --git a/frontend/src/pages/Workflow/Definition/Design/components/NodeConfigModal.tsx b/frontend/src/pages/Workflow/Definition/Design/components/NodeConfigModal.tsx index 9f09ae17..c3ab9ef8 100644 --- a/frontend/src/pages/Workflow/Definition/Design/components/NodeConfigModal.tsx +++ b/frontend/src/pages/Workflow/Definition/Design/components/NodeConfigModal.tsx @@ -61,22 +61,29 @@ const NodeConfigDrawer: React.FC = ({ // 处理 panelVariablesSchema 中定义的字段 if (nodeDefinition?.panelVariablesSchema?.properties) { - Object.keys(nodeDefinition.panelVariablesSchema.properties).forEach(key => { + Object.entries(nodeDefinition.panelVariablesSchema.properties).forEach(([key, property]) => { + // 如果值存在就用表单值,否则用默认值 if (values[key] !== undefined) { panelVariables[key] = values[key]; + } else if ((property as SchemaProperty).default !== undefined) { + panelVariables[key] = (property as SchemaProperty).default; } }); } // 处理 localVariablesSchema 中定义的字段 if (nodeDefinition?.localVariablesSchema?.properties) { - Object.keys(nodeDefinition.localVariablesSchema.properties).forEach(key => { + Object.entries(nodeDefinition.localVariablesSchema.properties).forEach(([key, property]) => { + // 如果值存在就用表单值,否则用默认值 if (values[key] !== undefined) { localVariables[key] = values[key]; + } else if ((property as SchemaProperty).default !== undefined) { + localVariables[key] = (property as SchemaProperty).default; } }); } + onOk({ panelVariables, localVariables @@ -195,7 +202,7 @@ const NodeConfigDrawer: React.FC = ({ return renderFormItem(key, property as SchemaProperty, required, true); }) } - ].filter(Boolean)} /> + ].filter(Boolean)}/> );