1
This commit is contained in:
parent
5f924a2f7d
commit
ddcd2ea11b
@ -930,8 +930,13 @@ const WorkflowDesign: React.FC = () => {
|
||||
// 创建节点
|
||||
response.graph?.nodes?.forEach((workflowDefinitionNode: any) => {
|
||||
const node = addNodeToGraph(false, graphInstance, workflowDefinitionNode, nodeDefinitions);
|
||||
// 保存节点配置
|
||||
node.setProp('workflowDefinitionNode', workflowDefinitionNode);
|
||||
// 只设置 graph 属性
|
||||
node.setProp('graph', {
|
||||
uiVariables: workflowDefinitionNode.uiVariables,
|
||||
panelVariables: workflowDefinitionNode.panelVariables,
|
||||
localVariables: workflowDefinitionNode.localVariables,
|
||||
formVariablesSchema: workflowDefinitionNode.formVariablesSchema
|
||||
});
|
||||
nodeMap.set(workflowDefinitionNode.id, node);
|
||||
});
|
||||
|
||||
@ -1043,21 +1048,14 @@ const WorkflowDesign: React.FC = () => {
|
||||
};
|
||||
|
||||
// 处理节点配置更新
|
||||
const handleNodeConfigUpdate = (values: any) => {
|
||||
const handleNodeConfigUpdate = (updatedNodeDefinition: any) => {
|
||||
if (!selectedNode) return;
|
||||
const nodeDefinition = selectedNode.getProp('nodeDefinition');
|
||||
console.log(values)
|
||||
|
||||
// 设置节点的 graph 属性,将所有数据统一放在 graph 下
|
||||
selectedNode.setProp('graph', {
|
||||
uiVariables: nodeDefinition?.uiVariables || {},
|
||||
panelVariables: values.panelVariables,
|
||||
localVariables: values.localVariables,
|
||||
formVariablesSchema: nodeDefinition?.formVariablesSchema || {}
|
||||
});
|
||||
selectedNode.setProp('graph', updatedNodeDefinition);
|
||||
// 更新节点显示名称(如果存在)
|
||||
if (values.panelVariables?.name) {
|
||||
selectedNode.attr('label/text', values.panelVariables.name);
|
||||
if (updatedNodeDefinition.panelVariables?.name) {
|
||||
selectedNode.attr('label/text', updatedNodeDefinition.panelVariables.name);
|
||||
}
|
||||
|
||||
setConfigModalVisible(false);
|
||||
@ -1079,12 +1077,23 @@ const WorkflowDesign: React.FC = () => {
|
||||
// 获取所有节点和边的数据
|
||||
const nodes = graph.getNodes().map(node => {
|
||||
const nodeType = node.getProp('nodeType');
|
||||
const graphData = node.getProp('graph') || {};
|
||||
const {
|
||||
uiVariables,
|
||||
panelVariables,
|
||||
localVariables,
|
||||
formVariablesSchema,
|
||||
...rest
|
||||
} = graphData;
|
||||
return {
|
||||
id: node.id,
|
||||
nodeCode: nodeType,
|
||||
nodeType: nodeType,
|
||||
nodeName: node.attr('label/text'),
|
||||
...node.getProp('graph'),
|
||||
uiVariables,
|
||||
panelVariables,
|
||||
localVariables,
|
||||
formVariablesSchema
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user