@rytass/bpm-core-react 0.5.0 → 0.6.0
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/CHANGELOG.md +24 -0
- package/README.md +21 -0
- package/dist/chunks/detail-Cci9tnoC.cjs +2 -0
- package/dist/chunks/detail-Cci9tnoC.cjs.map +1 -0
- package/dist/chunks/detail-kyolfdBu.js +1957 -0
- package/dist/chunks/detail-kyolfdBu.js.map +1 -0
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +8 -1
- package/dist/views/instances/detail/sections/container-helpers.d.ts +3 -2
- package/package.json +3 -3
- package/dist/chunks/detail-Bml-vXHX.js +0 -1622
- package/dist/chunks/detail-Bml-vXHX.js.map +0 -1
- package/dist/chunks/detail-CWeCrmtC.cjs +0 -2
- package/dist/chunks/detail-CWeCrmtC.cjs.map +0 -1
|
@@ -0,0 +1,1957 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as e } from "./auth-provider-B5oPmvk2.js";
|
|
3
|
+
import { t } from "./format-date-time-CB-LxzqT.js";
|
|
4
|
+
import { t as n } from "./bpm-form-field-Cao0rMol.js";
|
|
5
|
+
import { t as r } from "./FormRendererView-DrHsuSVo.js";
|
|
6
|
+
import { Fragment as i, forwardRef as a, useCallback as o, useEffect as s, useImperativeHandle as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
|
+
import { AutoComplete as f, Button as p, Input as m, Modal as h, PageHeader as g, Section as _, SectionGroup as ee, Select as v, Stepper as y, Table as te, Textarea as ne, Tooltip as b, Typography as x } from "@mezzanine-ui/react";
|
|
8
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
9
|
+
import { cancelAdhocDirective as re, cancelApprovalInstance as ie, configureAdhocCompletionNotification as ae, configureAdhocStageNotification as oe, decideTask as se, listAdhocDirectives as ce, listAttachments as le, listTaskDecisions as ue, readApprovalInstance as de, readAttachmentDownloadUrl as fe, readAttachmentPreviewUrl as pe, readInstanceSignatures as me, requestAdhocCountersign as he, requestAdhocPreApproval as ge, resolveMemberProfiles as _e, resubmitApprovalInstance as ve, searchMembers as ye, uploadAttachment as be } from "@rytass/bpm-core-client/workflow";
|
|
10
|
+
import xe from "@mezzanine-ui/react/ContentHeader";
|
|
11
|
+
import { CheckedIcon as Se, ChevronLeftIcon as T, ChevronRightIcon as E, DangerousOutlineIcon as Ce, DownloadIcon as D, FileSearchIcon as we, NotificationUnreadIcon as Te, PlusIcon as Ee, RefreshCcwIcon as De, ShareIcon as Oe, UserIcon as ke, ZoomInIcon as O, ZoomOutIcon as Ae } from "@mezzanine-ui/icons";
|
|
12
|
+
import { focusFormRendererField as je, validateFormRendererValues as Me } from "@rytass/bpm-core-client/form";
|
|
13
|
+
import { Background as Ne, Controls as Pe, Handle as Fe, Position as k, ReactFlow as A } from "@xyflow/react";
|
|
14
|
+
import * as Ie from "dagre";
|
|
15
|
+
import { Document as Le, Page as Re } from "react-pdf";
|
|
16
|
+
import { stepClasses as j } from "@mezzanine-ui/core/stepper";
|
|
17
|
+
import '../detail.css';var M = {
|
|
18
|
+
root: "bpm_root_ehm7w",
|
|
19
|
+
toolbar: "bpm_toolbar_R-tis",
|
|
20
|
+
pageControls: "bpm_pageControls_jM-rC",
|
|
21
|
+
zoomControls: "bpm_zoomControls_7RAbJ",
|
|
22
|
+
counter: "bpm_counter_ILUsD",
|
|
23
|
+
viewport: "bpm_viewport_DQXms",
|
|
24
|
+
page: "bpm_page_Cv5Rg",
|
|
25
|
+
state: "bpm_state_bpgp3"
|
|
26
|
+
}, N = 760, ze = 920, Be = 320, Ve = 32, P = .75, He = 1.75, Ue = .25;
|
|
27
|
+
function F({ filename: e, fileUrl: t, onDownload: n }) {
|
|
28
|
+
let r = u(null), [i, a] = d(null), [c, f] = d(1), [m, h] = d(1), [g, _] = d(N);
|
|
29
|
+
s(() => {
|
|
30
|
+
let e = r.current;
|
|
31
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
32
|
+
let t = new ResizeObserver((e) => {
|
|
33
|
+
let t = e[0]?.contentRect.width;
|
|
34
|
+
t && _(t);
|
|
35
|
+
});
|
|
36
|
+
return t.observe(e), () => t.disconnect();
|
|
37
|
+
}, []), s(() => {
|
|
38
|
+
a(null), f(1), h(1);
|
|
39
|
+
}, [t]);
|
|
40
|
+
let ee = l(() => {
|
|
41
|
+
let e = Math.max(Be, g - Ve);
|
|
42
|
+
return Math.round(Math.min(ze, e) * m);
|
|
43
|
+
}, [m, g]), v = o((e) => {
|
|
44
|
+
a(e.numPages), f(1);
|
|
45
|
+
}, []), y = c > 1, te = i !== null && c < i, ne = m > P, b = m < He, S = i === null ? `第 ${c} 頁` : `第 ${c} / ${i} 頁`, re = `${Math.round(m * 100)}%`;
|
|
46
|
+
return /* @__PURE__ */ w("section", {
|
|
47
|
+
"aria-label": `${e} PDF 預覽`,
|
|
48
|
+
className: M.root,
|
|
49
|
+
children: [/* @__PURE__ */ w("div", {
|
|
50
|
+
className: M.toolbar,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ w("div", {
|
|
53
|
+
className: M.pageControls,
|
|
54
|
+
"aria-label": "頁面切換",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ C(p, {
|
|
57
|
+
"aria-label": "上一頁",
|
|
58
|
+
disabled: !y,
|
|
59
|
+
icon: T,
|
|
60
|
+
onClick: () => {
|
|
61
|
+
f((e) => Math.max(1, e - 1));
|
|
62
|
+
},
|
|
63
|
+
size: "minor",
|
|
64
|
+
variant: "base-secondary"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ C(x, {
|
|
67
|
+
className: M.counter,
|
|
68
|
+
component: "span",
|
|
69
|
+
variant: "body",
|
|
70
|
+
children: S
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ C(p, {
|
|
73
|
+
"aria-label": "下一頁",
|
|
74
|
+
disabled: !te,
|
|
75
|
+
icon: E,
|
|
76
|
+
onClick: () => {
|
|
77
|
+
f((e) => i === null ? e : Math.min(i, e + 1));
|
|
78
|
+
},
|
|
79
|
+
size: "minor",
|
|
80
|
+
variant: "base-secondary"
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ w("div", {
|
|
85
|
+
className: M.zoomControls,
|
|
86
|
+
"aria-label": "縮放",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ C(p, {
|
|
89
|
+
"aria-label": "縮小",
|
|
90
|
+
disabled: !ne,
|
|
91
|
+
icon: Ae,
|
|
92
|
+
onClick: () => {
|
|
93
|
+
h((e) => Math.max(P, e - Ue));
|
|
94
|
+
},
|
|
95
|
+
size: "minor",
|
|
96
|
+
variant: "base-secondary"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ C(x, {
|
|
99
|
+
className: M.counter,
|
|
100
|
+
component: "span",
|
|
101
|
+
variant: "body",
|
|
102
|
+
children: re
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ C(p, {
|
|
105
|
+
"aria-label": "放大",
|
|
106
|
+
disabled: !b,
|
|
107
|
+
icon: O,
|
|
108
|
+
onClick: () => {
|
|
109
|
+
h((e) => Math.min(He, e + Ue));
|
|
110
|
+
},
|
|
111
|
+
size: "minor",
|
|
112
|
+
variant: "base-secondary"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
n ? /* @__PURE__ */ C(p, {
|
|
117
|
+
icon: D,
|
|
118
|
+
iconType: "leading",
|
|
119
|
+
onClick: n,
|
|
120
|
+
size: "minor",
|
|
121
|
+
variant: "base-primary",
|
|
122
|
+
children: "下載"
|
|
123
|
+
}) : null
|
|
124
|
+
]
|
|
125
|
+
}), /* @__PURE__ */ C("div", {
|
|
126
|
+
className: M.viewport,
|
|
127
|
+
ref: r,
|
|
128
|
+
children: /* @__PURE__ */ C(Le, {
|
|
129
|
+
error: /* @__PURE__ */ C(I, { message: "PDF 無法載入。" }),
|
|
130
|
+
file: t,
|
|
131
|
+
loading: /* @__PURE__ */ C(I, { message: "正在載入 PDF..." }),
|
|
132
|
+
noData: /* @__PURE__ */ C(I, { message: "沒有可預覽的 PDF。" }),
|
|
133
|
+
onLoadSuccess: v,
|
|
134
|
+
children: /* @__PURE__ */ C(Re, {
|
|
135
|
+
className: M.page,
|
|
136
|
+
loading: /* @__PURE__ */ C(I, { message: "正在載入頁面..." }),
|
|
137
|
+
pageNumber: c,
|
|
138
|
+
renderAnnotationLayer: !0,
|
|
139
|
+
renderTextLayer: !0,
|
|
140
|
+
width: ee
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function I({ message: e }) {
|
|
147
|
+
return /* @__PURE__ */ C("div", {
|
|
148
|
+
className: M.state,
|
|
149
|
+
children: /* @__PURE__ */ C(x, {
|
|
150
|
+
color: "text-neutral",
|
|
151
|
+
variant: "body",
|
|
152
|
+
children: e
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/views/instances/detail/sections/shared.ts
|
|
158
|
+
function L(e) {
|
|
159
|
+
let t = z(e, "from"), n = z(e, "to"), r = z(e, "reason");
|
|
160
|
+
return !t || !n || !r ? null : {
|
|
161
|
+
from: t,
|
|
162
|
+
reason: r,
|
|
163
|
+
ruleId: z(e, "ruleId"),
|
|
164
|
+
to: n
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function R(e) {
|
|
168
|
+
try {
|
|
169
|
+
let t = JSON.parse(e);
|
|
170
|
+
return Array.isArray(t) ? t.map((e) => We(e) ? L(e) : null).filter((e) => e !== null) : [];
|
|
171
|
+
} catch {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function z(e, t) {
|
|
176
|
+
let n = e[t];
|
|
177
|
+
return typeof n == "string" ? n : null;
|
|
178
|
+
}
|
|
179
|
+
function B(e, t) {
|
|
180
|
+
let n = e[t];
|
|
181
|
+
return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
|
|
182
|
+
}
|
|
183
|
+
function V(e, t) {
|
|
184
|
+
let n = e[t];
|
|
185
|
+
return typeof n == "number" ? n : null;
|
|
186
|
+
}
|
|
187
|
+
function H(e) {
|
|
188
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
189
|
+
}
|
|
190
|
+
function We(e) {
|
|
191
|
+
return typeof e == "object" && !!e;
|
|
192
|
+
}
|
|
193
|
+
function Ge(e) {
|
|
194
|
+
return e.status === "PENDING" || e.status === "IN_PROGRESS";
|
|
195
|
+
}
|
|
196
|
+
function U(e) {
|
|
197
|
+
return e instanceof Error ? e.message : "發生未知錯誤";
|
|
198
|
+
}
|
|
199
|
+
function W(e) {
|
|
200
|
+
return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
201
|
+
}
|
|
202
|
+
function G(e) {
|
|
203
|
+
return e.length > 16 ? `${e.slice(0, 12)}...` : e;
|
|
204
|
+
}
|
|
205
|
+
function Ke(e) {
|
|
206
|
+
return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
|
|
207
|
+
}
|
|
208
|
+
function qe(e) {
|
|
209
|
+
return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
|
|
210
|
+
}
|
|
211
|
+
function Je(e) {
|
|
212
|
+
return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
|
|
213
|
+
}
|
|
214
|
+
function Ye(e) {
|
|
215
|
+
return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
|
|
216
|
+
}
|
|
217
|
+
function K(e, t) {
|
|
218
|
+
return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
|
|
219
|
+
}
|
|
220
|
+
function q(e, t) {
|
|
221
|
+
if (!e) return "-";
|
|
222
|
+
let n = t.get(e);
|
|
223
|
+
return n ? `${n.name}(${n.email})` : e;
|
|
224
|
+
}
|
|
225
|
+
function Xe(e, t = /* @__PURE__ */ new Map()) {
|
|
226
|
+
let n = R(e.delegationChainJson);
|
|
227
|
+
if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => q(e, t)).join("、")}` : "未指定";
|
|
228
|
+
let r = q(e.assigneeMemberId, t), i = q(e.originalAssigneeMemberId, t);
|
|
229
|
+
return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
|
|
230
|
+
}
|
|
231
|
+
function Ze(e, t) {
|
|
232
|
+
return t ? e.assigneeMemberId === t || e.candidateMemberIds.includes(t) : !1;
|
|
233
|
+
}
|
|
234
|
+
function Qe(e, t) {
|
|
235
|
+
if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
|
|
236
|
+
if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
|
|
237
|
+
id: e.id,
|
|
238
|
+
name: `${e.data.label}(${Ye(e.type)})`
|
|
239
|
+
}));
|
|
240
|
+
let n = t.data.returnBehavior.allowedTargets === "INITIATOR" ? e.nodes.find((e) => e.type === "startEvent")?.id : e.edges.find((e) => e.target === t.id)?.source, r = e.nodes.find((e) => e.id === n);
|
|
241
|
+
return r ? [{
|
|
242
|
+
id: r.id,
|
|
243
|
+
name: `${r.data.label}(${Ye(r.type)})`
|
|
244
|
+
}] : [];
|
|
245
|
+
}
|
|
246
|
+
function $e(e) {
|
|
247
|
+
return {
|
|
248
|
+
email: e.email,
|
|
249
|
+
id: e.memberId,
|
|
250
|
+
name: `${e.name} · ${e.email}`
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function J(e) {
|
|
254
|
+
if (!We(e)) return null;
|
|
255
|
+
let t = e.email, n = e.id, r = e.name;
|
|
256
|
+
return typeof n == "string" && typeof r == "string" ? {
|
|
257
|
+
email: typeof t == "string" ? t : null,
|
|
258
|
+
id: n,
|
|
259
|
+
name: r
|
|
260
|
+
} : null;
|
|
261
|
+
}
|
|
262
|
+
function et(e, t) {
|
|
263
|
+
let n = e.trim().toLocaleLowerCase();
|
|
264
|
+
if (!n) return null;
|
|
265
|
+
let r = t.filter((e) => [
|
|
266
|
+
e.id,
|
|
267
|
+
e.name,
|
|
268
|
+
e.email ?? ""
|
|
269
|
+
].some((e) => e.toLocaleLowerCase().includes(n)));
|
|
270
|
+
return r.length === 1 ? r[0] ?? null : null;
|
|
271
|
+
}
|
|
272
|
+
function Y(e) {
|
|
273
|
+
return H(e) ? {
|
|
274
|
+
text: e,
|
|
275
|
+
type: "text"
|
|
276
|
+
} : null;
|
|
277
|
+
}
|
|
278
|
+
function tt(e) {
|
|
279
|
+
return H(e) ? {
|
|
280
|
+
text: e,
|
|
281
|
+
type: "dangerText"
|
|
282
|
+
} : null;
|
|
283
|
+
}
|
|
284
|
+
function X(e, t, n, r) {
|
|
285
|
+
let i = t ? n.get(t) : null;
|
|
286
|
+
return {
|
|
287
|
+
email: i?.email ?? null,
|
|
288
|
+
label: i?.name ?? r,
|
|
289
|
+
memberId: t,
|
|
290
|
+
prefix: e,
|
|
291
|
+
type: "member"
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function Z(e) {
|
|
295
|
+
return !!e;
|
|
296
|
+
}
|
|
297
|
+
function nt(e) {
|
|
298
|
+
let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
|
|
299
|
+
return t === -1 ? e.length : t;
|
|
300
|
+
}
|
|
301
|
+
function rt(e) {
|
|
302
|
+
return e.eventType === "INSTANCE_STARTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED";
|
|
303
|
+
}
|
|
304
|
+
function it(e) {
|
|
305
|
+
return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
|
|
306
|
+
}
|
|
307
|
+
function at(e, t) {
|
|
308
|
+
return e === "INSTANCE_STARTED" ? "案件已發起" : e === "TOKEN_CREATED" ? "流程路徑已建立" : e === "ENGINE_PROCESS_REQUESTED" ? "流程引擎已處理" : e === "TOKEN_ADVANCED" ? "流程已前進" : e === "TASK_CREATED" ? "待簽任務已建立" : e === "TASK_DECIDED" ? it(z(t, "action")) : e === "SLA_TRIGGERED" ? "時限提醒已觸發" : e;
|
|
309
|
+
}
|
|
310
|
+
function ot(e) {
|
|
311
|
+
try {
|
|
312
|
+
let t = JSON.parse(e.payloadJson);
|
|
313
|
+
return We(t) ? t : {};
|
|
314
|
+
} catch {
|
|
315
|
+
return {};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function Q(e, t) {
|
|
319
|
+
return e.eventType === "SLA_TRIGGERED" || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
|
|
320
|
+
}
|
|
321
|
+
function st(e) {
|
|
322
|
+
return t(e);
|
|
323
|
+
}
|
|
324
|
+
function ct(e, t, n, r) {
|
|
325
|
+
if (e.eventType === "TASK_CREATED") {
|
|
326
|
+
let e = z(t, "assigneeMemberId"), n = z(t, "originalAssigneeMemberId");
|
|
327
|
+
if (!e) {
|
|
328
|
+
let e = B(t, "candidateMemberIds");
|
|
329
|
+
return e.length ? `候選簽核人:${e.map((e) => q(e, r)).join("、")}` : null;
|
|
330
|
+
}
|
|
331
|
+
let i = q(e, r), a = q(n, r);
|
|
332
|
+
return n && n !== e ? `待簽人:${i}(原簽核人:${a})` : `待簽人:${i}`;
|
|
333
|
+
}
|
|
334
|
+
if (e.eventType === "TASK_DECIDED") {
|
|
335
|
+
let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${Je(e)}` : null, a = z(t, "transferToMemberId");
|
|
336
|
+
return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(H).join(" · ") : i;
|
|
337
|
+
}
|
|
338
|
+
if (e.eventType === "TOKEN_ADVANCED") {
|
|
339
|
+
let e = z(t, "action");
|
|
340
|
+
if (e) return `流程結果:${Je(e)}`;
|
|
341
|
+
let r = V(t, "arrivedCount"), i = V(t, "requiredCount");
|
|
342
|
+
if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
|
|
343
|
+
let a = z(t, "fromNodeId"), o = z(t, "toNodeId");
|
|
344
|
+
if (a && o) return `由 ${K(a, n)} 前進至 ${K(o, n)}`;
|
|
345
|
+
}
|
|
346
|
+
if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
|
|
347
|
+
let e = z(t, "state");
|
|
348
|
+
return e ? `案件狀態:${Ke(e)}` : null;
|
|
349
|
+
}
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
function lt(e, t, n, r, i, a, o) {
|
|
353
|
+
if (e.eventType !== "TASK_DECIDED") return [Y(ct(e, t, n, o))].filter(Z);
|
|
354
|
+
let s = e.taskId ? r.get(e.taskId) : null, c = z(t, "action") ?? s?.action ?? null, l = z(t, "comment") ?? s?.comment ?? null, u = z(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = z(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
|
|
355
|
+
return [
|
|
356
|
+
Y(c ? `決議:${Je(c)}` : null),
|
|
357
|
+
c === "REJECTED" ? tt(`拒絕原因:${l ?? "-"}`) : null,
|
|
358
|
+
c === "RETURNED" ? Y(`退回說明:${l ?? "-"}`) : null,
|
|
359
|
+
c === "TRANSFERRED" ? Y(`轉派給:${q(u, o)}`) : null,
|
|
360
|
+
c === "TRANSFERRED" ? Y(`轉派說明:${l ?? "-"}`) : null,
|
|
361
|
+
f ? Y(a?.valid ? `簽章:已驗證(${G(f.signedPayloadHash)})` : `簽章:待檢查(${G(f.signedPayloadHash)})`) : null
|
|
362
|
+
].filter(Z);
|
|
363
|
+
}
|
|
364
|
+
function $(e, t, n, r, i) {
|
|
365
|
+
if (e.type === "startEvent" || i.has(e.id)) return !1;
|
|
366
|
+
if (r === "REJECTED") return !0;
|
|
367
|
+
let a = vt(e, t, n, r);
|
|
368
|
+
return a.tone === "neutral" || a.tone === "waiting";
|
|
369
|
+
}
|
|
370
|
+
function ut(e, t, n, r, i) {
|
|
371
|
+
if (r !== "RUNNING" && r !== "REJECTED") return [];
|
|
372
|
+
let a = e.nodes.filter((e) => $(e, t, n, r, i)), o = dt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
|
|
373
|
+
return a.filter((e) => o.has(e.id)).sort((e, t) => {
|
|
374
|
+
let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
|
|
375
|
+
return n === r ? e.position.x === t.position.x ? e.position.y === t.position.y ? (s.get(e.id) ?? 0) - (s.get(t.id) ?? 0) : e.position.y - t.position.y : e.position.x - t.position.x : n - r;
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function dt(e, t, n, r, i) {
|
|
379
|
+
let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
|
|
380
|
+
let n = [...e.get(t.source) ?? [], t.target];
|
|
381
|
+
return new Map(e).set(t.source, n);
|
|
382
|
+
}, /* @__PURE__ */ new Map());
|
|
383
|
+
return ft(e, n, r, i).reduce((e, t) => ht(e, pt(t, o, a)), /* @__PURE__ */ new Map());
|
|
384
|
+
}
|
|
385
|
+
function ft(e, t, n, r) {
|
|
386
|
+
let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(Ge).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [...new Set([
|
|
387
|
+
...i,
|
|
388
|
+
...a,
|
|
389
|
+
...o
|
|
390
|
+
])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
|
|
391
|
+
return s.length > 0 ? s : c;
|
|
392
|
+
}
|
|
393
|
+
function pt(e, t, n) {
|
|
394
|
+
return mt([{
|
|
395
|
+
distance: 0,
|
|
396
|
+
nodeId: e
|
|
397
|
+
}], t, n);
|
|
398
|
+
}
|
|
399
|
+
function mt(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
|
|
400
|
+
let [a, ...o] = e;
|
|
401
|
+
if (!a) return i;
|
|
402
|
+
if (r.has(a.nodeId)) return mt(o, t, n, r, i);
|
|
403
|
+
let s = new Set(r).add(a.nodeId), c = n.has(a.nodeId) ? new Map(i).set(a.nodeId, Math.min(i.get(a.nodeId) ?? a.distance, a.distance)) : i;
|
|
404
|
+
return mt([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
|
|
405
|
+
distance: a.distance + 1,
|
|
406
|
+
nodeId: e
|
|
407
|
+
}))], t, n, s, c);
|
|
408
|
+
}
|
|
409
|
+
function ht(e, t) {
|
|
410
|
+
return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
|
|
411
|
+
}
|
|
412
|
+
function gt(e) {
|
|
413
|
+
return e.type === "userTask" ? `未來簽核:${e.data.label}` : e.type === "serviceTask" ? `未來知會:${e.data.label}` : e.type === "exclusiveGateway" ? `未來分流:${e.data.label}` : e.type === "parallelGateway" ? `未來匯合:${e.data.label}` : e.type === "endEvent" ? `流程完成:${e.data.label}` : `未來節點:${e.data.label}`;
|
|
414
|
+
}
|
|
415
|
+
function _t(e, t, n, r, i, a, o, s, c) {
|
|
416
|
+
let l = e.filter(rt).map((e) => {
|
|
417
|
+
let t = ot(e), n = e.nodeId ? K(e.nodeId, r) : null;
|
|
418
|
+
return {
|
|
419
|
+
descriptionParts: [
|
|
420
|
+
Y(n ? `節點:${n}` : "節點:全流程"),
|
|
421
|
+
X("操作者", e.actorMemberId, a, "系統"),
|
|
422
|
+
Y(`時間:${st(e.createdAt)}`),
|
|
423
|
+
...lt(e, t, r, o, s, c, a)
|
|
424
|
+
].filter(Z),
|
|
425
|
+
error: Q(e, t),
|
|
426
|
+
id: e.id,
|
|
427
|
+
title: at(e.eventType, t)
|
|
428
|
+
};
|
|
429
|
+
}), u = t.filter(Ge).map((e) => ({
|
|
430
|
+
descriptionParts: [
|
|
431
|
+
Y(`節點:${K(e.nodeId, r)}`),
|
|
432
|
+
X("處理者", e.assigneeMemberId, a, "未指定"),
|
|
433
|
+
Y(`建立時間:${st(e.createdAt)}`)
|
|
434
|
+
].filter(Z),
|
|
435
|
+
error: !1,
|
|
436
|
+
id: `pending-task-${e.id}`,
|
|
437
|
+
title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
|
|
438
|
+
})), d = new Set([...e.filter(rt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), f = r ? ut(r, t, n, i, d).map((e) => ({
|
|
439
|
+
descriptionParts: [Y(`${Ye(e.type)} · 尚未抵達`)].filter(Z),
|
|
440
|
+
error: !1,
|
|
441
|
+
forcePending: !0,
|
|
442
|
+
id: `future-node-${e.id}`,
|
|
443
|
+
title: gt(e)
|
|
444
|
+
})) : [];
|
|
445
|
+
return [
|
|
446
|
+
...l,
|
|
447
|
+
...u,
|
|
448
|
+
...f
|
|
449
|
+
];
|
|
450
|
+
}
|
|
451
|
+
function vt(e, t, n, r) {
|
|
452
|
+
let i = t.filter((t) => t.nodeId === e.id), a = i.find((e) => e.status === "PENDING" || e.status === "IN_PROGRESS"), o = i.find((e) => e.status === "CANCELLED"), s = i.find((e) => e.status === "COMPLETED"), c = n.filter((t) => t.currentNodeId === e.id), l = c.find((e) => e.status === "ACTIVE"), u = c.find((e) => e.status === "WAITING");
|
|
453
|
+
return a ? {
|
|
454
|
+
secondaryLabel: `處理者 ${Xe(a)}`,
|
|
455
|
+
statusLabel: "待處理",
|
|
456
|
+
tone: "current"
|
|
457
|
+
} : o ? {
|
|
458
|
+
secondaryLabel: `已取消 ${Xe(o)}`,
|
|
459
|
+
statusLabel: "已取消",
|
|
460
|
+
tone: "cancelled"
|
|
461
|
+
} : s ? {
|
|
462
|
+
secondaryLabel: `已完成 ${Xe(s)}`,
|
|
463
|
+
statusLabel: "已完成",
|
|
464
|
+
tone: "completed"
|
|
465
|
+
} : l ? {
|
|
466
|
+
secondaryLabel: `token ${l.id}`,
|
|
467
|
+
statusLabel: "執行中",
|
|
468
|
+
tone: "current"
|
|
469
|
+
} : u ? {
|
|
470
|
+
secondaryLabel: `token ${u.id}`,
|
|
471
|
+
statusLabel: "等待前置",
|
|
472
|
+
tone: "waiting"
|
|
473
|
+
} : e.type === "startEvent" ? {
|
|
474
|
+
secondaryLabel: "流程已發起",
|
|
475
|
+
statusLabel: "已發起",
|
|
476
|
+
tone: "completed"
|
|
477
|
+
} : e.type === "endEvent" && r !== "RUNNING" ? {
|
|
478
|
+
secondaryLabel: r,
|
|
479
|
+
statusLabel: r === "REJECTED" ? "已拒絕" : "已完成",
|
|
480
|
+
tone: r === "REJECTED" ? "cancelled" : "completed"
|
|
481
|
+
} : {
|
|
482
|
+
secondaryLabel: Ye(e.type),
|
|
483
|
+
statusLabel: "未抵達",
|
|
484
|
+
tone: "neutral"
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/views/instances/detail/sections/container-helpers.ts
|
|
489
|
+
async function yt({ activityLogs: e, adhocDirectives: t = [], tasks: n }) {
|
|
490
|
+
let r = [...new Set([
|
|
491
|
+
...e.map((e) => e.actorMemberId),
|
|
492
|
+
...n.map((e) => e.assigneeMemberId),
|
|
493
|
+
...n.map((e) => e.originalAssigneeMemberId),
|
|
494
|
+
...n.flatMap((e) => e.candidateMemberIds),
|
|
495
|
+
...n.flatMap((e) => R(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
|
|
496
|
+
...t.flatMap((e) => [e.createdByMemberId, ...bt(e.targetValueJson)])
|
|
497
|
+
].filter(H))];
|
|
498
|
+
try {
|
|
499
|
+
return await _e(r);
|
|
500
|
+
} catch {
|
|
501
|
+
return [];
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function bt(e) {
|
|
505
|
+
try {
|
|
506
|
+
return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
|
|
507
|
+
} catch {
|
|
508
|
+
return [];
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
async function xt(e) {
|
|
512
|
+
return (await Promise.all(e.map((e) => ue(e.id)))).flat();
|
|
513
|
+
}
|
|
514
|
+
function St(e) {
|
|
515
|
+
return e.reduce((e, t) => {
|
|
516
|
+
let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
|
|
517
|
+
return new Map(e).set(t.taskId, r);
|
|
518
|
+
}, /* @__PURE__ */ new Map());
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/views/instances/detail/sections/InstanceFormSection.tsx
|
|
522
|
+
var Ct = {
|
|
523
|
+
display: "grid",
|
|
524
|
+
gap: 16
|
|
525
|
+
}, wt = {
|
|
526
|
+
display: "flex",
|
|
527
|
+
flexWrap: "wrap",
|
|
528
|
+
gap: 8
|
|
529
|
+
};
|
|
530
|
+
function Tt({ canResubmitInstance: e, deciding: t, error: n, instance: i, loading: a, onResubmitFormChange: o, onResubmitInstance: s, onUploadAttachment: c, resubmitFormData: l, resubmitFormErrors: u }) {
|
|
531
|
+
return /* @__PURE__ */ w("div", {
|
|
532
|
+
style: Ct,
|
|
533
|
+
children: [
|
|
534
|
+
n ? /* @__PURE__ */ C(x, {
|
|
535
|
+
color: "text-error",
|
|
536
|
+
variant: "body",
|
|
537
|
+
children: n
|
|
538
|
+
}) : null,
|
|
539
|
+
a ? /* @__PURE__ */ C(x, {
|
|
540
|
+
color: "text-neutral",
|
|
541
|
+
variant: "body",
|
|
542
|
+
children: "載入中..."
|
|
543
|
+
}) : null,
|
|
544
|
+
i?.formDefinitionSnapshot.schema && i.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(r, {
|
|
545
|
+
errors: u,
|
|
546
|
+
onChange: (e) => {
|
|
547
|
+
o(e);
|
|
548
|
+
},
|
|
549
|
+
onUploadAttachment: e ? c : void 0,
|
|
550
|
+
readonly: !e,
|
|
551
|
+
schema: i.formDefinitionSnapshot.schema,
|
|
552
|
+
uiSchema: i.formDefinitionSnapshot.uiSchema,
|
|
553
|
+
value: e ? l : i.formData
|
|
554
|
+
}), e ? /* @__PURE__ */ C("div", {
|
|
555
|
+
style: wt,
|
|
556
|
+
children: /* @__PURE__ */ C(p, {
|
|
557
|
+
disabled: t,
|
|
558
|
+
icon: De,
|
|
559
|
+
iconType: "leading",
|
|
560
|
+
onClick: s,
|
|
561
|
+
variant: "base-primary",
|
|
562
|
+
children: "重新送出"
|
|
563
|
+
})
|
|
564
|
+
}) : null] }) : /* @__PURE__ */ C(x, {
|
|
565
|
+
color: "text-neutral",
|
|
566
|
+
variant: "body",
|
|
567
|
+
children: "此案件沒有可顯示的表單快照。"
|
|
568
|
+
})
|
|
569
|
+
]
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
|
|
574
|
+
var Et = {
|
|
575
|
+
display: "grid",
|
|
576
|
+
gap: 16
|
|
577
|
+
};
|
|
578
|
+
function Dt({ attachments: e, onDownload: n, onPreview: r }) {
|
|
579
|
+
let i = l(() => e.map((e) => ({
|
|
580
|
+
attachment: e,
|
|
581
|
+
createdAt: e.createdAt,
|
|
582
|
+
filename: e.filename,
|
|
583
|
+
id: e.id,
|
|
584
|
+
key: e.id,
|
|
585
|
+
mimeType: e.mimeType,
|
|
586
|
+
sizeLabel: W(Number(e.sizeBytes))
|
|
587
|
+
})), [e]), a = l(() => [
|
|
588
|
+
{
|
|
589
|
+
dataIndex: "filename",
|
|
590
|
+
key: "filename",
|
|
591
|
+
title: "檔名",
|
|
592
|
+
width: 260
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
dataIndex: "mimeType",
|
|
596
|
+
key: "mimeType",
|
|
597
|
+
title: "類型",
|
|
598
|
+
width: 180
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
dataIndex: "sizeLabel",
|
|
602
|
+
key: "sizeLabel",
|
|
603
|
+
title: "大小",
|
|
604
|
+
width: 120
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
key: "createdAt",
|
|
608
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
609
|
+
component: "span",
|
|
610
|
+
variant: "body",
|
|
611
|
+
children: t(e.createdAt)
|
|
612
|
+
}),
|
|
613
|
+
title: "上傳時間",
|
|
614
|
+
width: 220
|
|
615
|
+
}
|
|
616
|
+
], []), o = l(() => ({
|
|
617
|
+
render: (e) => [...e.mimeType === "application/pdf" ? [{
|
|
618
|
+
icon: we,
|
|
619
|
+
iconType: "leading",
|
|
620
|
+
name: "預覽",
|
|
621
|
+
onClick: () => {
|
|
622
|
+
r(e.attachment);
|
|
623
|
+
}
|
|
624
|
+
}] : [], {
|
|
625
|
+
icon: D,
|
|
626
|
+
iconType: "leading",
|
|
627
|
+
name: "下載",
|
|
628
|
+
onClick: () => {
|
|
629
|
+
n(e.attachment);
|
|
630
|
+
}
|
|
631
|
+
}],
|
|
632
|
+
variant: "base-secondary",
|
|
633
|
+
width: 160
|
|
634
|
+
}), [n, r]);
|
|
635
|
+
return /* @__PURE__ */ w("div", {
|
|
636
|
+
style: Et,
|
|
637
|
+
children: [/* @__PURE__ */ C(x, {
|
|
638
|
+
component: "h2",
|
|
639
|
+
variant: "h3",
|
|
640
|
+
children: "附件"
|
|
641
|
+
}), i.length > 0 ? /* @__PURE__ */ C(te, {
|
|
642
|
+
actions: o,
|
|
643
|
+
columns: a,
|
|
644
|
+
dataSource: i,
|
|
645
|
+
fullWidth: !0
|
|
646
|
+
}) : /* @__PURE__ */ C(x, {
|
|
647
|
+
color: "text-neutral",
|
|
648
|
+
variant: "body",
|
|
649
|
+
children: "此案件沒有附件。"
|
|
650
|
+
})]
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/views/instances/detail/sections/InstanceTasksSection.tsx
|
|
655
|
+
var Ot = {
|
|
656
|
+
display: "grid",
|
|
657
|
+
gap: 12,
|
|
658
|
+
width: "100%"
|
|
659
|
+
}, kt = {
|
|
660
|
+
minWidth: "100%",
|
|
661
|
+
width: "100%"
|
|
662
|
+
}, At = {
|
|
663
|
+
display: "grid",
|
|
664
|
+
gap: 12,
|
|
665
|
+
width: "100%"
|
|
666
|
+
}, jt = { marginTop: 12 }, Mt = { marginTop: 24 };
|
|
667
|
+
function Nt(e) {
|
|
668
|
+
e && (e.style.width = "100%");
|
|
669
|
+
}
|
|
670
|
+
var Pt = {
|
|
671
|
+
COMPLETION_NOTIFY: "結案通知",
|
|
672
|
+
COUNTERSIGN: "臨時會簽",
|
|
673
|
+
PRE_APPROVAL: "臨時加簽",
|
|
674
|
+
STAGE_NOTIFY: "階段完成通知"
|
|
675
|
+
}, Ft = {
|
|
676
|
+
COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
|
|
677
|
+
COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
|
|
678
|
+
PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
|
|
679
|
+
STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
|
|
680
|
+
}, It = [{
|
|
681
|
+
id: "REJECT_INSTANCE",
|
|
682
|
+
name: "加簽拒絕時整單駁回"
|
|
683
|
+
}, {
|
|
684
|
+
id: "RETURN_TO_ORIGIN",
|
|
685
|
+
name: "加簽拒絕時退回給我重新處理"
|
|
686
|
+
}], Lt = [{
|
|
687
|
+
id: "MEMBER",
|
|
688
|
+
name: "指定成員"
|
|
689
|
+
}, {
|
|
690
|
+
id: "WEBHOOK",
|
|
691
|
+
name: "Webhook"
|
|
692
|
+
}], Rt = a(function({ adhocDirectives: e, currentMemberId: r, instance: i, memberProfilesById: a, onChanged: o, tasks: s }, u) {
|
|
693
|
+
let [g, _] = d(!1), [ee, y] = d(null), [b, ie] = d(""), [ce, le] = d(null), [ue, de] = d(!1), [fe, pe] = d(""), [me, _e] = d(!1), [ve, be] = d(null), [xe, Se] = d(""), [T, E] = d(null), [Ce, D] = d(!1), [we, Te] = d([]), [Ee, De] = d(!1), [Oe, ke] = d(""), [O, Ae] = d(null), [je, Me] = d(!1), [Ne, Pe] = d([]), [Fe, k] = d(!1), [A, Ie] = d("COUNTERSIGN"), [Le, Re] = d("REJECT_INSTANCE"), [j, M] = d(!1), [N, ze] = d("MEMBER"), [Be, Ve] = d(""), P = b.trim(), He = fe.trim(), Ue = xe.trim(), F = l(() => s.find((e) => Ze(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, s]), I = l(() => F && i ? i.workflowSnapshot.nodes.find((e) => e.id === F.nodeId) ?? null : null, [F, i]), L = l(() => I && i ? Qe(i.workflowSnapshot, I) : [], [I, i]), R = I?.type === "userTask" && I.data.returnBehavior.allowReturn, z = I?.type === "userTask" && I.data.allowAddSigner, B = l(() => e.filter((e) => e.status === "PENDING"), [e]), V = L.find((e) => e.id === ve) ?? L[0] ?? null, H = l(() => s.map((e) => ({
|
|
694
|
+
...e,
|
|
695
|
+
assigneeLabel: Xe(e, a),
|
|
696
|
+
key: e.id,
|
|
697
|
+
nodeLabel: `${K(e.nodeId, i?.workflowSnapshot ?? null)}${e.isAdhoc ? e.adhocType === "COUNTERSIGN" ? "(臨時會簽)" : "(臨時加簽)" : ""}`,
|
|
698
|
+
statusLabel: qe(e.status)
|
|
699
|
+
})), [
|
|
700
|
+
i,
|
|
701
|
+
a,
|
|
702
|
+
s
|
|
703
|
+
]), We = l(() => [
|
|
704
|
+
{
|
|
705
|
+
dataIndex: "nodeLabel",
|
|
706
|
+
key: "nodeLabel",
|
|
707
|
+
title: "節點",
|
|
708
|
+
width: 180
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
key: "assigneeMemberId",
|
|
712
|
+
title: "處理者",
|
|
713
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
714
|
+
component: "span",
|
|
715
|
+
variant: "body",
|
|
716
|
+
children: e.assigneeLabel
|
|
717
|
+
}),
|
|
718
|
+
width: 180
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
dataIndex: "statusLabel",
|
|
722
|
+
key: "statusLabel",
|
|
723
|
+
title: "狀態",
|
|
724
|
+
width: 120
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
key: "createdAt",
|
|
728
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
729
|
+
component: "span",
|
|
730
|
+
variant: "body",
|
|
731
|
+
children: t(e.createdAt)
|
|
732
|
+
}),
|
|
733
|
+
title: "建立時間",
|
|
734
|
+
width: 220
|
|
735
|
+
}
|
|
736
|
+
], []), Ge = l(() => B.map((e) => ({
|
|
737
|
+
...e,
|
|
738
|
+
createdByLabel: q(e.createdByMemberId, a),
|
|
739
|
+
key: e.id,
|
|
740
|
+
targetLabel: zt(e, a),
|
|
741
|
+
typeLabel: Pt[e.type]
|
|
742
|
+
})), [a, B]), W = l(() => [
|
|
743
|
+
{
|
|
744
|
+
dataIndex: "typeLabel",
|
|
745
|
+
key: "typeLabel",
|
|
746
|
+
title: "類型",
|
|
747
|
+
width: 180
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
key: "targetLabel",
|
|
751
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
752
|
+
component: "span",
|
|
753
|
+
variant: "body",
|
|
754
|
+
children: e.targetLabel
|
|
755
|
+
}),
|
|
756
|
+
title: "對象",
|
|
757
|
+
width: 220
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
key: "createdByLabel",
|
|
761
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
762
|
+
component: "span",
|
|
763
|
+
variant: "body",
|
|
764
|
+
children: e.createdByLabel
|
|
765
|
+
}),
|
|
766
|
+
title: "設定者",
|
|
767
|
+
width: 180
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
key: "createdAt",
|
|
771
|
+
render: (e) => /* @__PURE__ */ C(x, {
|
|
772
|
+
component: "span",
|
|
773
|
+
variant: "body",
|
|
774
|
+
children: t(e.createdAt)
|
|
775
|
+
}),
|
|
776
|
+
title: "建立時間",
|
|
777
|
+
width: 220
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
key: "actions",
|
|
781
|
+
render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ C(p, {
|
|
782
|
+
disabled: j,
|
|
783
|
+
onClick: () => void lt(e.id),
|
|
784
|
+
size: "minor",
|
|
785
|
+
variant: "destructive-secondary",
|
|
786
|
+
children: "撤回"
|
|
787
|
+
}) : /* @__PURE__ */ C(S, {}),
|
|
788
|
+
title: "操作",
|
|
789
|
+
width: 100
|
|
790
|
+
}
|
|
791
|
+
], [j, r]);
|
|
792
|
+
async function G({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
|
|
793
|
+
if (!(!r || !F)) {
|
|
794
|
+
_(!0), y(null);
|
|
795
|
+
try {
|
|
796
|
+
await se({
|
|
797
|
+
action: e,
|
|
798
|
+
comment: t,
|
|
799
|
+
decidedByMemberId: r,
|
|
800
|
+
returnToNodeId: n,
|
|
801
|
+
taskId: F.id,
|
|
802
|
+
transferToMemberId: i
|
|
803
|
+
}), de(!1), _e(!1), De(!1), ie(""), pe(""), Se(""), E(null), be(null), le(null), await o();
|
|
804
|
+
} catch (e) {
|
|
805
|
+
y(U(e));
|
|
806
|
+
} finally {
|
|
807
|
+
_(!1);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function Ke() {
|
|
812
|
+
ie(""), le(null), de(!0);
|
|
813
|
+
}
|
|
814
|
+
function Je() {
|
|
815
|
+
g || (de(!1), ie(""), le(null));
|
|
816
|
+
}
|
|
817
|
+
function Ye() {
|
|
818
|
+
pe(""), be(L[0]?.id ?? null), _e(!0);
|
|
819
|
+
}
|
|
820
|
+
function Y() {
|
|
821
|
+
g || (_e(!1), pe(""), be(null));
|
|
822
|
+
}
|
|
823
|
+
function tt() {
|
|
824
|
+
Se(""), E(null), De(!0), Z("");
|
|
825
|
+
}
|
|
826
|
+
function X() {
|
|
827
|
+
g || (De(!1), Se(""), E(null));
|
|
828
|
+
}
|
|
829
|
+
async function Z(e) {
|
|
830
|
+
D(!0);
|
|
831
|
+
try {
|
|
832
|
+
Te((await ye(e)).filter((e) => e.memberId !== r).map($e));
|
|
833
|
+
} catch (e) {
|
|
834
|
+
y(U(e));
|
|
835
|
+
} finally {
|
|
836
|
+
D(!1);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
async function nt() {
|
|
840
|
+
if (!P) {
|
|
841
|
+
le("請輸入拒絕原因");
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
await G({
|
|
845
|
+
action: "REJECTED",
|
|
846
|
+
comment: P
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
async function rt() {
|
|
850
|
+
if (!T) {
|
|
851
|
+
y("請選擇轉派對象");
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
await G({
|
|
855
|
+
action: "TRANSFERRED",
|
|
856
|
+
comment: Ue || null,
|
|
857
|
+
transferToMemberId: T.id
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
async function it() {
|
|
861
|
+
await G({
|
|
862
|
+
action: "RETURNED",
|
|
863
|
+
comment: He || null,
|
|
864
|
+
returnToNodeId: V?.id ?? null
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function at() {
|
|
868
|
+
ke(""), Ae(null), Re("REJECT_INSTANCE"), ze("MEMBER"), Ve("");
|
|
869
|
+
}
|
|
870
|
+
function ot(e) {
|
|
871
|
+
Ie(e), at(), k(!0), st("");
|
|
872
|
+
}
|
|
873
|
+
function Q() {
|
|
874
|
+
j || (k(!1), at());
|
|
875
|
+
}
|
|
876
|
+
async function st(e) {
|
|
877
|
+
Me(!0);
|
|
878
|
+
try {
|
|
879
|
+
Pe((await ye(e)).map($e));
|
|
880
|
+
} catch (e) {
|
|
881
|
+
y(U(e));
|
|
882
|
+
} finally {
|
|
883
|
+
Me(!1);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
async function ct() {
|
|
887
|
+
if (!F) return;
|
|
888
|
+
let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && N === "WEBHOOK", t = Be.trim(), n = O;
|
|
889
|
+
if (e && !t) {
|
|
890
|
+
y("請輸入 Webhook URL");
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (!e && !n) {
|
|
894
|
+
y("請選擇對象成員");
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
let r = e || !n ? {
|
|
898
|
+
kind: "WEBHOOK",
|
|
899
|
+
webhookUrl: t
|
|
900
|
+
} : {
|
|
901
|
+
kind: "MEMBER",
|
|
902
|
+
memberIds: [n.id]
|
|
903
|
+
}, i = Oe.trim() || null;
|
|
904
|
+
M(!0), y(null);
|
|
905
|
+
try {
|
|
906
|
+
A === "COUNTERSIGN" ? await he({
|
|
907
|
+
comment: i,
|
|
908
|
+
target: r,
|
|
909
|
+
taskId: F.id
|
|
910
|
+
}) : A === "PRE_APPROVAL" ? await ge({
|
|
911
|
+
comment: i,
|
|
912
|
+
onReject: Le,
|
|
913
|
+
target: r,
|
|
914
|
+
taskId: F.id
|
|
915
|
+
}) : A === "STAGE_NOTIFY" ? await oe({
|
|
916
|
+
target: r,
|
|
917
|
+
taskId: F.id
|
|
918
|
+
}) : await ae({
|
|
919
|
+
target: r,
|
|
920
|
+
taskId: F.id
|
|
921
|
+
}), k(!1), at(), await o();
|
|
922
|
+
} catch (e) {
|
|
923
|
+
y(U(e));
|
|
924
|
+
} finally {
|
|
925
|
+
M(!1);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
async function lt(e) {
|
|
929
|
+
M(!0), y(null);
|
|
930
|
+
try {
|
|
931
|
+
await re(e), await o();
|
|
932
|
+
} catch (e) {
|
|
933
|
+
y(U(e));
|
|
934
|
+
} finally {
|
|
935
|
+
M(!1);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
c(u, () => ({
|
|
939
|
+
canAddSignerCurrentTask: z,
|
|
940
|
+
canReturnCurrentTask: R,
|
|
941
|
+
deciding: g,
|
|
942
|
+
handleApprove: () => {
|
|
943
|
+
G({
|
|
944
|
+
action: "APPROVED",
|
|
945
|
+
comment: null
|
|
946
|
+
});
|
|
947
|
+
},
|
|
948
|
+
hasCurrentTask: F !== null,
|
|
949
|
+
openAdhocModal: ot,
|
|
950
|
+
openRejectModal: Ke,
|
|
951
|
+
openReturnModal: Ye,
|
|
952
|
+
openTransferModal: tt
|
|
953
|
+
}), [
|
|
954
|
+
z,
|
|
955
|
+
R,
|
|
956
|
+
F,
|
|
957
|
+
g
|
|
958
|
+
]);
|
|
959
|
+
let $ = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", ut = $ && N === "WEBHOOK" ? !Be.trim() : !O, dt = It.find((e) => e.id === Le) ?? It[0], ft = Lt.find((e) => e.id === N) ?? Lt[0];
|
|
960
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
961
|
+
/* @__PURE__ */ C(x, {
|
|
962
|
+
component: "h2",
|
|
963
|
+
variant: "h3",
|
|
964
|
+
children: "任務"
|
|
965
|
+
}),
|
|
966
|
+
ee ? /* @__PURE__ */ C(x, {
|
|
967
|
+
color: "text-error",
|
|
968
|
+
variant: "body",
|
|
969
|
+
children: ee
|
|
970
|
+
}) : null,
|
|
971
|
+
/* @__PURE__ */ C("div", {
|
|
972
|
+
style: jt,
|
|
973
|
+
children: /* @__PURE__ */ C(te, {
|
|
974
|
+
columns: We,
|
|
975
|
+
dataSource: H,
|
|
976
|
+
fullWidth: !0
|
|
977
|
+
})
|
|
978
|
+
}),
|
|
979
|
+
B.length > 0 ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(x, {
|
|
980
|
+
component: "h3",
|
|
981
|
+
style: Mt,
|
|
982
|
+
variant: "h3",
|
|
983
|
+
children: "待生效的臨時設定"
|
|
984
|
+
}), /* @__PURE__ */ C("div", {
|
|
985
|
+
style: jt,
|
|
986
|
+
children: /* @__PURE__ */ C(te, {
|
|
987
|
+
columns: W,
|
|
988
|
+
dataSource: Ge,
|
|
989
|
+
fullWidth: !0
|
|
990
|
+
})
|
|
991
|
+
})] }) : null,
|
|
992
|
+
/* @__PURE__ */ C(h, {
|
|
993
|
+
cancelText: "取消",
|
|
994
|
+
confirmButtonProps: {
|
|
995
|
+
disabled: !P,
|
|
996
|
+
variant: "destructive-primary"
|
|
997
|
+
},
|
|
998
|
+
confirmText: "送出拒絕",
|
|
999
|
+
loading: g,
|
|
1000
|
+
modalStatusType: "error",
|
|
1001
|
+
modalType: "standard",
|
|
1002
|
+
onCancel: Je,
|
|
1003
|
+
onClose: Je,
|
|
1004
|
+
onConfirm: () => void nt(),
|
|
1005
|
+
open: ue,
|
|
1006
|
+
showModalFooter: !0,
|
|
1007
|
+
showModalHeader: !0,
|
|
1008
|
+
size: "regular",
|
|
1009
|
+
supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
|
|
1010
|
+
title: "拒絕原因",
|
|
1011
|
+
children: /* @__PURE__ */ w("div", {
|
|
1012
|
+
style: Ot,
|
|
1013
|
+
children: [/* @__PURE__ */ C(n, {
|
|
1014
|
+
label: "拒絕原因",
|
|
1015
|
+
name: "rejectReason",
|
|
1016
|
+
required: !0,
|
|
1017
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1018
|
+
autoFocus: !0,
|
|
1019
|
+
onChange: (e) => {
|
|
1020
|
+
ie(e.target.value), le(null);
|
|
1021
|
+
},
|
|
1022
|
+
placeholder: "請說明拒絕原因",
|
|
1023
|
+
ref: Nt,
|
|
1024
|
+
resize: "vertical",
|
|
1025
|
+
rows: 4,
|
|
1026
|
+
style: kt,
|
|
1027
|
+
type: ce ? "error" : "default",
|
|
1028
|
+
value: b
|
|
1029
|
+
})
|
|
1030
|
+
}), ce ? /* @__PURE__ */ C(x, {
|
|
1031
|
+
color: "text-error",
|
|
1032
|
+
variant: "body",
|
|
1033
|
+
children: ce
|
|
1034
|
+
}) : null]
|
|
1035
|
+
})
|
|
1036
|
+
}),
|
|
1037
|
+
/* @__PURE__ */ C(h, {
|
|
1038
|
+
cancelText: "取消",
|
|
1039
|
+
confirmButtonProps: { disabled: !T },
|
|
1040
|
+
confirmText: "送出轉派",
|
|
1041
|
+
loading: g,
|
|
1042
|
+
modalType: "standard",
|
|
1043
|
+
onCancel: X,
|
|
1044
|
+
onClose: X,
|
|
1045
|
+
onConfirm: () => void rt(),
|
|
1046
|
+
open: Ee,
|
|
1047
|
+
showModalFooter: !0,
|
|
1048
|
+
showModalHeader: !0,
|
|
1049
|
+
size: "regular",
|
|
1050
|
+
supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
|
|
1051
|
+
title: "轉派簽核",
|
|
1052
|
+
children: /* @__PURE__ */ w("div", {
|
|
1053
|
+
style: At,
|
|
1054
|
+
children: [/* @__PURE__ */ C(n, {
|
|
1055
|
+
label: "轉派對象",
|
|
1056
|
+
name: "transferToMemberId",
|
|
1057
|
+
required: !0,
|
|
1058
|
+
children: /* @__PURE__ */ C(f, {
|
|
1059
|
+
asyncData: !0,
|
|
1060
|
+
disabledOptionsFilter: !0,
|
|
1061
|
+
emptyText: "沒有符合的成員",
|
|
1062
|
+
inputProps: {
|
|
1063
|
+
autoCapitalize: "none",
|
|
1064
|
+
autoCorrect: "off",
|
|
1065
|
+
name: "transfer-member-search",
|
|
1066
|
+
spellCheck: !1
|
|
1067
|
+
},
|
|
1068
|
+
loading: Ce,
|
|
1069
|
+
loadingText: "搜尋成員中...",
|
|
1070
|
+
mode: "single",
|
|
1071
|
+
onChange: (e) => E(J(e)),
|
|
1072
|
+
onSearch: Z,
|
|
1073
|
+
onSearchTextChange: (e) => E(et(e, we)),
|
|
1074
|
+
onVisibilityChange: (e) => {
|
|
1075
|
+
e && Z("");
|
|
1076
|
+
},
|
|
1077
|
+
options: [...we],
|
|
1078
|
+
placeholder: "搜尋姓名或信箱",
|
|
1079
|
+
searchDebounceTime: 300,
|
|
1080
|
+
value: T
|
|
1081
|
+
})
|
|
1082
|
+
}), /* @__PURE__ */ C(n, {
|
|
1083
|
+
label: "轉派說明",
|
|
1084
|
+
name: "transferComment",
|
|
1085
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1086
|
+
onChange: (e) => Se(e.target.value),
|
|
1087
|
+
placeholder: "可補充轉派原因",
|
|
1088
|
+
ref: Nt,
|
|
1089
|
+
resize: "vertical",
|
|
1090
|
+
rows: 4,
|
|
1091
|
+
style: kt,
|
|
1092
|
+
value: xe
|
|
1093
|
+
})
|
|
1094
|
+
})]
|
|
1095
|
+
})
|
|
1096
|
+
}),
|
|
1097
|
+
/* @__PURE__ */ C(h, {
|
|
1098
|
+
cancelText: "取消",
|
|
1099
|
+
confirmButtonProps: { disabled: !V },
|
|
1100
|
+
confirmText: "送出退回",
|
|
1101
|
+
loading: g,
|
|
1102
|
+
modalType: "standard",
|
|
1103
|
+
onCancel: Y,
|
|
1104
|
+
onClose: Y,
|
|
1105
|
+
onConfirm: () => void it(),
|
|
1106
|
+
open: me,
|
|
1107
|
+
showModalFooter: !0,
|
|
1108
|
+
showModalHeader: !0,
|
|
1109
|
+
size: "regular",
|
|
1110
|
+
supportingText: "退回後,流程會回到指定節點並等待重新處理。",
|
|
1111
|
+
title: "退回簽核",
|
|
1112
|
+
children: /* @__PURE__ */ w("div", {
|
|
1113
|
+
style: At,
|
|
1114
|
+
children: [/* @__PURE__ */ C(n, {
|
|
1115
|
+
label: "退回節點",
|
|
1116
|
+
name: "returnTargetNodeId",
|
|
1117
|
+
required: !0,
|
|
1118
|
+
children: /* @__PURE__ */ C(v, {
|
|
1119
|
+
clearable: !1,
|
|
1120
|
+
fullWidth: !0,
|
|
1121
|
+
onChange: (e) => be(e?.id ?? null),
|
|
1122
|
+
options: [...L],
|
|
1123
|
+
placeholder: "選擇退回節點",
|
|
1124
|
+
value: V
|
|
1125
|
+
})
|
|
1126
|
+
}), /* @__PURE__ */ C(n, {
|
|
1127
|
+
label: "退回說明",
|
|
1128
|
+
name: "returnComment",
|
|
1129
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1130
|
+
onChange: (e) => pe(e.target.value),
|
|
1131
|
+
placeholder: "可補充需要修改的內容",
|
|
1132
|
+
ref: Nt,
|
|
1133
|
+
resize: "vertical",
|
|
1134
|
+
rows: 4,
|
|
1135
|
+
style: kt,
|
|
1136
|
+
value: fe
|
|
1137
|
+
})
|
|
1138
|
+
})]
|
|
1139
|
+
})
|
|
1140
|
+
}),
|
|
1141
|
+
/* @__PURE__ */ C(h, {
|
|
1142
|
+
cancelText: "取消",
|
|
1143
|
+
confirmButtonProps: { disabled: ut },
|
|
1144
|
+
confirmText: "送出",
|
|
1145
|
+
loading: j,
|
|
1146
|
+
modalType: "standard",
|
|
1147
|
+
onCancel: Q,
|
|
1148
|
+
onClose: Q,
|
|
1149
|
+
onConfirm: () => void ct(),
|
|
1150
|
+
open: Fe,
|
|
1151
|
+
showModalFooter: !0,
|
|
1152
|
+
showModalHeader: !0,
|
|
1153
|
+
size: "regular",
|
|
1154
|
+
supportingText: Ft[A],
|
|
1155
|
+
title: Pt[A],
|
|
1156
|
+
children: /* @__PURE__ */ w("div", {
|
|
1157
|
+
style: At,
|
|
1158
|
+
children: [
|
|
1159
|
+
$ ? /* @__PURE__ */ C(n, {
|
|
1160
|
+
label: "通知時機",
|
|
1161
|
+
name: "adhocNotifyMode",
|
|
1162
|
+
required: !0,
|
|
1163
|
+
children: /* @__PURE__ */ C(v, {
|
|
1164
|
+
clearable: !1,
|
|
1165
|
+
fullWidth: !0,
|
|
1166
|
+
onChange: (e) => Ie(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
|
|
1167
|
+
options: [{
|
|
1168
|
+
id: "STAGE_NOTIFY",
|
|
1169
|
+
name: Pt.STAGE_NOTIFY
|
|
1170
|
+
}, {
|
|
1171
|
+
id: "COMPLETION_NOTIFY",
|
|
1172
|
+
name: Pt.COMPLETION_NOTIFY
|
|
1173
|
+
}],
|
|
1174
|
+
value: {
|
|
1175
|
+
id: A,
|
|
1176
|
+
name: Pt[A]
|
|
1177
|
+
}
|
|
1178
|
+
})
|
|
1179
|
+
}) : null,
|
|
1180
|
+
$ ? /* @__PURE__ */ C(n, {
|
|
1181
|
+
label: "通知對象類型",
|
|
1182
|
+
name: "adhocTargetKind",
|
|
1183
|
+
required: !0,
|
|
1184
|
+
children: /* @__PURE__ */ C(v, {
|
|
1185
|
+
clearable: !1,
|
|
1186
|
+
fullWidth: !0,
|
|
1187
|
+
onChange: (e) => ze(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
|
|
1188
|
+
options: [...Lt],
|
|
1189
|
+
value: ft
|
|
1190
|
+
})
|
|
1191
|
+
}) : null,
|
|
1192
|
+
$ && N === "WEBHOOK" ? /* @__PURE__ */ C(n, {
|
|
1193
|
+
label: "Webhook URL",
|
|
1194
|
+
name: "adhocWebhookUrl",
|
|
1195
|
+
required: !0,
|
|
1196
|
+
children: /* @__PURE__ */ C(m, {
|
|
1197
|
+
fullWidth: !0,
|
|
1198
|
+
onChange: (e) => Ve(e.target.value),
|
|
1199
|
+
placeholder: "https://example.com/webhook",
|
|
1200
|
+
value: Be
|
|
1201
|
+
})
|
|
1202
|
+
}) : /* @__PURE__ */ C(n, {
|
|
1203
|
+
label: $ ? "通知對象" : "簽核對象",
|
|
1204
|
+
name: "adhocMemberId",
|
|
1205
|
+
required: !0,
|
|
1206
|
+
children: /* @__PURE__ */ C(f, {
|
|
1207
|
+
asyncData: !0,
|
|
1208
|
+
disabledOptionsFilter: !0,
|
|
1209
|
+
emptyText: "沒有符合的成員",
|
|
1210
|
+
inputProps: {
|
|
1211
|
+
autoCapitalize: "none",
|
|
1212
|
+
autoCorrect: "off",
|
|
1213
|
+
name: "adhoc-member-search",
|
|
1214
|
+
spellCheck: !1
|
|
1215
|
+
},
|
|
1216
|
+
loading: je,
|
|
1217
|
+
loadingText: "搜尋成員中...",
|
|
1218
|
+
mode: "single",
|
|
1219
|
+
onChange: (e) => Ae(J(e)),
|
|
1220
|
+
onSearch: st,
|
|
1221
|
+
onSearchTextChange: (e) => Ae(et(e, Ne)),
|
|
1222
|
+
onVisibilityChange: (e) => {
|
|
1223
|
+
e && st("");
|
|
1224
|
+
},
|
|
1225
|
+
options: [...Ne],
|
|
1226
|
+
placeholder: "搜尋姓名或信箱",
|
|
1227
|
+
searchDebounceTime: 300,
|
|
1228
|
+
value: O
|
|
1229
|
+
})
|
|
1230
|
+
}),
|
|
1231
|
+
A === "PRE_APPROVAL" ? /* @__PURE__ */ C(n, {
|
|
1232
|
+
label: "拒簽處理方式",
|
|
1233
|
+
name: "adhocOnReject",
|
|
1234
|
+
required: !0,
|
|
1235
|
+
children: /* @__PURE__ */ C(v, {
|
|
1236
|
+
clearable: !1,
|
|
1237
|
+
fullWidth: !0,
|
|
1238
|
+
onChange: (e) => Re(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
|
|
1239
|
+
options: [...It],
|
|
1240
|
+
value: dt
|
|
1241
|
+
})
|
|
1242
|
+
}) : null,
|
|
1243
|
+
$ ? null : /* @__PURE__ */ C(n, {
|
|
1244
|
+
label: "說明",
|
|
1245
|
+
name: "adhocComment",
|
|
1246
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1247
|
+
onChange: (e) => ke(e.target.value),
|
|
1248
|
+
placeholder: "可補充原因",
|
|
1249
|
+
ref: Nt,
|
|
1250
|
+
resize: "vertical",
|
|
1251
|
+
rows: 3,
|
|
1252
|
+
style: kt,
|
|
1253
|
+
value: Oe
|
|
1254
|
+
})
|
|
1255
|
+
})
|
|
1256
|
+
]
|
|
1257
|
+
})
|
|
1258
|
+
})
|
|
1259
|
+
] });
|
|
1260
|
+
});
|
|
1261
|
+
function zt(e, t) {
|
|
1262
|
+
try {
|
|
1263
|
+
let n = JSON.parse(e.targetValueJson);
|
|
1264
|
+
if (n.memberIds?.length) return n.memberIds.map((e) => q(e, t)).join("、");
|
|
1265
|
+
if (n.webhookUrl) return n.webhookUrl;
|
|
1266
|
+
if (n.positionId) return `職位 ${n.positionId}`;
|
|
1267
|
+
if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
|
|
1268
|
+
} catch {}
|
|
1269
|
+
return e.targetKind;
|
|
1270
|
+
}
|
|
1271
|
+
//#endregion
|
|
1272
|
+
//#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
|
|
1273
|
+
var Bt = {
|
|
1274
|
+
display: "grid",
|
|
1275
|
+
gap: 16
|
|
1276
|
+
};
|
|
1277
|
+
function Vt({ signatureVerification: e, signatures: n }) {
|
|
1278
|
+
let r = l(() => n.map((e) => ({
|
|
1279
|
+
algorithm: e.algorithm,
|
|
1280
|
+
hashLabel: G(e.signedPayloadHash),
|
|
1281
|
+
key: e.id,
|
|
1282
|
+
keyVersion: e.keyVersion,
|
|
1283
|
+
signedAtLabel: t(e.signedAt),
|
|
1284
|
+
signerMemberId: e.signerMemberId
|
|
1285
|
+
})), [n]), i = l(() => [
|
|
1286
|
+
{
|
|
1287
|
+
dataIndex: "signerMemberId",
|
|
1288
|
+
key: "signerMemberId",
|
|
1289
|
+
title: "簽章者",
|
|
1290
|
+
width: 160
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
dataIndex: "algorithm",
|
|
1294
|
+
key: "algorithm",
|
|
1295
|
+
title: "演算法",
|
|
1296
|
+
width: 150
|
|
1297
|
+
},
|
|
1298
|
+
{
|
|
1299
|
+
dataIndex: "keyVersion",
|
|
1300
|
+
key: "keyVersion",
|
|
1301
|
+
title: "Key 版本",
|
|
1302
|
+
width: 100
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
dataIndex: "hashLabel",
|
|
1306
|
+
key: "hashLabel",
|
|
1307
|
+
title: "Payload Hash",
|
|
1308
|
+
width: 180
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
dataIndex: "signedAtLabel",
|
|
1312
|
+
key: "signedAtLabel",
|
|
1313
|
+
title: "簽章時間",
|
|
1314
|
+
width: 220
|
|
1315
|
+
}
|
|
1316
|
+
], []);
|
|
1317
|
+
return /* @__PURE__ */ w("div", {
|
|
1318
|
+
style: Bt,
|
|
1319
|
+
children: [
|
|
1320
|
+
/* @__PURE__ */ C(x, {
|
|
1321
|
+
component: "h2",
|
|
1322
|
+
variant: "h3",
|
|
1323
|
+
children: "簽章"
|
|
1324
|
+
}),
|
|
1325
|
+
/* @__PURE__ */ C(x, {
|
|
1326
|
+
color: e?.valid ? "text-success" : "text-error",
|
|
1327
|
+
variant: "body",
|
|
1328
|
+
children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
|
|
1329
|
+
}),
|
|
1330
|
+
r.length > 0 ? /* @__PURE__ */ C(te, {
|
|
1331
|
+
columns: i,
|
|
1332
|
+
dataSource: r,
|
|
1333
|
+
fullWidth: !0
|
|
1334
|
+
}) : null
|
|
1335
|
+
]
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
//#endregion
|
|
1339
|
+
//#region src/views/instances/detail/sections/InstanceHistorySection.tsx
|
|
1340
|
+
var Ht = {
|
|
1341
|
+
display: "grid",
|
|
1342
|
+
gap: 16
|
|
1343
|
+
}, Ut = {
|
|
1344
|
+
cursor: "help",
|
|
1345
|
+
textDecoration: "underline dotted",
|
|
1346
|
+
textUnderlineOffset: 3
|
|
1347
|
+
}, Wt = { color: "var(--mzn-color-text-error)" };
|
|
1348
|
+
function Gt(...e) {
|
|
1349
|
+
return e.filter((e) => H(e ?? null)).join(" ");
|
|
1350
|
+
}
|
|
1351
|
+
var Kt = a(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: a = 0, orientation: o, status: s = "pending", title: c, type: l = "number", ...u }, d) {
|
|
1352
|
+
let f = r ? "pending" : s;
|
|
1353
|
+
return /* @__PURE__ */ w("div", {
|
|
1354
|
+
...u,
|
|
1355
|
+
className: Gt(j.host, l === "dot" ? j.dot : null, n && f !== "processing" ? j.error : null, o === "horizontal" ? j.horizontal : null, l === "number" ? j.number : null, f === "pending" ? j.pending : null, f === "processing" ? j.processing : null, n && f === "processing" ? j.processingError : null, !n && f === "succeeded" ? j.succeeded : null, o === "vertical" ? j.vertical : null, e),
|
|
1356
|
+
ref: d,
|
|
1357
|
+
children: [l === "dot" ? /* @__PURE__ */ C("span", { className: Gt(j.statusIndicator, j.statusIndicatorDot) }) : /* @__PURE__ */ C("span", {
|
|
1358
|
+
className: j.statusIndicator,
|
|
1359
|
+
children: a + 1
|
|
1360
|
+
}), /* @__PURE__ */ w("div", {
|
|
1361
|
+
className: j.textContainer,
|
|
1362
|
+
children: [/* @__PURE__ */ w(x, {
|
|
1363
|
+
className: j.title,
|
|
1364
|
+
variant: "label-primary-highlight",
|
|
1365
|
+
children: [c, /* @__PURE__ */ C("span", { className: j.titleConnectLine })]
|
|
1366
|
+
}), t.length > 0 ? /* @__PURE__ */ C(x, {
|
|
1367
|
+
className: j.description,
|
|
1368
|
+
variant: "caption",
|
|
1369
|
+
children: t.map((e, t) => /* @__PURE__ */ w(i, { children: [t > 0 ? " · " : null, qt(e)] }, `${e.type}-${t}`))
|
|
1370
|
+
}) : null]
|
|
1371
|
+
})]
|
|
1372
|
+
});
|
|
1373
|
+
});
|
|
1374
|
+
function qt(e) {
|
|
1375
|
+
return e.type === "text" ? e.text : e.type === "dangerText" ? /* @__PURE__ */ C("span", {
|
|
1376
|
+
style: Wt,
|
|
1377
|
+
children: e.text
|
|
1378
|
+
}) : e.email ? /* @__PURE__ */ w(S, { children: [
|
|
1379
|
+
e.prefix,
|
|
1380
|
+
":",
|
|
1381
|
+
/* @__PURE__ */ C(b, {
|
|
1382
|
+
title: e.email,
|
|
1383
|
+
children: ({ onMouseEnter: t, onMouseLeave: n, ref: r }) => /* @__PURE__ */ C("span", {
|
|
1384
|
+
"data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
|
|
1385
|
+
onMouseEnter: t,
|
|
1386
|
+
onMouseLeave: n,
|
|
1387
|
+
ref: r,
|
|
1388
|
+
style: Ut,
|
|
1389
|
+
children: e.label
|
|
1390
|
+
})
|
|
1391
|
+
})
|
|
1392
|
+
] }) : `${e.prefix}:${e.label}`;
|
|
1393
|
+
}
|
|
1394
|
+
function Jt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
|
|
1395
|
+
let l = _t(e, o, c, s, t, n, a, i, r), u = nt(l), d = l.map((e) => ({
|
|
1396
|
+
...e,
|
|
1397
|
+
descriptionParts: e.descriptionParts.filter(Z)
|
|
1398
|
+
}));
|
|
1399
|
+
return /* @__PURE__ */ w("div", {
|
|
1400
|
+
style: Ht,
|
|
1401
|
+
children: [/* @__PURE__ */ C(x, {
|
|
1402
|
+
component: "h2",
|
|
1403
|
+
variant: "h3",
|
|
1404
|
+
children: "歷程"
|
|
1405
|
+
}), d.length > 0 ? /* @__PURE__ */ C(y, {
|
|
1406
|
+
currentStep: u,
|
|
1407
|
+
orientation: "vertical",
|
|
1408
|
+
type: "dot",
|
|
1409
|
+
children: d.map((e) => /* @__PURE__ */ C(Kt, {
|
|
1410
|
+
descriptionParts: e.descriptionParts,
|
|
1411
|
+
error: e.error,
|
|
1412
|
+
forcePending: e.forcePending,
|
|
1413
|
+
title: e.title
|
|
1414
|
+
}, e.id))
|
|
1415
|
+
}) : /* @__PURE__ */ C(x, {
|
|
1416
|
+
color: "text-neutral",
|
|
1417
|
+
variant: "body",
|
|
1418
|
+
children: "尚無歷程紀錄。"
|
|
1419
|
+
})]
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
//#endregion
|
|
1423
|
+
//#region src/views/instances/detail/InstanceDetailView.tsx
|
|
1424
|
+
var Yt = 184, Xt = 96, Zt = {
|
|
1425
|
+
display: "grid",
|
|
1426
|
+
gap: 16
|
|
1427
|
+
}, Qt = {
|
|
1428
|
+
background: "#f8fafc",
|
|
1429
|
+
border: "1px solid #e2e8f0",
|
|
1430
|
+
borderRadius: 8,
|
|
1431
|
+
height: "min(64vh, 620px)",
|
|
1432
|
+
minHeight: 440,
|
|
1433
|
+
overflow: "hidden",
|
|
1434
|
+
width: "min(80vw, 1040px)"
|
|
1435
|
+
}, $t = {
|
|
1436
|
+
background: "#ffffff",
|
|
1437
|
+
border: "1px solid #cbd5e1",
|
|
1438
|
+
borderRadius: 8,
|
|
1439
|
+
boxShadow: "0 8px 18px rgba(15, 23, 42, 0.08)",
|
|
1440
|
+
display: "grid",
|
|
1441
|
+
gap: 6,
|
|
1442
|
+
minHeight: 82,
|
|
1443
|
+
padding: 12,
|
|
1444
|
+
width: 184
|
|
1445
|
+
}, en = {
|
|
1446
|
+
borderRadius: 999,
|
|
1447
|
+
fontSize: 12,
|
|
1448
|
+
fontWeight: 600,
|
|
1449
|
+
justifySelf: "start",
|
|
1450
|
+
lineHeight: "18px",
|
|
1451
|
+
padding: "0 8px"
|
|
1452
|
+
}, tn = {
|
|
1453
|
+
color: "#64748b",
|
|
1454
|
+
fontSize: 12,
|
|
1455
|
+
overflow: "hidden",
|
|
1456
|
+
textOverflow: "ellipsis",
|
|
1457
|
+
whiteSpace: "nowrap"
|
|
1458
|
+
}, nn = { opacity: 0 }, rn = {
|
|
1459
|
+
display: "flex",
|
|
1460
|
+
flexWrap: "wrap",
|
|
1461
|
+
gap: 8
|
|
1462
|
+
}, an = {
|
|
1463
|
+
alignItems: "center",
|
|
1464
|
+
background: "#ffffff",
|
|
1465
|
+
border: "1px solid #cbd5e1",
|
|
1466
|
+
borderRadius: 8,
|
|
1467
|
+
color: "#334155",
|
|
1468
|
+
display: "inline-flex",
|
|
1469
|
+
fontSize: 12,
|
|
1470
|
+
fontWeight: 600,
|
|
1471
|
+
gap: 6,
|
|
1472
|
+
lineHeight: "20px",
|
|
1473
|
+
padding: "4px 8px"
|
|
1474
|
+
}, on = {
|
|
1475
|
+
display: "grid",
|
|
1476
|
+
gap: 16
|
|
1477
|
+
}, sn = { workflowRuntime: _n };
|
|
1478
|
+
function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHistory: o = !0, showSignatures: c = !0, showTasks: f = !0 }) {
|
|
1479
|
+
let { member: m } = e(), v = m?.memberId ?? null, [y, te] = d([]), [b, re] = d(null), [ae, oe] = d([]), [se, ue] = d([]), [he, ge] = d([]), [_e, ye] = d(null), [T, E] = d([]), [D, we] = d([]), [O, Ae] = d([]), [Fe, k] = d(null), [Ie, Le] = d(!0), [Re, j] = d(!1), [M, N] = d(!1), [ze, Be] = d(""), [Ve, P] = d(!1), [He, Ue] = d({}), [I, L] = d({}), [R, z] = d(null), [B, V] = d(null), [H, We] = d([]), Ge = ze.trim(), W = u(null);
|
|
1480
|
+
s(() => {
|
|
1481
|
+
X();
|
|
1482
|
+
}, [v, r]), s(() => {
|
|
1483
|
+
L(b?.formData ?? {});
|
|
1484
|
+
}, [b]);
|
|
1485
|
+
let G = l(() => T.find((e) => Ze(e, v) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [v, T]), qe = l(() => G && b ? b.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, b]), Je = qe?.type === "userTask" && qe.data.returnBehavior.allowReturn, Ye = qe?.type === "userTask" && qe.data.allowAddSigner, K = !!(b && b.initiatorMemberId === v && (b.state === "RUNNING" || b.state === "RETURNED")), q = !!(b && b.initiatorMemberId === v && b.state === "RETURNED"), Xe = l(() => new Map(O.map((e) => [e.memberId, e])), [O]), Qe = l(() => St(ae), [ae]), $e = l(() => new Map(he.map((e) => [e.id, e])), [he]), J = l(() => b ? pn(b.workflowSnapshot) : null, [b]), et = l(() => b && J ? fn(J, T, D, b.state) : [], [
|
|
1486
|
+
b,
|
|
1487
|
+
J,
|
|
1488
|
+
T,
|
|
1489
|
+
D
|
|
1490
|
+
]), Y = l(() => J ? mn(J) : [], [J]), tt = l(() => b ? un(b.workflowSnapshot) : [], [b]);
|
|
1491
|
+
async function X() {
|
|
1492
|
+
Le(!0), k(null);
|
|
1493
|
+
try {
|
|
1494
|
+
let e = await de(r);
|
|
1495
|
+
te(e.activityLogs), re(e.instance), E(e.tasks), we(e.workflowTokens);
|
|
1496
|
+
let t = await ce(e.instance.id), [n, i, a, o] = await Promise.all([
|
|
1497
|
+
xt(e.tasks),
|
|
1498
|
+
yt({
|
|
1499
|
+
...e,
|
|
1500
|
+
adhocDirectives: t
|
|
1501
|
+
}),
|
|
1502
|
+
le(e.instance.id),
|
|
1503
|
+
me(e.instance.id)
|
|
1504
|
+
]);
|
|
1505
|
+
oe(n), Ae(i), ue(a), ge(o.signatures), ye(o.verification), We(t);
|
|
1506
|
+
} catch (e) {
|
|
1507
|
+
k(U(e));
|
|
1508
|
+
} finally {
|
|
1509
|
+
Le(!1);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
async function Z(e, t) {
|
|
1513
|
+
if (!v) throw Error("尚未登入,無法上傳附件");
|
|
1514
|
+
return { id: (await be({
|
|
1515
|
+
file: t,
|
|
1516
|
+
formFieldPath: `form.${e.fieldKey}`
|
|
1517
|
+
})).id };
|
|
1518
|
+
}
|
|
1519
|
+
async function nt(e) {
|
|
1520
|
+
if (!v) return;
|
|
1521
|
+
let t = await fe({ id: e.id });
|
|
1522
|
+
window.open(t, "_blank", "noopener,noreferrer");
|
|
1523
|
+
}
|
|
1524
|
+
async function rt(e) {
|
|
1525
|
+
if (!v) return;
|
|
1526
|
+
let t = await pe({ id: e.id });
|
|
1527
|
+
z(e), V(t);
|
|
1528
|
+
}
|
|
1529
|
+
async function it() {
|
|
1530
|
+
if (!(!v || !b || !K)) {
|
|
1531
|
+
if (j(!0), k(null), Ue({}), b.formDefinitionSnapshot.schema && b.formDefinitionSnapshot.uiSchema) {
|
|
1532
|
+
let e = Me({
|
|
1533
|
+
schema: b.formDefinitionSnapshot.schema,
|
|
1534
|
+
uiSchema: b.formDefinitionSnapshot.uiSchema,
|
|
1535
|
+
values: I
|
|
1536
|
+
});
|
|
1537
|
+
if (!e.valid) {
|
|
1538
|
+
Ue(e.errors), k("請先補齊必填欄位。"), e.firstInvalidFieldKey && je(e.firstInvalidFieldKey), j(!1);
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
try {
|
|
1543
|
+
await ie({
|
|
1544
|
+
cancelledByMemberId: v,
|
|
1545
|
+
comment: Ge || null,
|
|
1546
|
+
instanceId: b.id
|
|
1547
|
+
}), Be(""), P(!1), await X();
|
|
1548
|
+
} catch (e) {
|
|
1549
|
+
k(U(e));
|
|
1550
|
+
} finally {
|
|
1551
|
+
j(!1);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
async function at() {
|
|
1556
|
+
if (!(!v || !b || !q)) {
|
|
1557
|
+
j(!0), k(null);
|
|
1558
|
+
try {
|
|
1559
|
+
await ve({
|
|
1560
|
+
formData: I,
|
|
1561
|
+
initiatorMemberId: v,
|
|
1562
|
+
instanceId: b.id,
|
|
1563
|
+
title: b.title
|
|
1564
|
+
}), await X();
|
|
1565
|
+
} catch (e) {
|
|
1566
|
+
k(U(e));
|
|
1567
|
+
} finally {
|
|
1568
|
+
j(!1);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
let ot = W.current?.deciding ?? !1, Q = Re || ot;
|
|
1573
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
1574
|
+
/* @__PURE__ */ C(g, { children: /* @__PURE__ */ w(xe, {
|
|
1575
|
+
description: b ? `${Ke(b.state)} · ${t(b.startedAt)}` : "載入案件內容。",
|
|
1576
|
+
title: b?.title ?? "簽核案件",
|
|
1577
|
+
children: [
|
|
1578
|
+
b ? /* @__PURE__ */ C(p, {
|
|
1579
|
+
"aria-label": "查看流程圖",
|
|
1580
|
+
icon: Oe,
|
|
1581
|
+
iconType: "icon-only",
|
|
1582
|
+
onClick: () => N(!0),
|
|
1583
|
+
title: "查看流程圖",
|
|
1584
|
+
variant: "base-secondary",
|
|
1585
|
+
children: "流程圖"
|
|
1586
|
+
}) : null,
|
|
1587
|
+
K ? /* @__PURE__ */ C(p, {
|
|
1588
|
+
disabled: Q,
|
|
1589
|
+
icon: Ce,
|
|
1590
|
+
iconType: "leading",
|
|
1591
|
+
onClick: () => P(!0),
|
|
1592
|
+
variant: "destructive-secondary",
|
|
1593
|
+
children: "取消案件"
|
|
1594
|
+
}) : null,
|
|
1595
|
+
G ? /* @__PURE__ */ w(S, { children: [
|
|
1596
|
+
Ye ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(p, {
|
|
1597
|
+
disabled: Q,
|
|
1598
|
+
icon: Ee,
|
|
1599
|
+
iconType: "leading",
|
|
1600
|
+
onClick: () => W.current?.openAdhocModal("COUNTERSIGN"),
|
|
1601
|
+
variant: "base-secondary",
|
|
1602
|
+
children: "會簽"
|
|
1603
|
+
}, "adhoc-countersign"), /* @__PURE__ */ C(p, {
|
|
1604
|
+
disabled: Q,
|
|
1605
|
+
icon: Ee,
|
|
1606
|
+
iconType: "leading",
|
|
1607
|
+
onClick: () => W.current?.openAdhocModal("PRE_APPROVAL"),
|
|
1608
|
+
variant: "base-secondary",
|
|
1609
|
+
children: "加簽"
|
|
1610
|
+
}, "adhoc-pre-approval")] }) : null,
|
|
1611
|
+
/* @__PURE__ */ C(p, {
|
|
1612
|
+
disabled: Q,
|
|
1613
|
+
icon: Te,
|
|
1614
|
+
iconType: "leading",
|
|
1615
|
+
onClick: () => W.current?.openAdhocModal("STAGE_NOTIFY"),
|
|
1616
|
+
variant: "base-secondary",
|
|
1617
|
+
children: "通知設定"
|
|
1618
|
+
}, "adhoc-notify"),
|
|
1619
|
+
Je ? /* @__PURE__ */ C(p, {
|
|
1620
|
+
disabled: Q,
|
|
1621
|
+
icon: De,
|
|
1622
|
+
iconType: "leading",
|
|
1623
|
+
onClick: () => W.current?.openReturnModal(),
|
|
1624
|
+
variant: "base-secondary",
|
|
1625
|
+
children: "退回"
|
|
1626
|
+
}, "task-return") : null,
|
|
1627
|
+
/* @__PURE__ */ C(p, {
|
|
1628
|
+
disabled: Q,
|
|
1629
|
+
icon: ke,
|
|
1630
|
+
iconType: "leading",
|
|
1631
|
+
onClick: () => W.current?.openTransferModal(),
|
|
1632
|
+
variant: "base-secondary",
|
|
1633
|
+
children: "轉派"
|
|
1634
|
+
}, "task-transfer"),
|
|
1635
|
+
/* @__PURE__ */ C(p, {
|
|
1636
|
+
disabled: Q,
|
|
1637
|
+
icon: Ce,
|
|
1638
|
+
iconType: "leading",
|
|
1639
|
+
onClick: () => W.current?.openRejectModal(),
|
|
1640
|
+
variant: "destructive-secondary",
|
|
1641
|
+
children: "拒絕"
|
|
1642
|
+
}, "task-reject"),
|
|
1643
|
+
/* @__PURE__ */ C(p, {
|
|
1644
|
+
disabled: Q,
|
|
1645
|
+
icon: Se,
|
|
1646
|
+
iconType: "leading",
|
|
1647
|
+
onClick: () => W.current?.handleApprove(),
|
|
1648
|
+
variant: "base-primary",
|
|
1649
|
+
children: "同意"
|
|
1650
|
+
}, "task-approve")
|
|
1651
|
+
] }) : null
|
|
1652
|
+
]
|
|
1653
|
+
}) }),
|
|
1654
|
+
/* @__PURE__ */ w(ee, { children: [
|
|
1655
|
+
a ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Tt, {
|
|
1656
|
+
canResubmitInstance: q,
|
|
1657
|
+
deciding: Re,
|
|
1658
|
+
error: Fe,
|
|
1659
|
+
instance: b,
|
|
1660
|
+
loading: Ie,
|
|
1661
|
+
onResubmitFormChange: (e) => {
|
|
1662
|
+
L(e), Ue({});
|
|
1663
|
+
},
|
|
1664
|
+
onResubmitInstance: () => void at(),
|
|
1665
|
+
onUploadAttachment: Z,
|
|
1666
|
+
resubmitFormData: I,
|
|
1667
|
+
resubmitFormErrors: He
|
|
1668
|
+
}) }) : null,
|
|
1669
|
+
i ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Dt, {
|
|
1670
|
+
attachments: se,
|
|
1671
|
+
onDownload: (e) => {
|
|
1672
|
+
nt(e);
|
|
1673
|
+
},
|
|
1674
|
+
onPreview: (e) => {
|
|
1675
|
+
rt(e);
|
|
1676
|
+
}
|
|
1677
|
+
}) }) : null,
|
|
1678
|
+
f ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Rt, {
|
|
1679
|
+
adhocDirectives: H,
|
|
1680
|
+
currentMemberId: v,
|
|
1681
|
+
instance: b,
|
|
1682
|
+
memberProfilesById: Xe,
|
|
1683
|
+
onChanged: X,
|
|
1684
|
+
ref: W,
|
|
1685
|
+
tasks: T
|
|
1686
|
+
}) }) : null,
|
|
1687
|
+
c ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Vt, {
|
|
1688
|
+
signatureVerification: _e,
|
|
1689
|
+
signatures: he
|
|
1690
|
+
}) }) : null,
|
|
1691
|
+
o ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Jt, {
|
|
1692
|
+
activityLogs: y,
|
|
1693
|
+
instanceState: b?.state ?? "RUNNING",
|
|
1694
|
+
memberProfilesById: Xe,
|
|
1695
|
+
signatureVerification: _e,
|
|
1696
|
+
signaturesById: $e,
|
|
1697
|
+
taskDecisionsByTaskId: Qe,
|
|
1698
|
+
tasks: T,
|
|
1699
|
+
workflowSnapshot: b?.workflowSnapshot ?? null,
|
|
1700
|
+
workflowTokens: D
|
|
1701
|
+
}) }) : null
|
|
1702
|
+
] }),
|
|
1703
|
+
b ? /* @__PURE__ */ C(h, {
|
|
1704
|
+
modalType: "standard",
|
|
1705
|
+
onClose: () => N(!1),
|
|
1706
|
+
open: M,
|
|
1707
|
+
showModalHeader: !0,
|
|
1708
|
+
size: "wide",
|
|
1709
|
+
supportingText: `${Ke(b.state)} · ${t(b.startedAt)}`,
|
|
1710
|
+
title: "流程圖",
|
|
1711
|
+
children: /* @__PURE__ */ w("div", {
|
|
1712
|
+
style: Zt,
|
|
1713
|
+
children: [/* @__PURE__ */ C("div", {
|
|
1714
|
+
style: Qt,
|
|
1715
|
+
children: /* @__PURE__ */ w(A, {
|
|
1716
|
+
edges: Y,
|
|
1717
|
+
fitView: !0,
|
|
1718
|
+
fitViewOptions: { padding: .18 },
|
|
1719
|
+
maxZoom: 1.2,
|
|
1720
|
+
minZoom: .2,
|
|
1721
|
+
nodes: et,
|
|
1722
|
+
nodesDraggable: !1,
|
|
1723
|
+
nodesFocusable: !1,
|
|
1724
|
+
nodeTypes: sn,
|
|
1725
|
+
panOnDrag: !0,
|
|
1726
|
+
proOptions: { hideAttribution: !0 },
|
|
1727
|
+
children: [/* @__PURE__ */ C(Ne, {}), /* @__PURE__ */ C(Pe, { showInteractive: !1 })]
|
|
1728
|
+
})
|
|
1729
|
+
}), tt.length > 0 ? /* @__PURE__ */ C("div", {
|
|
1730
|
+
style: rn,
|
|
1731
|
+
children: tt.map((e) => /* @__PURE__ */ C("span", {
|
|
1732
|
+
style: an,
|
|
1733
|
+
children: e
|
|
1734
|
+
}, e))
|
|
1735
|
+
}) : null]
|
|
1736
|
+
})
|
|
1737
|
+
}) : null,
|
|
1738
|
+
/* @__PURE__ */ C(h, {
|
|
1739
|
+
modalType: "standard",
|
|
1740
|
+
onClose: () => {
|
|
1741
|
+
z(null), V(null);
|
|
1742
|
+
},
|
|
1743
|
+
open: !!(R && B),
|
|
1744
|
+
showModalHeader: !0,
|
|
1745
|
+
size: "wide",
|
|
1746
|
+
supportingText: R?.filename ?? void 0,
|
|
1747
|
+
title: "PDF 預覽",
|
|
1748
|
+
children: B ? /* @__PURE__ */ C(F, {
|
|
1749
|
+
filename: R?.filename ?? "PDF 預覽",
|
|
1750
|
+
fileUrl: B,
|
|
1751
|
+
onDownload: R ? () => void nt(R) : void 0
|
|
1752
|
+
}) : null
|
|
1753
|
+
}),
|
|
1754
|
+
/* @__PURE__ */ C(h, {
|
|
1755
|
+
cancelText: "保留案件",
|
|
1756
|
+
confirmButtonProps: { variant: "destructive-primary" },
|
|
1757
|
+
confirmText: "確認取消",
|
|
1758
|
+
loading: Re,
|
|
1759
|
+
modalStatusType: "error",
|
|
1760
|
+
modalType: "standard",
|
|
1761
|
+
onCancel: () => P(!1),
|
|
1762
|
+
onClose: () => P(!1),
|
|
1763
|
+
onConfirm: () => void it(),
|
|
1764
|
+
open: Ve,
|
|
1765
|
+
showModalFooter: !0,
|
|
1766
|
+
showModalHeader: !0,
|
|
1767
|
+
supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
|
|
1768
|
+
title: "取消案件",
|
|
1769
|
+
children: /* @__PURE__ */ w("div", {
|
|
1770
|
+
style: on,
|
|
1771
|
+
children: [/* @__PURE__ */ w(x, {
|
|
1772
|
+
variant: "body",
|
|
1773
|
+
children: [
|
|
1774
|
+
"確定要取消「",
|
|
1775
|
+
b?.title ?? "",
|
|
1776
|
+
"」嗎?"
|
|
1777
|
+
]
|
|
1778
|
+
}), /* @__PURE__ */ C(n, {
|
|
1779
|
+
label: "取消原因",
|
|
1780
|
+
name: "cancelComment",
|
|
1781
|
+
children: /* @__PURE__ */ C(ne, {
|
|
1782
|
+
onChange: (e) => Be(e.target.value),
|
|
1783
|
+
placeholder: "可填寫取消原因",
|
|
1784
|
+
resize: "vertical",
|
|
1785
|
+
rows: 3,
|
|
1786
|
+
value: ze
|
|
1787
|
+
})
|
|
1788
|
+
})]
|
|
1789
|
+
})
|
|
1790
|
+
})
|
|
1791
|
+
] });
|
|
1792
|
+
}
|
|
1793
|
+
function ln(e) {
|
|
1794
|
+
return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
|
|
1795
|
+
}
|
|
1796
|
+
function un(e) {
|
|
1797
|
+
return e.edges.map(ln).filter((e) => e.trim().length > 0);
|
|
1798
|
+
}
|
|
1799
|
+
function dn(e) {
|
|
1800
|
+
return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
|
|
1801
|
+
}
|
|
1802
|
+
function fn(e, t, n, r) {
|
|
1803
|
+
return e.nodes.map((e) => {
|
|
1804
|
+
let i = vt(e, t, n, r);
|
|
1805
|
+
return {
|
|
1806
|
+
data: {
|
|
1807
|
+
kindLabel: dn(e.type),
|
|
1808
|
+
label: e.data.label,
|
|
1809
|
+
secondaryLabel: i.secondaryLabel,
|
|
1810
|
+
statusLabel: i.statusLabel,
|
|
1811
|
+
tone: i.tone
|
|
1812
|
+
},
|
|
1813
|
+
id: e.id,
|
|
1814
|
+
position: e.position,
|
|
1815
|
+
sourcePosition: k.Right,
|
|
1816
|
+
targetPosition: k.Left,
|
|
1817
|
+
type: "workflowRuntime"
|
|
1818
|
+
};
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
function pn(e) {
|
|
1822
|
+
let t = new Ie.graphlib.Graph();
|
|
1823
|
+
return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
|
|
1824
|
+
nodesep: 56,
|
|
1825
|
+
rankdir: "LR",
|
|
1826
|
+
ranksep: 120
|
|
1827
|
+
}), e.nodes.forEach((e) => {
|
|
1828
|
+
t.setNode(e.id, {
|
|
1829
|
+
height: Xt,
|
|
1830
|
+
width: Yt
|
|
1831
|
+
});
|
|
1832
|
+
}), e.edges.forEach((e) => {
|
|
1833
|
+
t.setEdge(e.source, e.target);
|
|
1834
|
+
}), Ie.layout(t), {
|
|
1835
|
+
...e,
|
|
1836
|
+
nodes: e.nodes.map((e) => {
|
|
1837
|
+
let n = t.node(e.id);
|
|
1838
|
+
return n ? {
|
|
1839
|
+
...e,
|
|
1840
|
+
position: {
|
|
1841
|
+
x: n.x - Yt / 2,
|
|
1842
|
+
y: n.y - Xt / 2
|
|
1843
|
+
}
|
|
1844
|
+
} : e;
|
|
1845
|
+
})
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
function mn(e) {
|
|
1849
|
+
return e.edges.map((e) => {
|
|
1850
|
+
let t = ln(e);
|
|
1851
|
+
return {
|
|
1852
|
+
animated: !1,
|
|
1853
|
+
id: e.id,
|
|
1854
|
+
label: t,
|
|
1855
|
+
labelBgBorderRadius: 6,
|
|
1856
|
+
labelBgPadding: [8, 4],
|
|
1857
|
+
labelBgStyle: {
|
|
1858
|
+
fill: e.data.isDefault ? "#f8fafc" : "#eff6ff",
|
|
1859
|
+
stroke: e.data.isDefault ? "#64748b" : "#2563eb",
|
|
1860
|
+
strokeWidth: 1
|
|
1861
|
+
},
|
|
1862
|
+
labelShowBg: !!t,
|
|
1863
|
+
labelStyle: {
|
|
1864
|
+
fill: e.data.isDefault ? "#475569" : "#2563eb",
|
|
1865
|
+
fontSize: 12,
|
|
1866
|
+
fontWeight: 600
|
|
1867
|
+
},
|
|
1868
|
+
source: e.source,
|
|
1869
|
+
style: {
|
|
1870
|
+
stroke: "#475569",
|
|
1871
|
+
strokeWidth: 1.5
|
|
1872
|
+
},
|
|
1873
|
+
target: e.target,
|
|
1874
|
+
type: e.type ?? "smoothstep"
|
|
1875
|
+
};
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
function hn(e) {
|
|
1879
|
+
return e === "current" ? {
|
|
1880
|
+
...$t,
|
|
1881
|
+
border: "1px solid var(--mzn-color-primary, #0057ff)",
|
|
1882
|
+
boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
|
|
1883
|
+
} : e === "completed" ? {
|
|
1884
|
+
...$t,
|
|
1885
|
+
border: "1px solid #16a34a"
|
|
1886
|
+
} : e === "cancelled" ? {
|
|
1887
|
+
...$t,
|
|
1888
|
+
border: "1px solid #dc2626",
|
|
1889
|
+
opacity: .72
|
|
1890
|
+
} : e === "waiting" ? {
|
|
1891
|
+
...$t,
|
|
1892
|
+
border: "1px dashed #64748b"
|
|
1893
|
+
} : $t;
|
|
1894
|
+
}
|
|
1895
|
+
function gn(e) {
|
|
1896
|
+
let t = en;
|
|
1897
|
+
return e === "current" ? {
|
|
1898
|
+
...t,
|
|
1899
|
+
background: "#eff6ff",
|
|
1900
|
+
color: "#2563eb"
|
|
1901
|
+
} : e === "completed" ? {
|
|
1902
|
+
...t,
|
|
1903
|
+
background: "#f0fdf4",
|
|
1904
|
+
color: "#15803d"
|
|
1905
|
+
} : e === "cancelled" ? {
|
|
1906
|
+
...t,
|
|
1907
|
+
background: "#fef2f2",
|
|
1908
|
+
color: "#dc2626"
|
|
1909
|
+
} : e === "waiting" ? {
|
|
1910
|
+
...t,
|
|
1911
|
+
background: "#f8fafc",
|
|
1912
|
+
color: "#475569"
|
|
1913
|
+
} : {
|
|
1914
|
+
...t,
|
|
1915
|
+
background: "#f1f5f9",
|
|
1916
|
+
color: "#64748b"
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
function _n({ data: e }) {
|
|
1920
|
+
return /* @__PURE__ */ w("div", {
|
|
1921
|
+
style: hn(e.tone),
|
|
1922
|
+
children: [
|
|
1923
|
+
/* @__PURE__ */ C(Fe, {
|
|
1924
|
+
isConnectable: !1,
|
|
1925
|
+
position: k.Left,
|
|
1926
|
+
style: nn,
|
|
1927
|
+
type: "target"
|
|
1928
|
+
}),
|
|
1929
|
+
/* @__PURE__ */ C(x, {
|
|
1930
|
+
component: "span",
|
|
1931
|
+
ellipsis: !0,
|
|
1932
|
+
title: e.label,
|
|
1933
|
+
variant: "label-primary",
|
|
1934
|
+
children: e.label
|
|
1935
|
+
}),
|
|
1936
|
+
/* @__PURE__ */ C("span", {
|
|
1937
|
+
style: gn(e.tone),
|
|
1938
|
+
children: e.statusLabel
|
|
1939
|
+
}),
|
|
1940
|
+
/* @__PURE__ */ C("span", {
|
|
1941
|
+
title: e.secondaryLabel,
|
|
1942
|
+
style: tn,
|
|
1943
|
+
children: e.secondaryLabel || e.kindLabel
|
|
1944
|
+
}),
|
|
1945
|
+
/* @__PURE__ */ C(Fe, {
|
|
1946
|
+
isConnectable: !1,
|
|
1947
|
+
position: k.Right,
|
|
1948
|
+
style: nn,
|
|
1949
|
+
type: "source"
|
|
1950
|
+
})
|
|
1951
|
+
]
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
//#endregion
|
|
1955
|
+
export { Dt as a, Rt as i, Jt as n, Tt as o, Vt as r, cn as t };
|
|
1956
|
+
|
|
1957
|
+
//# sourceMappingURL=detail-kyolfdBu.js.map
|