From 61ff98737d07e75f8f9dba1d7c658607cc8d173e Mon Sep 17 00:00:00 2001 From: dengqichen Date: Fri, 5 Dec 2025 13:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0GIT=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Design/components/EdgeConfigModal.tsx | 56 ++--- .../components/KeyboardShortcutsPanel.tsx | 5 +- .../Design/components/NodeConfigModal.tsx | 2 +- .../Workflow/Design/hooks/useWorkflowSave.ts | 21 +- frontend/src/pages/Workflow/Design/index.tsx | 16 +- .../Design/utils/gatewayValidation.ts | 192 ++++++++++++++---- 6 files changed, 202 insertions(+), 90 deletions(-) diff --git a/frontend/src/pages/Workflow/Design/components/EdgeConfigModal.tsx b/frontend/src/pages/Workflow/Design/components/EdgeConfigModal.tsx index 1d1d2ce5..8c9c87d2 100644 --- a/frontend/src/pages/Workflow/Design/components/EdgeConfigModal.tsx +++ b/frontend/src/pages/Workflow/Design/components/EdgeConfigModal.tsx @@ -121,14 +121,8 @@ const EdgeConfigModal: React.FC = ({ const expr = values.expression?.trim(); const isDefault = !expr; - // 1. 检查多个默认分支 + // 1. 检查多个默认分支(已在UI上显示红色警告框,此处直接阻止提交) if (isDefault && hasOtherDefaultBranch) { - toast({ - variant: 'destructive', - title: '冲突:多个默认分支', - description: `节点"${sourceNode?.data.label}"已有默认分支。一个节点只能有一个默认分支,请为此分支配置条件表达式。`, - duration: 5000, - }); return; } @@ -260,20 +254,21 @@ const EdgeConfigModal: React.FC = ({ )} - {/* 🔴 错误提示:多个默认分支(网关节点) */} + {/* 错误提示:多个默认分支(网关节点) */} {isFromGateway && gatewayType && gatewayType !== 'parallelGateway' && hasOtherDefaultBranch && isDefaultBranch && ( -
+
- -
-

+

+ + + +
+
+

已存在默认分支

-

- 一个{gatewayType === 'exclusiveGateway' ? '排他' : '包容'}网关只能有一个默认分支!其他分支必须配置条件表达式。 -

-

- 💡 建议操作:将此分支设置为"表达式"类型,并配置条件表达式。 +

+ 当前网关已有一个默认分支,请将此分支设置为"表达式"类型并配置条件表达式。

@@ -281,23 +276,10 @@ const EdgeConfigModal: React.FC = ({ )} - {/* 并行网关:直接显示说明,不允许配置条件 */} + {/* 并行网关:简洁提示 */} {isFromGateway && gatewayType === 'parallelGateway' ? ( -
-
- -
-

- 并行网关分支(自动执行) -

-

- 并行网关的所有分支会同时执行,无需配置条件表达式、优先级或默认路径。 -

-

- 💡 此分支将自动执行,与其他分支并行运行(Fork 模式)。 -

-
-
+
+

并行网关的所有分支自动执行,无需配置条件。

) : (
@@ -319,8 +301,8 @@ const EdgeConfigModal: React.FC = ({
)} - {/* ✅ 错误提示:多个默认分支 */} - {isDefaultBranch && hasOtherDefaultBranch && ( + {/* ✅ 错误提示:多个默认分支(仅非网关节点) */} + {!isFromGateway && isDefaultBranch && hasOtherDefaultBranch && (
@@ -399,9 +381,9 @@ const EdgeConfigModal: React.FC = ({ - {/* 并行网关不需要确定按钮,只需要关闭 */} + {/* 并行网关不需要确定按钮 */} {(!isFromGateway || gatewayType !== 'parallelGateway') && (