diff --git a/frontend/src/pages/Workflow/Definition/Design/index.tsx b/frontend/src/pages/Workflow/Definition/Design/index.tsx index 9f3a4336..98001fe2 100644 --- a/frontend/src/pages/Workflow/Definition/Design/index.tsx +++ b/frontend/src/pages/Workflow/Definition/Design/index.tsx @@ -165,11 +165,20 @@ const WorkflowDesign: React.FC = () => { }, }; + // 创建节点时设置完整的属性 graph.addNode({ ...nodeConfig, x: point.x, y: point.y, - data: { type: node.type }, + // 保存完整的节点信息 + type: node.type, + code: node.code, + graph: { + shape: node.graphConfig.uiSchema.shape, + size: node.graphConfig.uiSchema.size, + style: node.graphConfig.uiSchema.style, + ports: node.graphConfig.uiSchema.ports + }, // 保存节点定义,用于后续编辑 nodeDefinition: node, }); @@ -201,17 +210,20 @@ const WorkflowDesign: React.FC = () => { try { // 获取所有节点和边的数据 const nodes = graph.getNodes().map(node => { + const nodeDefinition = node.getProp('nodeDefinition'); const nodeType = node.getProp('type'); - const nodeDefinition = NODE_REGISTRY_CONFIG[nodeType]; return { id: node.id, - code: node.getProp('code'), + code: nodeType, // 设置 code 为节点的 type type: nodeType, name: node.attr('label/text'), graph: { shape: nodeDefinition?.graphConfig.uiSchema.shape, - size: node.size(), + size: { + width: node.size().width, + height: node.size().height + }, style: nodeDefinition?.graphConfig.uiSchema.style, ports: nodeDefinition?.graphConfig.uiSchema.ports },