From 00e562e1a8129986e9a84eb052b62b6920a38c31 Mon Sep 17 00:00:00 2001 From: ZLY Date: Fri, 19 Sep 2025 15:17:57 +0800 Subject: [PATCH] =?UTF-8?q?pref(flowEditor):=20=E8=B0=83=E6=95=B4=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97=E7=9A=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=8A=82=E7=82=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/flowEditor/components/nodeContent.tsx | 1 - src/pages/flowEditor/components/nodeContentOther.tsx | 1 - src/pages/flowEditor/components/nodeEditModal.tsx | 10 +++++++--- src/pages/flowEditor/index.tsx | 10 +++++++++- src/pages/flowEditor/node/style/baseOther.module.less | 3 ++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/pages/flowEditor/components/nodeContent.tsx b/src/pages/flowEditor/components/nodeContent.tsx index f2f7793..61d4c5c 100644 --- a/src/pages/flowEditor/components/nodeContent.tsx +++ b/src/pages/flowEditor/components/nodeContent.tsx @@ -179,7 +179,6 @@ const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[] }; const formatFooter = (data: any) => { - console.log('formatFooter:', data); switch (data.type) { case 'WAIT': const { duration } = data.customDef; diff --git a/src/pages/flowEditor/components/nodeContentOther.tsx b/src/pages/flowEditor/components/nodeContentOther.tsx index a07df96..4bdfa3f 100644 --- a/src/pages/flowEditor/components/nodeContentOther.tsx +++ b/src/pages/flowEditor/components/nodeContentOther.tsx @@ -179,7 +179,6 @@ const renderRegularNodeHandles = (dataIns: any[], dataOuts: any[], apiIns: any[] }; const formatFooter = (data: any) => { - console.log('formatFooter:', data); switch (data.type) { case 'WAIT': const { duration } = data.customDef; diff --git a/src/pages/flowEditor/components/nodeEditModal.tsx b/src/pages/flowEditor/components/nodeEditModal.tsx index 62e52b5..812661d 100644 --- a/src/pages/flowEditor/components/nodeEditModal.tsx +++ b/src/pages/flowEditor/components/nodeEditModal.tsx @@ -16,6 +16,7 @@ interface NodeEditModalProps { popupContainer: any; node: Node; isOpen: boolean; + isDelete: boolean; onSave: (data: any) => void; onClose: () => void; } @@ -24,6 +25,7 @@ const NodeEditModal: React.FC = ({ popupContainer, node, isOpen, + isDelete, onSave, onClose }) => { @@ -82,9 +84,11 @@ const NodeEditModal: React.FC = ({ return ( = ({ footer={null} getPopupContainer={() => popupContainer?.current || document.body} onOk={handleSave} - onCancel={handleSave} + onCancel={isDelete ? handleClose : handleSave} > {getNodeEditor()} diff --git a/src/pages/flowEditor/index.tsx b/src/pages/flowEditor/index.tsx index ece98a6..710787d 100644 --- a/src/pages/flowEditor/index.tsx +++ b/src/pages/flowEditor/index.tsx @@ -67,6 +67,7 @@ const FlowEditor: React.FC = () => { // 添加编辑弹窗相关状态 const [editingNode, setEditingNode] = useState(null); const [isEditModalOpen, setIsEditModalOpen] = useState(false); + const [isDelete, setIsDelete] = useState(false); // 添加节点选择弹窗状态 const [edgeForNodeAdd, setEdgeForNodeAdd] = useState(null); @@ -164,6 +165,11 @@ const FlowEditor: React.FC = () => { [edges] ); + const onNodesDelete = useCallback((deletedNodes) => { + setIsDelete(true); + closeEditModal(); + }, []); + const onConnect = useCallback( (params: any) => { // 获取源节点和目标节点 @@ -631,6 +637,7 @@ const FlowEditor: React.FC = () => { edgeTypes={edgeTypes} snapToGrid={true} snapGrid={[2, 2]} + onNodesDelete={onNodesDelete} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} @@ -739,11 +746,12 @@ const FlowEditor: React.FC = () => { )} - {/*节点双击/节点编辑上下文*/} + {/*节点点击/节点编辑上下文*/} diff --git a/src/pages/flowEditor/node/style/baseOther.module.less b/src/pages/flowEditor/node/style/baseOther.module.less index d5b0b04..0c64bcc 100644 --- a/src/pages/flowEditor/node/style/baseOther.module.less +++ b/src/pages/flowEditor/node/style/baseOther.module.less @@ -86,7 +86,8 @@ background-color: #ffffff; color: #000000; padding: 5px 20px; - border-top: 1px solid rgba(204, 204, 204, 0.18); + border: 1px solid #cccccc; + border-top: none; min-height: 20px; text-align: center; }