diff --git a/src/hooks/useFlowCallbacks.ts b/src/hooks/useFlowCallbacks.ts index d890c30..7111c32 100644 --- a/src/hooks/useFlowCallbacks.ts +++ b/src/hooks/useFlowCallbacks.ts @@ -1105,6 +1105,7 @@ export const useFlowCallbacks = ( if (params.eventListenes.length > 0 || params.eventSends.length > 0) { return params; } + else return null; }; const upDatePublish = async (revertedData) => { const { currentAppData } = store.getState().ideContainer; @@ -1208,8 +1209,8 @@ export const useFlowCallbacks = ( const eventMap = new Map(); edges.forEach((edge: any) => { // 应用组件的桩点id就是事件id - const sourceId = edge.source; - const targetId = edge.target; + const sourceId = edge.sourceHandle; + const targetId = edge.targetHandle; const topic = edge.data.displayData.topic; if (eventMap.has(topic)) { @@ -1231,8 +1232,6 @@ export const useFlowCallbacks = ( eventId: Array.from(new Set(item.eventId)) })); - console.log('appEventParams:', appEventParams); - updateAppFlowData(appFlowParams); if (appEventParams.length > 0) { for (const item of appEventParams) { diff --git a/src/pages/flowEditor/components/nodeContentApp.tsx b/src/pages/flowEditor/components/nodeContentApp.tsx index c85d0e2..635b82c 100644 --- a/src/pages/flowEditor/components/nodeContentApp.tsx +++ b/src/pages/flowEditor/components/nodeContentApp.tsx @@ -43,82 +43,6 @@ const handleStyles = { } }; -// 渲染特殊节点(开始/结束节点)的句柄 -const renderSpecialNodeHandles = (isStartNode: boolean, isEndNode: boolean, dataIns: any[], dataOuts: any[], apiIns: any[], apiOuts: any[]) => { - const renderStartNodeHandles = () => { - if (!isStartNode) return null; - - return ( - <> - {apiOuts.map((_, index) => ( - - ))} - {dataOuts.length > 0 && dataOuts.map((_, index) => ( - - ))} - - ); - }; - - const renderEndNodeHandles = () => { - if (!isEndNode) return null; - - return ( - <> - {apiIns.map((_, index) => ( - - ))} - {dataIns.length > 0 && dataIns.map((_, index) => ( - - ))} - - ); - }; - - return ( - <> - {renderStartNodeHandles()} - {renderEndNodeHandles()} - - ); -}; - // 渲染普通节点的句柄 const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[], apiOuts: any[]) => { return ( @@ -128,7 +52,7 @@ const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[] key={`api-output-handle-${index}`} type="source" position={Position.Right} - id={apiOuts[index].name || apiOuts[index].id || `output-${index}`} + id={apiOuts[index].eventId || `output-${index}`} style={{ ...handleStyles.mainSource, top: `${35 + index * 20}px` @@ -140,7 +64,7 @@ const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[] key={`api-input-handle-${index}`} type="target" position={Position.Left} - id={apiIns[index].name || apiIns[index].id || `input-${index}`} + id={apiIns[index].eventId || `input-${index}`} style={{ ...handleStyles.mainTarget, top: `${35 + index * 20}px` @@ -294,11 +218,6 @@ const NodeContent = ({ data }: { data: NodeContentData }) => { // 获取事件分组信息 const eventGroups = useEventGroups(data.component); - // 判断节点类型 - const isStartNode = data.type === 'start'; - const isEndNode = data.type === 'end'; - const isSpecialNode = isStartNode || isEndNode; - return ( <> {/*content栏-api部分*/} @@ -312,7 +231,7 @@ const NodeContent = ({ data }: { data: NodeContentData }) => { const group = findApiGroupByTopic(input, eventGroups); return (
{ const group = findApiGroupByTopic(output, eventGroups); return (
{ {/*content栏-data部分*/}
- {dataIns.length > 0 && !isStartNode && ( + {dataIns.length > 0 && (
{dataIns.map((input, index) => { // 查找关联的事件分组 @@ -374,7 +293,7 @@ const NodeContent = ({ data }: { data: NodeContentData }) => {
)} - {dataOuts.length > 0 && !isEndNode && ( + {dataOuts.length > 0 && (
{dataOuts.map((output, index) => { // 查找关联的事件分组 @@ -407,9 +326,7 @@ const NodeContent = ({ data }: { data: NodeContentData }) => { {/*)}*/} {/* 根据节点类型渲染不同的句柄 */} - {isSpecialNode - ? renderSpecialNodeHandles(isStartNode, isEndNode, dataIns, dataOuts, apiIns, apiOuts) - : renderRegularNodeHandles(dataIns, dataOuts, apiIns, apiOuts)} + {renderRegularNodeHandles(dataIns, dataOuts, apiIns, apiOuts)} ); }; diff --git a/src/utils/convertAppFlowData.ts b/src/utils/convertAppFlowData.ts index 6480375..7fc6e0d 100644 --- a/src/utils/convertAppFlowData.ts +++ b/src/utils/convertAppFlowData.ts @@ -114,8 +114,8 @@ export const convertAppFlowData = (appFlowData: any[]) => { id: `e-${sourceNode.id}-${targetNode.id}-${outIndex}-${inIndex}`, source: sourceNode.id, target: targetNode.id, - sourceHandle: sourceEvent.eventName, - targetHandle: targetEvent.eventName, + sourceHandle: sourceEvent.eventId, + targetHandle: targetEvent.eventId, type: 'custom', data: { displayData: {