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