diff --git a/frontend/src/pages/Workflow/NodeDesign/Design.tsx b/frontend/src/pages/Workflow/NodeDesign/Design.tsx
index 6039b830..b1d4e529 100644
--- a/frontend/src/pages/Workflow/NodeDesign/Design.tsx
+++ b/frontend/src/pages/Workflow/NodeDesign/Design.tsx
@@ -51,6 +51,9 @@ const FormRenderer: React.FC<{
}> = ({ schema, path = '', readOnly = false }) => {
if (!schema || !schema.properties) return null;
+ console.log('Current path:', path);
+ console.log('Properties:', Object.keys(schema.properties));
+
const renderPortConfig = (portSchema: any, portPath: string) => {
if (!portSchema || !portSchema.properties) return null;
@@ -67,6 +70,7 @@ const FormRenderer: React.FC<{
}
tooltip={position.description}
required={portSchema.required?.includes('position')}
+ initialValue={'default' in position ? position.default : undefined}
style={{ marginBottom: 16 }}
>
{readOnly ? (
@@ -102,102 +106,11 @@ const FormRenderer: React.FC<{
);
};
- // 检查是否是顶层配置
- const isTopLevel = !path;
- const hasNodeConfigs = isTopLevel &&
- schema.properties.size &&
- schema.properties.shape &&
- schema.properties.style;
-
return (
- {hasNodeConfigs ? (
-
-
-
-
-
-
-
-
-
- {schema.properties.shape.title}
-
- }
- tooltip={schema.properties.shape.description}
- required={schema.required?.includes('shape')}
- style={{ marginBottom: 16 }}
- >
- {readOnly ? (
- {schema.properties.shape.default || '-'}
- ) : (
- renderField(schema.properties.shape)
- )}
-
-
-
-
-
-
-
-
-
- ) : null}
-
{Object.entries(schema.properties).map(([key, value]: [string, any]) => {
- // 如果是已经在上面渲染的配置,则跳过
- if (hasNodeConfigs && (key === 'size' || key === 'shape' || key === 'style')) {
- return null;
- }
-
const fieldPath = path ? `${path}.${key}` : key;
+ console.log('Field path:', fieldPath, 'Type:', value.type);
if (value.type === 'object') {
// 特殊处理端口组配置
@@ -284,6 +197,7 @@ const FormRenderer: React.FC<{
}
tooltip={value.description}
required={schema.required?.includes(key)}
+ initialValue={'default' in value ? value.default : undefined}
style={{ marginBottom: 16 }}
>
{readOnly ? (
@@ -336,36 +250,22 @@ const NodeDesignForm: React.FC = () => {
};
// 处理节点选择
- const handleNodeSelect = (nodeCode: string) => {
- const node = nodeDefinitionsDefined.find(n => n.nodeCode === nodeCode);
- if (node) {
- setSelectedNode(node);
- const availableTabs = getAvailableTabs(node);
- if (availableTabs.length > 0) {
- setActiveTab(availableTabs[0].key);
- }
- form.resetFields();
- }
+ const handleNodeSelect = (node: NodeDesignData) => {
+ setSelectedNode(node);
+ form.resetFields();
};
- // 处理Tab切换
+ // 处理 Tab 切换
const handleTabChange = (key: string) => {
setActiveTab(key);
+ form.resetFields();
};
- // 获取当前schema
- const getCurrentSchema = () => {
- if (!selectedNode) return null;
- const currentTab = TAB_CONFIG.find(tab => tab.key === activeTab);
- if (!currentTab) return null;
- return selectedNode[currentTab.schemaKey as keyof NodeDesignData];
- };
-
- // 处理表单提交
+ // 处理保存
const handleSave = async () => {
try {
const values = await form.validateFields();
- console.log('表单数据:', values);
+ console.log('Form values:', values);
message.success('保存成功');
} catch (error) {
console.error('表单验证失败:', error);
@@ -373,20 +273,30 @@ const NodeDesignForm: React.FC = () => {
}
};
+ // 获取当前 schema
+ const getCurrentSchema = () => {
+ if (!selectedNode) return null;
+ const currentTab = TAB_CONFIG.find(tab => tab.key === activeTab);
+ if (!currentTab) return null;
+ return selectedNode[currentTab.schemaKey as keyof NodeDesignData];
+ };
+
return (
- 保存
-
- ]}
+ header={{
+ title: '节点设计',
+ extra: [
+
+ ],
+ }}
>
-
+
{
节点类型