@ximatai/muyun-web-app 0.26.27 → 0.26.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BusinessActivityLogView-Bbe-GbNG.js → BusinessActivityLogView-DlNB97pu.js} +2 -2
- package/dist/BusinessLogListDrawer-ByiwQP1m.js +868 -0
- package/dist/CodeConfigurationView-91B9dHjD.js +2333 -0
- package/dist/{ConfigurationTranslationView-B3Cr9Wes.js → ConfigurationTranslationView-ClovkYJt.js} +49 -49
- package/dist/{LoginAuditLogView-DOwkqtVB.js → LoginAuditLogView-Blg9giRX.js} +2 -2
- package/dist/{ModuleActionManagementView-DNXAhdXk.js → ModuleActionManagementView-Chr_XTJ3.js} +191 -191
- package/dist/{ModuleGovernanceView-g5W2R_Zl.js → ModuleGovernanceView-BNlRHqSj.js} +3403 -3421
- package/dist/{RequestErrorLogView-9GIz2mkQ.js → RequestErrorLogView-CGczIKQy.js} +2 -2
- package/dist/RoleDetailWorkspaceView-CPH9cga9.js +1435 -0
- package/dist/{RuntimeLogView-C5i19Z-u.js → RuntimeLogView-DF-1k-9y.js} +51 -51
- package/dist/{WorkflowAdministrationView-CnoTudpI.js → WorkflowAdministrationView-CCXry0G4.js} +57 -57
- package/dist/WorkflowConfigurationView-BqSfYua2.js +2227 -0
- package/dist/{WorkflowWorkbenchView-DbWqspEB.js → WorkflowWorkbenchView-DUFfO3Gf.js} +248 -248
- package/dist/{codeConfiguration-Bno8cWxB.js → codeConfiguration-BRxveKen.js} +66 -49
- package/dist/configurationEditorNavigation-DeXvfJyr.js +15 -0
- package/dist/formulaReferences-CKkkdA_R.js +23 -0
- package/dist/index.css +1 -1
- package/dist/index.js +727 -727
- package/dist/{moduleMenuWorkspace-DW13bHG5.js → moduleMenuWorkspace-D_A94ZgR.js} +237 -248
- package/dist/{platform-components-D3NvMY3T.js → platform-components-DSMqalgQ.js} +4535 -4455
- package/dist/{platform-workbench-C4OFiuG5.js → platform-workbench-B53hydzq.js} +5376 -5289
- package/dist/types/dynamic-page-runtime/ModulePageBusinessSession.d.ts +2 -0
- package/dist/types/dynamic-page-runtime/ModulePageHostRuntime.vue.d.ts +28 -3
- package/dist/types/dynamic-page-runtime/ModuleReferenceRecordDetailBrowser.vue.d.ts +13 -4
- package/dist/types/dynamic-page-runtime/modulePageEnhancements.d.ts +2 -0
- package/dist/types/dynamic-page-runtime/recordFormAssistantCapabilities.d.ts +3 -1
- package/dist/types/dynamic-page-runtime/recordFormDraftAccess.d.ts +2 -0
- package/dist/types/dynamic-page-runtime/useModulePageSession.d.ts +1 -0
- package/dist/types/platform-components/BusinessNotificationPanel.vue.d.ts +2 -0
- package/dist/types/platform-components/ReferenceRecordDetailBrowser.vue.d.ts +10 -0
- package/dist/types/platform-components/index.d.ts +2 -2
- package/dist/types/platform-components/optionFieldOptionCache.d.ts +11 -1
- package/dist/types/platform-components/recordFormFieldModel.d.ts +1 -0
- package/dist/types/platform-components/referenceRecordDetailBrowser.d.ts +13 -1
- package/dist/types/platform-components/useWorkflowDesignSession.d.ts +141 -0
- package/dist/types/platform-components/workflowDesignEditing.d.ts +8 -7
- package/dist/types/platform-components/workflowDesignOperations.d.ts +107 -0
- package/dist/types/views/CodeRuleRecoveryPanel.vue.d.ts +20 -0
- package/dist/types/views/businessRuleGovernance.d.ts +1 -2
- package/dist/types/views/codeConfiguration.d.ts +29 -1
- package/dist/types/views/codeConfigurationAssistantSurface.d.ts +17 -0
- package/dist/types/views/codeRuleSaveRecovery.d.ts +12 -0
- package/dist/types/views/useCodeConfigurationAssistant.d.ts +10 -0
- package/dist/types/views/useCodeConfigurationSession.d.ts +16 -0
- package/dist/types/views/useWorkflowConfigurationAssistant.d.ts +16 -0
- package/dist/types/views/useWorkflowConfigurationContext.d.ts +16 -2
- package/dist/types/views/useWorkflowConfigurationSession.d.ts +146 -0
- package/dist/types/views/workflowConfigurationAssistantSurface.d.ts +169 -0
- package/dist/types/views/workflowSaveRecovery.d.ts +11 -0
- package/dist/types/vue-ui-antdv/components/sidePanelHost.d.ts +3 -1
- package/dist/types/vue-ui-antdv/index.d.ts +1 -0
- package/dist/types/web-core/formulaReferences.d.ts +2 -0
- package/dist/types/web-core/workflow.d.ts +11 -1
- package/dist/useWorkflowConfigurationContext-BuBDdUcQ.js +78 -0
- package/dist/{workspaceViews-D2Uh4KAq.js → workspaceViews-BSVtjZj1.js} +680 -680
- package/package.json +1 -1
- package/dist/BusinessLogListDrawer-BmF-14We.js +0 -868
- package/dist/CodeConfigurationView-DdPfBjoC.js +0 -1667
- package/dist/RoleDetailWorkspaceView-BuqRT0pd.js +0 -1435
- package/dist/WorkflowConfigurationView-Cku-F1Fm.js +0 -980
- package/dist/useWorkflowConfigurationContext-eQKyqe6_.js +0 -66
|
@@ -0,0 +1,2227 @@
|
|
|
1
|
+
import { D as e, b as t, y as n } from "./platform-workbench-B53hydzq.js";
|
|
2
|
+
import { Aa as r, Fn as i, Ia as a, In as o, Jn as s, Kt as c, Na as l, Pn as u, Qr as d, Rn as f, Rr as p, Sn as m, Un as ee, Ur as te, Vr as ne, Zi as h, a as re, ao as ie, ba as ae, br as oe, c as se, d as ce, en as le, ia as g, l as ue, la as _, m as de, mr as fe, n as pe, no as v, o as me, on as he, pa as y, q as ge, rr as _e, s as ve, t as ye, ua as be, vr as b, ya as xe, zn as Se } from "./platform-components-DSMqalgQ.js";
|
|
3
|
+
import { t as Ce } from "./configurationEditorNavigation-DeXvfJyr.js";
|
|
4
|
+
import { t as we } from "./useWorkflowConfigurationContext-BuBDdUcQ.js";
|
|
5
|
+
import { t as Te } from "./formulaReferences-CKkkdA_R.js";
|
|
6
|
+
import { Fragment as Ee, computed as x, createBlock as De, createCommentVNode as S, createElementBlock as C, createElementVNode as w, createSlots as Oe, createTextVNode as T, createVNode as E, defineComponent as D, inject as ke, normalizeStyle as Ae, onActivated as je, onBeforeUnmount as Me, onDeactivated as Ne, onMounted as Pe, onScopeDispose as Fe, openBlock as O, ref as k, renderList as Ie, toDisplayString as A, unref as j, watch as Le, withCtx as M } from "vue";
|
|
7
|
+
//#region src/views/workflowSaveRecovery.ts
|
|
8
|
+
function Re(e, t) {
|
|
9
|
+
let n = `muyun.workflow-design-save.${e}`;
|
|
10
|
+
function r() {
|
|
11
|
+
let e = t.getItem(n);
|
|
12
|
+
if (!e) return;
|
|
13
|
+
let r = JSON.parse(e);
|
|
14
|
+
if (!r || Object.keys(r).sort().join(",") !== "expectedVersion,requestId,versionId" || typeof r.requestId != "string" || !/^[a-zA-Z0-9-]{16,80}$/.test(r.requestId) || typeof r.versionId != "string" || !r.versionId || r.versionId.length > 128 || !Number.isSafeInteger(r.expectedVersion) || r.expectedVersion < 0) throw Error("原流程保存查询引用无效,请核实后恢复");
|
|
15
|
+
return r;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
restore: r,
|
|
19
|
+
save(e) {
|
|
20
|
+
if (r()) throw Error("原流程保存结果尚未核实");
|
|
21
|
+
t.setItem(n, JSON.stringify(e));
|
|
22
|
+
},
|
|
23
|
+
clear(e) {
|
|
24
|
+
r()?.requestId === e && t.removeItem(n);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/platform-components/useWorkflowDesignHistory.ts
|
|
30
|
+
function ze(e, t = 100) {
|
|
31
|
+
let n = k([JSON.stringify(e.value)]), r = k(0), i = k(n.value[0]), a = !1, o = 0;
|
|
32
|
+
Fe(() => {
|
|
33
|
+
o++;
|
|
34
|
+
}), Le(() => JSON.stringify(e.value), (e) => {
|
|
35
|
+
a || e === n.value[r.value] || (o++, n.value = [...n.value.slice(0, r.value + 1), e].slice(-t), r.value = n.value.length - 1);
|
|
36
|
+
}, { flush: "sync" });
|
|
37
|
+
function s(t) {
|
|
38
|
+
t < 0 || t >= n.value.length || (o++, a = !0, r.value = t, e.value = JSON.parse(n.value[t]), a = !1);
|
|
39
|
+
}
|
|
40
|
+
function c(t, s = t) {
|
|
41
|
+
o++, a = !0, e.value = t, n.value = [JSON.stringify(t)], r.value = 0, i.value = JSON.stringify(s), a = !1;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
checkpoint() {
|
|
45
|
+
let e = o;
|
|
46
|
+
return () => o === e;
|
|
47
|
+
},
|
|
48
|
+
canUndo: x(() => r.value > 0),
|
|
49
|
+
canRedo: x(() => r.value < n.value.length - 1),
|
|
50
|
+
dirty: x(() => JSON.stringify(e.value) !== i.value),
|
|
51
|
+
undo: () => s(r.value - 1),
|
|
52
|
+
redo: () => s(r.value + 1),
|
|
53
|
+
markSaved: () => {
|
|
54
|
+
i.value = JSON.stringify(e.value);
|
|
55
|
+
},
|
|
56
|
+
reset: c
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/platform-components/workflowDesignEditing.ts
|
|
61
|
+
function Be(e, t) {
|
|
62
|
+
return {
|
|
63
|
+
nodeKey: e,
|
|
64
|
+
nodeType: "approval",
|
|
65
|
+
title: t,
|
|
66
|
+
approvalMode: "all",
|
|
67
|
+
participantPolicyText: "{\"rules\":[]}",
|
|
68
|
+
allowReject: !0
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function Ve(e, t, n, r = v) {
|
|
72
|
+
let i = e.links.find((e) => e.routeKey === t);
|
|
73
|
+
if (!i) throw Error(r.t("platform.workflow-assistant.insert-branch-route", "请选择需要插入分支的路径"));
|
|
74
|
+
let a = `${n}_join`, o = [
|
|
75
|
+
{
|
|
76
|
+
nodeKey: n,
|
|
77
|
+
nodeType: "branch",
|
|
78
|
+
title: r.t("platform.workflow-assistant.default-branch", "条件分支"),
|
|
79
|
+
routeMode: "auto",
|
|
80
|
+
convergeNodeKey: a
|
|
81
|
+
},
|
|
82
|
+
Be(`${n}_path1`, r.t("platform.workflow-assistant.default-approval", "分支审批{index}", { index: 1 })),
|
|
83
|
+
Be(`${n}_path2`, r.t("platform.workflow-assistant.default-approval", "分支审批{index}", { index: 2 })),
|
|
84
|
+
{
|
|
85
|
+
nodeKey: a,
|
|
86
|
+
nodeType: "converge",
|
|
87
|
+
title: r.t("platform.workflow-assistant.default-join", "分支汇聚"),
|
|
88
|
+
convergeMode: "all"
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
if (o.some((t) => e.nodes.some((e) => e.nodeKey === t.nodeKey))) throw Error(r.t("platform.workflow-assistant.key-exists", "节点标识已存在"));
|
|
92
|
+
let s = [...[1, 2].flatMap((e) => [{
|
|
93
|
+
routeKey: `${n}_exit${e}`,
|
|
94
|
+
sourceNodeKey: n,
|
|
95
|
+
targetNodeKey: `${n}_path${e}`,
|
|
96
|
+
title: r.t("platform.workflow-assistant.default-path", "路径{index}", { index: e })
|
|
97
|
+
}, {
|
|
98
|
+
routeKey: `${n}_return${e}`,
|
|
99
|
+
sourceNodeKey: `${n}_path${e}`,
|
|
100
|
+
targetNodeKey: a,
|
|
101
|
+
title: r.t("platform.workflow-assistant.default-converge", "汇聚")
|
|
102
|
+
}]), {
|
|
103
|
+
routeKey: `${n}_next`,
|
|
104
|
+
sourceNodeKey: a,
|
|
105
|
+
targetNodeKey: i.targetNodeKey,
|
|
106
|
+
title: r.t("platform.workflow-assistant.default-continue", "继续")
|
|
107
|
+
}];
|
|
108
|
+
return {
|
|
109
|
+
...e,
|
|
110
|
+
nodes: [...e.nodes, ...o],
|
|
111
|
+
links: [...e.links.map((e) => e === i ? {
|
|
112
|
+
...e,
|
|
113
|
+
targetNodeKey: n
|
|
114
|
+
} : e), ...s]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function He(e, t, n, r = v) {
|
|
118
|
+
let i = e.nodes.find((e) => e.nodeKey === t && e.nodeType === "branch"), a = e.nodes.find((e) => e.nodeKey === i?.convergeNodeKey && e.nodeType === "converge");
|
|
119
|
+
if (!i || !a) throw Error(r.t("platform.workflow-assistant.branch-join-required", "分支必须绑定有效汇聚节点"));
|
|
120
|
+
if (e.nodes.some((e) => e.nodeKey === n)) throw Error(r.t("platform.workflow-assistant.key-exists", "节点标识已存在"));
|
|
121
|
+
let o = e.links.filter((e) => e.sourceNodeKey === t).length + 1;
|
|
122
|
+
return {
|
|
123
|
+
...e,
|
|
124
|
+
nodes: [...e.nodes, Be(n, r.t("platform.workflow-assistant.default-approval", "分支审批{index}", { index: o }))],
|
|
125
|
+
links: [
|
|
126
|
+
...e.links,
|
|
127
|
+
{
|
|
128
|
+
routeKey: `${n}_in`,
|
|
129
|
+
sourceNodeKey: t,
|
|
130
|
+
targetNodeKey: n,
|
|
131
|
+
title: r.t("platform.workflow-assistant.default-path", "路径{index}", { index: o })
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
routeKey: `${n}_out`,
|
|
135
|
+
sourceNodeKey: n,
|
|
136
|
+
targetNodeKey: a.nodeKey,
|
|
137
|
+
title: r.t("platform.workflow-assistant.default-converge", "汇聚")
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function Ue(e, t, n = v) {
|
|
143
|
+
let r = e.nodes.find((e) => e.nodeKey === t && e.nodeType === "branch"), i = e.nodes.find((e) => e.nodeKey === r?.convergeNodeKey && e.nodeType === "converge");
|
|
144
|
+
if (!r || !i) throw Error(n.t("platform.workflow-assistant.branch-join-required", "分支必须绑定有效汇聚节点"));
|
|
145
|
+
let a = /* @__PURE__ */ new Set([t]), o = /* @__PURE__ */ new Map();
|
|
146
|
+
for (let t of e.links) {
|
|
147
|
+
let e = o.get(t.sourceNodeKey) ?? [];
|
|
148
|
+
e.push(t.targetNodeKey), o.set(t.sourceNodeKey, e);
|
|
149
|
+
}
|
|
150
|
+
let s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
151
|
+
function l(e) {
|
|
152
|
+
if (e === i.nodeKey) return;
|
|
153
|
+
if (s.has(e)) throw Error(n.t("platform.workflow-assistant.branch-cycle", "分支内存在循环,请先修正路径"));
|
|
154
|
+
if (c.has(e)) return;
|
|
155
|
+
let t = o.get(e) ?? [];
|
|
156
|
+
if (!t.length) throw Error(n.t("platform.workflow-assistant.branch-unjoined", "分支路径未到达配对汇聚节点"));
|
|
157
|
+
a.add(e), s.add(e), t.forEach(l), s.delete(e), c.add(e);
|
|
158
|
+
}
|
|
159
|
+
l(t), a.add(i.nodeKey);
|
|
160
|
+
let u = e.links.filter((e) => !a.has(e.sourceNodeKey) && a.has(e.targetNodeKey)), d = e.links.filter((e) => a.has(e.sourceNodeKey) && !a.has(e.targetNodeKey));
|
|
161
|
+
if (u.length !== 1 || u[0]?.targetNodeKey !== t || d.length !== 1 || d[0]?.sourceNodeKey !== i.nodeKey) throw Error(n.t("platform.workflow-assistant.branch-crossing", "分支包含外部交叉路径,不能整体删除"));
|
|
162
|
+
return {
|
|
163
|
+
...e,
|
|
164
|
+
nodes: e.nodes.filter((e) => !a.has(e.nodeKey)),
|
|
165
|
+
links: e.links.filter((e) => !a.has(e.sourceNodeKey) && (!a.has(e.targetNodeKey) || e === u[0])).map((e) => e === u[0] ? {
|
|
166
|
+
...e,
|
|
167
|
+
targetNodeKey: d[0].targetNodeKey
|
|
168
|
+
} : e)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function We(e, t, n, r = v) {
|
|
172
|
+
let i = e.links.find((e) => e.routeKey === t);
|
|
173
|
+
if (!i) throw Error(r.t("platform.workflow-assistant.route-missing", "路径不存在"));
|
|
174
|
+
return {
|
|
175
|
+
...e,
|
|
176
|
+
links: e.links.map((e) => e === i ? {
|
|
177
|
+
...e,
|
|
178
|
+
...n,
|
|
179
|
+
...n.defaultRoute === !0 ? { conditionExpression: void 0 } : {}
|
|
180
|
+
} : n.defaultRoute === !0 && e.sourceNodeKey === i.sourceNodeKey ? {
|
|
181
|
+
...e,
|
|
182
|
+
defaultRoute: !1
|
|
183
|
+
} : e)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function Ge(e, t, n, r = v) {
|
|
187
|
+
let i = e.links.find((e) => e.routeKey === t);
|
|
188
|
+
if (!i) throw Error(r.t("platform.workflow-assistant.insert-node-route", "请选择需要插入节点的路径"));
|
|
189
|
+
if (e.nodes.some((e) => e.nodeKey === n.nodeKey)) throw Error(r.t("platform.workflow-assistant.key-exists", "节点标识已存在"));
|
|
190
|
+
return {
|
|
191
|
+
...e,
|
|
192
|
+
nodes: [...e.nodes, n],
|
|
193
|
+
links: [...e.links.map((e) => e === i ? {
|
|
194
|
+
...e,
|
|
195
|
+
targetNodeKey: n.nodeKey
|
|
196
|
+
} : e), {
|
|
197
|
+
routeKey: `${n.nodeKey}_next`,
|
|
198
|
+
sourceNodeKey: n.nodeKey,
|
|
199
|
+
targetNodeKey: i.targetNodeKey,
|
|
200
|
+
title: r.t("platform.workflow-assistant.default-continue", "继续")
|
|
201
|
+
}]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function Ke(e, t, n = v) {
|
|
205
|
+
let r = e.nodes.find((e) => e.nodeKey === t);
|
|
206
|
+
if (!r || ["start", "end"].includes(r.nodeType)) throw Error(n.t("platform.workflow-assistant.retain-endpoints", "开始和结束节点必须保留"));
|
|
207
|
+
let i = e.links.filter((e) => e.targetNodeKey === t), a = e.links.filter((e) => e.sourceNodeKey === t);
|
|
208
|
+
if (i.length !== 1 || a.length !== 1 || a[0]?.conditionExpression) throw Error(n.t("platform.workflow-assistant.complex-delete", "该节点包含分支或复杂路径,请先调整连线,确保删除后路径含义明确"));
|
|
209
|
+
return {
|
|
210
|
+
...e,
|
|
211
|
+
nodes: e.nodes.filter((e) => e.nodeKey !== t),
|
|
212
|
+
links: e.links.filter((e) => e.sourceNodeKey !== t).map((e) => e.targetNodeKey === t ? {
|
|
213
|
+
...e,
|
|
214
|
+
targetNodeKey: a[0].targetNodeKey
|
|
215
|
+
} : e)
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function qe(e, t = v) {
|
|
219
|
+
let n = [
|
|
220
|
+
{
|
|
221
|
+
nodeKey: "start",
|
|
222
|
+
nodeType: "start",
|
|
223
|
+
title: t.t("platform.workflow.submit", "提交")
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
...Be("approval", t.t("platform.workflow.approval", "审批")),
|
|
227
|
+
requireRejectReason: !0,
|
|
228
|
+
allowRejectReturnToMe: !0,
|
|
229
|
+
allowRollback: !0,
|
|
230
|
+
requireRollbackReason: !0,
|
|
231
|
+
allowAddSign: !0
|
|
232
|
+
},
|
|
233
|
+
...e ? [{
|
|
234
|
+
nodeKey: "approved",
|
|
235
|
+
nodeType: "milestone",
|
|
236
|
+
title: t.t("platform.workflow.approval_completed", "审批完成"),
|
|
237
|
+
milestoneType: "approval_completed"
|
|
238
|
+
}] : [],
|
|
239
|
+
{
|
|
240
|
+
nodeKey: "end",
|
|
241
|
+
nodeType: "end",
|
|
242
|
+
title: t.t("platform.action.done", "完成")
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
return {
|
|
246
|
+
nodes: n,
|
|
247
|
+
links: n.slice(1).map((e, r) => ({
|
|
248
|
+
routeKey: `route_${r + 1}`,
|
|
249
|
+
sourceNodeKey: n[r].nodeKey,
|
|
250
|
+
targetNodeKey: e.nodeKey,
|
|
251
|
+
title: t.t("platform.workflow-assistant.default-continue", "继续")
|
|
252
|
+
}))
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/platform-components/workflowDesignOperations.ts
|
|
257
|
+
function Je(e) {
|
|
258
|
+
return e.assistantPolicy !== "HIDDEN" && e.fieldControl?.alias !== "password";
|
|
259
|
+
}
|
|
260
|
+
function Ye(e, t) {
|
|
261
|
+
return !e || Te(e).every((e) => t.some((t) => t.name === e && Je(t)));
|
|
262
|
+
}
|
|
263
|
+
var N = (e, t = 1) => ({
|
|
264
|
+
type: "string",
|
|
265
|
+
minLength: t,
|
|
266
|
+
maxLength: e
|
|
267
|
+
}), P = (e, t = []) => ({
|
|
268
|
+
type: "object",
|
|
269
|
+
additionalProperties: !1,
|
|
270
|
+
properties: e,
|
|
271
|
+
required: t
|
|
272
|
+
}), F = (...e) => ({
|
|
273
|
+
type: "string",
|
|
274
|
+
enum: e
|
|
275
|
+
}), I = { anyOf: [N(128), P({
|
|
276
|
+
created: N(40),
|
|
277
|
+
part: N(40)
|
|
278
|
+
}, ["created", "part"])] }, L = {
|
|
279
|
+
type: "integer",
|
|
280
|
+
minimum: 1,
|
|
281
|
+
maximum: 100
|
|
282
|
+
}, R = {
|
|
283
|
+
type: "array",
|
|
284
|
+
minItems: 0,
|
|
285
|
+
maxItems: 16,
|
|
286
|
+
items: { anyOf: [
|
|
287
|
+
P({ type: F("INITIATOR_SELF") }, ["type"]),
|
|
288
|
+
P({
|
|
289
|
+
type: F("FIELD"),
|
|
290
|
+
fieldName: N(255)
|
|
291
|
+
}, ["type", "fieldName"]),
|
|
292
|
+
P({
|
|
293
|
+
type: F("RELATIVE"),
|
|
294
|
+
relation: F("SUPERVISOR"),
|
|
295
|
+
depth: {
|
|
296
|
+
type: "integer",
|
|
297
|
+
minimum: 1,
|
|
298
|
+
maximum: 32
|
|
299
|
+
},
|
|
300
|
+
fieldName: N(255)
|
|
301
|
+
}, [
|
|
302
|
+
"type",
|
|
303
|
+
"relation",
|
|
304
|
+
"depth"
|
|
305
|
+
])
|
|
306
|
+
] }
|
|
307
|
+
}, z = {
|
|
308
|
+
title: N(128),
|
|
309
|
+
approvalMode: F("all", "any", "ratio", "notice"),
|
|
310
|
+
approvalRatio: L,
|
|
311
|
+
participants: R,
|
|
312
|
+
milestoneType: F("approval_completed")
|
|
313
|
+
}, B = (e) => ({
|
|
314
|
+
...P(e),
|
|
315
|
+
minProperties: 1
|
|
316
|
+
}), V = P({ operations: {
|
|
317
|
+
type: "array",
|
|
318
|
+
minItems: 1,
|
|
319
|
+
maxItems: 40,
|
|
320
|
+
items: { anyOf: [
|
|
321
|
+
P({
|
|
322
|
+
op: F("insert-node"),
|
|
323
|
+
as: N(40),
|
|
324
|
+
route: I,
|
|
325
|
+
node: P({
|
|
326
|
+
...z,
|
|
327
|
+
kind: F("approval", "notice", "milestone")
|
|
328
|
+
}, ["kind", "title"])
|
|
329
|
+
}, [
|
|
330
|
+
"op",
|
|
331
|
+
"as",
|
|
332
|
+
"route",
|
|
333
|
+
"node"
|
|
334
|
+
]),
|
|
335
|
+
P({
|
|
336
|
+
op: F("update-node"),
|
|
337
|
+
node: I,
|
|
338
|
+
patch: B(z)
|
|
339
|
+
}, [
|
|
340
|
+
"op",
|
|
341
|
+
"node",
|
|
342
|
+
"patch"
|
|
343
|
+
]),
|
|
344
|
+
P({
|
|
345
|
+
op: F("delete-node"),
|
|
346
|
+
node: I
|
|
347
|
+
}, ["op", "node"]),
|
|
348
|
+
P({
|
|
349
|
+
op: F("insert-branch"),
|
|
350
|
+
as: N(40),
|
|
351
|
+
route: I,
|
|
352
|
+
title: N(128)
|
|
353
|
+
}, [
|
|
354
|
+
"op",
|
|
355
|
+
"as",
|
|
356
|
+
"route"
|
|
357
|
+
]),
|
|
358
|
+
P({
|
|
359
|
+
op: F("append-path"),
|
|
360
|
+
as: N(40),
|
|
361
|
+
branch: I
|
|
362
|
+
}, [
|
|
363
|
+
"op",
|
|
364
|
+
"as",
|
|
365
|
+
"branch"
|
|
366
|
+
]),
|
|
367
|
+
P({
|
|
368
|
+
op: F("delete-branch"),
|
|
369
|
+
branch: I
|
|
370
|
+
}, ["op", "branch"]),
|
|
371
|
+
P({
|
|
372
|
+
op: F("update-branch"),
|
|
373
|
+
branch: I,
|
|
374
|
+
patch: B({
|
|
375
|
+
title: N(128),
|
|
376
|
+
routeMode: F("auto", "manual"),
|
|
377
|
+
selectorNode: I,
|
|
378
|
+
requireManualSelectionReason: { type: "boolean" },
|
|
379
|
+
convergeMode: F("all", "any", "ratio"),
|
|
380
|
+
convergeRatio: L
|
|
381
|
+
})
|
|
382
|
+
}, [
|
|
383
|
+
"op",
|
|
384
|
+
"branch",
|
|
385
|
+
"patch"
|
|
386
|
+
]),
|
|
387
|
+
P({
|
|
388
|
+
op: F("update-route"),
|
|
389
|
+
route: I,
|
|
390
|
+
patch: B({
|
|
391
|
+
title: N(128),
|
|
392
|
+
conditionExpression: N(2e3, 0),
|
|
393
|
+
defaultRoute: { type: "boolean" }
|
|
394
|
+
})
|
|
395
|
+
}, [
|
|
396
|
+
"op",
|
|
397
|
+
"route",
|
|
398
|
+
"patch"
|
|
399
|
+
])
|
|
400
|
+
] }
|
|
401
|
+
} }, ["operations"]);
|
|
402
|
+
function Xe() {
|
|
403
|
+
return JSON.parse(JSON.stringify(V));
|
|
404
|
+
}
|
|
405
|
+
function H(e, t) {
|
|
406
|
+
if (t.anyOf) return t.anyOf.some((t) => H(e, t));
|
|
407
|
+
if (t.enum && !t.enum.includes(e)) return !1;
|
|
408
|
+
if (t.type === "string") return typeof e == "string" && [...e].length >= (t.minLength ?? 0) && [...e].length <= (t.maxLength ?? Infinity) && (!t.minLength || !!e.trim());
|
|
409
|
+
if (t.type === "integer") return typeof e == "number" && Number.isSafeInteger(e) && e >= (t.minimum ?? -Infinity) && e <= (t.maximum ?? Infinity);
|
|
410
|
+
if (t.type === "boolean") return typeof e == "boolean";
|
|
411
|
+
if (t.type === "array") return Array.isArray(e) && e.length >= (t.minItems ?? 0) && e.length <= (t.maxItems ?? Infinity) && e.every((e) => H(e, t.items));
|
|
412
|
+
if (t.type === "object") {
|
|
413
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
414
|
+
let n = e;
|
|
415
|
+
return Object.keys(n).length >= (t.minProperties ?? 0) && (t.required ?? []).every((e) => Object.hasOwn(n, e)) && Object.keys(n).every((e) => Object.hasOwn(t.properties, e) && H(n[e], t.properties[e]));
|
|
416
|
+
}
|
|
417
|
+
return !1;
|
|
418
|
+
}
|
|
419
|
+
function Ze(e, t = v) {
|
|
420
|
+
if (!H(e, V)) throw Error(t.t("platform.workflow-assistant.invalid-input", "流程操作参数无效:请使用已声明的操作、字段和容量限制"));
|
|
421
|
+
let n = JSON.parse(JSON.stringify(e)), r = /* @__PURE__ */ new Set();
|
|
422
|
+
for (let e of n.operations) if ("as" in e) {
|
|
423
|
+
if (r.has(e.as)) throw Error(t.t("platform.workflow-assistant.alias-invalid", "批内新建别名无效或重复"));
|
|
424
|
+
r.add(e.as);
|
|
425
|
+
}
|
|
426
|
+
return n;
|
|
427
|
+
}
|
|
428
|
+
function Qe(e, t, n) {
|
|
429
|
+
for (let r of e) if ("fieldName" in r && r.fieldName && !t.some((e) => e.name === r.fieldName && e.referenceModule === "iam.user" && Je(e))) throw Error(n.t("platform.workflow-assistant.participant-field-invalid", "参与人字段必须是当前模块已声明的账号引用字段"));
|
|
430
|
+
return JSON.stringify({ rules: e });
|
|
431
|
+
}
|
|
432
|
+
function $e(e, t, n, r) {
|
|
433
|
+
if (![
|
|
434
|
+
"approval",
|
|
435
|
+
"milestone",
|
|
436
|
+
"task"
|
|
437
|
+
].includes(e.nodeType)) throw Error(r.t("platform.workflow-assistant.specialized-node", "此节点仅支持专用结构操作"));
|
|
438
|
+
let { participants: i, ...a } = t;
|
|
439
|
+
if (e.nodeType !== "approval" && (a.approvalMode !== void 0 || a.approvalRatio !== void 0)) throw Error(r.t("platform.workflow-assistant.approval-node-only", "审批模式仅可用于审批/知会节点"));
|
|
440
|
+
if (e.nodeType !== "milestone" && a.milestoneType !== void 0) throw Error(r.t("platform.workflow-assistant.milestone-only", "里程碑类型仅可用于里程碑节点"));
|
|
441
|
+
if (e.nodeType === "milestone" && i !== void 0) throw Error(r.t("platform.workflow-assistant.milestone-participants", "里程碑不配置参与人"));
|
|
442
|
+
let o = {
|
|
443
|
+
...e,
|
|
444
|
+
...a,
|
|
445
|
+
...i === void 0 ? {} : { participantPolicyText: Qe(i, n, r) }
|
|
446
|
+
};
|
|
447
|
+
if (a.approvalRatio !== void 0 && o.approvalMode !== "ratio") throw Error(r.t("platform.workflow-assistant.approval-ratio-only", "审批比例仅可用于比例审批模式"));
|
|
448
|
+
return o;
|
|
449
|
+
}
|
|
450
|
+
function U(e, t = [], n = v) {
|
|
451
|
+
let r = [], i = [];
|
|
452
|
+
if (e.nodes.length > 300 || e.links.length > 600) return {
|
|
453
|
+
valid: !1,
|
|
454
|
+
errors: [n.t("platform.workflow-assistant.diagnostic-capacity", "当前流程超过助手本地诊断容量,请人工复核")],
|
|
455
|
+
warnings: [],
|
|
456
|
+
truncated: !0,
|
|
457
|
+
formulaCheck: "requires-server-validation",
|
|
458
|
+
publishedValidation: !1
|
|
459
|
+
};
|
|
460
|
+
let a = !0, o = new Map(e.nodes.map((e) => [e.nodeKey, e]));
|
|
461
|
+
o.size !== e.nodes.length && r.push(n.t("platform.workflow-assistant.duplicate-nodes", "存在重复节点标识")), new Set(e.links.map((e) => e.routeKey)).size !== e.links.length && r.push(n.t("platform.workflow-assistant.duplicate-routes", "存在重复路径标识"));
|
|
462
|
+
for (let t of ["start", "end"]) e.nodes.filter((e) => e.nodeType === t).length !== 1 && r.push(n.t("platform.workflow-assistant.unique-node-kind", "流程需要唯一的 {kind} 节点", { kind: t }));
|
|
463
|
+
for (let s of e.nodes) {
|
|
464
|
+
let c = s.title || s.nodeKey;
|
|
465
|
+
s.title?.trim() || r.push(n.t("platform.workflow-assistant.title-required", "{name}:标题未填写", { name: c }));
|
|
466
|
+
let l = e.links.filter((e) => e.targetNodeKey === s.nodeKey), u = e.links.filter((e) => e.sourceNodeKey === s.nodeKey);
|
|
467
|
+
if (s.nodeType === "start" && l.length && r.push(n.t("platform.workflow-assistant.start-incoming", "{name}:开始节点不能有进入路径", { name: c })), s.nodeType === "end" && u.length && r.push(n.t("platform.workflow-assistant.end-outgoing", "{name}:结束节点不能有离开路径", { name: c })), s.nodeType !== "end" && !u.length && r.push(n.t("platform.workflow-assistant.broken-route", "{name}:路径中断,未连接后续节点", { name: c })), [
|
|
468
|
+
"start",
|
|
469
|
+
"approval",
|
|
470
|
+
"task",
|
|
471
|
+
"milestone",
|
|
472
|
+
"converge"
|
|
473
|
+
].includes(s.nodeType) && u.length > 1 && r.push(n.t("platform.workflow-assistant.multiple-exits", "{name}:普通节点不能有多个出口,请使用分支", { name: c })), ["approval", "task"].includes(s.nodeType)) {
|
|
474
|
+
if (!se(s.participantPolicyText)) r.push(n.t("platform.workflow-assistant.participants-required", "{name}:参与人未配置或无效", { name: c }));
|
|
475
|
+
else try {
|
|
476
|
+
let e = s.participantPolicyText?.trim();
|
|
477
|
+
if (e?.startsWith("{") || e?.startsWith("[")) {
|
|
478
|
+
let t = JSON.parse(e), r = t, o = Array.isArray(t) ? t : Array.isArray(r.rules) ? r.rules : [t], s = [
|
|
479
|
+
"type",
|
|
480
|
+
"ids",
|
|
481
|
+
"userIds",
|
|
482
|
+
"targetIds",
|
|
483
|
+
"userId",
|
|
484
|
+
"targetId",
|
|
485
|
+
"id",
|
|
486
|
+
"value",
|
|
487
|
+
"fieldName",
|
|
488
|
+
"relation",
|
|
489
|
+
"depth",
|
|
490
|
+
"headOnly"
|
|
491
|
+
], l = !Array.isArray(t) && Array.isArray(r.rules) && Object.keys(r).some((e) => e !== "rules"), u = o.some((e) => e && typeof e == "object" && !Array.isArray(e) && Object.entries(e).some(([e, t]) => !s.includes(e) || e === "headOnly" && typeof t != "boolean"));
|
|
492
|
+
(l || u) && (a = !1, i.push(n.t("platform.workflow-assistant.participants-preserved", "{name}:参与人保留了本地无法检查的配置,请人工核对", { name: c })));
|
|
493
|
+
}
|
|
494
|
+
for (let e of ue(s.participantPolicyText)) {
|
|
495
|
+
if (e.fieldName && !t.some((t) => t.name === e.fieldName && Je(t))) {
|
|
496
|
+
a = !1, i.push(n.t("platform.workflow-assistant.participants-preserved", "{name}:参与人保留了本地无法检查的配置,请人工核对", { name: c }));
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
e.fieldName && !t.some((t) => t.name === e.fieldName && t.referenceModule === "iam.user") && r.push(n.t("platform.workflow-assistant.participant-field-unavailable", "{name}:参与人账号字段不可用", { name: c })), [
|
|
500
|
+
"USER",
|
|
501
|
+
"ROLE",
|
|
502
|
+
"DEPT",
|
|
503
|
+
"ORG"
|
|
504
|
+
].includes(e.type) && i.push(n.t("platform.workflow-assistant.identity-manual", "{name}:指定身份候选需人工核对,助手不提供此类写入", { name: c })), e.type === "RELATIVE" && ![
|
|
505
|
+
"SELF",
|
|
506
|
+
"SUPERVISOR",
|
|
507
|
+
"DEPARTMENT",
|
|
508
|
+
"DEPARTMENT_MANAGER",
|
|
509
|
+
"ORGANIZATION",
|
|
510
|
+
"ORGANIZATION_MANAGER"
|
|
511
|
+
].includes(e.relation ?? "") && r.push(n.t("platform.workflow-assistant.relative-invalid", "{name}:相对人员关系无效", { name: c })), e.headOnly !== void 0 && (a = !1, i.push(n.t("platform.workflow-assistant.head-manual", "{name}:负责人筛选由人工配置,本地未核实筛选结果", { name: c }))), e.type === "RELATIVE" && e.relation === "SUPERVISOR" && (!Number.isInteger(e.depth ?? 1) || (e.depth ?? 1) < 0 || (e.depth ?? 1) > 32) && r.push(n.t("platform.workflow-assistant.depth-invalid", "{name}:主管链层数无效", { name: c }));
|
|
512
|
+
}
|
|
513
|
+
} catch {
|
|
514
|
+
r.push(n.t("platform.workflow-assistant.participant-rules-invalid", "{name}:参与人规则无效", { name: c }));
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (s.nodeType === "approval" && ![
|
|
518
|
+
"all",
|
|
519
|
+
"any",
|
|
520
|
+
"ratio",
|
|
521
|
+
"notice"
|
|
522
|
+
].includes(s.approvalMode ?? "all") && r.push(n.t("platform.workflow-assistant.approval-mode-invalid", "{name}:审批模式不受支持", { name: c })), s.approvalMode === "ratio" && (!Number.isInteger(s.approvalRatio ?? 100) || (s.approvalRatio ?? 100) < 1 || (s.approvalRatio ?? 100) > 100) && r.push(n.t("platform.workflow-assistant.approval-ratio-invalid", "{name}:审批比例无效", { name: c })), s.nodeType === "milestone" && (s.milestoneType ?? "approval_completed") !== "approval_completed" && r.push(n.t("platform.workflow-assistant.milestone-invalid", "{name}:里程碑类型不受支持", { name: c })), s.nodeType === "task" && i.push(n.t("platform.workflow-assistant.task-manual", "{name}:业务任务办理指引与完成检查由人工配置,需正式发布校验", { name: c })), s.nodeType === "branch") {
|
|
523
|
+
o.get(s.convergeNodeKey ?? "")?.nodeType !== "converge" && r.push(n.t("platform.workflow-assistant.join-missing", "{name}:缺少配对汇聚", { name: c }));
|
|
524
|
+
let t = e.links.filter((e) => e.sourceNodeKey === s.nodeKey);
|
|
525
|
+
t.length < 2 && r.push(n.t("platform.workflow-assistant.branch-paths", "{name}:分支至少需要两条路径", { name: c })), t.filter((e) => e.defaultRoute).length > 1 && r.push(n.t("platform.workflow-assistant.default-unique", "{name}:默认出口不唯一", { name: c })), s.routeMode === "manual" && ![
|
|
526
|
+
"start",
|
|
527
|
+
"approval",
|
|
528
|
+
"task"
|
|
529
|
+
].includes(o.get(s.selectorNodeKey ?? "")?.nodeType ?? "") && r.push(n.t("platform.workflow-assistant.selector-missing", "{name}:人工选路节点缺失或无效", { name: c })), ["auto", "manual"].includes(s.routeMode ?? "auto") || r.push(n.t("platform.workflow-assistant.route-mode-invalid", "{name}:选路模式不受支持", { name: c }));
|
|
530
|
+
}
|
|
531
|
+
s.nodeType === "converge" && ([
|
|
532
|
+
"all",
|
|
533
|
+
"any",
|
|
534
|
+
"ratio"
|
|
535
|
+
].includes(s.convergeMode ?? "all") || r.push(n.t("platform.workflow-assistant.converge-mode-invalid", "{name}:汇聚规则不受支持", { name: c })), s.convergeMode === "ratio" && (!Number.isInteger(s.convergeRatio ?? 100) || (s.convergeRatio ?? 100) < 1 || (s.convergeRatio ?? 100) > 100) && r.push(n.t("platform.workflow-assistant.converge-ratio-invalid", "{name}:汇聚比例无效", { name: c })));
|
|
536
|
+
}
|
|
537
|
+
for (let t of e.links) (!o.has(t.sourceNodeKey) || !o.has(t.targetNodeKey)) && r.push(n.t("platform.workflow-assistant.endpoints-missing", "{name}:路径端点不存在", { name: t.routeKey })), t.defaultRoute && t.conditionExpression?.trim() && r.push(n.t("platform.workflow-assistant.default-condition-diagnostic", "{name}:默认出口不能同时配置条件", { name: t.routeKey })), t.conditionExpression?.trim() && i.push(n.t("platform.workflow-assistant.formula-pending", "{name}:条件公式待服务端只读检查及正式发布校验", { name: t.routeKey }));
|
|
538
|
+
let s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
539
|
+
for (let t of e.links) l.set(t.sourceNodeKey, [...l.get(t.sourceNodeKey) ?? [], t.targetNodeKey]);
|
|
540
|
+
let u = !1;
|
|
541
|
+
function d(e) {
|
|
542
|
+
if (c.has(e)) {
|
|
543
|
+
u = !0;
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (!s.has(e)) {
|
|
547
|
+
s.add(e), c.add(e);
|
|
548
|
+
for (let t of l.get(e) ?? []) d(t);
|
|
549
|
+
c.delete(e);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
let f = e.nodes.find((e) => e.nodeType === "start");
|
|
553
|
+
f && d(f.nodeKey), s.size < o.size && r.push(n.t("platform.workflow-assistant.unreachable-nodes", "存在从开始节点不可达的节点"));
|
|
554
|
+
for (let t of e.nodes) d(t.nodeKey);
|
|
555
|
+
u && r.push(n.t("platform.workflow-assistant.cycle", "流程存在循环路径"));
|
|
556
|
+
let p = [...new Set(r)], m = [...new Set(i)];
|
|
557
|
+
return {
|
|
558
|
+
valid: !r.length && a,
|
|
559
|
+
errors: p.slice(0, 40).map((e) => e.length > 500 ? n.t("platform.workflow-assistant.truncated-message", "{message}…(已截断)", { message: e.slice(0, 480) }) : e),
|
|
560
|
+
warnings: m.slice(0, 40).map((e) => e.length > 500 ? n.t("platform.workflow-assistant.truncated-message", "{message}…(已截断)", { message: e.slice(0, 480) }) : e),
|
|
561
|
+
truncated: p.length > 40 || m.length > 40 || [...p, ...m].some((e) => e.length > 500),
|
|
562
|
+
formulaCheck: "requires-server-validation",
|
|
563
|
+
publishedValidation: !1
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function W(e, t, n = [], r = v) {
|
|
567
|
+
let i = Ze(t, r);
|
|
568
|
+
if (e.nodes.length > 300 || e.links.length > 600) throw Error(r.t("platform.workflow-assistant.edit-capacity", "当前流程超过助手可编辑容量,请人工配置"));
|
|
569
|
+
let a = e, o = Object.create(null), s = `assistant_${crypto.randomUUID().replaceAll("-", "")}`, c = (e) => {
|
|
570
|
+
let t = typeof e == "string" ? e : o[e.created]?.[e.part];
|
|
571
|
+
if (!t || !/^[a-zA-Z0-9_.:-]{1,128}$/.test(t)) throw Error(r.t("platform.workflow-assistant.reference-invalid", "对象标识无效,或批内引用尚未创建/部件不存在"));
|
|
572
|
+
return t;
|
|
573
|
+
}, l = (e) => {
|
|
574
|
+
let t = a.nodes.find((t) => t.nodeKey === c(e));
|
|
575
|
+
if (!t) throw Error(r.t("platform.workflow-assistant.node-missing", "节点不存在"));
|
|
576
|
+
return t;
|
|
577
|
+
};
|
|
578
|
+
for (let [e, t] of i.operations.entries()) {
|
|
579
|
+
let i = `${s}_${e}`;
|
|
580
|
+
if (t.op === "insert-node") {
|
|
581
|
+
let { kind: e, ...s } = t.node, l = e === "milestone" ? {
|
|
582
|
+
nodeKey: i,
|
|
583
|
+
nodeType: "milestone",
|
|
584
|
+
milestoneType: "approval_completed"
|
|
585
|
+
} : {
|
|
586
|
+
...Be(i, t.node.title),
|
|
587
|
+
...e === "notice" ? { approvalMode: "notice" } : {}
|
|
588
|
+
};
|
|
589
|
+
if (e === "notice" && s.approvalMode !== void 0 && s.approvalMode !== "notice") throw Error(r.t("platform.workflow-assistant.notice-mode-only", "知会节点必须使用知会模式"));
|
|
590
|
+
let u = $e(l, s, n, r), d = c(t.route);
|
|
591
|
+
a = Ge(a, d, u, r), o[t.as] = {
|
|
592
|
+
node: i,
|
|
593
|
+
next: `${i}_next`
|
|
594
|
+
};
|
|
595
|
+
} else if (t.op === "update-node") {
|
|
596
|
+
let e = l(t.node), i = $e(e, t.patch, n, r);
|
|
597
|
+
a = {
|
|
598
|
+
...a,
|
|
599
|
+
nodes: a.nodes.map((t) => t === e ? i : t)
|
|
600
|
+
};
|
|
601
|
+
} else if (t.op === "delete-node") {
|
|
602
|
+
let e = l(t.node);
|
|
603
|
+
if (![
|
|
604
|
+
"approval",
|
|
605
|
+
"task",
|
|
606
|
+
"milestone"
|
|
607
|
+
].includes(e.nodeType)) throw Error(r.t("platform.workflow-assistant.ordinary-delete-only", "仅可删除普通节点;分支请使用成对删除"));
|
|
608
|
+
a = Ke(a, e.nodeKey, r);
|
|
609
|
+
} else if (t.op === "insert-branch") {
|
|
610
|
+
let e = c(t.route);
|
|
611
|
+
a = Ve(a, e, i, r), t.title !== void 0 && (a = {
|
|
612
|
+
...a,
|
|
613
|
+
nodes: a.nodes.map((e) => e.nodeKey === i ? {
|
|
614
|
+
...e,
|
|
615
|
+
title: t.title
|
|
616
|
+
} : e)
|
|
617
|
+
}), o[t.as] = {
|
|
618
|
+
branch: i,
|
|
619
|
+
join: `${i}_join`,
|
|
620
|
+
path1: `${i}_path1`,
|
|
621
|
+
path2: `${i}_path2`,
|
|
622
|
+
exit1: `${i}_exit1`,
|
|
623
|
+
exit2: `${i}_exit2`,
|
|
624
|
+
return1: `${i}_return1`,
|
|
625
|
+
return2: `${i}_return2`,
|
|
626
|
+
next: `${i}_next`
|
|
627
|
+
};
|
|
628
|
+
} else if (t.op === "append-path") {
|
|
629
|
+
let e = c(t.branch);
|
|
630
|
+
a = He(a, e, i, r), o[t.as] = {
|
|
631
|
+
node: i,
|
|
632
|
+
in: `${i}_in`,
|
|
633
|
+
out: `${i}_out`
|
|
634
|
+
};
|
|
635
|
+
} else if (t.op === "delete-branch") {
|
|
636
|
+
let e = c(t.branch);
|
|
637
|
+
a = Ue(a, e, r);
|
|
638
|
+
} else if (t.op === "update-branch") {
|
|
639
|
+
let e = l(t.branch), n = a.nodes.find((t) => t.nodeKey === e.convergeNodeKey && t.nodeType === "converge");
|
|
640
|
+
if (e.nodeType !== "branch" || !n) throw Error(r.t("platform.workflow-assistant.branch-join-invalid", "分支必须具有有效的配对汇聚"));
|
|
641
|
+
let { convergeMode: i, convergeRatio: o, selectorNode: s, ...c } = t.patch, u = s === void 0 ? void 0 : l(s);
|
|
642
|
+
if (u && ![
|
|
643
|
+
"start",
|
|
644
|
+
"approval",
|
|
645
|
+
"task"
|
|
646
|
+
].includes(u.nodeType)) throw Error(r.t("platform.workflow-assistant.selector-invalid", "请选择开始、审批或业务任务作为人工选路节点"));
|
|
647
|
+
let d = {
|
|
648
|
+
...e,
|
|
649
|
+
...c,
|
|
650
|
+
...u ? { selectorNodeKey: u.nodeKey } : {},
|
|
651
|
+
...c.routeMode === "auto" ? {
|
|
652
|
+
selectorNodeKey: void 0,
|
|
653
|
+
requireManualSelectionReason: !1
|
|
654
|
+
} : {}
|
|
655
|
+
};
|
|
656
|
+
if (u && d.routeMode !== "manual") throw Error(r.t("platform.workflow-assistant.auto-selector", "自动分支不配置人工选路节点"));
|
|
657
|
+
let f = {
|
|
658
|
+
...n,
|
|
659
|
+
...i === void 0 ? {} : { convergeMode: i },
|
|
660
|
+
...o === void 0 ? {} : { convergeRatio: o }
|
|
661
|
+
};
|
|
662
|
+
if (o !== void 0 && f.convergeMode !== "ratio") throw Error(r.t("platform.workflow-assistant.converge-ratio-only", "汇聚比例仅用于比例汇聚"));
|
|
663
|
+
a = {
|
|
664
|
+
...a,
|
|
665
|
+
nodes: a.nodes.map((t) => t === e ? d : t === n ? f : t)
|
|
666
|
+
};
|
|
667
|
+
} else {
|
|
668
|
+
let e = c(t.route), n = a.links.find((t) => t.routeKey === e);
|
|
669
|
+
if (!n) throw Error(r.t("platform.workflow-assistant.route-missing", "路径不存在"));
|
|
670
|
+
if ((t.patch.conditionExpression !== void 0 || t.patch.defaultRoute !== void 0) && a.nodes.find((e) => e.nodeKey === n.sourceNodeKey)?.nodeType !== "branch") throw Error(r.t("platform.workflow-assistant.branch-condition-only", "仅分支出口支持条件和默认出口"));
|
|
671
|
+
if (t.patch.defaultRoute === !0 && t.patch.conditionExpression?.trim()) throw Error(r.t("platform.workflow-assistant.default-condition", "默认出口不能同时配置条件"));
|
|
672
|
+
if (n.defaultRoute && t.patch.defaultRoute !== !1 && t.patch.conditionExpression?.trim()) throw Error(r.t("platform.workflow-assistant.clear-default-first", "请先取消默认出口,再设置条件"));
|
|
673
|
+
a = We(a, e, t.patch, r);
|
|
674
|
+
}
|
|
675
|
+
if (a.nodes.length > 300 || a.links.length > 600) throw Error(r.t("platform.workflow-assistant.result-capacity", "操作结果超过助手可编辑容量"));
|
|
676
|
+
}
|
|
677
|
+
let u = G(e, a, r);
|
|
678
|
+
return {
|
|
679
|
+
design: a,
|
|
680
|
+
changes: u,
|
|
681
|
+
created: o,
|
|
682
|
+
diagnostics: U(a, n, r)
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function G(e, t, n = v) {
|
|
686
|
+
let r = [], i = {
|
|
687
|
+
title: n.t("platform.workflow-assistant.label-title", "标题"),
|
|
688
|
+
approvalMode: n.t("platform.workflow-assistant.label-approval-mode", "审批/知会模式"),
|
|
689
|
+
approvalRatio: n.t("platform.workflow-assistant.label-approval-ratio", "审批比例"),
|
|
690
|
+
participantPolicyText: n.t("platform.workflow-assistant.label-participants", "参与人规则"),
|
|
691
|
+
milestoneType: n.t("platform.workflow-assistant.label-milestone", "里程碑"),
|
|
692
|
+
routeMode: n.t("platform.workflow-assistant.label-route-mode", "选路模式"),
|
|
693
|
+
selectorNodeKey: n.t("platform.workflow-assistant.label-selector", "人工选路节点"),
|
|
694
|
+
requireManualSelectionReason: n.t("platform.workflow-assistant.label-route-reason", "选路原因要求"),
|
|
695
|
+
convergeMode: n.t("platform.workflow-assistant.label-converge-mode", "汇聚规则"),
|
|
696
|
+
convergeRatio: n.t("platform.workflow-assistant.label-converge-ratio", "汇聚比例"),
|
|
697
|
+
conditionExpression: n.t("platform.workflow-assistant.label-condition", "条件公式"),
|
|
698
|
+
defaultRoute: n.t("platform.workflow-assistant.label-default", "默认出口"),
|
|
699
|
+
sourceNodeKey: n.t("platform.workflow-assistant.label-source", "路径来源连接"),
|
|
700
|
+
targetNodeKey: n.t("platform.workflow-assistant.label-target", "路径目标连接")
|
|
701
|
+
};
|
|
702
|
+
for (let [a, o, s, c] of [[
|
|
703
|
+
n.t("platform.workflow-assistant.label-node", "节点"),
|
|
704
|
+
e.nodes,
|
|
705
|
+
t.nodes,
|
|
706
|
+
"nodeKey"
|
|
707
|
+
], [
|
|
708
|
+
n.t("platform.workflow-assistant.label-route", "路径"),
|
|
709
|
+
e.links,
|
|
710
|
+
t.links,
|
|
711
|
+
"routeKey"
|
|
712
|
+
]]) {
|
|
713
|
+
let e = new Map(o.map((e) => [String(e[c]), e]));
|
|
714
|
+
for (let t of s) {
|
|
715
|
+
let o = String(t[c]), s = e.get(o);
|
|
716
|
+
if (!s) r.push(n.t("platform.workflow-assistant.change-add", "新增{kind}:{name}", {
|
|
717
|
+
kind: a,
|
|
718
|
+
name: t.title || o
|
|
719
|
+
}));
|
|
720
|
+
else if (JSON.stringify(s) !== JSON.stringify(t)) {
|
|
721
|
+
let e = Object.keys({
|
|
722
|
+
...s,
|
|
723
|
+
...t
|
|
724
|
+
}).filter((e) => JSON.stringify(s[e]) !== JSON.stringify(t[e]));
|
|
725
|
+
r.push(n.t("platform.workflow-assistant.change-update", "修改{kind}:{name}({fields})", {
|
|
726
|
+
kind: a,
|
|
727
|
+
name: t.title || o,
|
|
728
|
+
fields: e.map((e) => i[e] ?? n.t("platform.workflow-assistant.label-other", "其他配置")).join(", ")
|
|
729
|
+
}));
|
|
730
|
+
}
|
|
731
|
+
e.delete(o);
|
|
732
|
+
}
|
|
733
|
+
for (let [t, i] of e) r.push(n.t("platform.workflow-assistant.change-delete", "删除{kind}:{name}", {
|
|
734
|
+
kind: a,
|
|
735
|
+
name: i.title || t
|
|
736
|
+
}));
|
|
737
|
+
}
|
|
738
|
+
return e.layoutJson !== t.layoutJson && r.push(n.t("platform.workflow-assistant.layout-changed", "画布布局已修改")), r;
|
|
739
|
+
}
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region src/platform-components/useWorkflowDesignSession.ts
|
|
742
|
+
function K() {
|
|
743
|
+
let e = ie(), t = k({
|
|
744
|
+
nodes: [],
|
|
745
|
+
links: []
|
|
746
|
+
}), n = ze(t);
|
|
747
|
+
function r(e, n) {
|
|
748
|
+
t.value = {
|
|
749
|
+
...t.value,
|
|
750
|
+
nodes: t.value.nodes.map((t) => t.nodeKey === e ? {
|
|
751
|
+
...t,
|
|
752
|
+
...n
|
|
753
|
+
} : t)
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
function i(n, r) {
|
|
757
|
+
t.value = We(t.value, n, r, e);
|
|
758
|
+
}
|
|
759
|
+
function a(r, i, a) {
|
|
760
|
+
let o = n.checkpoint(), s = W(t.value, r, i, e);
|
|
761
|
+
return () => {
|
|
762
|
+
if (!a() || !o()) throw new xe(new ae(e.t("platform.workflow-assistant.draft-changed", "流程草稿已变更,请重新读取")));
|
|
763
|
+
return t.value = s.design, {
|
|
764
|
+
changes: s.changes,
|
|
765
|
+
created: s.created,
|
|
766
|
+
diagnostics: s.diagnostics
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
return {
|
|
771
|
+
design: t,
|
|
772
|
+
history: n,
|
|
773
|
+
updateNode: r,
|
|
774
|
+
updateRoute: i,
|
|
775
|
+
prepare: a
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/views/useWorkflowConfigurationSession.ts
|
|
780
|
+
function et(e) {
|
|
781
|
+
let r = n(), i = ke(t, void 0), a = x(() => JSON.stringify([
|
|
782
|
+
r?.value?.userId,
|
|
783
|
+
r?.value?.tenantId,
|
|
784
|
+
r?.value?.organizationId,
|
|
785
|
+
r?.value?.system,
|
|
786
|
+
i?.value,
|
|
787
|
+
e.moduleAlias(),
|
|
788
|
+
e.definitionId()
|
|
789
|
+
])), o = k(!0);
|
|
790
|
+
je(() => {
|
|
791
|
+
o.value = !0;
|
|
792
|
+
}), Ne(() => {
|
|
793
|
+
o.value = !1;
|
|
794
|
+
}), Me(() => {
|
|
795
|
+
o.value = !1;
|
|
796
|
+
});
|
|
797
|
+
let s = k("idle"), c = x(() => s.value !== "idle");
|
|
798
|
+
return {
|
|
799
|
+
...K(),
|
|
800
|
+
scope: a,
|
|
801
|
+
active: o,
|
|
802
|
+
submissionStatus: s,
|
|
803
|
+
recoveryRequired: c
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/views/workflowConfigurationAssistantSurface.ts
|
|
808
|
+
function q(e) {
|
|
809
|
+
return e.ready && e.editable && !e.busy && e.version?.publishStatus === "draft";
|
|
810
|
+
}
|
|
811
|
+
function J(e, t, n = () => []) {
|
|
812
|
+
let r = e.language ?? v, i = () => {
|
|
813
|
+
let t = e.state();
|
|
814
|
+
if (!t.ready) throw new g(r.t("platform.workflow-assistant.not-ready", "流程尚未加载就绪,请稍后重新读取"));
|
|
815
|
+
return t;
|
|
816
|
+
}, a = {
|
|
817
|
+
effect: "read",
|
|
818
|
+
descriptor: {
|
|
819
|
+
code: "workflow.describe-draft",
|
|
820
|
+
description: "读取当前流程定义、版本、同一画布草稿、已选对象、字段和参与人限制。truncated 表示省略或裁剪,不能据此认定对象不存在。未保存草稿不代表已发布。仅已列出的标识可用于已有对象;批内新对象使用 created 引用。",
|
|
821
|
+
inputSchema: _()
|
|
822
|
+
},
|
|
823
|
+
parseInput: be,
|
|
824
|
+
async execute() {
|
|
825
|
+
return Z(i(), r);
|
|
826
|
+
}
|
|
827
|
+
}, o = {
|
|
828
|
+
effect: "read",
|
|
829
|
+
descriptor: {
|
|
830
|
+
code: "workflow.diagnose-draft",
|
|
831
|
+
description: "只读诊断当前共享草稿的本地结构、必填、受支持参与人和条件配置。不保存、不调用会先保存的页面校验,不复制服务端发布规则。条件公式仍需服务端正式检查,人工保存、校验和发布后才能生效。",
|
|
832
|
+
inputSchema: _()
|
|
833
|
+
},
|
|
834
|
+
parseInput: be,
|
|
835
|
+
async execute(t, n) {
|
|
836
|
+
let a = i(), o = X(U(a.design, a.fields, r)), s = [...new Set(a.design.links.map((e) => e.conditionExpression).filter((e) => !!e?.trim()))], c = s.filter((e) => e.length <= 2e3 && Ye(e, a.fields)).slice(0, 16), l = [];
|
|
837
|
+
if (e.validateCondition) for (let t of c) {
|
|
838
|
+
if (!n.isCurrent()) throw new g(r.t("platform.workflow-assistant.stale-diagnostic", "流程已变更,请重新诊断"));
|
|
839
|
+
let i;
|
|
840
|
+
try {
|
|
841
|
+
await e.validateCondition(t, n.signal);
|
|
842
|
+
} catch (e) {
|
|
843
|
+
if (n.signal.aborted || !n.isCurrent()) throw e;
|
|
844
|
+
i = r.t("platform.workflow-assistant.formula-failed", "条件公式检查未通过,请在属性面板核对公式");
|
|
845
|
+
}
|
|
846
|
+
if (!n.isCurrent()) throw new g(r.t("platform.workflow-assistant.stale-diagnostic", "流程已变更,请重新诊断"));
|
|
847
|
+
l.push({
|
|
848
|
+
expression: t.slice(0, 500),
|
|
849
|
+
valid: !i,
|
|
850
|
+
...i ? { error: i } : {}
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
let u = l.filter((e) => !e.valid).map((e) => `${e.error}:${e.expression}`), d = s.length - l.length;
|
|
854
|
+
return {
|
|
855
|
+
...o,
|
|
856
|
+
valid: o.valid && !u.length,
|
|
857
|
+
errors: [...o.errors, ...u].slice(0, 30),
|
|
858
|
+
warnings: [...o.warnings, ...d ? [r.t("platform.workflow-assistant.formula-omitted", "部分条件尚未通过只读服务端公式检查,需人工正式校验。")] : []].slice(0, 30),
|
|
859
|
+
truncated: o.truncated || d > 0 || o.errors.length + u.length > 30 || o.warnings.length + +!!d > 30 || c.some((e) => e.length > 500),
|
|
860
|
+
formulaChecks: {
|
|
861
|
+
total: s.length,
|
|
862
|
+
checked: l.length,
|
|
863
|
+
omitted: d,
|
|
864
|
+
entries: l,
|
|
865
|
+
officialPublicationValidation: !1
|
|
866
|
+
},
|
|
867
|
+
unsaved: a.dirty,
|
|
868
|
+
...a.submissionStatus && a.submissionStatus !== "idle" ? {
|
|
869
|
+
submissionStatus: a.submissionStatus,
|
|
870
|
+
recoveryRequired: !0
|
|
871
|
+
} : {},
|
|
872
|
+
saved: !1,
|
|
873
|
+
published: !1
|
|
874
|
+
};
|
|
875
|
+
},
|
|
876
|
+
present(e) {
|
|
877
|
+
let t = e;
|
|
878
|
+
return {
|
|
879
|
+
title: r.t("platform.workflow-assistant.diagnostic-title", "流程草稿本地诊断"),
|
|
880
|
+
lines: [
|
|
881
|
+
...t.errors.slice(0, 8),
|
|
882
|
+
...t.warnings.slice(0, 8),
|
|
883
|
+
t.valid ? r.t("platform.workflow-assistant.diagnostic-passed", "本地检查通过;仍需人工保存并执行服务端正式校验和发布。") : r.t("platform.workflow-assistant.diagnostic-incomplete", "草稿尚不完整,请继续配置。"),
|
|
884
|
+
...t.truncated || t.errors.length > 8 || t.warnings.length > 8 ? [r.t("platform.workflow-assistant.diagnostic-truncated", "诊断结果已截断,请在画布核对完整配置。")] : []
|
|
885
|
+
]
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
}, s = {
|
|
889
|
+
effect: "configuration-draft",
|
|
890
|
+
descriptor: {
|
|
891
|
+
code: "workflow.revise-draft",
|
|
892
|
+
description: "批量调整当前画布未保存草稿,完整校验后一次应用、一次撤销。仅支持审批/知会/审批完成里程碑、分支汇聚和路径条件;不覆盖整图、路径端点、ID、版本或冻结状态。参与人仅提交人、相对主管链和合法人员字段;账号/角色/部门/组织以及业务任务复杂配置须人工维护。新建对象用 as 命名并以 {created:as,part:部件} 引用,不能猜新ID。insert-node部件 node/next;insert-branch部件 branch/join/path1/path2/exit1/exit2/return1/return2/next;append-path部件 node/in/out。未涉及配置保留。不保存或发布,完成后请用户沿现有人工保存、校验、发布入口交付。",
|
|
893
|
+
inputSchema: Xe()
|
|
894
|
+
},
|
|
895
|
+
parseInput(e) {
|
|
896
|
+
return Y(() => Ze(e, r), r);
|
|
897
|
+
},
|
|
898
|
+
async execute(t, n) {
|
|
899
|
+
let a = i();
|
|
900
|
+
if (!q(a)) throw new g(r.t("platform.workflow-assistant.not-editable", "当前流程草稿不可编辑"));
|
|
901
|
+
if (t.operations.some((e) => e.op === "update-route" && !Ye(e.patch.conditionExpression, a.fields))) throw new g(r.t("platform.workflow-assistant.condition-field-unavailable", "条件只能引用当前助手可见的业务字段,请在属性面板维护其他条件"));
|
|
902
|
+
let o = Y(() => e.prepare(t), r), s = n.applyEffect(o);
|
|
903
|
+
return {
|
|
904
|
+
changes: s.changes.slice(0, 40).map((e) => e.slice(0, 500)),
|
|
905
|
+
changesTruncated: s.changes.length > 40 || s.changes.some((e) => e.length > 500),
|
|
906
|
+
created: s.created,
|
|
907
|
+
diagnostics: X(s.diagnostics),
|
|
908
|
+
unsaved: e.state().dirty,
|
|
909
|
+
saved: !1,
|
|
910
|
+
published: !1
|
|
911
|
+
};
|
|
912
|
+
},
|
|
913
|
+
present(e) {
|
|
914
|
+
let t = e;
|
|
915
|
+
return {
|
|
916
|
+
title: r.t("platform.workflow-assistant.revised-title", "流程草稿已调整(未保存)"),
|
|
917
|
+
lines: [
|
|
918
|
+
...t.diagnostics.errors.slice(0, 5),
|
|
919
|
+
...t.diagnostics.warnings.slice(0, 5),
|
|
920
|
+
...t.changes.slice(0, 20).map((e) => e.slice(0, 500)),
|
|
921
|
+
...t.changesTruncated || t.changes.length > 20 || t.diagnostics.truncated || t.diagnostics.errors.length > 5 || t.diagnostics.warnings.length > 5 ? [r.t("platform.workflow-assistant.change-truncated", "变化与诊断摘要已截断,请在画布核对完整草稿。")] : [],
|
|
922
|
+
r.t("platform.workflow-assistant.handoff", "尚未保存或发布。请核对画布,并使用现有人工保存、校验和发布入口交付。")
|
|
923
|
+
]
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
return {
|
|
928
|
+
requestTurn: t,
|
|
929
|
+
describe: () => {
|
|
930
|
+
let t = e.state();
|
|
931
|
+
return {
|
|
932
|
+
surface: "workflow-configuration",
|
|
933
|
+
title: t.ready ? t.definition?.title?.slice(0, 200) : void 0,
|
|
934
|
+
facts: {
|
|
935
|
+
ready: t.ready,
|
|
936
|
+
editable: q(t),
|
|
937
|
+
...t.ready ? {
|
|
938
|
+
moduleAlias: t.moduleAlias,
|
|
939
|
+
unsaved: t.dirty
|
|
940
|
+
} : {},
|
|
941
|
+
delivery: r.t("platform.workflow-assistant.delivery-fact", "共享草稿由人工保存、校验和发布;助手不会执行持久写入")
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
},
|
|
945
|
+
capabilities: () => {
|
|
946
|
+
let t = e.state();
|
|
947
|
+
return [...n(), ...t.ready ? [
|
|
948
|
+
a,
|
|
949
|
+
o,
|
|
950
|
+
...q(t) ? [s] : []
|
|
951
|
+
] : []];
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
function Y(e, t) {
|
|
956
|
+
try {
|
|
957
|
+
return e();
|
|
958
|
+
} catch (e) {
|
|
959
|
+
throw e instanceof g ? e : new g(e instanceof Error ? e.message : t.t("platform.workflow-assistant.operation-invalid", "流程操作无效"));
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function X(e) {
|
|
963
|
+
return {
|
|
964
|
+
...e,
|
|
965
|
+
errors: e.errors.slice(0, 30).map((e) => e.slice(0, 300)),
|
|
966
|
+
warnings: e.warnings.slice(0, 30).map((e) => e.slice(0, 300)),
|
|
967
|
+
truncated: e.truncated || e.errors.length > 30 || e.warnings.length > 30 || [...e.errors, ...e.warnings].some((e) => e.length > 300)
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function Z(e, t = v) {
|
|
971
|
+
let n = !1, r = (e, t = 300) => (e && e.length > t && (n = !0), e?.slice(0, t)), i = (t) => {
|
|
972
|
+
if ((t.participantPolicyText?.length ?? 0) > 12e3) return n = !0, {
|
|
973
|
+
configured: !0,
|
|
974
|
+
omitted: !0,
|
|
975
|
+
manualConfigurationRequired: !0
|
|
976
|
+
};
|
|
977
|
+
try {
|
|
978
|
+
let i = ue(t.participantPolicyText);
|
|
979
|
+
return i.length > 16 && (n = !0), {
|
|
980
|
+
configured: !!i.length,
|
|
981
|
+
rules: i.slice(0, 16).map((t) => t.fieldName && !e.fields.some((e) => e.name === t.fieldName && Je(e)) ? { manualConfigurationRequired: !0 } : {
|
|
982
|
+
type: r(t.type),
|
|
983
|
+
...t.fieldName ? { fieldName: r(t.fieldName) } : {},
|
|
984
|
+
...t.relation ? {
|
|
985
|
+
relation: r(t.relation),
|
|
986
|
+
depth: t.depth,
|
|
987
|
+
headOnly: t.headOnly
|
|
988
|
+
} : {},
|
|
989
|
+
...t.ids?.length ? {
|
|
990
|
+
targetCount: t.ids.length,
|
|
991
|
+
manualConfigurationRequired: !0
|
|
992
|
+
} : {}
|
|
993
|
+
})
|
|
994
|
+
};
|
|
995
|
+
} catch {
|
|
996
|
+
return {
|
|
997
|
+
configured: !!t.participantPolicyText,
|
|
998
|
+
invalid: !0
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
}, a = (t) => {
|
|
1002
|
+
if (t.nodeType !== "task" && !t.nodeConfigText) return;
|
|
1003
|
+
let i = {
|
|
1004
|
+
taskDefinitionId: r(t.taskDefinitionId),
|
|
1005
|
+
configured: !!t.nodeConfigText,
|
|
1006
|
+
manualConfigurationRequired: !0
|
|
1007
|
+
};
|
|
1008
|
+
if (!t.nodeConfigText) return i;
|
|
1009
|
+
if (t.nodeConfigText.length > 2e4) return n = !0, {
|
|
1010
|
+
...i,
|
|
1011
|
+
omitted: !0
|
|
1012
|
+
};
|
|
1013
|
+
try {
|
|
1014
|
+
let a = JSON.parse(t.nodeConfigText);
|
|
1015
|
+
if (!tt(a)) return {
|
|
1016
|
+
...i,
|
|
1017
|
+
invalid: !0
|
|
1018
|
+
};
|
|
1019
|
+
let o = (t, i) => {
|
|
1020
|
+
if (Array.isArray(t)) return t.length > 6 && (n = !0), {
|
|
1021
|
+
total: t.length,
|
|
1022
|
+
entries: t.slice(0, 6).filter(tt).map((t) => ({
|
|
1023
|
+
title: r(typeof t.title == "string" ? t.title : void 0),
|
|
1024
|
+
kind: r(typeof t[`${i}Kind`] == "string" ? t[`${i}Kind`] : void 0),
|
|
1025
|
+
enabled: t.enabled === !0,
|
|
1026
|
+
...i === "check" ? { expression: r(typeof t.expression == "string" && Ye(t.expression, e.fields) ? t.expression : void 0) } : {},
|
|
1027
|
+
advancedConfigurationPreserved: !!t[`${i}ConfigText`]
|
|
1028
|
+
}))
|
|
1029
|
+
};
|
|
1030
|
+
};
|
|
1031
|
+
return {
|
|
1032
|
+
...i,
|
|
1033
|
+
definition: tt(a.definition) ? {
|
|
1034
|
+
manualConfirm: a.definition.manualConfirm === !0,
|
|
1035
|
+
enabled: a.definition.enabled !== !1
|
|
1036
|
+
} : void 0,
|
|
1037
|
+
checks: o(a.checks, "check"),
|
|
1038
|
+
guides: o(a.guides, "guide")
|
|
1039
|
+
};
|
|
1040
|
+
} catch {
|
|
1041
|
+
return {
|
|
1042
|
+
...i,
|
|
1043
|
+
invalid: !0
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
}, o = 1e4, s = (e, t, r) => {
|
|
1047
|
+
let i = [];
|
|
1048
|
+
for (let a of e.slice(0, t)) {
|
|
1049
|
+
let e = r(a), t = JSON.stringify(e).length;
|
|
1050
|
+
if (t > o) {
|
|
1051
|
+
n = !0;
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
o -= t, i.push(e);
|
|
1055
|
+
}
|
|
1056
|
+
return i.length < e.length && (n = !0), {
|
|
1057
|
+
total: e.length,
|
|
1058
|
+
entries: i,
|
|
1059
|
+
omitted: e.length - i.length
|
|
1060
|
+
};
|
|
1061
|
+
}, c = e.definition && {
|
|
1062
|
+
id: r(e.definition.id, 128),
|
|
1063
|
+
title: r(e.definition.title),
|
|
1064
|
+
alias: r(e.definition.alias ?? void 0),
|
|
1065
|
+
definitionStatus: r(e.definition.definitionStatus),
|
|
1066
|
+
approvalEnabled: e.definition.approvalEnabled,
|
|
1067
|
+
version: e.definition.version
|
|
1068
|
+
}, l = e.version && {
|
|
1069
|
+
id: r(e.version.id, 128),
|
|
1070
|
+
version: e.version.version,
|
|
1071
|
+
versionNo: e.version.versionNo,
|
|
1072
|
+
publishStatus: r(e.version.publishStatus)
|
|
1073
|
+
}, u = s(e.design.nodes, 60, (e) => ({
|
|
1074
|
+
nodeKey: r(e.nodeKey, 128),
|
|
1075
|
+
nodeType: r(e.nodeType),
|
|
1076
|
+
title: r(e.title),
|
|
1077
|
+
approvalMode: r(e.approvalMode),
|
|
1078
|
+
approvalRatio: e.approvalRatio,
|
|
1079
|
+
milestoneType: r(e.milestoneType),
|
|
1080
|
+
routeMode: r(e.routeMode),
|
|
1081
|
+
selectorNodeKey: r(e.selectorNodeKey, 128),
|
|
1082
|
+
convergeNodeKey: r(e.convergeNodeKey, 128),
|
|
1083
|
+
convergeMode: r(e.convergeMode),
|
|
1084
|
+
convergeRatio: e.convergeRatio,
|
|
1085
|
+
requireManualSelectionReason: e.requireManualSelectionReason,
|
|
1086
|
+
participants: i(e),
|
|
1087
|
+
businessTask: a(e)
|
|
1088
|
+
})), d = s(e.design.links, 100, (t) => ({
|
|
1089
|
+
routeKey: r(t.routeKey, 128),
|
|
1090
|
+
sourceNodeKey: r(t.sourceNodeKey, 128),
|
|
1091
|
+
targetNodeKey: r(t.targetNodeKey, 128),
|
|
1092
|
+
title: r(t.title),
|
|
1093
|
+
conditionExpression: r(Ye(t.conditionExpression, e.fields) ? t.conditionExpression : void 0, 500),
|
|
1094
|
+
defaultRoute: t.defaultRoute
|
|
1095
|
+
})), f = s(e.fields.filter(Je), 60, (e) => ({
|
|
1096
|
+
name: r(e.name),
|
|
1097
|
+
label: r(e.label),
|
|
1098
|
+
referenceModule: r(e.referenceModule),
|
|
1099
|
+
participantSupported: e.referenceModule === "iam.user"
|
|
1100
|
+
})), p = e.selectedNodeKeys.slice(0, 20).map((e) => r(e, 128));
|
|
1101
|
+
p.length < e.selectedNodeKeys.length && (n = !0);
|
|
1102
|
+
let m = r(e.selectedRouteKey, 128);
|
|
1103
|
+
return {
|
|
1104
|
+
moduleAlias: r(e.moduleAlias, 128),
|
|
1105
|
+
definition: c,
|
|
1106
|
+
version: l,
|
|
1107
|
+
editable: q(e),
|
|
1108
|
+
unsaved: e.dirty,
|
|
1109
|
+
...e.submissionStatus && e.submissionStatus !== "idle" ? {
|
|
1110
|
+
submissionStatus: e.submissionStatus,
|
|
1111
|
+
recoveryRequired: !0
|
|
1112
|
+
} : {},
|
|
1113
|
+
nodes: u,
|
|
1114
|
+
routes: d,
|
|
1115
|
+
fields: f,
|
|
1116
|
+
selectedNodeKeys: p,
|
|
1117
|
+
selectedRouteKey: m,
|
|
1118
|
+
truncated: n,
|
|
1119
|
+
limits: {
|
|
1120
|
+
participantWrites: [
|
|
1121
|
+
"INITIATOR_SELF",
|
|
1122
|
+
"RELATIVE:SUPERVISOR",
|
|
1123
|
+
"FIELD:iam.user"
|
|
1124
|
+
],
|
|
1125
|
+
manualConfiguration: [
|
|
1126
|
+
"USER",
|
|
1127
|
+
"ROLE",
|
|
1128
|
+
"DEPT",
|
|
1129
|
+
"ORG",
|
|
1130
|
+
t.t("platform.workflow-assistant.manual-task", "业务任务复杂办理指引与完成检查")
|
|
1131
|
+
],
|
|
1132
|
+
delivery: t.t("platform.workflow-assistant.delivery-limit", "共享草稿;须人工保存、服务端正式校验和发布。未保存不代表已生效。")
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
function tt(e) {
|
|
1137
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1138
|
+
}
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region src/views/useWorkflowConfigurationAssistant.ts
|
|
1141
|
+
function nt(e) {
|
|
1142
|
+
let t = y(), { scope: n, active: r } = e.session, i = k(!1), a = k(!1), o = k(!1), s = 0, c, l;
|
|
1143
|
+
function u() {
|
|
1144
|
+
s++, a.value = o.value = !1, i.value = !1, c?.(), c = void 0;
|
|
1145
|
+
}
|
|
1146
|
+
async function f() {
|
|
1147
|
+
if (u(), !r.value || !t) return;
|
|
1148
|
+
let c = n.value, l = s;
|
|
1149
|
+
i.value = !0;
|
|
1150
|
+
try {
|
|
1151
|
+
let t = d({
|
|
1152
|
+
http: e.http,
|
|
1153
|
+
moduleAlias: "platform.workflow.definition",
|
|
1154
|
+
runtimeAccess: "VIEW"
|
|
1155
|
+
}), i = await t.runtime.ready;
|
|
1156
|
+
if (!r.value || l !== s || n.value !== c) return;
|
|
1157
|
+
let u = e.definitionId(), f = await t.recordActions(u);
|
|
1158
|
+
if (!r.value || l !== s || n.value !== c) return;
|
|
1159
|
+
let p = (e) => i.actions.some((t) => t.actionCode === e && t.authorized === !0) && f.recordId === u && f.actions.some((t) => t.actionCode === e && t.available === !0);
|
|
1160
|
+
a.value = p("viewWorkflowDesign"), o.value = a.value && p("editWorkflowDesign");
|
|
1161
|
+
} catch {} finally {
|
|
1162
|
+
l === s && (i.value = !1);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
function p() {
|
|
1166
|
+
t && !c && r.value && l && (c = t.registry.register({
|
|
1167
|
+
pageInstanceKey: l,
|
|
1168
|
+
executionScopeKey: () => n.value,
|
|
1169
|
+
contextRevision: e.revision,
|
|
1170
|
+
interactionRevision: e.interactionRevision,
|
|
1171
|
+
settle: (t) => Ce(() => !i.value && !e.adapter.state().busy, t),
|
|
1172
|
+
surface: J(e.adapter, h(e.http), () => t.capabilities?.() ?? [])
|
|
1173
|
+
}));
|
|
1174
|
+
}
|
|
1175
|
+
function m() {
|
|
1176
|
+
r.value && (l ||= t?.activePageInstanceKey(), !(c || i.value) && (p(), f().then(p)));
|
|
1177
|
+
}
|
|
1178
|
+
return Le(n, () => {
|
|
1179
|
+
u(), r.value && f().then(p);
|
|
1180
|
+
}, { flush: "sync" }), Pe(m), je(m), Ne(() => {
|
|
1181
|
+
u();
|
|
1182
|
+
}), Me(() => {
|
|
1183
|
+
u();
|
|
1184
|
+
}), {
|
|
1185
|
+
readable: a,
|
|
1186
|
+
writable: o,
|
|
1187
|
+
accessLoading: i
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/platform-components/workflowDesignClipboard.ts
|
|
1192
|
+
var Q = /* @__PURE__ */ new Set([
|
|
1193
|
+
"approval",
|
|
1194
|
+
"task",
|
|
1195
|
+
"milestone",
|
|
1196
|
+
"branch",
|
|
1197
|
+
"converge"
|
|
1198
|
+
]);
|
|
1199
|
+
function rt(e) {
|
|
1200
|
+
if (e?.kind !== "muyun.workflow.fragment" || e.version !== 1 || !Array.isArray(e.nodes) || !Array.isArray(e.links) || !e.nodes.length || e.nodes.length > 500 || e.links.length > 2e3) throw Error("剪贴板中不是有效的流程片段");
|
|
1201
|
+
let t = new Set(e.nodes.map((e) => e?.nodeKey)), n = new Set(e.links.map((e) => e?.routeKey));
|
|
1202
|
+
if (t.size !== e.nodes.length || [...t].some((e) => typeof e != "string" || !e) || n.size !== e.links.length || [...n].some((e) => typeof e != "string" || !e) || e.nodes.some((e) => !Q.has(e.nodeType)) || !t.has(e.entry) || !t.has(e.exit) || e.links.some((e) => !t.has(e.sourceNodeKey) || !t.has(e.targetNodeKey))) throw Error("流程片段包含无效节点或路径");
|
|
1203
|
+
for (let t of e.nodes) if (t.nodeType === "branch" && !e.nodes.some((e) => e.nodeKey === t.convergeNodeKey && e.nodeType === "converge") || t.nodeType === "converge" && !e.nodes.some((e) => e.nodeType === "branch" && e.convergeNodeKey === t.nodeKey)) throw Error("请完整复制分支及其汇聚");
|
|
1204
|
+
let r = /* @__PURE__ */ new Set();
|
|
1205
|
+
function i(t, n = /* @__PURE__ */ new Set()) {
|
|
1206
|
+
if (n.has(t)) throw Error("流程片段不能包含循环");
|
|
1207
|
+
if (r.has(t)) return;
|
|
1208
|
+
let a = e.links.filter((e) => e.sourceNodeKey === t);
|
|
1209
|
+
if (t === e.exit != (a.length === 0)) throw Error("请选择具有单一入口和出口的连续流程片段");
|
|
1210
|
+
for (let e of a) i(e.targetNodeKey, /* @__PURE__ */ new Set([...n, t]));
|
|
1211
|
+
r.add(t);
|
|
1212
|
+
}
|
|
1213
|
+
if (e.links.some((t) => t.targetNodeKey === e.entry)) throw Error("流程片段入口无效");
|
|
1214
|
+
if (i(e.entry), r.size !== t.size) throw Error("请选择连续的流程片段");
|
|
1215
|
+
for (let t of e.nodes.filter((e) => e.nodeType === "branch")) {
|
|
1216
|
+
let n = /* @__PURE__ */ new Set();
|
|
1217
|
+
function r(i) {
|
|
1218
|
+
if (n.has(i) || (n.add(i), i === t.convergeNodeKey)) return;
|
|
1219
|
+
let a = e.links.filter((e) => e.sourceNodeKey === i);
|
|
1220
|
+
if (!a.length) throw Error("分支路径必须到达配对汇聚");
|
|
1221
|
+
a.forEach((e) => r(e.targetNodeKey));
|
|
1222
|
+
}
|
|
1223
|
+
if (r(t.nodeKey), e.links.some((e) => !n.has(e.sourceNodeKey) && n.has(e.targetNodeKey) && e.targetNodeKey !== t.nodeKey || n.has(e.sourceNodeKey) && !n.has(e.targetNodeKey) && e.sourceNodeKey !== t.convergeNodeKey)) throw Error("分支不能包含外部交叉路径");
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
function it(e, t) {
|
|
1227
|
+
let n = new Set(t.filter((t) => Q.has(e.nodes.find((e) => e.nodeKey === t)?.nodeType ?? "")));
|
|
1228
|
+
for (let t of [...n]) {
|
|
1229
|
+
if (e.nodes.find((e) => e.nodeKey === t)?.nodeType !== "branch") continue;
|
|
1230
|
+
let r = new Set(Ue(e, t).nodes.map((e) => e.nodeKey));
|
|
1231
|
+
e.nodes.filter((e) => !r.has(e.nodeKey)).forEach((e) => n.add(e.nodeKey));
|
|
1232
|
+
}
|
|
1233
|
+
let r = e.links.filter((e) => !n.has(e.sourceNodeKey) && n.has(e.targetNodeKey)), i = e.links.filter((e) => n.has(e.sourceNodeKey) && !n.has(e.targetNodeKey));
|
|
1234
|
+
if (r.length !== 1 || i.length !== 1) throw Error("请选择具有单一入口和出口的连续节点;分支会整体复制");
|
|
1235
|
+
let a = {
|
|
1236
|
+
kind: "muyun.workflow.fragment",
|
|
1237
|
+
version: 1,
|
|
1238
|
+
nodes: e.nodes.filter((e) => n.has(e.nodeKey)),
|
|
1239
|
+
links: e.links.filter((e) => n.has(e.sourceNodeKey) && n.has(e.targetNodeKey)),
|
|
1240
|
+
entry: r[0].targetNodeKey,
|
|
1241
|
+
exit: i[0].sourceNodeKey
|
|
1242
|
+
};
|
|
1243
|
+
return rt(a), JSON.stringify(a);
|
|
1244
|
+
}
|
|
1245
|
+
function at(e, t, n, r) {
|
|
1246
|
+
if (n.length > 1e6) throw Error("流程片段过大");
|
|
1247
|
+
let i;
|
|
1248
|
+
try {
|
|
1249
|
+
i = JSON.parse(n);
|
|
1250
|
+
} catch {
|
|
1251
|
+
throw Error("剪贴板中不是有效的流程片段");
|
|
1252
|
+
}
|
|
1253
|
+
rt(i);
|
|
1254
|
+
let a = e.links.find((e) => e.routeKey === t);
|
|
1255
|
+
if (!a) throw Error("请选择粘贴位置的路径或节点");
|
|
1256
|
+
let o = new Map(i.nodes.map((e, t) => [e.nodeKey, `${r}_n${t}`])), s = (e) => `${r}_r${e}`;
|
|
1257
|
+
if (e.nodes.some((e) => [...o.values()].includes(e.nodeKey)) || e.links.some((e) => Array.from({ length: i.links.length + 1 }, (e, t) => s(t)).includes(e.routeKey))) throw Error("粘贴标识冲突,请重试");
|
|
1258
|
+
let c = i.nodes.map((e) => {
|
|
1259
|
+
let t = { ...e };
|
|
1260
|
+
return delete t.id, delete t.version, delete t.nodeStatus, {
|
|
1261
|
+
...t,
|
|
1262
|
+
nodeKey: o.get(e.nodeKey),
|
|
1263
|
+
convergeNodeKey: e.convergeNodeKey ? o.get(e.convergeNodeKey) : void 0,
|
|
1264
|
+
selectorNodeKey: e.selectorNodeKey ? o.get(e.selectorNodeKey) : void 0
|
|
1265
|
+
};
|
|
1266
|
+
}), l = i.links.map((e, t) => {
|
|
1267
|
+
let n = { ...e };
|
|
1268
|
+
return delete n.id, delete n.routeStatus, delete n.routeReason, delete n.selectedReason, {
|
|
1269
|
+
...n,
|
|
1270
|
+
routeKey: s(t),
|
|
1271
|
+
sourceNodeKey: o.get(e.sourceNodeKey),
|
|
1272
|
+
targetNodeKey: o.get(e.targetNodeKey)
|
|
1273
|
+
};
|
|
1274
|
+
});
|
|
1275
|
+
return {
|
|
1276
|
+
design: {
|
|
1277
|
+
...e,
|
|
1278
|
+
nodes: [...e.nodes, ...c],
|
|
1279
|
+
links: [
|
|
1280
|
+
...e.links.map((e) => e === a ? {
|
|
1281
|
+
...e,
|
|
1282
|
+
targetNodeKey: o.get(i.entry)
|
|
1283
|
+
} : e),
|
|
1284
|
+
...l,
|
|
1285
|
+
{
|
|
1286
|
+
routeKey: s(l.length),
|
|
1287
|
+
sourceNodeKey: o.get(i.exit),
|
|
1288
|
+
targetNodeKey: a.targetNodeKey,
|
|
1289
|
+
title: "继续"
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
},
|
|
1293
|
+
keys: c.map((e) => e.nodeKey),
|
|
1294
|
+
reconfigureSelectorKeys: c.filter((e) => e.nodeType === "branch" && e.routeMode === "manual" && !e.selectorNodeKey).map((e) => e.nodeKey)
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/views/WorkflowConfigurationView.vue?vue&type=script&setup=true&lang.ts
|
|
1299
|
+
var ot = { class: "workflow-configuration" }, st = { class: "configuration-status" }, ct = {
|
|
1300
|
+
class: "configuration-state configuration-state--dirty",
|
|
1301
|
+
role: "status"
|
|
1302
|
+
}, lt = { class: "configuration-state" }, ut = {
|
|
1303
|
+
key: 0,
|
|
1304
|
+
class: "configuration-recovery",
|
|
1305
|
+
role: "alert"
|
|
1306
|
+
}, dt = { key: 1 }, ft = { key: 3 }, pt = { class: "configuration-property-operations" }, mt = { class: "publish-nodes" }, ht = { key: 0 }, gt = { key: 0 }, _t = { key: 1 }, vt = { key: 0 }, yt = 720, bt = /*#__PURE__*/ oe(/* @__PURE__ */ D({
|
|
1307
|
+
name: "WorkflowConfigurationView",
|
|
1308
|
+
__name: "WorkflowConfigurationView",
|
|
1309
|
+
props: {
|
|
1310
|
+
moduleAlias: {},
|
|
1311
|
+
moduleTitle: {},
|
|
1312
|
+
definitionId: {}
|
|
1313
|
+
},
|
|
1314
|
+
setup(t) {
|
|
1315
|
+
let n = ie();
|
|
1316
|
+
function d(e) {
|
|
1317
|
+
return de(e, n);
|
|
1318
|
+
}
|
|
1319
|
+
let h = t, { context: ae, businessRuntime: oe, businessLoading: g, fields: _, conditionTools: v } = we(() => h.moduleAlias), y = ne(ae.http, h.moduleAlias), be = k({
|
|
1320
|
+
tasks: [],
|
|
1321
|
+
queries: [],
|
|
1322
|
+
generations: [],
|
|
1323
|
+
associations: []
|
|
1324
|
+
}), xe = x(() => (oe.value?.actions ?? []).map((e) => ({
|
|
1325
|
+
value: e.actionCode,
|
|
1326
|
+
label: e.title ?? d(e.actionCode)
|
|
1327
|
+
}))), Ce = k(), Te = pe(Ce, () => yt + ee.compact + he.columnGap), D = k(!1), ke = k(!1), Fe = x(() => [
|
|
1328
|
+
{
|
|
1329
|
+
key: "save",
|
|
1330
|
+
title: n.t("platform.screen.WorkflowConfigurationView.save-draft", "保存草稿"),
|
|
1331
|
+
level: "primary",
|
|
1332
|
+
disabled: !Q.value || !X.value
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
key: "read-current",
|
|
1336
|
+
title: n.t("platform.workflow-config.read-current", "读取当前版本"),
|
|
1337
|
+
level: "secondary",
|
|
1338
|
+
disabled: !I.value || Y.value || !X.value && !z.value
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
key: "validate",
|
|
1342
|
+
title: n.t("platform.screen.WorkflowConfigurationView.validate-workflow", "校验流程"),
|
|
1343
|
+
level: "secondary",
|
|
1344
|
+
disabled: !Q.value
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
key: "publish",
|
|
1348
|
+
title: L.value?.publishStatus === "published" ? n.t("platform.screen.WorkflowConfigurationView.enable-published", "启用已发布版本") : n.t("platform.screen.WorkflowConfigurationView.publish-workflow", "发布流程"),
|
|
1349
|
+
disabled: !L.value || Y.value || z.value
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
key: "upgrade",
|
|
1353
|
+
title: n.t("platform.screen.WorkflowConfigurationView.create-version", "创建新版本"),
|
|
1354
|
+
level: "secondary",
|
|
1355
|
+
disabled: !I.value || Y.value || X.value || z.value
|
|
1356
|
+
}
|
|
1357
|
+
]), ze = x(() => $.value?.nodeType === "branch" ? [{
|
|
1358
|
+
key: "path",
|
|
1359
|
+
title: n.t("platform.screen.WorkflowDesignProperties.add-branch-route", "增加分支路径"),
|
|
1360
|
+
disabled: !Q.value
|
|
1361
|
+
}] : [{
|
|
1362
|
+
key: "node",
|
|
1363
|
+
title: n.t("platform.screen.WorkflowConfigurationView.insert-approval-node", "插入节点"),
|
|
1364
|
+
disabled: !Q.value || !$t()
|
|
1365
|
+
}, {
|
|
1366
|
+
key: "branch",
|
|
1367
|
+
title: n.t("platform.screen.WorkflowConfigurationView.insert-branch-and-convergence", "添加分支"),
|
|
1368
|
+
disabled: !Q.value || !$t()
|
|
1369
|
+
}]);
|
|
1370
|
+
function We(e) {
|
|
1371
|
+
e === "node" ? rn() : e === "branch" ? en() : e === "path" && tn();
|
|
1372
|
+
}
|
|
1373
|
+
function Je(e) {
|
|
1374
|
+
e === "save" ? Vt() : e === "read-current" ? Ut() : e === "validate" ? Gt() : e === "publish" ? ke.value = !0 : e === "upgrade" && qt();
|
|
1375
|
+
}
|
|
1376
|
+
function Ye(e) {
|
|
1377
|
+
try {
|
|
1378
|
+
return ue(e).map((e) => ({
|
|
1379
|
+
INITIATOR_SELF: n.t("platform.workflow-participant.initiator", "提交人本人"),
|
|
1380
|
+
USER: n.t("platform.workflow-participant.named-accounts", "指定账号"),
|
|
1381
|
+
ROLE: n.t("platform.workflow-participant.role-members", "角色成员"),
|
|
1382
|
+
DEPT: n.t("platform.workflow-participant.department-members", "部门成员"),
|
|
1383
|
+
ORG: n.t("platform.workflow-participant.organization-members", "组织成员"),
|
|
1384
|
+
FIELD: n.t("platform.workflow-participant.participant-field", "业务人员字段"),
|
|
1385
|
+
RELATIVE: n.t("platform.workflow-participant.relative-participants", "相对人员")
|
|
1386
|
+
}[e.type] ?? e.type) + (e.ids?.length ? n.t("platform.workflow-config.target-count", "({count} 个目标)", { count: e.ids.length }) : e.fieldName ? `(${_.value.find((t) => t.name === e.fieldName)?.label ?? e.fieldName})` : "")).join("、") || n.t("platform.workflow-config.empty-participants", "尚未配置参与人");
|
|
1387
|
+
} catch {
|
|
1388
|
+
return n.t("platform.workflow-config.invalid-participants", "人员配置格式无效");
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
let N = k(!1), P = k(), F = k([]), I = k(), L = k(), R = et({
|
|
1392
|
+
moduleAlias: () => h.moduleAlias,
|
|
1393
|
+
definitionId: () => h.definitionId
|
|
1394
|
+
}), { recoveryRequired: z, submissionStatus: B } = R, V = k(), Xe = k(!1), H = k(!1), Ze = k(!1), Qe = x(() => !V.value || Xe.value || H.value || (W.value?.version.version ?? -1) > V.value.expectedVersion);
|
|
1395
|
+
function $e() {
|
|
1396
|
+
return Re(R.scope.value, window.sessionStorage);
|
|
1397
|
+
}
|
|
1398
|
+
let U = k(""), W = k(), { design: G, history: K } = R, q = k(""), J = k(""), Y = k(!1), X = K.dirty, Z = k([]), tt = x(() => ["published", "archived"].includes(L.value?.publishStatus ?? "")), Q = x(() => L.value?.publishStatus === "draft" && !Y.value && !z.value), rt = k(""), bt = k(0), xt = nt({
|
|
1399
|
+
session: R,
|
|
1400
|
+
http: ae.http,
|
|
1401
|
+
definitionId: () => h.definitionId,
|
|
1402
|
+
interactionRevision: () => String(bt.value),
|
|
1403
|
+
revision: () => JSON.stringify([
|
|
1404
|
+
R.scope.value,
|
|
1405
|
+
rt.value,
|
|
1406
|
+
L.value,
|
|
1407
|
+
I.value,
|
|
1408
|
+
G.value,
|
|
1409
|
+
_.value,
|
|
1410
|
+
Z.value,
|
|
1411
|
+
J.value,
|
|
1412
|
+
Y.value,
|
|
1413
|
+
B.value,
|
|
1414
|
+
N.value,
|
|
1415
|
+
g.value,
|
|
1416
|
+
xt.readable.value,
|
|
1417
|
+
xt.writable.value,
|
|
1418
|
+
R.active.value
|
|
1419
|
+
]),
|
|
1420
|
+
adapter: {
|
|
1421
|
+
language: n,
|
|
1422
|
+
validateCondition: (e) => y.validateCondition(e),
|
|
1423
|
+
state: () => ({
|
|
1424
|
+
ready: R.active.value && xt.readable.value && rt.value === R.scope.value && !!(I.value && L.value && oe.value) && !N.value && !P.value && !Y.value,
|
|
1425
|
+
editable: Q.value && xt.writable.value,
|
|
1426
|
+
busy: Y.value || N.value || g.value,
|
|
1427
|
+
moduleAlias: h.moduleAlias,
|
|
1428
|
+
definition: I.value,
|
|
1429
|
+
version: L.value,
|
|
1430
|
+
design: G.value,
|
|
1431
|
+
fields: _.value,
|
|
1432
|
+
selectedNodeKeys: Z.value,
|
|
1433
|
+
selectedRouteKey: J.value,
|
|
1434
|
+
dirty: X.value,
|
|
1435
|
+
submissionStatus: B.value
|
|
1436
|
+
}),
|
|
1437
|
+
prepare: (e) => {
|
|
1438
|
+
let t = R.scope.value;
|
|
1439
|
+
return R.prepare(e, _.value, () => R.scope.value === t && R.active.value && xt.readable.value && xt.writable.value && Q.value && rt.value === t && !N.value && !P.value);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}), $ = x(() => G.value.nodes.find((e) => e.nodeKey === q.value)), St = x(() => G.value.links.find((e) => e.routeKey === J.value)), Ct = k(!1), wt = x(() => Q.value && !Ct.value && Z.value.length === 1 && $.value != null && ![
|
|
1443
|
+
"start",
|
|
1444
|
+
"end",
|
|
1445
|
+
"converge"
|
|
1446
|
+
].includes($.value.nodeType));
|
|
1447
|
+
async function Tt() {
|
|
1448
|
+
if (wt.value) {
|
|
1449
|
+
Ct.value = !0;
|
|
1450
|
+
try {
|
|
1451
|
+
$.value?.nodeType === "branch" ? await nn() : an();
|
|
1452
|
+
} finally {
|
|
1453
|
+
Ct.value = !1;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
function Et(e) {
|
|
1458
|
+
let t = G.value.nodes.find((t) => t.nodeKey === e.convergeNodeKey), r = {
|
|
1459
|
+
all: n.t("platform.workflow-config.all-arrive", "全部到达"),
|
|
1460
|
+
any: n.t("platform.workflow-config.any-arrive", "任一到达"),
|
|
1461
|
+
ratio: n.t("platform.workflow-config.ratio-arrive", "比例到达")
|
|
1462
|
+
}, i = t?.convergeMode ?? "all";
|
|
1463
|
+
return `${r[i]}${i === "ratio" ? ` ${t?.convergeRatio ?? 100}%` : ""}`;
|
|
1464
|
+
}
|
|
1465
|
+
p(() => n.t("platform.workflow-config.configuration", "流程配置"), () => X.value, () => Y.value), Pe(() => {
|
|
1466
|
+
Rt();
|
|
1467
|
+
});
|
|
1468
|
+
let Dt = 0, Ot = !1, kt = !1, At = 0, jt = 0, Mt = !1;
|
|
1469
|
+
function Nt() {
|
|
1470
|
+
let e = jt;
|
|
1471
|
+
return () => !kt && jt === e;
|
|
1472
|
+
}
|
|
1473
|
+
function Pt() {
|
|
1474
|
+
let e = At, t = R.scope.value;
|
|
1475
|
+
return () => !kt && R.active.value && At === e && R.scope.value === t;
|
|
1476
|
+
}
|
|
1477
|
+
function Ft() {
|
|
1478
|
+
let e = Pt(), t = K.checkpoint();
|
|
1479
|
+
return () => e() && t();
|
|
1480
|
+
}
|
|
1481
|
+
Le(R.scope, () => {
|
|
1482
|
+
At++, jt++, Mt = !1, B.value = "idle", V.value = void 0, Xe.value = !1, H.value = !1, Ze.value = !1, W.value = void 0, Dt++, rt.value = "", I.value = void 0, L.value = void 0, F.value = [], K.reset({
|
|
1483
|
+
nodes: [],
|
|
1484
|
+
links: []
|
|
1485
|
+
}), Z.value = [], q.value = J.value = "", D.value = ke.value = !1, Y.value = !1, y = ne(ae.http, h.moduleAlias), R.active.value && Rt();
|
|
1486
|
+
}, { flush: "sync" }), Ne(() => {
|
|
1487
|
+
At++, Dt++, Mt || (Y.value = !1), N.value = !1;
|
|
1488
|
+
}), Me(() => {
|
|
1489
|
+
kt = !0, At++, Dt++;
|
|
1490
|
+
});
|
|
1491
|
+
async function It() {
|
|
1492
|
+
if (kt || !I.value) return;
|
|
1493
|
+
if (Y.value) {
|
|
1494
|
+
Ot = !0;
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
let e = ++Dt, t = Pt();
|
|
1498
|
+
try {
|
|
1499
|
+
let n = await y.view(h.definitionId);
|
|
1500
|
+
t() && e === Dt && (I.value = n);
|
|
1501
|
+
} catch (n) {
|
|
1502
|
+
t() && e === Dt && m(n, {
|
|
1503
|
+
source: "workflow-design",
|
|
1504
|
+
phase: "load"
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
je(() => {
|
|
1509
|
+
I.value ? It() : Rt();
|
|
1510
|
+
}), e({
|
|
1511
|
+
moduleAlias: "platform.workflow.definition",
|
|
1512
|
+
recordId: () => h.definitionId,
|
|
1513
|
+
handler: It
|
|
1514
|
+
});
|
|
1515
|
+
async function Lt(e, t = !1) {
|
|
1516
|
+
if (Y.value) return;
|
|
1517
|
+
Dt++, Y.value = !0;
|
|
1518
|
+
let n = t ? Nt() : Pt();
|
|
1519
|
+
Mt = t;
|
|
1520
|
+
try {
|
|
1521
|
+
await e(n);
|
|
1522
|
+
} catch (e) {
|
|
1523
|
+
n() && m(e, {
|
|
1524
|
+
source: "workflow-design",
|
|
1525
|
+
phase: "action"
|
|
1526
|
+
});
|
|
1527
|
+
} finally {
|
|
1528
|
+
n() && (Y.value = !1, Mt = !1), n() && Ot && (Ot = !1, await It());
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
async function Rt() {
|
|
1532
|
+
if (Y.value || X.value) return;
|
|
1533
|
+
N.value = !0, P.value = void 0;
|
|
1534
|
+
let e = Pt(), t = y, r = h.definitionId;
|
|
1535
|
+
await Lt(async (e) => {
|
|
1536
|
+
try {
|
|
1537
|
+
V.value = $e().restore(), V.value && (B.value = "unknown", Ze.value = !0);
|
|
1538
|
+
let i = await t.view(r);
|
|
1539
|
+
if (!e()) return;
|
|
1540
|
+
let a = await t.catalog(i.id);
|
|
1541
|
+
if (!e()) return;
|
|
1542
|
+
let o = (await t.versions(i.id)).sort((e, t) => t.versionNo - e.versionNo);
|
|
1543
|
+
if (!e()) return;
|
|
1544
|
+
let s = V.value ? o.find((e) => e.id === V.value.versionId) : o[0] ?? await t.upgrade(i.id);
|
|
1545
|
+
if (!s) throw Error("原保存的流程版本已不存在,请联系管理员核实");
|
|
1546
|
+
if (!e()) return;
|
|
1547
|
+
o.length || o.push(s);
|
|
1548
|
+
let c = await t.design(i.id, s.id);
|
|
1549
|
+
if (!e()) return;
|
|
1550
|
+
let l = s.publishStatus === "draft" && !c.nodes.length;
|
|
1551
|
+
l && (c = qe(i.approvalEnabled, n)), I.value = i, be.value = a, F.value = o, L.value = s, K.reset(c, l ? {
|
|
1552
|
+
nodes: [],
|
|
1553
|
+
links: []
|
|
1554
|
+
} : c), rt.value = R.scope.value, Z.value = [], q.value = "", J.value = "", D.value = !1;
|
|
1555
|
+
} catch (t) {
|
|
1556
|
+
e() && (P.value = () => a(l(t), n));
|
|
1557
|
+
}
|
|
1558
|
+
}), e() && (N.value = !1);
|
|
1559
|
+
}
|
|
1560
|
+
async function zt(e, t = Pt()) {
|
|
1561
|
+
let n = await y.design(I.value.id, e.id);
|
|
1562
|
+
t() && (L.value = e, K.reset(n), Z.value = [], q.value = G.value.nodes[0]?.nodeKey ?? "", J.value = "", D.value = !1);
|
|
1563
|
+
}
|
|
1564
|
+
async function Bt(e) {
|
|
1565
|
+
if (X.value || z.value || Y.value) return;
|
|
1566
|
+
let t = F.value.find((t) => t.id === e);
|
|
1567
|
+
t && (bt.value++, await Lt(() => zt(t)));
|
|
1568
|
+
}
|
|
1569
|
+
async function Vt() {
|
|
1570
|
+
Q.value && L.value && I.value && await Lt(async (e) => {
|
|
1571
|
+
let t = {
|
|
1572
|
+
requestId: te(),
|
|
1573
|
+
versionId: L.value.id,
|
|
1574
|
+
expectedVersion: L.value.version
|
|
1575
|
+
}, a = $e();
|
|
1576
|
+
a.save(t), V.value = t, Xe.value = !1, H.value = !1;
|
|
1577
|
+
let o = await y.saveDesign(I.value.id, L.value.id, L.value.version, G.value, t.requestId).catch((n) => {
|
|
1578
|
+
if (n instanceof r && [
|
|
1579
|
+
400,
|
|
1580
|
+
401,
|
|
1581
|
+
403,
|
|
1582
|
+
404,
|
|
1583
|
+
409,
|
|
1584
|
+
422
|
|
1585
|
+
].includes(n.status ?? 0)) {
|
|
1586
|
+
try {
|
|
1587
|
+
a.clear(t.requestId);
|
|
1588
|
+
} catch (t) {
|
|
1589
|
+
throw e() && (B.value = "unknown"), t;
|
|
1590
|
+
}
|
|
1591
|
+
e() && (V.value = void 0);
|
|
1592
|
+
}
|
|
1593
|
+
throw e() && n instanceof r && n.status === 409 && (B.value = "conflict"), e() && !(n instanceof r && [
|
|
1594
|
+
400,
|
|
1595
|
+
401,
|
|
1596
|
+
403,
|
|
1597
|
+
404,
|
|
1598
|
+
409,
|
|
1599
|
+
422
|
|
1600
|
+
].includes(n.status ?? 0)) && (B.value = "unknown"), n;
|
|
1601
|
+
});
|
|
1602
|
+
try {
|
|
1603
|
+
a.clear(t.requestId);
|
|
1604
|
+
} catch (t) {
|
|
1605
|
+
throw e() && (B.value = "unknown"), t;
|
|
1606
|
+
}
|
|
1607
|
+
e() && (V.value = void 0, L.value = o, F.value = F.value.map((e) => e.id === L.value.id ? L.value : e), K.markSaved(), i(n.t("platform.workflow-config.draft-saved", "流程草稿已保存")));
|
|
1608
|
+
}, !0);
|
|
1609
|
+
}
|
|
1610
|
+
async function Ht() {
|
|
1611
|
+
if (Y.value || !V.value || !I.value || !L.value) return;
|
|
1612
|
+
let e = V.value, t = I.value.id;
|
|
1613
|
+
await Lt(async (n) => {
|
|
1614
|
+
let r = await y.abandonSave(t, e.versionId, e.requestId);
|
|
1615
|
+
n() && (Xe.value = r.committed === !0, H.value = r.cancelled === !0);
|
|
1616
|
+
}, !0), R.active.value && V.value === e && await Ut();
|
|
1617
|
+
}
|
|
1618
|
+
async function Ut() {
|
|
1619
|
+
if (!z.value && !X.value || !I.value || !L.value) return;
|
|
1620
|
+
let e = I.value.id, t = L.value.id;
|
|
1621
|
+
Y.value || (W.value = void 0, B.value === "idle" && (B.value = "review"), await Lt(async (r) => {
|
|
1622
|
+
if (V.value) {
|
|
1623
|
+
let n = await y.saveReceipt(e, t, V.value.requestId);
|
|
1624
|
+
if (!r()) return;
|
|
1625
|
+
Xe.value = n.committed === !0, H.value = n.cancelled === !0;
|
|
1626
|
+
}
|
|
1627
|
+
let i = await y.versions(e);
|
|
1628
|
+
if (!r()) return;
|
|
1629
|
+
let a = i.find((e) => e.id === t);
|
|
1630
|
+
if (!a) throw Error(n.t("platform.workflow-config.version-missing", "当前流程版本已不存在"));
|
|
1631
|
+
let o = await y.design(e, t);
|
|
1632
|
+
r() && (F.value = i.sort((e, t) => t.versionNo - e.versionNo), W.value = {
|
|
1633
|
+
version: a,
|
|
1634
|
+
design: o
|
|
1635
|
+
}, U.value = `node:${o.nodes.find((e) => !["start", "end"].includes(e.nodeType))?.nodeKey ?? o.nodes[0]?.nodeKey ?? ""}`);
|
|
1636
|
+
}));
|
|
1637
|
+
}
|
|
1638
|
+
function Wt(e) {
|
|
1639
|
+
if (Y.value || !W.value || !z.value || !Qe.value || e && (Ze.value || W.value.version.publishStatus !== "draft")) return;
|
|
1640
|
+
let t = W.value;
|
|
1641
|
+
try {
|
|
1642
|
+
V.value && $e().clear(V.value.requestId);
|
|
1643
|
+
} catch (e) {
|
|
1644
|
+
m(e, {
|
|
1645
|
+
source: "workflow-design",
|
|
1646
|
+
phase: "action"
|
|
1647
|
+
});
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
V.value = void 0, Xe.value = !1, H.value = !1, Ze.value = !1, L.value = t.version, K.reset(e ? G.value : t.design, t.design), W.value = void 0, B.value = "idle", bt.value++;
|
|
1651
|
+
}
|
|
1652
|
+
async function Gt() {
|
|
1653
|
+
if (z.value) return;
|
|
1654
|
+
let e = Pt();
|
|
1655
|
+
X.value && await Vt(), e() && !X.value && L.value && await Lt(async (e) => {
|
|
1656
|
+
await y.validate(I.value.id, L.value.id), e() && i(n.t("platform.workflow-config.validated", "流程发布校验通过"));
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
async function Kt() {
|
|
1660
|
+
if (z.value) return;
|
|
1661
|
+
let e = Pt();
|
|
1662
|
+
if (G.value.nodes.some((e) => ["approval", "task"].includes(e.nodeType) && !se(e.participantPolicyText))) {
|
|
1663
|
+
m(Error(n.t("platform.workflow-config.participants-required", "请为每个审批或业务任务节点明确配置参与人")), {
|
|
1664
|
+
source: "workflow-design",
|
|
1665
|
+
phase: "validation"
|
|
1666
|
+
});
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
X.value && await Vt(), e() && !X.value && I.value && L.value && await Lt(async (e) => {
|
|
1670
|
+
let t = await y.publish(I.value.id, L.value.id, I.value.version, L.value.version);
|
|
1671
|
+
if (e()) {
|
|
1672
|
+
L.value = t, F.value = F.value.map((e) => e.id === L.value.id ? L.value : e), K.markSaved(), ke.value = !1, i(n.t("platform.workflow-config.published", "流程已发布,后续新申请使用该版本"));
|
|
1673
|
+
try {
|
|
1674
|
+
let t = await y.view(I.value.id);
|
|
1675
|
+
e() && (I.value = t);
|
|
1676
|
+
} catch (t) {
|
|
1677
|
+
e() && m(t, {
|
|
1678
|
+
source: "workflow-design",
|
|
1679
|
+
phase: "load"
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
}, !0);
|
|
1684
|
+
}
|
|
1685
|
+
async function qt() {
|
|
1686
|
+
z.value || X.value || I.value && await Lt(async (e) => {
|
|
1687
|
+
let t = await y.upgrade(I.value.id);
|
|
1688
|
+
e() && (F.value = [t, ...F.value.filter((e) => e.id !== t.id)], await zt(t, e), e() && (G.value.nodes.length || (G.value = qe(I.value.approvalEnabled, n), Jt("approval"))));
|
|
1689
|
+
}, !0);
|
|
1690
|
+
}
|
|
1691
|
+
function Jt(e) {
|
|
1692
|
+
G.value.nodes.some((t) => t.nodeKey === e) || (e = ""), Z.value = e ? [e] : [], q.value = e, J.value = "", D.value = !!e;
|
|
1693
|
+
}
|
|
1694
|
+
function Yt(e) {
|
|
1695
|
+
G.value.links.some((t) => t.routeKey === e) || (e = ""), Z.value = [], J.value = e, q.value = "", D.value = !!e;
|
|
1696
|
+
}
|
|
1697
|
+
function Xt(e) {
|
|
1698
|
+
Q.value && G.value.layoutJson !== e && (G.value = {
|
|
1699
|
+
...G.value,
|
|
1700
|
+
layoutJson: e
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
function Zt(e) {
|
|
1704
|
+
$.value && Q.value && R.updateNode(q.value, e);
|
|
1705
|
+
}
|
|
1706
|
+
function Qt(e) {
|
|
1707
|
+
St.value && Q.value && R.updateRoute(St.value.routeKey, e);
|
|
1708
|
+
}
|
|
1709
|
+
function $t() {
|
|
1710
|
+
let e = G.value.links.filter((e) => e.sourceNodeKey === q.value);
|
|
1711
|
+
return J.value || (e.length === 1 ? e[0]?.routeKey : void 0) || "";
|
|
1712
|
+
}
|
|
1713
|
+
function en() {
|
|
1714
|
+
if (!Q.value) return;
|
|
1715
|
+
let e = `branch_${Date.now().toString(36)}`;
|
|
1716
|
+
try {
|
|
1717
|
+
G.value = Ve(G.value, $t(), e, n), Jt(e);
|
|
1718
|
+
} catch (e) {
|
|
1719
|
+
m(e, {
|
|
1720
|
+
source: "workflow-design",
|
|
1721
|
+
phase: "validation"
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
function tn() {
|
|
1726
|
+
if (Q.value) try {
|
|
1727
|
+
G.value = He(G.value, q.value, `path_${Date.now().toString(36)}`, n);
|
|
1728
|
+
} catch (e) {
|
|
1729
|
+
m(e, {
|
|
1730
|
+
source: "workflow-design",
|
|
1731
|
+
phase: "validation"
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
async function nn() {
|
|
1736
|
+
if (Q.value) try {
|
|
1737
|
+
let e = Ft(), t = Ue(G.value, q.value, n);
|
|
1738
|
+
if (!await o({
|
|
1739
|
+
title: n.t("platform.workflow-config.delete-branch-confirm", "删除整个分支?"),
|
|
1740
|
+
content: n.t("platform.workflow-config.delete-branch-detail", "将删除分支、配对汇聚及其中 {count} 个节点,并连接前后路径。", { count: G.value.nodes.length - t.nodes.length - 2 }),
|
|
1741
|
+
danger: !0,
|
|
1742
|
+
okText: n.t("platform.workflow-config.delete-branch", "删除分支")
|
|
1743
|
+
}, n) || !sn(e)) return;
|
|
1744
|
+
G.value = t, q.value = "", D.value = !1;
|
|
1745
|
+
} catch (e) {
|
|
1746
|
+
m(e, {
|
|
1747
|
+
source: "workflow-design",
|
|
1748
|
+
phase: "validation"
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
function rn() {
|
|
1753
|
+
if (!Q.value) return;
|
|
1754
|
+
let e = G.value.links.filter((e) => e.sourceNodeKey === q.value), t = J.value || (e.length === 1 ? e[0]?.routeKey : void 0), r = `node_${Date.now().toString(36)}`;
|
|
1755
|
+
try {
|
|
1756
|
+
G.value = Ge(G.value, t ?? "", Be(r, n.t("platform.workflow-config.new-approval-node", "新审批节点")), n), Jt(r);
|
|
1757
|
+
} catch (e) {
|
|
1758
|
+
m(e, {
|
|
1759
|
+
source: "workflow-design",
|
|
1760
|
+
phase: "validation"
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
function an() {
|
|
1765
|
+
if (Q.value) try {
|
|
1766
|
+
G.value = Ke(G.value, q.value, n), q.value = "", D.value = !1;
|
|
1767
|
+
} catch (e) {
|
|
1768
|
+
m(e, {
|
|
1769
|
+
source: "workflow-design",
|
|
1770
|
+
phase: "validation"
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
function on(e) {
|
|
1775
|
+
let t = new Set(G.value.nodes.map((e) => e.nodeKey));
|
|
1776
|
+
e = [...new Set(e)].filter((e) => t.has(e)), Z.value = e, q.value = e.length === 1 ? e[0] : "", J.value = "", D.value = !1;
|
|
1777
|
+
}
|
|
1778
|
+
Le(() => JSON.stringify([
|
|
1779
|
+
G.value,
|
|
1780
|
+
Z.value,
|
|
1781
|
+
J.value
|
|
1782
|
+
]), () => {
|
|
1783
|
+
!Y.value && !N.value && bt.value++;
|
|
1784
|
+
}, { flush: "sync" }), Le(() => [G.value.nodes.map((e) => e.nodeKey), G.value.links.map((e) => e.routeKey)], ([e, t]) => {
|
|
1785
|
+
let n = new Set(e);
|
|
1786
|
+
Z.value = Z.value.filter((e) => n.has(e)), q.value && !n.has(q.value) && (q.value = "", D.value = !1), J.value && !t.includes(J.value) && (J.value = "", D.value = !1);
|
|
1787
|
+
}, { flush: "sync" });
|
|
1788
|
+
function sn(e) {
|
|
1789
|
+
return kt || !R.active.value ? !1 : Q.value && e() ? !0 : (u(n.t("platform.workflow-config.stale-edit", "流程已变更,本次操作未应用,请重新操作。")), !1);
|
|
1790
|
+
}
|
|
1791
|
+
function cn() {
|
|
1792
|
+
Q.value && K.undo();
|
|
1793
|
+
}
|
|
1794
|
+
function ln() {
|
|
1795
|
+
Q.value && K.redo();
|
|
1796
|
+
}
|
|
1797
|
+
function un(e) {
|
|
1798
|
+
if (e.clipboardData) try {
|
|
1799
|
+
let t = it(G.value, Z.value);
|
|
1800
|
+
e.clipboardData.setData("text/plain", t), e.preventDefault();
|
|
1801
|
+
} catch (e) {
|
|
1802
|
+
m(e, {
|
|
1803
|
+
source: "workflow-design",
|
|
1804
|
+
phase: "action"
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
function dn() {
|
|
1809
|
+
let e = $.value?.nodeType === "branch" ? $.value.convergeNodeKey : void 0;
|
|
1810
|
+
return $t() || (e ? G.value.links.find((t) => t.sourceNodeKey === e)?.routeKey : void 0) || G.value.links.find((e) => G.value.nodes.some((t) => t.nodeKey === e.targetNodeKey && t.nodeType === "end"))?.routeKey || "";
|
|
1811
|
+
}
|
|
1812
|
+
function fn(e, t) {
|
|
1813
|
+
if (!Q.value || !e.includes("muyun.workflow.fragment")) return;
|
|
1814
|
+
let r = at(G.value, t, e, `copy_${te().replaceAll("-", "")}`);
|
|
1815
|
+
if (G.value = r.design, r.reconfigureSelectorKeys.length) {
|
|
1816
|
+
let e = r.reconfigureSelectorKeys.map((e) => r.design.nodes.find((t) => t.nodeKey === e)?.title ?? e).join("、");
|
|
1817
|
+
u(n.t("platform.workflow-config.paste-reconfigure-selectors", "已粘贴,以下人工分支需要重新配置选择来源:{names}。", { names: e })), Jt(r.reconfigureSelectorKeys[0]);
|
|
1818
|
+
} else on(r.keys);
|
|
1819
|
+
}
|
|
1820
|
+
function pn(e) {
|
|
1821
|
+
if (!Q.value || !e.clipboardData) return;
|
|
1822
|
+
let t = e.clipboardData.getData("text/plain");
|
|
1823
|
+
if (t.includes("muyun.workflow.fragment")) {
|
|
1824
|
+
e.preventDefault();
|
|
1825
|
+
try {
|
|
1826
|
+
fn(t, dn());
|
|
1827
|
+
} catch (e) {
|
|
1828
|
+
m(e, {
|
|
1829
|
+
source: "workflow-design",
|
|
1830
|
+
phase: "action"
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
async function mn() {
|
|
1836
|
+
try {
|
|
1837
|
+
if (!navigator.clipboard) throw Error("当前浏览器不支持访问剪贴板");
|
|
1838
|
+
await navigator.clipboard.writeText(it(G.value, Z.value));
|
|
1839
|
+
} catch (e) {
|
|
1840
|
+
m(e, {
|
|
1841
|
+
source: "workflow-design",
|
|
1842
|
+
phase: "action"
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
async function hn() {
|
|
1847
|
+
if (!Q.value) return;
|
|
1848
|
+
let e = Ft(), t = dn();
|
|
1849
|
+
try {
|
|
1850
|
+
if (!navigator.clipboard) throw Error("当前浏览器不支持访问剪贴板");
|
|
1851
|
+
let n = await navigator.clipboard.readText();
|
|
1852
|
+
n.includes("muyun.workflow.fragment") && sn(e) && fn(n, t);
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
m(e, {
|
|
1855
|
+
source: "workflow-design",
|
|
1856
|
+
phase: "action"
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
return (e, r) => (O(), C("section", ot, [E(j(ge), { title: I.value?.title ?? j(n).t("platform.workflow-config.configuration", "流程配置") }, Oe({
|
|
1861
|
+
actions: M(() => [E(j(le), {
|
|
1862
|
+
class: "configuration-action-bar",
|
|
1863
|
+
actions: Fe.value,
|
|
1864
|
+
onAction: r[0] ||= (e) => Je(e.key)
|
|
1865
|
+
}, null, 8, ["actions"])]),
|
|
1866
|
+
default: M(() => [
|
|
1867
|
+
j(z) ? (O(), C("div", ut, [
|
|
1868
|
+
w("p", null, A(Ze.value ? j(n).t("platform.workflow-config.save-restored", "检测到上次保存的查询引用。刷新前的本地草稿未恢复,请核实原请求与当前版本。") : j(B) === "review" ? j(n).t("platform.workflow-config.review-current", "本地草稿已保留,请读取当前版本后核对。") : j(n).t("platform.workflow-config.save-unknown", "上次保存未能确认,本地草稿已保留。请读取当前版本后重新核对。")), 1),
|
|
1869
|
+
E(j(b), {
|
|
1870
|
+
disabled: Y.value,
|
|
1871
|
+
onClick: Ut
|
|
1872
|
+
}, {
|
|
1873
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.read-current", "读取当前版本")), 1)]),
|
|
1874
|
+
_: 1
|
|
1875
|
+
}, 8, ["disabled"]),
|
|
1876
|
+
j(B) === "review" ? (O(), De(j(b), {
|
|
1877
|
+
key: 0,
|
|
1878
|
+
disabled: Y.value,
|
|
1879
|
+
onClick: r[2] ||= (e) => {
|
|
1880
|
+
B.value = "idle", W.value = void 0;
|
|
1881
|
+
}
|
|
1882
|
+
}, {
|
|
1883
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.cancel-review", "取消核对,继续编辑")), 1)]),
|
|
1884
|
+
_: 1
|
|
1885
|
+
}, 8, ["disabled"])) : S("v-if", !0),
|
|
1886
|
+
V.value && W.value ? (O(), C("p", dt, A(Xe.value ? j(n).t("platform.workflow-config.receipt-committed", "已确认原保存请求提交成功;以下为服务端当前版本,可能包含后续修改。") : H.value ? j(n).t("platform.workflow-config.receipt-cancelled", "原请求已终止,迟到的请求不会写入。请核对当前版本后继续。") : Qe.value ? j(n).t("platform.workflow-config.receipt-superseded", "未查到原请求回执,但版本已推进,原请求不能再覆盖当前版本。请核对后继续。") : j(n).t("platform.workflow-config.receipt-pending", "尚未查到原请求回执,结果仍不确定。请稍后重新核实,暂不能继续写入。")), 1)) : S("v-if", !0),
|
|
1887
|
+
V.value && !Xe.value && !H.value && !Qe.value ? (O(), C(Ee, { key: 2 }, [w("p", null, A(j(n).t("platform.workflow-config.abandon-help", "持续无法确认时,可终止原请求。服务器会确认已提交,或阻止尚未执行的请求;已提交内容不会撤销。")), 1), E(j(b), {
|
|
1888
|
+
disabled: Y.value,
|
|
1889
|
+
onClick: Ht
|
|
1890
|
+
}, {
|
|
1891
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.abandon-save", "终止原请求并核对当前版本")), 1)]),
|
|
1892
|
+
_: 1
|
|
1893
|
+
}, 8, ["disabled"])], 64)) : S("v-if", !0),
|
|
1894
|
+
H.value && !W.value ? (O(), C("p", ft, A(j(n).t("platform.workflow-config.receipt-cancelled", "原请求已终止,迟到的请求不会写入。请核对当前版本后继续。")), 1)) : S("v-if", !0),
|
|
1895
|
+
W.value ? (O(), C(Ee, { key: 4 }, [
|
|
1896
|
+
w("details", null, [
|
|
1897
|
+
w("summary", null, A(j(n).t("platform.workflow-config.view-current", "查看服务端当前流程与完整配置")), 1),
|
|
1898
|
+
E(j(ce), {
|
|
1899
|
+
nodes: W.value.design.nodes,
|
|
1900
|
+
routes: W.value.design.links,
|
|
1901
|
+
"layout-json": W.value.design.layoutJson,
|
|
1902
|
+
editable: !1,
|
|
1903
|
+
interactive: "",
|
|
1904
|
+
onSelect: r[3] ||= (e) => U.value = `node:${e}`,
|
|
1905
|
+
onSelectRoute: r[4] ||= (e) => U.value = `route:${e}`
|
|
1906
|
+
}, null, 8, [
|
|
1907
|
+
"nodes",
|
|
1908
|
+
"routes",
|
|
1909
|
+
"layout-json"
|
|
1910
|
+
]),
|
|
1911
|
+
E(j(fe), {
|
|
1912
|
+
value: U.value,
|
|
1913
|
+
"onUpdate:value": r[5] ||= (e) => U.value = e,
|
|
1914
|
+
options: [...W.value.design.nodes.map((e) => ({
|
|
1915
|
+
value: `node:${e.nodeKey}`,
|
|
1916
|
+
label: e.title ?? e.nodeKey
|
|
1917
|
+
})), ...W.value.design.links.map((e) => ({
|
|
1918
|
+
value: `route:${e.routeKey}`,
|
|
1919
|
+
label: e.title ?? e.routeKey
|
|
1920
|
+
}))]
|
|
1921
|
+
}, null, 8, ["value", "options"]),
|
|
1922
|
+
E(j(re), {
|
|
1923
|
+
design: W.value.design,
|
|
1924
|
+
"node-key": U.value.startsWith("node:") ? U.value.slice(5) : "",
|
|
1925
|
+
"route-key": U.value.startsWith("route:") ? U.value.slice(6) : "",
|
|
1926
|
+
editable: !1,
|
|
1927
|
+
"condition-tools": j(v),
|
|
1928
|
+
http: j(ae).http,
|
|
1929
|
+
"module-alias": t.moduleAlias,
|
|
1930
|
+
fields: j(_),
|
|
1931
|
+
catalog: be.value,
|
|
1932
|
+
actions: xe.value,
|
|
1933
|
+
onSelectRoute: r[6] ||= (e) => U.value = `route:${e}`
|
|
1934
|
+
}, null, 8, [
|
|
1935
|
+
"design",
|
|
1936
|
+
"node-key",
|
|
1937
|
+
"route-key",
|
|
1938
|
+
"condition-tools",
|
|
1939
|
+
"http",
|
|
1940
|
+
"module-alias",
|
|
1941
|
+
"fields",
|
|
1942
|
+
"catalog",
|
|
1943
|
+
"actions"
|
|
1944
|
+
])
|
|
1945
|
+
]),
|
|
1946
|
+
w("p", null, A(j(n).t("platform.workflow-config.current-read", "已读取当前版本;这不代表原保存请求的回执。采用当前版本将替换本地草稿,保留本地草稿则需重新核对后保存。")), 1),
|
|
1947
|
+
E(j(b), {
|
|
1948
|
+
disabled: Y.value || !Qe.value,
|
|
1949
|
+
onClick: r[7] ||= (e) => Wt(!1)
|
|
1950
|
+
}, {
|
|
1951
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.use-current", "采用当前版本")), 1)]),
|
|
1952
|
+
_: 1
|
|
1953
|
+
}, 8, ["disabled"]),
|
|
1954
|
+
E(j(b), {
|
|
1955
|
+
disabled: Y.value || !Qe.value || Ze.value || W.value.version.publishStatus !== "draft",
|
|
1956
|
+
onClick: r[8] ||= (e) => Wt(!0)
|
|
1957
|
+
}, {
|
|
1958
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.keep-draft", "保留本地草稿并重新核对")), 1)]),
|
|
1959
|
+
_: 1
|
|
1960
|
+
}, 8, ["disabled"])
|
|
1961
|
+
], 64)) : S("v-if", !0)
|
|
1962
|
+
])) : S("v-if", !0),
|
|
1963
|
+
N.value ? (O(), De(j(Se), { key: 1 })) : S("v-if", !0),
|
|
1964
|
+
P.value ? (O(), De(j(f), {
|
|
1965
|
+
key: 2,
|
|
1966
|
+
message: P.value()
|
|
1967
|
+
}, null, 8, ["message"])) : S("v-if", !0),
|
|
1968
|
+
P.value ? (O(), De(j(b), {
|
|
1969
|
+
key: 3,
|
|
1970
|
+
onClick: Rt
|
|
1971
|
+
}, {
|
|
1972
|
+
default: M(() => [T(A(j(n).t("platform.screen.CrudRecordListExplorer.reload", "重新加载")), 1)]),
|
|
1973
|
+
_: 1
|
|
1974
|
+
})) : S("v-if", !0),
|
|
1975
|
+
I.value ? (O(), C("div", {
|
|
1976
|
+
key: 4,
|
|
1977
|
+
ref_key: "designHost",
|
|
1978
|
+
ref: Ce,
|
|
1979
|
+
class: "configuration-design",
|
|
1980
|
+
style: Ae({ gap: `${j(he).columnGap}px` })
|
|
1981
|
+
}, [(O(), De(j(ce), {
|
|
1982
|
+
key: L.value?.id,
|
|
1983
|
+
nodes: j(G).nodes,
|
|
1984
|
+
routes: j(G).links,
|
|
1985
|
+
"selected-node-key": q.value,
|
|
1986
|
+
"selected-node-keys": Z.value,
|
|
1987
|
+
"can-undo": j(K).canUndo.value,
|
|
1988
|
+
"can-redo": j(K).canRedo.value,
|
|
1989
|
+
onUndo: cn,
|
|
1990
|
+
onRedo: ln,
|
|
1991
|
+
onSelectionChange: on,
|
|
1992
|
+
onCopy: un,
|
|
1993
|
+
onCopyShortcut: mn,
|
|
1994
|
+
onPasteShortcut: hn,
|
|
1995
|
+
onDeleteSelection: Tt,
|
|
1996
|
+
onPaste: pn,
|
|
1997
|
+
"selected-route-key": J.value,
|
|
1998
|
+
"layout-json": j(G).layoutJson,
|
|
1999
|
+
editable: Q.value,
|
|
2000
|
+
interactive: "",
|
|
2001
|
+
presentation: "designer",
|
|
2002
|
+
onSelect: Jt,
|
|
2003
|
+
onSelectRoute: Yt,
|
|
2004
|
+
onLayoutChange: Xt
|
|
2005
|
+
}, {
|
|
2006
|
+
actions: M(() => [E(j(s), {
|
|
2007
|
+
items: ze.value,
|
|
2008
|
+
align: "start",
|
|
2009
|
+
onSelect: We
|
|
2010
|
+
}, {
|
|
2011
|
+
default: M(() => [E(j(b), {
|
|
2012
|
+
"icon-name": "plus",
|
|
2013
|
+
disabled: !Q.value
|
|
2014
|
+
}, {
|
|
2015
|
+
default: M(() => [T(A(j(n).t("platform.workflow-config.add-element", "添加节点 / 分支")), 1)]),
|
|
2016
|
+
_: 1
|
|
2017
|
+
}, 8, ["disabled"])]),
|
|
2018
|
+
_: 1
|
|
2019
|
+
}, 8, ["items"])]),
|
|
2020
|
+
navigation: M(() => [E(j(fe), {
|
|
2021
|
+
class: "configuration-route-locator",
|
|
2022
|
+
value: J.value || void 0,
|
|
2023
|
+
placeholder: j(n).t("platform.screen.WorkflowConfigurationView.select-link", "选择连线"),
|
|
2024
|
+
options: j(G).links.map((e) => ({
|
|
2025
|
+
value: e.routeKey,
|
|
2026
|
+
label: `${e.title ?? j(n).t("platform.workflow-config.route", "路径")}:${j(G).nodes.find((t) => t.nodeKey === e.sourceNodeKey)?.title} → ${j(G).nodes.find((t) => t.nodeKey === e.targetNodeKey)?.title}`
|
|
2027
|
+
})),
|
|
2028
|
+
"onUpdate:value": r[9] ||= (e) => Yt(String(e))
|
|
2029
|
+
}, null, 8, [
|
|
2030
|
+
"value",
|
|
2031
|
+
"placeholder",
|
|
2032
|
+
"options"
|
|
2033
|
+
])]),
|
|
2034
|
+
_: 1
|
|
2035
|
+
}, 8, [
|
|
2036
|
+
"nodes",
|
|
2037
|
+
"routes",
|
|
2038
|
+
"selected-node-key",
|
|
2039
|
+
"selected-node-keys",
|
|
2040
|
+
"can-undo",
|
|
2041
|
+
"can-redo",
|
|
2042
|
+
"selected-route-key",
|
|
2043
|
+
"layout-json",
|
|
2044
|
+
"editable"
|
|
2045
|
+
])), E(j(ye), {
|
|
2046
|
+
docked: !j(Te),
|
|
2047
|
+
width: "compact",
|
|
2048
|
+
open: D.value,
|
|
2049
|
+
title: $.value?.title ? j(n).t("platform.workflow-config.node-properties", "节点属性 · {title}", { title: $.value.title }) : j(n).t("platform.workflow-config.route-properties", "路径属性"),
|
|
2050
|
+
onClose: r[11] ||= (e) => D.value = !1
|
|
2051
|
+
}, {
|
|
2052
|
+
operation: M(() => [w("div", pt, [$.value?.nodeType === "branch" ? (O(), De(j(b), {
|
|
2053
|
+
key: 0,
|
|
2054
|
+
danger: "",
|
|
2055
|
+
disabled: !wt.value,
|
|
2056
|
+
onClick: Tt
|
|
2057
|
+
}, {
|
|
2058
|
+
default: M(() => [T(A(j(n).t("platform.screen.WorkflowDesignProperties.delete-entire-branch", "删除整个分支")), 1)]),
|
|
2059
|
+
_: 1
|
|
2060
|
+
}, 8, ["disabled"])) : $.value ? (O(), De(j(b), {
|
|
2061
|
+
key: 1,
|
|
2062
|
+
danger: "",
|
|
2063
|
+
disabled: !wt.value,
|
|
2064
|
+
onClick: Tt
|
|
2065
|
+
}, {
|
|
2066
|
+
default: M(() => [T(A(j(n).t("platform.screen.WorkflowDesignProperties.delete-and-reconnect-adjacent-nodes", "删除节点")), 1)]),
|
|
2067
|
+
_: 1
|
|
2068
|
+
}, 8, ["disabled"])) : S("v-if", !0), E(j(b), {
|
|
2069
|
+
disabled: Y.value,
|
|
2070
|
+
onClick: r[10] ||= (e) => D.value = !1
|
|
2071
|
+
}, {
|
|
2072
|
+
default: M(() => [T(A(j(n).t("platform.screen.WorkflowConfigurationView.finish-configuration", "完成配置")), 1)]),
|
|
2073
|
+
_: 1
|
|
2074
|
+
}, 8, ["disabled"])])]),
|
|
2075
|
+
default: M(() => [E(j(re), {
|
|
2076
|
+
"condition-tools": j(v),
|
|
2077
|
+
design: j(G),
|
|
2078
|
+
"node-key": q.value,
|
|
2079
|
+
"route-key": J.value,
|
|
2080
|
+
editable: Q.value,
|
|
2081
|
+
http: j(ae).http,
|
|
2082
|
+
"module-alias": t.moduleAlias,
|
|
2083
|
+
fields: j(_),
|
|
2084
|
+
catalog: be.value,
|
|
2085
|
+
actions: xe.value,
|
|
2086
|
+
onUpdateNode: Zt,
|
|
2087
|
+
onUpdateRoute: Qt,
|
|
2088
|
+
onSelectRoute: Yt,
|
|
2089
|
+
onAppendBranchPath: tn
|
|
2090
|
+
}, null, 8, [
|
|
2091
|
+
"condition-tools",
|
|
2092
|
+
"design",
|
|
2093
|
+
"node-key",
|
|
2094
|
+
"route-key",
|
|
2095
|
+
"editable",
|
|
2096
|
+
"http",
|
|
2097
|
+
"module-alias",
|
|
2098
|
+
"fields",
|
|
2099
|
+
"catalog",
|
|
2100
|
+
"actions"
|
|
2101
|
+
])]),
|
|
2102
|
+
_: 1
|
|
2103
|
+
}, 8, [
|
|
2104
|
+
"docked",
|
|
2105
|
+
"open",
|
|
2106
|
+
"title"
|
|
2107
|
+
])], 4)) : S("v-if", !0)
|
|
2108
|
+
]),
|
|
2109
|
+
_: 2
|
|
2110
|
+
}, [I.value ? {
|
|
2111
|
+
name: "status",
|
|
2112
|
+
fn: M(() => [w("div", st, [E(j(fe), {
|
|
2113
|
+
class: "configuration-version-selector",
|
|
2114
|
+
value: L.value?.id,
|
|
2115
|
+
options: F.value.map((e) => ({
|
|
2116
|
+
value: e.id,
|
|
2117
|
+
label: j(n).t("platform.screen.WorkflowConfigurationView.version-value-value", "版本 {value1} · {value2}", {
|
|
2118
|
+
value1: e.versionNo,
|
|
2119
|
+
value2: d(e.publishStatus)
|
|
2120
|
+
})
|
|
2121
|
+
})),
|
|
2122
|
+
disabled: Y.value || j(X) || j(z),
|
|
2123
|
+
"onUpdate:value": r[1] ||= (e) => Bt(String(e))
|
|
2124
|
+
}, null, 8, [
|
|
2125
|
+
"value",
|
|
2126
|
+
"options",
|
|
2127
|
+
"disabled"
|
|
2128
|
+
]), j(X) ? (O(), De(j(_e), {
|
|
2129
|
+
key: 0,
|
|
2130
|
+
title: j(n).t("platform.screen.WorkflowConfigurationView.the-draft-has-unsaved-changes", "草稿有未保存的修改")
|
|
2131
|
+
}, {
|
|
2132
|
+
default: M(() => [w("span", ct, A(j(n).t("platform.workflow-config.unsaved", "未保存")), 1)]),
|
|
2133
|
+
_: 1
|
|
2134
|
+
}, 8, ["title"])) : tt.value ? (O(), De(j(_e), {
|
|
2135
|
+
key: 1,
|
|
2136
|
+
title: j(n).t("platform.screen.WorkflowConfigurationView.this-version-is-frozen-create-a-new", "此版本已冻结。修改流程请创建新版本;已有实例继续使用原版本。")
|
|
2137
|
+
}, {
|
|
2138
|
+
default: M(() => [w("span", lt, A(j(n).t("platform.workflow-config.readonly", "只读")), 1)]),
|
|
2139
|
+
_: 1
|
|
2140
|
+
}, 8, ["title"])) : S("v-if", !0)])]),
|
|
2141
|
+
key: "0"
|
|
2142
|
+
} : void 0]), 1032, ["title"]), E(j(c), {
|
|
2143
|
+
width: "extraWide",
|
|
2144
|
+
open: ke.value,
|
|
2145
|
+
title: j(n).t("platform.screen.WorkflowConfigurationView.confirm-workflow-publication", "确认发布流程"),
|
|
2146
|
+
onClose: r[12] ||= (e) => ke.value = !1
|
|
2147
|
+
}, {
|
|
2148
|
+
operation: M(() => [E(j(b), {
|
|
2149
|
+
type: "primary",
|
|
2150
|
+
loading: Y.value,
|
|
2151
|
+
onClick: Kt
|
|
2152
|
+
}, {
|
|
2153
|
+
default: M(() => [T(A(j(n).t("platform.screen.WorkflowConfigurationView.confirm-publication", "确认发布")), 1)]),
|
|
2154
|
+
_: 1
|
|
2155
|
+
}, 8, ["loading"])]),
|
|
2156
|
+
default: M(() => [
|
|
2157
|
+
w("p", null, A(j(n).t("platform.workflow-config.publication-frozen", "流程:{title} · 版本 {version}。发布后配置冻结;已有实例继续使用原版本。", {
|
|
2158
|
+
title: I.value?.title,
|
|
2159
|
+
version: L.value?.versionNo
|
|
2160
|
+
})), 1),
|
|
2161
|
+
w("p", null, A(j(n).t("platform.workflow-config.matching-scope", "匹配范围")) + ":" + A(I.value?.organizationId ? j(n).t("platform.workflow-config.scoped-organizations", "指定组织及下级组织") : j(n).t("platform.workflow-config.all-organizations", "模块内全部组织")) + ";" + A(I.value?.defaultDefinition ? j(n).t("platform.workflow-config.default-workflow", "作为默认兜底流程") : j(n).t("platform.workflow-config.conditional-workflow", "按匹配条件选择")) + "。 " + A(I.value?.matchExpression ? j(n).t("platform.workflow-config.matching-expression", "匹配条件:{expression}", { expression: I.value.matchExpression }) : j(n).t("platform.workflow-config.no-matching-condition", "未设置额外条件")), 1),
|
|
2162
|
+
w("ul", mt, [(O(!0), C(Ee, null, Ie(j(G).nodes.filter((e) => ["approval", "task"].includes(e.nodeType)), (e) => (O(), C("li", { key: e.nodeKey }, [
|
|
2163
|
+
w("strong", null, A(e.title), 1),
|
|
2164
|
+
T(" · " + A(Ye(e.participantPolicyText)) + " ", 1),
|
|
2165
|
+
w("details", null, [w("summary", null, A(j(n).t("platform.screen.WorkflowConfigurationView.view-complete-participant-rules", "查看完整人员规则")), 1), E(j(ve), {
|
|
2166
|
+
value: e.participantPolicyText,
|
|
2167
|
+
http: j(ae).http,
|
|
2168
|
+
fields: j(_),
|
|
2169
|
+
disabled: ""
|
|
2170
|
+
}, null, 8, [
|
|
2171
|
+
"value",
|
|
2172
|
+
"http",
|
|
2173
|
+
"fields"
|
|
2174
|
+
])]),
|
|
2175
|
+
e.nodeType === "task" ? (O(), C("details", ht, [
|
|
2176
|
+
w("summary", null, A(j(n).t("platform.screen.WorkflowConfigurationView.view-business-task-checks-and-instructions", "查看业务任务检查与办理指引")), 1),
|
|
2177
|
+
e.taskDefinitionId ? (O(), C("p", gt, A(j(n).t("platform.workflow-config.referenced-task", "引用任务")) + ":" + A(be.value.tasks.find((t) => t.id === e.taskDefinitionId)?.title ?? e.taskDefinitionId), 1)) : S("v-if", !0),
|
|
2178
|
+
E(j(me), {
|
|
2179
|
+
"condition-tools": j(v),
|
|
2180
|
+
value: e.nodeConfigText,
|
|
2181
|
+
"module-alias": t.moduleAlias,
|
|
2182
|
+
fields: j(_),
|
|
2183
|
+
catalog: be.value,
|
|
2184
|
+
actions: xe.value,
|
|
2185
|
+
associations: be.value.associations.map((e) => ({
|
|
2186
|
+
value: e.id,
|
|
2187
|
+
label: e.title
|
|
2188
|
+
})),
|
|
2189
|
+
disabled: ""
|
|
2190
|
+
}, null, 8, [
|
|
2191
|
+
"condition-tools",
|
|
2192
|
+
"value",
|
|
2193
|
+
"module-alias",
|
|
2194
|
+
"fields",
|
|
2195
|
+
"catalog",
|
|
2196
|
+
"actions",
|
|
2197
|
+
"associations"
|
|
2198
|
+
])
|
|
2199
|
+
])) : S("v-if", !0),
|
|
2200
|
+
e.participantPolicyText?.includes("INITIATOR_SELF") ? (O(), C("p", _t, A(j(n).t("platform.screen.WorkflowConfigurationView.the-submitter-processes-this-node-confirm-that", "此节点由提交人本人办理,请确认符合业务要求。")), 1)) : S("v-if", !0)
|
|
2201
|
+
]))), 128))]),
|
|
2202
|
+
(O(!0), C(Ee, null, Ie(j(G).nodes.filter((e) => e.nodeType === "branch"), (e) => (O(), C("div", { key: e.nodeKey }, [
|
|
2203
|
+
w("strong", null, A(e.title) + " · " + A(e.routeMode === "manual" ? j(n).t("platform.workflow-config.manual-route", "人工单选") : j(n).t("platform.workflow-config.auto-route", "自动判定(全部命中出口)")), 1),
|
|
2204
|
+
e.routeMode === "manual" ? (O(), C("p", vt, A(j(n).t("platform.workflow-config.selector-summary", "由{title}的实际办理人选路;{reason}。", {
|
|
2205
|
+
title: j(G).nodes.find((t) => t.nodeKey === e.selectorNodeKey)?.title ?? j(n).t("platform.workflow-config.missing-selector", "未配置选择节点"),
|
|
2206
|
+
reason: e.requireManualSelectionReason ? j(n).t("platform.workflow-config.reason-required", "必须填写原因") : j(n).t("platform.workflow-config.reason-optional", "原因选填")
|
|
2207
|
+
})), 1)) : S("v-if", !0),
|
|
2208
|
+
w("ul", null, [(O(!0), C(Ee, null, Ie(j(G).links.filter((t) => t.sourceNodeKey === e.nodeKey), (e) => (O(), C("li", { key: e.routeKey }, A(e.title ?? j(n).t("platform.workflow-config.exit", "出口")) + ":" + A(e.defaultRoute ? j(n).t("platform.workflow-config.fallback-exit", "默认兜底") : e.conditionExpression || j(n).t("platform.workflow-config.unconditional", "无条件(始终命中)")), 1))), 128))]),
|
|
2209
|
+
w("p", null, A(j(n).t("platform.workflow-config.convergence-counting", "汇聚:{summary},只计算有效出口。", { summary: Et(e) })), 1)
|
|
2210
|
+
]))), 128)),
|
|
2211
|
+
w("details", null, [w("summary", null, A(j(n).t("platform.screen.WorkflowConfigurationView.view-published-workflow", "查看发布流程图")), 1), E(j(ce), {
|
|
2212
|
+
presentation: "detail",
|
|
2213
|
+
nodes: j(G).nodes,
|
|
2214
|
+
routes: j(G).links,
|
|
2215
|
+
"layout-json": j(G).layoutJson
|
|
2216
|
+
}, null, 8, [
|
|
2217
|
+
"nodes",
|
|
2218
|
+
"routes",
|
|
2219
|
+
"layout-json"
|
|
2220
|
+
])])
|
|
2221
|
+
]),
|
|
2222
|
+
_: 1
|
|
2223
|
+
}, 8, ["open", "title"])]));
|
|
2224
|
+
}
|
|
2225
|
+
}), [["__scopeId", "data-v-92284893"]]);
|
|
2226
|
+
//#endregion
|
|
2227
|
+
export { bt as default };
|