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 @@