From acbf601e7af287db143584353fe00c01bce94d2f Mon Sep 17 00:00:00 2001 From: chenxing Date: Sat, 10 Oct 2026 18:52:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(condition):=20=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E2=80=94=E2=80=94=E5=88=A4=E6=96=AD=E6=96=B9=E5=BC=8F=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20+=20=E5=87=BA=E5=8F=A3=E6=9D=A1=E4=BB=B6=E5=B0=B1?= =?UTF-8?q?=E5=9C=B0=E7=BC=96=E8=BE=91=20+=20=E8=A1=A8=E8=BE=BE=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ConditionNode 增 judgeMode/conditions(SERVICE 缺省,旧定义天然兼容);DefEdgeJson/DefNodeJson 透传 condition/judgeMode - convert.ts 双向透传:CONDITION 分支首边带 condition,序列化顺序=分支顺序(求值优先级保序) - ConditionDrawer 判断方式 Radio(服务/表达式);ConditionBox 表达式模式分支头部条件输入(序号即优先级) - validate.ts 镜像校验:表达式模式每出口条件必填(语法由后端发布期拦) - Routers 页加「表达式调试」Modal(/admin/router/eval,与线上同一求值核心) - addBranch/removeBranch 同步维护 conditions 占位 --- src/api/module/flow.ts | 4 ++ src/views/flow/admin/Routers.vue | 59 +++++++++++++++++++ .../def-editor/components/ConditionBox.vue | 47 +++++++++++++-- .../def-editor/components/ConditionDrawer.vue | 45 ++++++++++++-- src/views/flow/admin/def-editor/convert.ts | 26 ++++++-- src/views/flow/admin/def-editor/index.vue | 6 ++ src/views/flow/admin/def-editor/model.ts | 24 ++++++-- src/views/flow/admin/def-editor/validate.ts | 14 ++++- 8 files changed, 205 insertions(+), 20 deletions(-) diff --git a/src/api/module/flow.ts b/src/api/module/flow.ts index f810b0f..e7736b9 100644 --- a/src/api/module/flow.ts +++ b/src/api/module/flow.ts @@ -236,6 +236,10 @@ class FlowApi { instanceReroute(instanceId: number | string) { return post(`${ROOT}/admin/instance/${instanceId}/reroute`); } + /** 表达式调试求值(2026-10-10:与运行时同一求值核心;不落库不走流程) */ + routerEval(body: { expression: string; variablesJson?: string }) { + return post(`${ROOT}/admin/router/eval`, body); + } // ==================== 管理面:办件查询 ==================== adminInstances(params: { status?: number; keyword?: string; page?: number; size?: number }) { diff --git a/src/views/flow/admin/Routers.vue b/src/views/flow/admin/Routers.vue index 831ae62..5f1d813 100644 --- a/src/views/flow/admin/Routers.vue +++ b/src/views/flow/admin/Routers.vue @@ -131,6 +131,35 @@ function onEnable(row: any) { }); } +// ---- 表达式调试(2026-10-10 四议题):与运行时同一求值核心(/admin/router/eval) ---- +const evalVisible = ref(false); +const evaluating = ref(false); +const evalForm = ref<{ expression: string; variablesJson: string }>({ expression: "", variablesJson: "" }); +const evalResult = ref<{ result: boolean; value?: string; error?: string } | null>(null); + +function onEval() { + evalForm.value = { expression: "", variablesJson: "" }; + evalResult.value = null; + evalVisible.value = true; +} + +async function doEval() { + if (!evalForm.value.expression.trim()) { + Message.warning("请填写表达式"); + return; + } + evaluating.value = true; + evalResult.value = null; + try { + evalResult.value = (await flowApi.routerEval({ + expression: evalForm.value.expression.trim(), + variablesJson: evalForm.value.variablesJson.trim(), + }).send()) || null; + } finally { + evaluating.value = false; + } +} + onMounted(load); @@ -139,6 +168,7 @@ onMounted(load);
+
@@ -177,6 +207,35 @@ onMounted(load); + + +

+ 与 CONDITION 节点 EXPRESSION 模式同一套求值(AviatorScript 沙箱)。变量 = 样例 JSON 的 + 键 + 线上另注入 schId/bizType/bizId/submitterId/instanceId/instanceVersion/nodeId/nodeName + (调试时请在样例里自行提供内置变量取值)。变量未提供会报错——线上同口径(宁挂起不误放行) +

+ + +
+ + +
+ +
diff --git a/src/views/flow/admin/def-editor/components/ConditionBox.vue b/src/views/flow/admin/def-editor/components/ConditionBox.vue index 5bf9114..eb40ffb 100644 --- a/src/views/flow/admin/def-editor/components/ConditionBox.vue +++ b/src/views/flow/admin/def-editor/components/ConditionBox.vue @@ -1,7 +1,8 @@