From 70f6333596fa021548edad58c92a61d9ed70b0d9 Mon Sep 17 00:00:00 2001 From: ZLY Date: Fri, 6 Feb 2026 15:30:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(flowEditor):=20=E5=B0=86=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E8=8A=82=E7=82=B9=E5=92=8C=E7=BB=93=E6=9D=9F=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E4=BB=8E=E9=80=9A=E7=94=A8=E7=BB=84=E4=BB=B6=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FlowEditor/node/endNode/EndNode.tsx | 10 +++++----- src/components/FlowEditor/node/startNode/StartNode.tsx | 4 ++-- src/pages/flowEditor/components/nodeContentLocal.tsx | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/FlowEditor/node/endNode/EndNode.tsx b/src/components/FlowEditor/node/endNode/EndNode.tsx index 55d60f9..f0b44ec 100644 --- a/src/components/FlowEditor/node/endNode/EndNode.tsx +++ b/src/components/FlowEditor/node/endNode/EndNode.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less'; -import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; +import NodeContentLocal from '@/pages/flowEditor/components/nodeContentLocal'; import { useStore } from '@xyflow/react'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType'; import NodeStatusIndicator, { NodeStatus } from '@/components/FlowEditor/NodeStatusIndicator'; @@ -15,12 +15,12 @@ const EndNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => { ); // 获取节点运行状态 - const nodeStatus: NodeStatus = useFlowStore((state) => + const nodeStatus: NodeStatus = useFlowStore((state) => (state.nodeLookup.get(id)?.data?.status as NodeStatus) || 'waiting' ); - + // 获取运行状态可见性 - const isStatusVisible = useFlowStore((state) => + const isStatusVisible = useFlowStore((state) => !!state.nodeLookup.get(id)?.data?.isStatusVisible ); @@ -30,7 +30,7 @@ const EndNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => { {title} - + ); }; diff --git a/src/components/FlowEditor/node/startNode/StartNode.tsx b/src/components/FlowEditor/node/startNode/StartNode.tsx index 97417b9..4c96155 100644 --- a/src/components/FlowEditor/node/startNode/StartNode.tsx +++ b/src/components/FlowEditor/node/startNode/StartNode.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less'; -import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; +import NodeContentLocal from '@/pages/flowEditor/components/nodeContentLocal'; import { useStore } from '@xyflow/react'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType'; import NodeStatusIndicator, { NodeStatus } from '@/components/FlowEditor/NodeStatusIndicator'; @@ -30,7 +30,7 @@ const StartNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => { {title} - + ); }; diff --git a/src/pages/flowEditor/components/nodeContentLocal.tsx b/src/pages/flowEditor/components/nodeContentLocal.tsx index c50c57f..5463d5e 100644 --- a/src/pages/flowEditor/components/nodeContentLocal.tsx +++ b/src/pages/flowEditor/components/nodeContentLocal.tsx @@ -67,10 +67,10 @@ const renderSpecialNodeHandles = (isStartNode: boolean, isEndNode: boolean, data key={`output-handle-${index}`} type="source" position={Position.Right} - id={dataOuts[index].name || `output-${index}`} + id={dataOuts[index].name|| dataOuts[index].id || `output-${index}`} style={{ ...handleStyles.data, - top: `${70 + apiIns.length * 20 + index * 20}px` + top: `${70 + apiOuts.length * 20 + index * 20}px` }} /> ))} @@ -100,7 +100,7 @@ const renderSpecialNodeHandles = (isStartNode: boolean, isEndNode: boolean, data key={`input-handle-${index}`} type="target" position={Position.Left} - id={dataIns[index].name || `input-${index}`} + id={dataIns[index].name || dataIns[index].id || `input-${index}`} style={{ ...handleStyles.data, top: `${70 + apiIns.length * 20 + index * 20}px`