This commit is contained in:
dengqichen 2024-12-20 14:45:24 +08:00
parent 57fb736bfd
commit 4750b9e394

View File

@ -61,22 +61,29 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
// 处理 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