feat(convertFlowData): 开始/结束节点增加简单的唯一值

master
钟良源 1 month ago
parent 1560907ce1
commit d3d95b13ba

@ -25,11 +25,12 @@ export const convertFlowData = (flowData: any, useDefault = true) => {
if (!flowData || Object.keys(flowData).length === 0) {
// 如果useDefault为true且flowData为空则返回默认的开始和结束节点
const timestamp = Date.now();
if (useDefault) {
return {
nodes: [
{
id: 'start',
id: `start-${timestamp}`,
type: 'start',
position: { x: 200, y: 200 },
data: {
@ -44,7 +45,7 @@ export const convertFlowData = (flowData: any, useDefault = true) => {
}
},
{
id: 'end',
id: `end-${timestamp}`,
type: 'end',
position: { x: 600, y: 200 },
data: {
@ -107,10 +108,10 @@ export const convertFlowData = (flowData: any, useDefault = true) => {
// 确定节点类型
let nodeType = 'BASIC';
if (nodeId === 'start') {
if (nodeId.includes('start')) {
nodeType = 'start';
}
else if (nodeId === 'end') {
else if (nodeId.includes('end')) {
nodeType = 'end';
}
else if (nodeConfig.component?.type === 'LOOP_START' || nodeConfig.component?.type === 'LOOP_END') {
@ -405,10 +406,10 @@ export const revertFlowData = (nodes: any[], edges: any[]) => {
// 确定节点类型
let nodeType = node.data.type;
// 特殊处理 start 和 end 节点
if (nodeId === 'start') {
if (nodeId.includes('start')) {
nodeType = 'start';
}
else if (nodeId === 'end') {
else if (nodeId.includes('end')) {
nodeType = 'end';
}
@ -666,7 +667,7 @@ const getNodeApiIns = (nodeId: string, nodeConfig: any, currentProjectCompData:
else if (nodeConfig.component?.type === 'LOOP_END') {
return [{ name: 'continue', desc: '', dataType: '', defaultValue: '' }];
}
else if (nodeId === 'end') {
else if (nodeId.includes('end')) {
return [{ name: 'end', desc: '', dataType: '', defaultValue: '' }];
}
else {
@ -748,10 +749,10 @@ const getNodeApiOuts = (nodeId: string, nodeConfig: any, currentProjectCompData:
return [{ name: 'done', desc: '', dataType: '', defaultValue: '' }];
}
}
else if (nodeId === 'start') {
else if (nodeId.includes('start')) {
return [{ name: 'start', desc: '', dataType: '', defaultValue: '' }];
}
else if (nodeId === 'end') {
else if (nodeId.includes('end')) {
return [];
}
else {
@ -777,10 +778,10 @@ const getNodeApiOutHandle = (nodeId: string, nodeConfig: any) => {
else if (nodeConfig.component?.type === 'LOOP_END') {
return 'break';
}
else if (nodeId === 'start') {
else if (nodeId.includes('start')) {
return 'start';
}
else if (nodeId === 'end') {
else if (nodeId.includes('end')) {
return 'end';
}
return 'done';

Loading…
Cancel
Save