diff --git a/src/pages/flowEditor/components/nodeContentLocal.tsx b/src/pages/flowEditor/components/nodeContentLocal.tsx index 5463d5e..84498d5 100644 --- a/src/pages/flowEditor/components/nodeContentLocal.tsx +++ b/src/pages/flowEditor/components/nodeContentLocal.tsx @@ -210,15 +210,15 @@ const formatFooter = (data: any, eventListOld = []) => { if (topic.includes('**empty**')) return ''; return `事件: ${name}`; } - case 'EVENTSEND_SYNC': - const parsedData1 = isJSON(data.customDef) ? JSON.parse(data.customDef) : null; - if (parsedData1) { - const { eventName } = parsedData1; - return `事件: ${eventName}`; - } - else { - return ''; - } + // case 'EVENTSEND_SYNC': + // const parsedData1 = isJSON(data.customDef) ? JSON.parse(data.customDef) : null; + // if (parsedData1) { + // const { eventName } = parsedData1; + // return `事件: ${eventName}`; + // } + // else { + // return ''; + // } case 'BASIC': case 'BASIC_LOOP': return data.compIdentifier ? `当前实例:${data.compIdentifier}` : ''; diff --git a/src/utils/convertFlowData.ts b/src/utils/convertFlowData.ts index 7cd3c88..f650169 100644 --- a/src/utils/convertFlowData.ts +++ b/src/utils/convertFlowData.ts @@ -129,7 +129,6 @@ export const convertFlowData = (flowData: any, useDefault = true) => { } else { nodeType = nodeConfig.component?.type || 'BASIC'; } - // 解析位置信息 const position = nodeConfig.position || { x: 0, y: 0 }; @@ -143,7 +142,7 @@ export const convertFlowData = (flowData: any, useDefault = true) => { parameters: { apiIns: getNodeApiIns(nodeId, nodeConfig, currentProjectCompData), apiOuts: getNodeApiOuts(nodeId, nodeConfig, currentProjectCompData), - dataIns: nodeConfig.dataIns || [], + dataIns: getNodeDataIns(nodeConfig), dataOuts: nodeConfig.dataOuts || [], }, type: nodeConfig.component?.type || nodeType, @@ -725,6 +724,27 @@ export const reverseConvertFlowData = ( return flowData; }; +// 获取节点的数据输入参数 +const getNodeDataIns = (nodeConfig: any) => { + if (Array.isArray(nodeConfig.dataIns) && nodeConfig.dataIns.length > 0) { + return nodeConfig.dataIns; + } + + if (nodeConfig.component?.type === 'EVENTSEND_SYNC') { + return [ + { + arrayType: null, + dataType: 'STRING', + defaultValue: '', + desc: '输入', + id: 'in', + }, + ]; + } + + return []; +}; + // 获取节点的API输入参数 const getNodeApiIns = ( nodeId: string,