@rytass/bpm-core-react 0.17.6 → 0.17.8
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 +44 -0
- package/dist/chunks/{FormBuilderView-aBcA-_tt.cjs → FormBuilderView-CUOyS07f.cjs} +2 -2
- package/dist/chunks/{FormBuilderView-aBcA-_tt.cjs.map → FormBuilderView-CUOyS07f.cjs.map} +1 -1
- package/dist/chunks/{FormBuilderView-BYL42M0d.js → FormBuilderView-ClLnQ1e_.js} +2 -2
- package/dist/chunks/{FormBuilderView-BYL42M0d.js.map → FormBuilderView-ClLnQ1e_.js.map} +1 -1
- package/dist/chunks/{FormRendererView-cZGOOjU5.js → FormRendererView-BsTwZkqU.js} +207 -198
- package/dist/chunks/FormRendererView-BsTwZkqU.js.map +1 -0
- package/dist/chunks/FormRendererView-GpsE03np.cjs +4 -0
- package/dist/chunks/FormRendererView-GpsE03np.cjs.map +1 -0
- package/dist/chunks/approver-filled-form-D1DmqDVP.cjs +2 -0
- package/dist/chunks/approver-filled-form-D1DmqDVP.cjs.map +1 -0
- package/dist/chunks/approver-filled-form-DuQGPtNB.js +95 -0
- package/dist/chunks/approver-filled-form-DuQGPtNB.js.map +1 -0
- package/dist/chunks/{compose-DOEaPfEC.cjs → compose-Cock_B2Q.cjs} +2 -2
- package/dist/chunks/{compose-DOEaPfEC.cjs.map → compose-Cock_B2Q.cjs.map} +1 -1
- package/dist/chunks/{compose-v1Vcw9hE.js → compose-jnvnnVfN.js} +4 -4
- package/dist/chunks/{compose-v1Vcw9hE.js.map → compose-jnvnnVfN.js.map} +1 -1
- package/dist/chunks/{designer-DBBrktom.js → designer-B8Gvew_k.js} +1668 -1182
- package/dist/chunks/designer-B8Gvew_k.js.map +1 -0
- package/dist/chunks/designer-CAEFV1ve.cjs +65 -0
- package/dist/chunks/designer-CAEFV1ve.cjs.map +1 -0
- package/dist/chunks/detail-COh5sjAt.cjs +2 -0
- package/dist/chunks/detail-COh5sjAt.cjs.map +1 -0
- package/dist/chunks/detail-D6X61pkg.js +2581 -0
- package/dist/chunks/detail-D6X61pkg.js.map +1 -0
- package/dist/chunks/{providers-H_vPRsSN.js → providers-B_d5tbCL.js} +178 -167
- package/dist/chunks/providers-B_d5tbCL.js.map +1 -0
- package/dist/chunks/providers-chuJvMgv.cjs +2 -0
- package/dist/chunks/providers-chuJvMgv.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.js +1 -1
- package/dist/next/workflow-chat-route.cjs +1 -0
- package/dist/next/workflow-chat-route.cjs.map +1 -1
- package/dist/next/workflow-chat-route.d.cts +1 -1
- package/dist/next/workflow-chat-route.d.ts +1 -1
- package/dist/next/workflow-chat-route.js +1 -1
- package/dist/next/workflow-chat-route.js.map +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/templates/compose/index.cjs +1 -1
- package/dist/pages/templates/compose/index.js +1 -1
- package/dist/pages/templates/designer/index.cjs +1 -1
- package/dist/pages/templates/designer/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/renderer/FormRendererView.d.cts +16 -1
- package/dist/views/forms/renderer/FormRendererView.d.ts +16 -1
- package/dist/views/forms/renderer/index.cjs +1 -1
- package/dist/views/forms/renderer/index.js +1 -1
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.cjs.map +1 -1
- package/dist/views/inbox/index.js +109 -99
- package/dist/views/inbox/index.js.map +1 -1
- package/dist/views/instances/approver-filled-form.d.cts +76 -0
- package/dist/views/instances/approver-filled-form.d.ts +76 -0
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +30 -2
- package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +30 -2
- package/dist/views/instances/detail/sections/InstanceHistorySection.d.cts +4 -1
- package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +4 -1
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +28 -0
- package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +28 -0
- package/dist/views/instances/detail/sections/container-helpers.d.cts +1 -1
- package/dist/views/instances/detail/sections/container-helpers.d.ts +1 -1
- package/dist/views/instances/detail/sections/shared.d.cts +11 -2
- package/dist/views/instances/detail/sections/shared.d.ts +11 -2
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.cjs.map +1 -1
- package/dist/views/instances/new/index.js +88 -87
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/instances/viewer-field-access.d.cts +22 -0
- package/dist/views/instances/viewer-field-access.d.ts +22 -0
- package/dist/views/templates/compose/index.cjs +1 -1
- package/dist/views/templates/compose/index.js +1 -1
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +33 -0
- package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +33 -0
- package/dist/views/templates/designer/field-access-matrix/FieldAccessNodeSection.d.cts +20 -0
- package/dist/views/templates/designer/field-access-matrix/FieldAccessNodeSection.d.ts +20 -0
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +22 -0
- package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +22 -0
- package/dist/views/templates/designer/index.cjs +1 -1
- package/dist/views/templates/designer/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunks/FormRendererView-DRFi_IH7.cjs +0 -4
- package/dist/chunks/FormRendererView-DRFi_IH7.cjs.map +0 -1
- package/dist/chunks/FormRendererView-cZGOOjU5.js.map +0 -1
- package/dist/chunks/designer-CTXMqCD2.cjs +0 -65
- package/dist/chunks/designer-CTXMqCD2.cjs.map +0 -1
- package/dist/chunks/designer-DBBrktom.js.map +0 -1
- package/dist/chunks/detail-BQSVgVlO.cjs +0 -2
- package/dist/chunks/detail-BQSVgVlO.cjs.map +0 -1
- package/dist/chunks/detail-B_bSg31B.js +0 -2387
- package/dist/chunks/detail-B_bSg31B.js.map +0 -1
- package/dist/chunks/providers-DP7b0TMN.cjs +0 -2
- package/dist/chunks/providers-DP7b0TMN.cjs.map +0 -1
- package/dist/chunks/providers-H_vPRsSN.js.map +0 -1
|
@@ -0,0 +1,2581 @@
|
|
|
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 "./use-bpm-member-D57LKe_u.js";
|
|
6
|
+
import { t as i } from "./format-member-label-DudVI55w.js";
|
|
7
|
+
import { t as a } from "./task-node-label-CWZgOBj0.js";
|
|
8
|
+
import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as ee, u as te } from "./approver-filled-form-DuQGPtNB.js";
|
|
9
|
+
import { o as m, t as ne } from "./FormRendererView-BsTwZkqU.js";
|
|
10
|
+
import '../style.css';import '../detail.css';/* empty css */
|
|
11
|
+
import { Fragment as h, forwardRef as re, useCallback as g, useEffect as ie, useImperativeHandle as ae, useMemo as _, useRef as oe, useState as v } from "react";
|
|
12
|
+
import { AutoComplete as se, Badge as ce, Button as y, Description as b, DescriptionContent as le, InlineMessage as x, Input as ue, Message as de, Modal as S, PageHeader as fe, Section as pe, SectionGroup as me, Select as C, Stepper as he, Table as ge, Textarea as _e, Tooltip as ve, Typography as w } from "@mezzanine-ui/react";
|
|
13
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
14
|
+
import { cancelAdhocDirective as ye, cancelApprovalInstance as be, configureAdhocCompletionNotification as xe, configureAdhocStageNotification as Se, decideTask as Ce, listAdhocDirectives as we, listAttachments as Te, listTaskDecisions as O, listWorkflowWebhookDeliveries as Ee, readApprovalInstance as De, readAttachmentDownloadUrl as Oe, readAttachmentPreviewUrl as ke, readInstanceSignatures as Ae, requestAdhocCountersign as je, requestAdhocPreApproval as Me, resolveMemberProfiles as Ne, resubmitApprovalInstance as Pe, retryWorkflowWebhookDelivery as Fe, searchMembers as k, uploadAttachment as Ie } from "@rytass/bpm-core-client/workflow";
|
|
15
|
+
import Le from "@mezzanine-ui/react/ContentHeader";
|
|
16
|
+
import { CheckedIcon as Re, ChevronLeftIcon as ze, ChevronRightIcon as Be, DangerousOutlineIcon as Ve, DownloadIcon as He, FileSearchIcon as Ue, NotificationUnreadIcon as We, PlusIcon as Ge, RefreshCcwIcon as Ke, ResetIcon as qe, ShareIcon as A, UserIcon as Je, ZoomInIcon as Ye, ZoomOutIcon as j } from "@mezzanine-ui/icons";
|
|
17
|
+
import { readNodeFillableFieldKeys as M, readRevealedFieldKeys as Xe, readTopLevelFieldKey as Ze, resolveFieldAccess as Qe } from "@rytass/bpm-core-shared";
|
|
18
|
+
import { buildFormRendererValues as $e, focusFormRendererField as et, readFormDataSourceErrorMessage as N, validateFormRendererValues as tt } from "@rytass/bpm-core-client/form";
|
|
19
|
+
import { Background as nt, Controls as P, Handle as F, Position as I, ReactFlow as rt } from "@xyflow/react";
|
|
20
|
+
import * as L from "dagre";
|
|
21
|
+
import { Document as it, Page as at } from "react-pdf";
|
|
22
|
+
import { stepClasses as R } from "@mezzanine-ui/core/stepper";
|
|
23
|
+
var z = {
|
|
24
|
+
root: "bpm_root_ehm7w",
|
|
25
|
+
toolbar: "bpm_toolbar_R-tis",
|
|
26
|
+
pageControls: "bpm_pageControls_jM-rC",
|
|
27
|
+
zoomControls: "bpm_zoomControls_7RAbJ",
|
|
28
|
+
counter: "bpm_counter_ILUsD",
|
|
29
|
+
viewport: "bpm_viewport_DQXms",
|
|
30
|
+
page: "bpm_page_Cv5Rg",
|
|
31
|
+
state: "bpm_state_bpgp3"
|
|
32
|
+
}, ot = 760, st = 920, ct = 320, lt = 32, ut = .75, dt = 1.75, ft = .25;
|
|
33
|
+
function pt({ filename: e, fileUrl: t, onDownload: n }) {
|
|
34
|
+
let r = oe(null), [i, a] = v(null), [o, s] = v(1), [c, l] = v(1), [u, d] = v(ot);
|
|
35
|
+
ie(() => {
|
|
36
|
+
let e = r.current;
|
|
37
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
38
|
+
let t = new ResizeObserver((e) => {
|
|
39
|
+
let t = e[0]?.contentRect.width;
|
|
40
|
+
t && d(t);
|
|
41
|
+
});
|
|
42
|
+
return t.observe(e), () => t.disconnect();
|
|
43
|
+
}, []), ie(() => {
|
|
44
|
+
a(null), s(1), l(1);
|
|
45
|
+
}, [t]);
|
|
46
|
+
let f = _(() => {
|
|
47
|
+
let e = Math.max(ct, u - lt);
|
|
48
|
+
return Math.round(Math.min(st, e) * c);
|
|
49
|
+
}, [c, u]), p = g((e) => {
|
|
50
|
+
a(e.numPages), s(1);
|
|
51
|
+
}, []), ee = o > 1, te = i !== null && o < i, m = c > ut, ne = c < dt, h = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, re = `${Math.round(c * 100)}%`;
|
|
52
|
+
return /* @__PURE__ */ D("section", {
|
|
53
|
+
"aria-label": `${e} PDF 預覽`,
|
|
54
|
+
className: z.root,
|
|
55
|
+
children: [/* @__PURE__ */ D("div", {
|
|
56
|
+
className: z.toolbar,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ D("div", {
|
|
59
|
+
className: z.pageControls,
|
|
60
|
+
"aria-label": "頁面切換",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ E(y, {
|
|
63
|
+
"aria-label": "上一頁",
|
|
64
|
+
disabled: !ee,
|
|
65
|
+
icon: ze,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
s((e) => Math.max(1, e - 1));
|
|
68
|
+
},
|
|
69
|
+
size: "minor",
|
|
70
|
+
variant: "base-secondary"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ E(w, {
|
|
73
|
+
className: z.counter,
|
|
74
|
+
component: "span",
|
|
75
|
+
variant: "body",
|
|
76
|
+
children: h
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ E(y, {
|
|
79
|
+
"aria-label": "下一頁",
|
|
80
|
+
disabled: !te,
|
|
81
|
+
icon: Be,
|
|
82
|
+
onClick: () => {
|
|
83
|
+
s((e) => i === null ? e : Math.min(i, e + 1));
|
|
84
|
+
},
|
|
85
|
+
size: "minor",
|
|
86
|
+
variant: "base-secondary"
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ D("div", {
|
|
91
|
+
className: z.zoomControls,
|
|
92
|
+
"aria-label": "縮放",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ E(y, {
|
|
95
|
+
"aria-label": "縮小",
|
|
96
|
+
disabled: !m,
|
|
97
|
+
icon: j,
|
|
98
|
+
onClick: () => {
|
|
99
|
+
l((e) => Math.max(ut, e - ft));
|
|
100
|
+
},
|
|
101
|
+
size: "minor",
|
|
102
|
+
variant: "base-secondary"
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ E(w, {
|
|
105
|
+
className: z.counter,
|
|
106
|
+
component: "span",
|
|
107
|
+
variant: "body",
|
|
108
|
+
children: re
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ E(y, {
|
|
111
|
+
"aria-label": "放大",
|
|
112
|
+
disabled: !ne,
|
|
113
|
+
icon: Ye,
|
|
114
|
+
onClick: () => {
|
|
115
|
+
l((e) => Math.min(dt, e + ft));
|
|
116
|
+
},
|
|
117
|
+
size: "minor",
|
|
118
|
+
variant: "base-secondary"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
}),
|
|
122
|
+
n ? /* @__PURE__ */ E(y, {
|
|
123
|
+
icon: He,
|
|
124
|
+
iconType: "leading",
|
|
125
|
+
onClick: n,
|
|
126
|
+
size: "minor",
|
|
127
|
+
variant: "base-primary",
|
|
128
|
+
children: "下載"
|
|
129
|
+
}) : null
|
|
130
|
+
]
|
|
131
|
+
}), /* @__PURE__ */ E("div", {
|
|
132
|
+
className: z.viewport,
|
|
133
|
+
ref: r,
|
|
134
|
+
children: /* @__PURE__ */ E(it, {
|
|
135
|
+
error: /* @__PURE__ */ E(B, { message: "PDF 無法載入。" }),
|
|
136
|
+
file: t,
|
|
137
|
+
loading: /* @__PURE__ */ E(B, { message: "正在載入 PDF..." }),
|
|
138
|
+
noData: /* @__PURE__ */ E(B, { message: "沒有可預覽的 PDF。" }),
|
|
139
|
+
onLoadSuccess: p,
|
|
140
|
+
suspense: !1,
|
|
141
|
+
children: /* @__PURE__ */ E(at, {
|
|
142
|
+
className: z.page,
|
|
143
|
+
loading: /* @__PURE__ */ E(B, { message: "正在載入頁面..." }),
|
|
144
|
+
pageNumber: o,
|
|
145
|
+
renderAnnotationLayer: !0,
|
|
146
|
+
renderTextLayer: !0,
|
|
147
|
+
width: f
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function B({ message: e }) {
|
|
154
|
+
return /* @__PURE__ */ E("div", {
|
|
155
|
+
className: z.state,
|
|
156
|
+
children: /* @__PURE__ */ E(w, {
|
|
157
|
+
color: "text-neutral",
|
|
158
|
+
variant: "body",
|
|
159
|
+
children: e
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/views/instances/detail/submitted-by.ts
|
|
165
|
+
function mt({ initiatorMemberId: e, submittedByMemberId: t }) {
|
|
166
|
+
return t && t !== e ? t : null;
|
|
167
|
+
}
|
|
168
|
+
function ht(e, t) {
|
|
169
|
+
let n = mt(e);
|
|
170
|
+
if (!n || !e.initiatorMemberId) return null;
|
|
171
|
+
let r = (e) => t.get(e)?.name ?? e;
|
|
172
|
+
return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/views/instances/detail/sections/shared.ts
|
|
176
|
+
function gt(e) {
|
|
177
|
+
let t = V(e, "from"), n = V(e, "to"), r = V(e, "reason");
|
|
178
|
+
return !t || !n || !r ? null : {
|
|
179
|
+
from: t,
|
|
180
|
+
reason: r,
|
|
181
|
+
ruleId: V(e, "ruleId"),
|
|
182
|
+
to: n
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function _t(e) {
|
|
186
|
+
try {
|
|
187
|
+
let t = JSON.parse(e);
|
|
188
|
+
return Array.isArray(t) ? t.map((e) => U(e) ? gt(e) : null).filter((e) => e !== null) : [];
|
|
189
|
+
} catch {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function V(e, t) {
|
|
194
|
+
let n = e[t];
|
|
195
|
+
return typeof n == "string" ? n : null;
|
|
196
|
+
}
|
|
197
|
+
function vt(e, t) {
|
|
198
|
+
let n = e[t];
|
|
199
|
+
return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
|
|
200
|
+
}
|
|
201
|
+
function yt(e, t) {
|
|
202
|
+
let n = e[t];
|
|
203
|
+
return typeof n == "number" ? n : null;
|
|
204
|
+
}
|
|
205
|
+
function H(e) {
|
|
206
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
207
|
+
}
|
|
208
|
+
function U(e) {
|
|
209
|
+
return typeof e == "object" && !!e;
|
|
210
|
+
}
|
|
211
|
+
function bt(e) {
|
|
212
|
+
return e.status === "PENDING" || e.status === "IN_PROGRESS";
|
|
213
|
+
}
|
|
214
|
+
function W(e) {
|
|
215
|
+
return N(e) || (e instanceof Error ? e.message : "發生未知錯誤");
|
|
216
|
+
}
|
|
217
|
+
function xt(e) {
|
|
218
|
+
return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
219
|
+
}
|
|
220
|
+
function St(e) {
|
|
221
|
+
return e.length > 16 ? `${e.slice(0, 12)}...` : e;
|
|
222
|
+
}
|
|
223
|
+
function Ct(e) {
|
|
224
|
+
return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
|
|
225
|
+
}
|
|
226
|
+
function G(e) {
|
|
227
|
+
return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
|
|
228
|
+
}
|
|
229
|
+
function K(e) {
|
|
230
|
+
return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
|
|
231
|
+
}
|
|
232
|
+
function wt(e) {
|
|
233
|
+
return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
|
|
234
|
+
}
|
|
235
|
+
function Tt(e, t) {
|
|
236
|
+
return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
|
|
237
|
+
}
|
|
238
|
+
function q(e, t) {
|
|
239
|
+
if (!e) return "-";
|
|
240
|
+
let n = t.get(e);
|
|
241
|
+
return n ? i(n.name, n.email, "fullwidth") : e;
|
|
242
|
+
}
|
|
243
|
+
function Et(e, t = /* @__PURE__ */ new Map()) {
|
|
244
|
+
let n = _t(e.delegationChainJson);
|
|
245
|
+
if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => q(e, t)).join("、")}` : "未指定";
|
|
246
|
+
let r = q(e.assigneeMemberId, t), i = q(e.originalAssigneeMemberId, t);
|
|
247
|
+
return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
|
|
248
|
+
}
|
|
249
|
+
function Dt(e, t) {
|
|
250
|
+
return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
|
|
251
|
+
}
|
|
252
|
+
function Ot(e, t) {
|
|
253
|
+
let n = e.filter((e) => Dt(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
|
|
254
|
+
return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
|
|
255
|
+
}
|
|
256
|
+
function kt(e, t) {
|
|
257
|
+
if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
|
|
258
|
+
if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
|
|
259
|
+
id: e.id,
|
|
260
|
+
name: `${e.data.label}(${wt(e.type)})`
|
|
261
|
+
}));
|
|
262
|
+
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);
|
|
263
|
+
return r ? [{
|
|
264
|
+
id: r.id,
|
|
265
|
+
name: `${r.data.label}(${wt(r.type)})`
|
|
266
|
+
}] : [];
|
|
267
|
+
}
|
|
268
|
+
function At(e) {
|
|
269
|
+
return {
|
|
270
|
+
email: e.email,
|
|
271
|
+
id: e.memberId,
|
|
272
|
+
name: i(e.name, e.email, "dot")
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function jt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
|
|
276
|
+
if (t) {
|
|
277
|
+
let e = n.trim();
|
|
278
|
+
return e ? {
|
|
279
|
+
target: {
|
|
280
|
+
kind: "WEBHOOK",
|
|
281
|
+
webhookUrl: e
|
|
282
|
+
},
|
|
283
|
+
valid: !0
|
|
284
|
+
} : {
|
|
285
|
+
error: "請輸入 Webhook URL",
|
|
286
|
+
valid: !1
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return e.length > 0 ? {
|
|
290
|
+
target: {
|
|
291
|
+
kind: "MEMBER",
|
|
292
|
+
memberIds: e
|
|
293
|
+
},
|
|
294
|
+
valid: !0
|
|
295
|
+
} : {
|
|
296
|
+
error: "請選擇對象成員",
|
|
297
|
+
valid: !1
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function J(e) {
|
|
301
|
+
return !!e;
|
|
302
|
+
}
|
|
303
|
+
function Mt(e) {
|
|
304
|
+
if (!U(e)) return null;
|
|
305
|
+
let t = e.email, n = e.id, r = e.name;
|
|
306
|
+
return typeof n == "string" && typeof r == "string" ? {
|
|
307
|
+
email: typeof t == "string" ? t : null,
|
|
308
|
+
id: n,
|
|
309
|
+
name: r
|
|
310
|
+
} : null;
|
|
311
|
+
}
|
|
312
|
+
function Nt(e, t) {
|
|
313
|
+
let n = e.trim().toLocaleLowerCase();
|
|
314
|
+
if (!n) return null;
|
|
315
|
+
let r = t.filter((e) => [
|
|
316
|
+
e.id,
|
|
317
|
+
e.name,
|
|
318
|
+
e.email ?? ""
|
|
319
|
+
].some((e) => e.toLocaleLowerCase().includes(n)));
|
|
320
|
+
return r.length === 1 ? r[0] ?? null : null;
|
|
321
|
+
}
|
|
322
|
+
function Y(e) {
|
|
323
|
+
return H(e) ? {
|
|
324
|
+
text: e,
|
|
325
|
+
type: "text"
|
|
326
|
+
} : null;
|
|
327
|
+
}
|
|
328
|
+
function Pt(e, t, n = "neutral") {
|
|
329
|
+
return H(t) ? {
|
|
330
|
+
label: e,
|
|
331
|
+
text: t,
|
|
332
|
+
tone: n,
|
|
333
|
+
type: "comment"
|
|
334
|
+
} : null;
|
|
335
|
+
}
|
|
336
|
+
function Ft(e, t, n, r) {
|
|
337
|
+
let i = t ? n.get(t) : null;
|
|
338
|
+
return {
|
|
339
|
+
email: i?.email ?? null,
|
|
340
|
+
label: i?.name ?? r,
|
|
341
|
+
memberId: t,
|
|
342
|
+
prefix: e,
|
|
343
|
+
type: "member"
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function It(e) {
|
|
347
|
+
return !!e;
|
|
348
|
+
}
|
|
349
|
+
function Lt(e) {
|
|
350
|
+
let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
|
|
351
|
+
return t === -1 ? e.length : t;
|
|
352
|
+
}
|
|
353
|
+
function X(e) {
|
|
354
|
+
return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Z(e) || zt(e.eventType, Ut(e));
|
|
355
|
+
}
|
|
356
|
+
function Z(e) {
|
|
357
|
+
return e.eventType === "TASK_CREATED" && vt(Ut(e), "sequentialCandidateMemberIds").length > 0;
|
|
358
|
+
}
|
|
359
|
+
function Q(e) {
|
|
360
|
+
if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
|
|
361
|
+
let t = Ut(e);
|
|
362
|
+
return [
|
|
363
|
+
...vt(t, "sequentialCandidateMemberIds"),
|
|
364
|
+
V(t, "candidateMemberId"),
|
|
365
|
+
V(t, "previousMemberId")
|
|
366
|
+
].filter(H);
|
|
367
|
+
}
|
|
368
|
+
var Rt = /* @__PURE__ */ new Set([
|
|
369
|
+
"SERVICE_TASK_EXECUTED",
|
|
370
|
+
"SERVICE_TASK_FAILED",
|
|
371
|
+
"WEBHOOK_DELIVERY_RETRIED"
|
|
372
|
+
]);
|
|
373
|
+
function zt(e, t) {
|
|
374
|
+
return Rt.has(e) && V(t, "action") === "NOTIFY_WEBHOOK";
|
|
375
|
+
}
|
|
376
|
+
function Bt(e) {
|
|
377
|
+
return V(e, "endpointLabel") ?? V(e, "endpointKey") ?? "外部系統";
|
|
378
|
+
}
|
|
379
|
+
function Vt(e) {
|
|
380
|
+
return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
|
|
381
|
+
}
|
|
382
|
+
function Ht(e, t) {
|
|
383
|
+
if (e === "INSTANCE_STARTED") return "案件已發起";
|
|
384
|
+
if (e === "INSTANCE_CANCELLED") return "案件已取消";
|
|
385
|
+
if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
|
|
386
|
+
if (e === "TOKEN_CREATED") return "流程路徑已建立";
|
|
387
|
+
if (e === "ENGINE_PROCESS_REQUESTED") return "流程引擎已處理";
|
|
388
|
+
if (e === "TOKEN_ADVANCED") return "流程已前進";
|
|
389
|
+
if (e === "TASK_CREATED") return "待簽任務已建立";
|
|
390
|
+
if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
|
|
391
|
+
if (e === "TASK_DECIDED") return Vt(V(t, "action"));
|
|
392
|
+
if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
|
|
393
|
+
if (e === "TASK_REASSIGNED") return "管理者改派待辦";
|
|
394
|
+
if (zt(e, t)) {
|
|
395
|
+
let n = Bt(t);
|
|
396
|
+
return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
|
|
397
|
+
}
|
|
398
|
+
return e;
|
|
399
|
+
}
|
|
400
|
+
function Ut(e) {
|
|
401
|
+
try {
|
|
402
|
+
let t = JSON.parse(e.payloadJson);
|
|
403
|
+
return U(t) ? t : {};
|
|
404
|
+
} catch {
|
|
405
|
+
return {};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function Wt(e, t) {
|
|
409
|
+
return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && zt(e.eventType, t) || V(t, "action") === "REJECTED" || V(t, "instanceState") === "REJECTED";
|
|
410
|
+
}
|
|
411
|
+
function Gt(e) {
|
|
412
|
+
return t(e);
|
|
413
|
+
}
|
|
414
|
+
function Kt(e, t, n, r) {
|
|
415
|
+
if (e.eventType === "INSTANCE_STARTED") return ht({
|
|
416
|
+
initiatorMemberId: e.actorMemberId,
|
|
417
|
+
submittedByMemberId: V(t, "submittedByMemberId")
|
|
418
|
+
}, r);
|
|
419
|
+
if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
|
|
420
|
+
let e = V(t, "candidateMemberId"), n = V(t, "previousMemberId");
|
|
421
|
+
if (!e) return null;
|
|
422
|
+
let i = q(e, r);
|
|
423
|
+
return n ? `輪到:${i}(前一位:${q(n, r)})` : `輪到:${i}`;
|
|
424
|
+
}
|
|
425
|
+
if (e.eventType === "TASK_CREATED") {
|
|
426
|
+
let e = vt(t, "sequentialCandidateMemberIds");
|
|
427
|
+
if (e.length) return `簽核順序:${e.map((e) => q(e, r)).join(" → ")}`;
|
|
428
|
+
let n = V(t, "assigneeMemberId"), i = V(t, "originalAssigneeMemberId");
|
|
429
|
+
if (!n) {
|
|
430
|
+
let e = vt(t, "candidateMemberIds");
|
|
431
|
+
return e.length ? `候選簽核人:${e.map((e) => q(e, r)).join("、")}` : null;
|
|
432
|
+
}
|
|
433
|
+
let a = q(n, r), o = q(i, r);
|
|
434
|
+
return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
|
|
435
|
+
}
|
|
436
|
+
if (e.eventType === "TASK_DECIDED") {
|
|
437
|
+
let e = V(t, "action"), n = V(t, "comment"), i = e ? `決議:${K(e)}` : null, a = V(t, "transferToMemberId");
|
|
438
|
+
return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(H).join(" · ") : i;
|
|
439
|
+
}
|
|
440
|
+
if (e.eventType === "TOKEN_ADVANCED") {
|
|
441
|
+
let e = V(t, "action");
|
|
442
|
+
if (e) return `流程結果:${K(e)}`;
|
|
443
|
+
let r = yt(t, "arrivedCount"), i = yt(t, "requiredCount");
|
|
444
|
+
if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
|
|
445
|
+
let a = V(t, "fromNodeId"), o = V(t, "toNodeId");
|
|
446
|
+
if (a && o) return `由 ${Tt(a, n)} 前進至 ${Tt(o, n)}`;
|
|
447
|
+
}
|
|
448
|
+
if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
|
|
449
|
+
let e = V(t, "state");
|
|
450
|
+
return e ? `案件狀態:${Ct(e)}` : null;
|
|
451
|
+
}
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
function qt(e, t, n, r, i, a, o, s = null) {
|
|
455
|
+
if (e.eventType !== "TASK_DECIDED") return [Y(Kt(e, t, n, o))].filter(It);
|
|
456
|
+
let c = e.taskId ? r.get(e.taskId) : null, l = V(t, "action") ?? c?.action ?? null, u = V(t, "comment") ?? c?.comment ?? null, d = V(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = V(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
|
|
457
|
+
return [
|
|
458
|
+
Y(l ? `決議:${K(l)}` : null),
|
|
459
|
+
l === "REJECTED" ? Pt("拒絕原因", u ?? "-", "danger") : null,
|
|
460
|
+
l === "APPROVED" ? Pt("同意說明", u) : null,
|
|
461
|
+
l === "RETURNED" ? Pt("退回說明", u ?? "-") : null,
|
|
462
|
+
l === "TRANSFERRED" ? Y(`轉派給:${q(d, o)}`) : null,
|
|
463
|
+
l === "TRANSFERRED" ? Pt("轉派說明", u ?? "-") : null,
|
|
464
|
+
Y(Jt(t, s)),
|
|
465
|
+
p ? Y(a?.valid ? `簽章:已驗證(${St(p.signedPayloadHash)})` : `簽章:待檢查(${St(p.signedPayloadHash)})`) : null
|
|
466
|
+
].filter(It);
|
|
467
|
+
}
|
|
468
|
+
function Jt(e, t) {
|
|
469
|
+
let n = e.changedFieldKeys;
|
|
470
|
+
if (!Array.isArray(n)) return null;
|
|
471
|
+
let r = n.filter((e) => typeof e == "string" && e !== "");
|
|
472
|
+
if (r.length === 0) return null;
|
|
473
|
+
let i = r.map((e) => t?.fields.find((t) => t.fieldKey === e)?.label || e);
|
|
474
|
+
return `補填 ${r.length} 個欄位:${i.join("、")}`;
|
|
475
|
+
}
|
|
476
|
+
function Yt(e, t, n, r, i) {
|
|
477
|
+
if (e.type === "startEvent" || i.has(e.id)) return !1;
|
|
478
|
+
if (r === "REJECTED") return !0;
|
|
479
|
+
let a = on(e, t, n, r);
|
|
480
|
+
return a.tone === "neutral" || a.tone === "waiting";
|
|
481
|
+
}
|
|
482
|
+
function Xt(e, t, n, r, i) {
|
|
483
|
+
if (r !== "RUNNING" && r !== "REJECTED") return [];
|
|
484
|
+
let a = e.nodes.filter((e) => Yt(e, t, n, r, i)), o = Zt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
|
|
485
|
+
return a.filter((e) => o.has(e.id)).sort((e, t) => {
|
|
486
|
+
let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
|
|
487
|
+
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;
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
function Zt(e, t, n, r, i) {
|
|
491
|
+
let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
|
|
492
|
+
let n = [...e.get(t.source) ?? [], t.target];
|
|
493
|
+
return new Map(e).set(t.source, n);
|
|
494
|
+
}, /* @__PURE__ */ new Map());
|
|
495
|
+
return Qt(e, n, r, i).reduce((e, t) => tn(e, $t(t, o, a)), /* @__PURE__ */ new Map());
|
|
496
|
+
}
|
|
497
|
+
function Qt(e, t, n, r) {
|
|
498
|
+
let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(bt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
|
|
499
|
+
...i,
|
|
500
|
+
...a,
|
|
501
|
+
...o
|
|
502
|
+
])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
|
|
503
|
+
return s.length > 0 ? s : c;
|
|
504
|
+
}
|
|
505
|
+
function $t(e, t, n) {
|
|
506
|
+
return en([{
|
|
507
|
+
distance: 0,
|
|
508
|
+
nodeId: e
|
|
509
|
+
}], t, n);
|
|
510
|
+
}
|
|
511
|
+
function en(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
|
|
512
|
+
let [a, ...o] = e;
|
|
513
|
+
if (!a) return i;
|
|
514
|
+
if (r.has(a.nodeId)) return en(o, t, n, r, i);
|
|
515
|
+
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;
|
|
516
|
+
return en([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
|
|
517
|
+
distance: a.distance + 1,
|
|
518
|
+
nodeId: e
|
|
519
|
+
}))], t, n, s, c);
|
|
520
|
+
}
|
|
521
|
+
function tn(e, t) {
|
|
522
|
+
return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
|
|
523
|
+
}
|
|
524
|
+
function nn(e) {
|
|
525
|
+
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}`;
|
|
526
|
+
}
|
|
527
|
+
function rn(e, t, n, r, i, a, o, s, c, l = null) {
|
|
528
|
+
let u = e.filter(X).map((e) => {
|
|
529
|
+
let t = Ut(e), n = e.nodeId ? Tt(e.nodeId, r) : null;
|
|
530
|
+
return {
|
|
531
|
+
descriptionParts: [
|
|
532
|
+
Y(n ? `節點:${n}` : "節點:全流程"),
|
|
533
|
+
Ft("操作者", e.actorMemberId, a, "系統"),
|
|
534
|
+
Y(`時間:${Gt(e.createdAt)}`),
|
|
535
|
+
...qt(e, t, r, o, s, c, a, l)
|
|
536
|
+
].filter(It),
|
|
537
|
+
error: Wt(e, t),
|
|
538
|
+
id: e.id,
|
|
539
|
+
title: Ht(e.eventType, t)
|
|
540
|
+
};
|
|
541
|
+
}), d = t.filter(bt).map((e) => ({
|
|
542
|
+
descriptionParts: [
|
|
543
|
+
Y(`節點:${Tt(e.nodeId, r)}`),
|
|
544
|
+
Ft("處理者", e.assigneeMemberId, a, "未指定"),
|
|
545
|
+
Y(`建立時間:${Gt(e.createdAt)}`)
|
|
546
|
+
].filter(It),
|
|
547
|
+
error: !1,
|
|
548
|
+
id: `pending-task-${e.id}`,
|
|
549
|
+
title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
|
|
550
|
+
})), f = new Set([...e.filter(X).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), p = r ? Xt(r, t, n, i, f).map((e) => ({
|
|
551
|
+
descriptionParts: [Y(`${wt(e.type)} · 尚未抵達`)].filter(It),
|
|
552
|
+
error: !1,
|
|
553
|
+
forcePending: !0,
|
|
554
|
+
id: `future-node-${e.id}`,
|
|
555
|
+
title: nn(e)
|
|
556
|
+
})) : [];
|
|
557
|
+
return [
|
|
558
|
+
...u,
|
|
559
|
+
...d,
|
|
560
|
+
...p
|
|
561
|
+
];
|
|
562
|
+
}
|
|
563
|
+
var an = {
|
|
564
|
+
APPROVED: {
|
|
565
|
+
statusLabel: "已完成",
|
|
566
|
+
tone: "completed"
|
|
567
|
+
},
|
|
568
|
+
CANCELLED: {
|
|
569
|
+
statusLabel: "已取消",
|
|
570
|
+
tone: "cancelled"
|
|
571
|
+
},
|
|
572
|
+
EXPIRED: {
|
|
573
|
+
statusLabel: "已逾期終止",
|
|
574
|
+
tone: "cancelled"
|
|
575
|
+
},
|
|
576
|
+
REJECTED: {
|
|
577
|
+
statusLabel: "已拒絕",
|
|
578
|
+
tone: "cancelled"
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
function on(e, t, n, r) {
|
|
582
|
+
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");
|
|
583
|
+
if (a) return {
|
|
584
|
+
secondaryLabel: `處理者 ${Et(a)}`,
|
|
585
|
+
statusLabel: "待處理",
|
|
586
|
+
tone: "current"
|
|
587
|
+
};
|
|
588
|
+
if (o) return {
|
|
589
|
+
secondaryLabel: `已取消 ${Et(o)}`,
|
|
590
|
+
statusLabel: "已取消",
|
|
591
|
+
tone: "cancelled"
|
|
592
|
+
};
|
|
593
|
+
if (s) return {
|
|
594
|
+
secondaryLabel: `已完成 ${Et(s)}`,
|
|
595
|
+
statusLabel: "已完成",
|
|
596
|
+
tone: "completed"
|
|
597
|
+
};
|
|
598
|
+
if (l) return {
|
|
599
|
+
secondaryLabel: `token ${l.id}`,
|
|
600
|
+
statusLabel: "執行中",
|
|
601
|
+
tone: "current"
|
|
602
|
+
};
|
|
603
|
+
if (u) return {
|
|
604
|
+
secondaryLabel: `token ${u.id}`,
|
|
605
|
+
statusLabel: "等待前置",
|
|
606
|
+
tone: "waiting"
|
|
607
|
+
};
|
|
608
|
+
if (e.type === "startEvent") return {
|
|
609
|
+
secondaryLabel: "流程已發起",
|
|
610
|
+
statusLabel: "已發起",
|
|
611
|
+
tone: "completed"
|
|
612
|
+
};
|
|
613
|
+
let d = e.type === "endEvent" ? an[r] : void 0;
|
|
614
|
+
return d ? {
|
|
615
|
+
...d,
|
|
616
|
+
secondaryLabel: r
|
|
617
|
+
} : {
|
|
618
|
+
secondaryLabel: wt(e.type),
|
|
619
|
+
statusLabel: "未抵達",
|
|
620
|
+
tone: "neutral"
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/views/instances/detail/sections/container-helpers.ts
|
|
625
|
+
async function sn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
|
|
626
|
+
let i = [...new Set([
|
|
627
|
+
n?.initiatorMemberId ?? null,
|
|
628
|
+
n?.submittedByMemberId ?? null,
|
|
629
|
+
...e.map((e) => e.actorMemberId),
|
|
630
|
+
...e.flatMap(Q),
|
|
631
|
+
...r.map((e) => e.assigneeMemberId),
|
|
632
|
+
...r.map((e) => e.originalAssigneeMemberId),
|
|
633
|
+
...r.flatMap((e) => e.candidateMemberIds),
|
|
634
|
+
...r.flatMap((e) => _t(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
|
|
635
|
+
...t.flatMap((e) => [e.createdByMemberId, ...cn(e.targetValueJson)])
|
|
636
|
+
].filter(H))];
|
|
637
|
+
try {
|
|
638
|
+
return await Ne(i);
|
|
639
|
+
} catch {
|
|
640
|
+
return [];
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function cn(e) {
|
|
644
|
+
try {
|
|
645
|
+
return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
|
|
646
|
+
} catch {
|
|
647
|
+
return [];
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
async function ln(e) {
|
|
651
|
+
return (await Promise.all(e.map((e) => O(e.id)))).flat();
|
|
652
|
+
}
|
|
653
|
+
function un(e) {
|
|
654
|
+
return e.reduce((e, t) => {
|
|
655
|
+
let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
|
|
656
|
+
return new Map(e).set(t.taskId, r);
|
|
657
|
+
}, /* @__PURE__ */ new Map());
|
|
658
|
+
}
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region src/views/instances/detail/sections/InstanceFormSection.tsx
|
|
661
|
+
var dn = {
|
|
662
|
+
display: "grid",
|
|
663
|
+
gap: 16
|
|
664
|
+
}, $ = {
|
|
665
|
+
display: "flex",
|
|
666
|
+
flexWrap: "wrap",
|
|
667
|
+
gap: 8
|
|
668
|
+
};
|
|
669
|
+
function fn({ canResubmitInstance: e, deciding: t, error: n, fieldAccess: r, fieldLabelMarkers: i, fill: a = null, instance: o, loading: s, onDataSourceStateChange: c, onResubmitFormChange: l, onReloadAfterConflict: d = null, onResubmitInstance: f, onUploadAttachment: p, resubmitFormData: ee, resubmitFormErrors: te }) {
|
|
670
|
+
let m = o?.formDefinitionSnapshot.schema, h = o?.workflowSnapshot, re = _(() => e && m && h ? u(m, h) : a?.schema ?? m, [
|
|
671
|
+
e,
|
|
672
|
+
a?.schema,
|
|
673
|
+
m,
|
|
674
|
+
h
|
|
675
|
+
]), g = !e && a !== null;
|
|
676
|
+
return /* @__PURE__ */ D("div", {
|
|
677
|
+
style: dn,
|
|
678
|
+
children: [
|
|
679
|
+
n ? /* @__PURE__ */ E(w, {
|
|
680
|
+
color: "text-error",
|
|
681
|
+
variant: "body",
|
|
682
|
+
children: n
|
|
683
|
+
}) : null,
|
|
684
|
+
s ? /* @__PURE__ */ E(w, {
|
|
685
|
+
color: "text-neutral",
|
|
686
|
+
variant: "body",
|
|
687
|
+
children: "載入中..."
|
|
688
|
+
}) : null,
|
|
689
|
+
d ? /* @__PURE__ */ D("div", {
|
|
690
|
+
style: dn,
|
|
691
|
+
children: [/* @__PURE__ */ E(x, {
|
|
692
|
+
content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
|
|
693
|
+
severity: "error"
|
|
694
|
+
}), /* @__PURE__ */ E("div", {
|
|
695
|
+
style: $,
|
|
696
|
+
children: /* @__PURE__ */ E(y, {
|
|
697
|
+
disabled: s,
|
|
698
|
+
icon: Ke,
|
|
699
|
+
iconType: "leading",
|
|
700
|
+
onClick: d,
|
|
701
|
+
variant: "base-secondary",
|
|
702
|
+
children: "重新載入"
|
|
703
|
+
})
|
|
704
|
+
})]
|
|
705
|
+
}) : null,
|
|
706
|
+
g && a.fieldCount > 0 ? /* @__PURE__ */ E(x, {
|
|
707
|
+
content: `本關需要你補填 ${a.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
|
|
708
|
+
severity: "info"
|
|
709
|
+
}) : null,
|
|
710
|
+
re && o?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(ne, {
|
|
711
|
+
dataSourceContext: e ? {
|
|
712
|
+
instanceId: o.id,
|
|
713
|
+
kind: "runtime"
|
|
714
|
+
} : void 0,
|
|
715
|
+
dataSourceInitialValues: o.formData,
|
|
716
|
+
errors: g ? a.errors : te,
|
|
717
|
+
...!e && r ? { fieldAccess: r } : {},
|
|
718
|
+
...!e && i ? { fieldLabelMarkers: i } : {},
|
|
719
|
+
onChange: (e) => {
|
|
720
|
+
g ? a.onChange(e) : l(e);
|
|
721
|
+
},
|
|
722
|
+
onDataSourceStateChange: c,
|
|
723
|
+
onUploadAttachment: e ? p : void 0,
|
|
724
|
+
optionSnapshots: o.formDataOptionSnapshot,
|
|
725
|
+
readonly: !e,
|
|
726
|
+
schema: re,
|
|
727
|
+
uiSchema: o.formDefinitionSnapshot.uiSchema,
|
|
728
|
+
value: e ? ee : g ? a.value : o.formData
|
|
729
|
+
}), e ? /* @__PURE__ */ E("div", {
|
|
730
|
+
style: $,
|
|
731
|
+
children: /* @__PURE__ */ E(y, {
|
|
732
|
+
disabled: t,
|
|
733
|
+
icon: Ke,
|
|
734
|
+
iconType: "leading",
|
|
735
|
+
onClick: f,
|
|
736
|
+
variant: "base-primary",
|
|
737
|
+
children: "重新送出"
|
|
738
|
+
})
|
|
739
|
+
}) : null] }) : /* @__PURE__ */ E(w, {
|
|
740
|
+
color: "text-neutral",
|
|
741
|
+
variant: "body",
|
|
742
|
+
children: "此案件沒有可顯示的表單快照。"
|
|
743
|
+
})
|
|
744
|
+
]
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
|
|
749
|
+
var pn = {
|
|
750
|
+
display: "grid",
|
|
751
|
+
gap: 16
|
|
752
|
+
};
|
|
753
|
+
function mn({ attachments: e, onDownload: n, onPreview: r }) {
|
|
754
|
+
let i = _(() => e.map((e) => ({
|
|
755
|
+
attachment: e,
|
|
756
|
+
createdAt: e.createdAt,
|
|
757
|
+
filename: e.filename,
|
|
758
|
+
id: e.id,
|
|
759
|
+
key: e.id,
|
|
760
|
+
mimeType: e.mimeType,
|
|
761
|
+
sizeLabel: xt(Number(e.sizeBytes))
|
|
762
|
+
})), [e]), a = _(() => [
|
|
763
|
+
{
|
|
764
|
+
dataIndex: "filename",
|
|
765
|
+
key: "filename",
|
|
766
|
+
title: "檔名",
|
|
767
|
+
width: 260
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
dataIndex: "mimeType",
|
|
771
|
+
key: "mimeType",
|
|
772
|
+
title: "類型",
|
|
773
|
+
width: 180
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
dataIndex: "sizeLabel",
|
|
777
|
+
key: "sizeLabel",
|
|
778
|
+
title: "大小",
|
|
779
|
+
width: 120
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
key: "createdAt",
|
|
783
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
784
|
+
component: "span",
|
|
785
|
+
variant: "body",
|
|
786
|
+
children: t(e.createdAt)
|
|
787
|
+
}),
|
|
788
|
+
title: "上傳時間",
|
|
789
|
+
width: 220
|
|
790
|
+
}
|
|
791
|
+
], []), o = _(() => ({
|
|
792
|
+
render: (e) => [...e.mimeType === "application/pdf" ? [{
|
|
793
|
+
icon: Ue,
|
|
794
|
+
iconType: "leading",
|
|
795
|
+
name: "預覽",
|
|
796
|
+
onClick: () => {
|
|
797
|
+
r(e.attachment);
|
|
798
|
+
}
|
|
799
|
+
}] : [], {
|
|
800
|
+
icon: He,
|
|
801
|
+
iconType: "leading",
|
|
802
|
+
name: "下載",
|
|
803
|
+
onClick: () => {
|
|
804
|
+
n(e.attachment);
|
|
805
|
+
}
|
|
806
|
+
}],
|
|
807
|
+
variant: "base-secondary",
|
|
808
|
+
width: 160
|
|
809
|
+
}), [n, r]);
|
|
810
|
+
return /* @__PURE__ */ D("div", {
|
|
811
|
+
style: pn,
|
|
812
|
+
children: [/* @__PURE__ */ E(w, {
|
|
813
|
+
component: "h2",
|
|
814
|
+
variant: "h3",
|
|
815
|
+
children: "附件"
|
|
816
|
+
}), i.length > 0 ? /* @__PURE__ */ E(ge, {
|
|
817
|
+
actions: o,
|
|
818
|
+
columns: a,
|
|
819
|
+
dataSource: i,
|
|
820
|
+
fullWidth: !0
|
|
821
|
+
}) : /* @__PURE__ */ E(w, {
|
|
822
|
+
color: "text-neutral",
|
|
823
|
+
variant: "body",
|
|
824
|
+
children: "此案件沒有附件。"
|
|
825
|
+
})]
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/views/instances/detail/sections/InstanceTasksSection.tsx
|
|
830
|
+
var hn = {
|
|
831
|
+
display: "grid",
|
|
832
|
+
gap: 12,
|
|
833
|
+
width: "100%"
|
|
834
|
+
}, gn = {
|
|
835
|
+
minWidth: "100%",
|
|
836
|
+
width: "100%"
|
|
837
|
+
}, _n = {
|
|
838
|
+
display: "grid",
|
|
839
|
+
gap: 12,
|
|
840
|
+
width: "100%"
|
|
841
|
+
}, vn = { marginTop: 12 }, yn = { marginTop: 24 };
|
|
842
|
+
function bn(e) {
|
|
843
|
+
e && (e.style.width = "100%");
|
|
844
|
+
}
|
|
845
|
+
var xn = {
|
|
846
|
+
COMPLETION_NOTIFY: "結案通知",
|
|
847
|
+
COUNTERSIGN: "臨時會簽",
|
|
848
|
+
PRE_APPROVAL: "臨時加簽",
|
|
849
|
+
STAGE_NOTIFY: "階段完成通知"
|
|
850
|
+
}, Sn = {
|
|
851
|
+
COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
|
|
852
|
+
COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
|
|
853
|
+
PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
|
|
854
|
+
STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
|
|
855
|
+
}, Cn = [{
|
|
856
|
+
id: "REJECT_INSTANCE",
|
|
857
|
+
name: "加簽拒絕時整單駁回"
|
|
858
|
+
}, {
|
|
859
|
+
id: "RETURN_TO_ORIGIN",
|
|
860
|
+
name: "加簽拒絕時退回給我重新處理"
|
|
861
|
+
}], wn = [{
|
|
862
|
+
id: "MEMBER",
|
|
863
|
+
name: "指定成員"
|
|
864
|
+
}, {
|
|
865
|
+
id: "WEBHOOK",
|
|
866
|
+
name: "Webhook"
|
|
867
|
+
}], Tn = re(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onDecidingChange: l, onFillApproveError: u, tasks: d }, f) {
|
|
868
|
+
let [p, ee] = v(!1), [te, m] = v(null);
|
|
869
|
+
ie(() => {
|
|
870
|
+
l?.(p);
|
|
871
|
+
}, [p, l]);
|
|
872
|
+
let [ne, h] = v(""), [re, g] = v(!1), [oe, x] = v(""), [de, fe] = v(null), [pe, me] = v(!1), [he, ve] = v(""), [be, we] = v(!1), [Te, O] = v(null), [Ee, De] = v(""), [Oe, ke] = v(null), [Ae, Ne] = v(!1), [Pe, Fe] = v([]), [Ie, Le] = v(!1), [Re, ze] = v(""), [Be, Ve] = v([]), [He, Ue] = v(!1), [We, Ge] = v([]), [Ke, qe] = v(!1), [A, Je] = v("COUNTERSIGN"), [Ye, j] = v("REJECT_INSTANCE"), [M, Xe] = v(!1), [Ze, Qe] = v("MEMBER"), [$e, et] = v(""), N = oe.trim(), tt = he.trim(), nt = Ee.trim(), P = _(() => Ot(d, r), [r, d]), F = _(() => P && o ? o.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, o]), I = _(() => F && o ? kt(o.workflowSnapshot, F) : [], [F, o]), rt = F?.type === "userTask" && F.data.returnBehavior.allowReturn, L = F?.type === "userTask" && F.data.allowReject !== !1, it = F?.type === "userTask" && F.data.allowTransfer !== !1, at = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, R = F?.type === "userTask" && F.data.allowAddSigner, z = _(() => e.filter((e) => e.status === "PENDING"), [e]), ot = I.find((e) => e.id === Te) ?? I[0] ?? null, st = _(() => d.map((e) => ({
|
|
873
|
+
...e,
|
|
874
|
+
assigneeLabel: Et(e, s),
|
|
875
|
+
fillFieldCount: Dn(e, o?.workflowSnapshot ?? null),
|
|
876
|
+
key: e.id,
|
|
877
|
+
nodeLabel: a({
|
|
878
|
+
...e,
|
|
879
|
+
nodeLabel: Tt(e.nodeId, o?.workflowSnapshot ?? null)
|
|
880
|
+
}),
|
|
881
|
+
statusLabel: G(e.status)
|
|
882
|
+
})), [
|
|
883
|
+
o,
|
|
884
|
+
s,
|
|
885
|
+
d
|
|
886
|
+
]), ct = _(() => [
|
|
887
|
+
{
|
|
888
|
+
dataIndex: "nodeLabel",
|
|
889
|
+
key: "nodeLabel",
|
|
890
|
+
title: "節點",
|
|
891
|
+
width: 180
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
key: "assigneeMemberId",
|
|
895
|
+
title: "處理者",
|
|
896
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
897
|
+
component: "span",
|
|
898
|
+
variant: "body",
|
|
899
|
+
children: e.assigneeLabel
|
|
900
|
+
}),
|
|
901
|
+
width: 180
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
dataIndex: "statusLabel",
|
|
905
|
+
key: "statusLabel",
|
|
906
|
+
title: "狀態",
|
|
907
|
+
width: 120
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
key: "fill",
|
|
911
|
+
render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ E(ce, {
|
|
912
|
+
size: "sub",
|
|
913
|
+
text: `需補填 ${e.fillFieldCount} 欄`,
|
|
914
|
+
variant: "dot-warning"
|
|
915
|
+
}) : null,
|
|
916
|
+
title: "補填",
|
|
917
|
+
width: 140
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
key: "createdAt",
|
|
921
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
922
|
+
component: "span",
|
|
923
|
+
variant: "body",
|
|
924
|
+
children: t(e.createdAt)
|
|
925
|
+
}),
|
|
926
|
+
title: "建立時間",
|
|
927
|
+
width: 220
|
|
928
|
+
}
|
|
929
|
+
], []), lt = _(() => z.map((e) => ({
|
|
930
|
+
...e,
|
|
931
|
+
createdByLabel: q(e.createdByMemberId, s),
|
|
932
|
+
key: e.id,
|
|
933
|
+
targetLabel: En(e, s),
|
|
934
|
+
typeLabel: xn[e.type]
|
|
935
|
+
})), [s, z]), ut = _(() => [
|
|
936
|
+
{
|
|
937
|
+
dataIndex: "typeLabel",
|
|
938
|
+
key: "typeLabel",
|
|
939
|
+
title: "類型",
|
|
940
|
+
width: 180
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
key: "targetLabel",
|
|
944
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
945
|
+
component: "span",
|
|
946
|
+
variant: "body",
|
|
947
|
+
children: e.targetLabel
|
|
948
|
+
}),
|
|
949
|
+
title: "對象",
|
|
950
|
+
width: 220
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
key: "createdByLabel",
|
|
954
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
955
|
+
component: "span",
|
|
956
|
+
variant: "body",
|
|
957
|
+
children: e.createdByLabel
|
|
958
|
+
}),
|
|
959
|
+
title: "設定者",
|
|
960
|
+
width: 180
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
key: "createdAt",
|
|
964
|
+
render: (e) => /* @__PURE__ */ E(w, {
|
|
965
|
+
component: "span",
|
|
966
|
+
variant: "body",
|
|
967
|
+
children: t(e.createdAt)
|
|
968
|
+
}),
|
|
969
|
+
title: "建立時間",
|
|
970
|
+
width: 220
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
key: "actions",
|
|
974
|
+
render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ E(y, {
|
|
975
|
+
disabled: M,
|
|
976
|
+
onClick: () => void Dt(e.id),
|
|
977
|
+
size: "minor",
|
|
978
|
+
variant: "destructive-secondary",
|
|
979
|
+
children: "撤回"
|
|
980
|
+
}) : /* @__PURE__ */ E(T, {}),
|
|
981
|
+
title: "操作",
|
|
982
|
+
width: 100
|
|
983
|
+
}
|
|
984
|
+
], [M, r]);
|
|
985
|
+
async function dt({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
|
|
986
|
+
if (!r || !P || e === "REJECTED" && !L || e === "TRANSFERRED" && !it) return !1;
|
|
987
|
+
ee(!0), m(null);
|
|
988
|
+
let o = e === "APPROVED" && i !== null && !P.isAdhoc ? {
|
|
989
|
+
expectedFormDataFingerprint: i.expectedFormDataFingerprint,
|
|
990
|
+
formData: i.formData
|
|
991
|
+
} : null;
|
|
992
|
+
try {
|
|
993
|
+
await Ce({
|
|
994
|
+
action: e,
|
|
995
|
+
comment: t,
|
|
996
|
+
decidedByMemberId: r,
|
|
997
|
+
fill: o,
|
|
998
|
+
returnToNodeId: n,
|
|
999
|
+
taskId: P.id,
|
|
1000
|
+
transferToMemberId: a
|
|
1001
|
+
}), me(!1), we(!1), Le(!1), x(""), ve(""), De(""), ke(null), O(null), fe(null);
|
|
1002
|
+
} catch (e) {
|
|
1003
|
+
return ee(!1), o !== null && e instanceof Error && u?.(e.message) === !0 ? (g(!1), !1) : (m(W(e)), !1);
|
|
1004
|
+
}
|
|
1005
|
+
try {
|
|
1006
|
+
await c();
|
|
1007
|
+
} catch (e) {
|
|
1008
|
+
m(W(e));
|
|
1009
|
+
} finally {
|
|
1010
|
+
ee(!1);
|
|
1011
|
+
}
|
|
1012
|
+
return !0;
|
|
1013
|
+
}
|
|
1014
|
+
function ft() {
|
|
1015
|
+
r && P && (m(null), g(!0));
|
|
1016
|
+
}
|
|
1017
|
+
function pt() {
|
|
1018
|
+
p || (g(!1), h(""));
|
|
1019
|
+
}
|
|
1020
|
+
async function B() {
|
|
1021
|
+
p || await dt({
|
|
1022
|
+
action: "APPROVED",
|
|
1023
|
+
comment: ne.trim() || null
|
|
1024
|
+
}) && (g(!1), h(""));
|
|
1025
|
+
}
|
|
1026
|
+
function mt() {
|
|
1027
|
+
L && (x(""), fe(null), me(!0));
|
|
1028
|
+
}
|
|
1029
|
+
function ht() {
|
|
1030
|
+
p || (me(!1), x(""), fe(null));
|
|
1031
|
+
}
|
|
1032
|
+
function gt() {
|
|
1033
|
+
ve(""), O(I[0]?.id ?? null), we(!0);
|
|
1034
|
+
}
|
|
1035
|
+
function _t() {
|
|
1036
|
+
p || (we(!1), ve(""), O(null));
|
|
1037
|
+
}
|
|
1038
|
+
function V() {
|
|
1039
|
+
it && (De(""), ke(null), Le(!0), yt(""));
|
|
1040
|
+
}
|
|
1041
|
+
function vt() {
|
|
1042
|
+
p || (Le(!1), De(""), ke(null));
|
|
1043
|
+
}
|
|
1044
|
+
async function yt(e) {
|
|
1045
|
+
Ne(!0);
|
|
1046
|
+
try {
|
|
1047
|
+
Fe((await k(e)).filter((e) => e.memberId !== r).map(At));
|
|
1048
|
+
} catch (e) {
|
|
1049
|
+
m(W(e));
|
|
1050
|
+
} finally {
|
|
1051
|
+
Ne(!1);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
async function H() {
|
|
1055
|
+
L && (N ? await dt({
|
|
1056
|
+
action: "REJECTED",
|
|
1057
|
+
comment: N
|
|
1058
|
+
}) : fe("請輸入拒絕原因"));
|
|
1059
|
+
}
|
|
1060
|
+
async function U() {
|
|
1061
|
+
it && (Oe ? await dt({
|
|
1062
|
+
action: "TRANSFERRED",
|
|
1063
|
+
comment: nt || null,
|
|
1064
|
+
transferToMemberId: Oe.id
|
|
1065
|
+
}) : m("請選擇轉派對象"));
|
|
1066
|
+
}
|
|
1067
|
+
async function bt() {
|
|
1068
|
+
await dt({
|
|
1069
|
+
action: "RETURNED",
|
|
1070
|
+
comment: tt || null,
|
|
1071
|
+
returnToNodeId: ot?.id ?? null
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function xt() {
|
|
1075
|
+
ze(""), Ve([]), j("REJECT_INSTANCE"), Qe("MEMBER"), et("");
|
|
1076
|
+
}
|
|
1077
|
+
function St(e) {
|
|
1078
|
+
Je(e), xt(), qe(!0), K("");
|
|
1079
|
+
}
|
|
1080
|
+
function Ct() {
|
|
1081
|
+
M || (qe(!1), xt());
|
|
1082
|
+
}
|
|
1083
|
+
async function K(e) {
|
|
1084
|
+
Ue(!0);
|
|
1085
|
+
try {
|
|
1086
|
+
Ge((await k(e)).map(At));
|
|
1087
|
+
} catch (e) {
|
|
1088
|
+
m(W(e));
|
|
1089
|
+
} finally {
|
|
1090
|
+
Ue(!1);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
async function wt() {
|
|
1094
|
+
if (!P) return;
|
|
1095
|
+
let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && Ze === "WEBHOOK", t = jt({
|
|
1096
|
+
memberIds: Be.map((e) => e.id),
|
|
1097
|
+
useWebhookTarget: e,
|
|
1098
|
+
webhookUrl: $e
|
|
1099
|
+
});
|
|
1100
|
+
if (!t.valid) {
|
|
1101
|
+
m(t.error);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
let { target: n } = t, r = Re.trim() || null;
|
|
1105
|
+
Xe(!0), m(null);
|
|
1106
|
+
try {
|
|
1107
|
+
A === "COUNTERSIGN" ? await je({
|
|
1108
|
+
comment: r,
|
|
1109
|
+
target: n,
|
|
1110
|
+
taskId: P.id
|
|
1111
|
+
}) : A === "PRE_APPROVAL" ? await Me({
|
|
1112
|
+
comment: r,
|
|
1113
|
+
onReject: Ye,
|
|
1114
|
+
target: n,
|
|
1115
|
+
taskId: P.id
|
|
1116
|
+
}) : A === "STAGE_NOTIFY" ? await Se({
|
|
1117
|
+
target: n,
|
|
1118
|
+
taskId: P.id
|
|
1119
|
+
}) : await xe({
|
|
1120
|
+
target: n,
|
|
1121
|
+
taskId: P.id
|
|
1122
|
+
}), qe(!1), xt(), await c();
|
|
1123
|
+
} catch (e) {
|
|
1124
|
+
m(W(e));
|
|
1125
|
+
} finally {
|
|
1126
|
+
Xe(!1);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
async function Dt(e) {
|
|
1130
|
+
Xe(!0), m(null);
|
|
1131
|
+
try {
|
|
1132
|
+
await ye(e), await c();
|
|
1133
|
+
} catch (e) {
|
|
1134
|
+
m(W(e));
|
|
1135
|
+
} finally {
|
|
1136
|
+
Xe(!1);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
ae(f, () => ({
|
|
1140
|
+
canAddSignerCurrentTask: R,
|
|
1141
|
+
canRejectCurrentTask: L,
|
|
1142
|
+
canReturnCurrentTask: rt,
|
|
1143
|
+
canTransferCurrentTask: it,
|
|
1144
|
+
deciding: p,
|
|
1145
|
+
handleApprove: ft,
|
|
1146
|
+
hasCurrentTask: P !== null,
|
|
1147
|
+
openAdhocModal: St,
|
|
1148
|
+
openRejectModal: mt,
|
|
1149
|
+
openReturnModal: gt,
|
|
1150
|
+
openTransferModal: V
|
|
1151
|
+
}), [
|
|
1152
|
+
R,
|
|
1153
|
+
L,
|
|
1154
|
+
rt,
|
|
1155
|
+
it,
|
|
1156
|
+
r,
|
|
1157
|
+
P,
|
|
1158
|
+
p
|
|
1159
|
+
]);
|
|
1160
|
+
let Y = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", Pt = Y && Ze === "WEBHOOK" ? !$e.trim() : Be.length === 0, Ft = Cn.find((e) => e.id === Ye) ?? Cn[0], It = wn.find((e) => e.id === Ze) ?? wn[0];
|
|
1161
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
1162
|
+
/* @__PURE__ */ E(w, {
|
|
1163
|
+
component: "h2",
|
|
1164
|
+
variant: "h3",
|
|
1165
|
+
children: "任務"
|
|
1166
|
+
}),
|
|
1167
|
+
te ? /* @__PURE__ */ E(w, {
|
|
1168
|
+
color: "text-error",
|
|
1169
|
+
variant: "body",
|
|
1170
|
+
children: te
|
|
1171
|
+
}) : null,
|
|
1172
|
+
/* @__PURE__ */ E("div", {
|
|
1173
|
+
style: vn,
|
|
1174
|
+
children: /* @__PURE__ */ E(ge, {
|
|
1175
|
+
columns: ct,
|
|
1176
|
+
dataSource: st,
|
|
1177
|
+
fullWidth: !0
|
|
1178
|
+
})
|
|
1179
|
+
}),
|
|
1180
|
+
z.length > 0 ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(w, {
|
|
1181
|
+
component: "h3",
|
|
1182
|
+
style: yn,
|
|
1183
|
+
variant: "h3",
|
|
1184
|
+
children: "待生效的臨時設定"
|
|
1185
|
+
}), /* @__PURE__ */ E("div", {
|
|
1186
|
+
style: vn,
|
|
1187
|
+
children: /* @__PURE__ */ E(ge, {
|
|
1188
|
+
columns: ut,
|
|
1189
|
+
dataSource: lt,
|
|
1190
|
+
fullWidth: !0
|
|
1191
|
+
})
|
|
1192
|
+
})] }) : null,
|
|
1193
|
+
/* @__PURE__ */ D(S, {
|
|
1194
|
+
cancelText: "取消",
|
|
1195
|
+
confirmText: "送出同意",
|
|
1196
|
+
loading: p,
|
|
1197
|
+
modalType: "standard",
|
|
1198
|
+
onCancel: pt,
|
|
1199
|
+
onClose: pt,
|
|
1200
|
+
onConfirm: () => void B(),
|
|
1201
|
+
open: re,
|
|
1202
|
+
showModalFooter: !0,
|
|
1203
|
+
showModalHeader: !0,
|
|
1204
|
+
size: "regular",
|
|
1205
|
+
supportingText: "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
|
|
1206
|
+
title: "簽核意見",
|
|
1207
|
+
children: [
|
|
1208
|
+
te ? /* @__PURE__ */ E(w, {
|
|
1209
|
+
color: "text-error",
|
|
1210
|
+
role: "alert",
|
|
1211
|
+
variant: "body",
|
|
1212
|
+
children: te
|
|
1213
|
+
}) : null,
|
|
1214
|
+
i !== null && i.summary.length > 0 ? /* @__PURE__ */ D("div", {
|
|
1215
|
+
style: hn,
|
|
1216
|
+
children: [/* @__PURE__ */ E(w, {
|
|
1217
|
+
variant: "body",
|
|
1218
|
+
children: "將一併送出的補填欄位:"
|
|
1219
|
+
}), i.summary.map((e) => /* @__PURE__ */ E(b, {
|
|
1220
|
+
title: e.label,
|
|
1221
|
+
children: /* @__PURE__ */ E(le, { children: e.text })
|
|
1222
|
+
}, e.fieldKey))]
|
|
1223
|
+
}) : null,
|
|
1224
|
+
/* @__PURE__ */ E("div", {
|
|
1225
|
+
style: hn,
|
|
1226
|
+
children: /* @__PURE__ */ E(n, {
|
|
1227
|
+
label: "簽核意見",
|
|
1228
|
+
name: "approveComment",
|
|
1229
|
+
children: /* @__PURE__ */ E(_e, {
|
|
1230
|
+
autoFocus: !0,
|
|
1231
|
+
onChange: (e) => h(e.target.value),
|
|
1232
|
+
placeholder: "選填,例如補充核准的條件或提醒事項",
|
|
1233
|
+
ref: bn,
|
|
1234
|
+
resize: "vertical",
|
|
1235
|
+
rows: 4,
|
|
1236
|
+
style: gn,
|
|
1237
|
+
value: ne
|
|
1238
|
+
})
|
|
1239
|
+
})
|
|
1240
|
+
})
|
|
1241
|
+
]
|
|
1242
|
+
}),
|
|
1243
|
+
/* @__PURE__ */ E(S, {
|
|
1244
|
+
cancelText: "取消",
|
|
1245
|
+
confirmButtonProps: {
|
|
1246
|
+
disabled: !N,
|
|
1247
|
+
variant: "destructive-primary"
|
|
1248
|
+
},
|
|
1249
|
+
confirmText: "送出拒絕",
|
|
1250
|
+
loading: p,
|
|
1251
|
+
modalStatusType: "error",
|
|
1252
|
+
modalType: "standard",
|
|
1253
|
+
onCancel: ht,
|
|
1254
|
+
onClose: ht,
|
|
1255
|
+
onConfirm: () => void H(),
|
|
1256
|
+
open: pe,
|
|
1257
|
+
showModalFooter: !0,
|
|
1258
|
+
showModalHeader: !0,
|
|
1259
|
+
size: "regular",
|
|
1260
|
+
supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
|
|
1261
|
+
title: "拒絕原因",
|
|
1262
|
+
children: /* @__PURE__ */ D("div", {
|
|
1263
|
+
style: hn,
|
|
1264
|
+
children: [/* @__PURE__ */ E(n, {
|
|
1265
|
+
label: "拒絕原因",
|
|
1266
|
+
name: "rejectReason",
|
|
1267
|
+
required: !0,
|
|
1268
|
+
children: /* @__PURE__ */ E(_e, {
|
|
1269
|
+
autoFocus: !0,
|
|
1270
|
+
onChange: (e) => {
|
|
1271
|
+
x(e.target.value), fe(null);
|
|
1272
|
+
},
|
|
1273
|
+
placeholder: "請說明拒絕原因",
|
|
1274
|
+
ref: bn,
|
|
1275
|
+
resize: "vertical",
|
|
1276
|
+
rows: 4,
|
|
1277
|
+
style: gn,
|
|
1278
|
+
type: de ? "error" : "default",
|
|
1279
|
+
value: oe
|
|
1280
|
+
})
|
|
1281
|
+
}), de ? /* @__PURE__ */ E(w, {
|
|
1282
|
+
color: "text-error",
|
|
1283
|
+
variant: "body",
|
|
1284
|
+
children: de
|
|
1285
|
+
}) : null]
|
|
1286
|
+
})
|
|
1287
|
+
}),
|
|
1288
|
+
/* @__PURE__ */ E(S, {
|
|
1289
|
+
cancelText: "取消",
|
|
1290
|
+
confirmButtonProps: { disabled: !Oe },
|
|
1291
|
+
confirmText: "送出轉派",
|
|
1292
|
+
loading: p,
|
|
1293
|
+
modalType: "standard",
|
|
1294
|
+
onCancel: vt,
|
|
1295
|
+
onClose: vt,
|
|
1296
|
+
onConfirm: () => void U(),
|
|
1297
|
+
open: Ie,
|
|
1298
|
+
showModalFooter: !0,
|
|
1299
|
+
showModalHeader: !0,
|
|
1300
|
+
size: "regular",
|
|
1301
|
+
supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
|
|
1302
|
+
title: "轉派簽核",
|
|
1303
|
+
children: /* @__PURE__ */ D("div", {
|
|
1304
|
+
style: _n,
|
|
1305
|
+
children: [/* @__PURE__ */ E(n, {
|
|
1306
|
+
label: "轉派對象",
|
|
1307
|
+
name: "transferToMemberId",
|
|
1308
|
+
required: !0,
|
|
1309
|
+
children: /* @__PURE__ */ E(se, {
|
|
1310
|
+
asyncData: !0,
|
|
1311
|
+
disabledOptionsFilter: !0,
|
|
1312
|
+
emptyText: "沒有符合的成員",
|
|
1313
|
+
inputProps: {
|
|
1314
|
+
autoCapitalize: "none",
|
|
1315
|
+
autoCorrect: "off",
|
|
1316
|
+
name: "transfer-member-search",
|
|
1317
|
+
spellCheck: !1
|
|
1318
|
+
},
|
|
1319
|
+
loading: Ae,
|
|
1320
|
+
loadingText: "搜尋成員中...",
|
|
1321
|
+
mode: "single",
|
|
1322
|
+
onChange: (e) => ke(Mt(e)),
|
|
1323
|
+
onSearch: yt,
|
|
1324
|
+
onSearchTextChange: (e) => ke(Nt(e, Pe)),
|
|
1325
|
+
onVisibilityChange: (e) => {
|
|
1326
|
+
e && yt("");
|
|
1327
|
+
},
|
|
1328
|
+
options: [...Pe],
|
|
1329
|
+
placeholder: "搜尋姓名或信箱",
|
|
1330
|
+
searchDebounceTime: 300,
|
|
1331
|
+
value: Oe
|
|
1332
|
+
})
|
|
1333
|
+
}), /* @__PURE__ */ E(n, {
|
|
1334
|
+
label: "轉派說明",
|
|
1335
|
+
name: "transferComment",
|
|
1336
|
+
children: /* @__PURE__ */ E(_e, {
|
|
1337
|
+
onChange: (e) => De(e.target.value),
|
|
1338
|
+
placeholder: "可補充轉派原因",
|
|
1339
|
+
ref: bn,
|
|
1340
|
+
resize: "vertical",
|
|
1341
|
+
rows: 4,
|
|
1342
|
+
style: gn,
|
|
1343
|
+
value: Ee
|
|
1344
|
+
})
|
|
1345
|
+
})]
|
|
1346
|
+
})
|
|
1347
|
+
}),
|
|
1348
|
+
/* @__PURE__ */ E(S, {
|
|
1349
|
+
cancelText: "取消",
|
|
1350
|
+
confirmButtonProps: { disabled: !ot || at && !tt },
|
|
1351
|
+
confirmText: "送出退回",
|
|
1352
|
+
loading: p,
|
|
1353
|
+
modalType: "standard",
|
|
1354
|
+
onCancel: _t,
|
|
1355
|
+
onClose: _t,
|
|
1356
|
+
onConfirm: () => void bt(),
|
|
1357
|
+
open: be,
|
|
1358
|
+
showModalFooter: !0,
|
|
1359
|
+
showModalHeader: !0,
|
|
1360
|
+
size: "regular",
|
|
1361
|
+
supportingText: "退回後,流程會回到指定節點並等待重新處理。",
|
|
1362
|
+
title: "退回簽核",
|
|
1363
|
+
children: /* @__PURE__ */ D("div", {
|
|
1364
|
+
style: _n,
|
|
1365
|
+
children: [/* @__PURE__ */ E(n, {
|
|
1366
|
+
label: "退回節點",
|
|
1367
|
+
name: "returnTargetNodeId",
|
|
1368
|
+
required: !0,
|
|
1369
|
+
children: /* @__PURE__ */ E(C, {
|
|
1370
|
+
clearable: !1,
|
|
1371
|
+
fullWidth: !0,
|
|
1372
|
+
onChange: (e) => O(e?.id ?? null),
|
|
1373
|
+
options: [...I],
|
|
1374
|
+
placeholder: "選擇退回節點",
|
|
1375
|
+
value: ot
|
|
1376
|
+
})
|
|
1377
|
+
}), /* @__PURE__ */ E(n, {
|
|
1378
|
+
hintText: at ? "此關卡設定退回時必須填寫意見。" : void 0,
|
|
1379
|
+
label: "退回說明",
|
|
1380
|
+
name: "returnComment",
|
|
1381
|
+
required: at,
|
|
1382
|
+
children: /* @__PURE__ */ E(_e, {
|
|
1383
|
+
onChange: (e) => ve(e.target.value),
|
|
1384
|
+
placeholder: at ? "請說明退回原因" : "可補充需要修改的內容",
|
|
1385
|
+
ref: bn,
|
|
1386
|
+
resize: "vertical",
|
|
1387
|
+
rows: 4,
|
|
1388
|
+
style: gn,
|
|
1389
|
+
value: he
|
|
1390
|
+
})
|
|
1391
|
+
})]
|
|
1392
|
+
})
|
|
1393
|
+
}),
|
|
1394
|
+
/* @__PURE__ */ E(S, {
|
|
1395
|
+
cancelText: "取消",
|
|
1396
|
+
confirmButtonProps: { disabled: Pt },
|
|
1397
|
+
confirmText: "送出",
|
|
1398
|
+
loading: M,
|
|
1399
|
+
modalType: "standard",
|
|
1400
|
+
onCancel: Ct,
|
|
1401
|
+
onClose: Ct,
|
|
1402
|
+
onConfirm: () => void wt(),
|
|
1403
|
+
open: Ke,
|
|
1404
|
+
showModalFooter: !0,
|
|
1405
|
+
showModalHeader: !0,
|
|
1406
|
+
size: "regular",
|
|
1407
|
+
supportingText: Sn[A],
|
|
1408
|
+
title: xn[A],
|
|
1409
|
+
children: /* @__PURE__ */ D("div", {
|
|
1410
|
+
style: _n,
|
|
1411
|
+
children: [
|
|
1412
|
+
Y ? /* @__PURE__ */ E(n, {
|
|
1413
|
+
label: "通知時機",
|
|
1414
|
+
name: "adhocNotifyMode",
|
|
1415
|
+
required: !0,
|
|
1416
|
+
children: /* @__PURE__ */ E(C, {
|
|
1417
|
+
clearable: !1,
|
|
1418
|
+
fullWidth: !0,
|
|
1419
|
+
onChange: (e) => Je(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
|
|
1420
|
+
options: [{
|
|
1421
|
+
id: "STAGE_NOTIFY",
|
|
1422
|
+
name: xn.STAGE_NOTIFY
|
|
1423
|
+
}, {
|
|
1424
|
+
id: "COMPLETION_NOTIFY",
|
|
1425
|
+
name: xn.COMPLETION_NOTIFY
|
|
1426
|
+
}],
|
|
1427
|
+
value: {
|
|
1428
|
+
id: A,
|
|
1429
|
+
name: xn[A]
|
|
1430
|
+
}
|
|
1431
|
+
})
|
|
1432
|
+
}) : null,
|
|
1433
|
+
Y ? /* @__PURE__ */ E(n, {
|
|
1434
|
+
label: "通知對象類型",
|
|
1435
|
+
name: "adhocTargetKind",
|
|
1436
|
+
required: !0,
|
|
1437
|
+
children: /* @__PURE__ */ E(C, {
|
|
1438
|
+
clearable: !1,
|
|
1439
|
+
fullWidth: !0,
|
|
1440
|
+
onChange: (e) => Qe(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
|
|
1441
|
+
options: [...wn],
|
|
1442
|
+
value: It
|
|
1443
|
+
})
|
|
1444
|
+
}) : null,
|
|
1445
|
+
Y && Ze === "WEBHOOK" ? /* @__PURE__ */ E(n, {
|
|
1446
|
+
label: "Webhook URL",
|
|
1447
|
+
name: "adhocWebhookUrl",
|
|
1448
|
+
required: !0,
|
|
1449
|
+
children: /* @__PURE__ */ E(ue, {
|
|
1450
|
+
fullWidth: !0,
|
|
1451
|
+
onChange: (e) => et(e.target.value),
|
|
1452
|
+
placeholder: "https://example.com/webhook",
|
|
1453
|
+
value: $e
|
|
1454
|
+
})
|
|
1455
|
+
}) : /* @__PURE__ */ E(n, {
|
|
1456
|
+
label: Y ? "通知對象" : "簽核對象",
|
|
1457
|
+
name: "adhocMemberId",
|
|
1458
|
+
required: !0,
|
|
1459
|
+
children: /* @__PURE__ */ E(se, {
|
|
1460
|
+
asyncData: !0,
|
|
1461
|
+
disabledOptionsFilter: !0,
|
|
1462
|
+
emptyText: "沒有符合的成員",
|
|
1463
|
+
inputProps: {
|
|
1464
|
+
autoCapitalize: "none",
|
|
1465
|
+
autoCorrect: "off",
|
|
1466
|
+
name: "adhoc-member-search",
|
|
1467
|
+
spellCheck: !1
|
|
1468
|
+
},
|
|
1469
|
+
loading: He,
|
|
1470
|
+
loadingText: "搜尋成員中...",
|
|
1471
|
+
menuMaxHeight: 320,
|
|
1472
|
+
mode: "multiple",
|
|
1473
|
+
onChange: (e) => Ve(e.map(Mt).filter(J)),
|
|
1474
|
+
onSearch: K,
|
|
1475
|
+
onVisibilityChange: (e) => {
|
|
1476
|
+
e && K("");
|
|
1477
|
+
},
|
|
1478
|
+
options: [...We],
|
|
1479
|
+
overflowStrategy: "wrap",
|
|
1480
|
+
placeholder: "搜尋姓名或信箱,可加入多位",
|
|
1481
|
+
searchDebounceTime: 300,
|
|
1482
|
+
value: [...Be]
|
|
1483
|
+
})
|
|
1484
|
+
}),
|
|
1485
|
+
A === "PRE_APPROVAL" ? /* @__PURE__ */ E(n, {
|
|
1486
|
+
label: "拒簽處理方式",
|
|
1487
|
+
name: "adhocOnReject",
|
|
1488
|
+
required: !0,
|
|
1489
|
+
children: /* @__PURE__ */ E(C, {
|
|
1490
|
+
clearable: !1,
|
|
1491
|
+
fullWidth: !0,
|
|
1492
|
+
onChange: (e) => j(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
|
|
1493
|
+
options: [...Cn],
|
|
1494
|
+
value: Ft
|
|
1495
|
+
})
|
|
1496
|
+
}) : null,
|
|
1497
|
+
Y ? null : /* @__PURE__ */ E(n, {
|
|
1498
|
+
label: "說明",
|
|
1499
|
+
name: "adhocComment",
|
|
1500
|
+
children: /* @__PURE__ */ E(_e, {
|
|
1501
|
+
onChange: (e) => ze(e.target.value),
|
|
1502
|
+
placeholder: "可補充原因",
|
|
1503
|
+
ref: bn,
|
|
1504
|
+
resize: "vertical",
|
|
1505
|
+
rows: 3,
|
|
1506
|
+
style: gn,
|
|
1507
|
+
value: Re
|
|
1508
|
+
})
|
|
1509
|
+
})
|
|
1510
|
+
]
|
|
1511
|
+
})
|
|
1512
|
+
})
|
|
1513
|
+
] });
|
|
1514
|
+
});
|
|
1515
|
+
function En(e, t) {
|
|
1516
|
+
try {
|
|
1517
|
+
let n = JSON.parse(e.targetValueJson);
|
|
1518
|
+
if (n.memberIds?.length) return n.memberIds.map((e) => q(e, t)).join("、");
|
|
1519
|
+
if (n.webhookUrl) return n.webhookUrl;
|
|
1520
|
+
if (n.positionId) return `職位 ${n.positionId}`;
|
|
1521
|
+
if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
|
|
1522
|
+
} catch {}
|
|
1523
|
+
return e.targetKind;
|
|
1524
|
+
}
|
|
1525
|
+
function Dn(e, t) {
|
|
1526
|
+
if (e.isAdhoc || e.status !== "PENDING" && e.status !== "IN_PROGRESS") return 0;
|
|
1527
|
+
let n = t?.nodes.find((t) => t.id === e.nodeId);
|
|
1528
|
+
return n?.type === "userTask" ? M(n).size : 0;
|
|
1529
|
+
}
|
|
1530
|
+
//#endregion
|
|
1531
|
+
//#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
|
|
1532
|
+
var On = {
|
|
1533
|
+
display: "grid",
|
|
1534
|
+
gap: 16
|
|
1535
|
+
};
|
|
1536
|
+
function kn({ signatureVerification: e, signatures: n }) {
|
|
1537
|
+
let r = _(() => n.map((e) => ({
|
|
1538
|
+
algorithm: e.algorithm,
|
|
1539
|
+
hashLabel: St(e.signedPayloadHash),
|
|
1540
|
+
key: e.id,
|
|
1541
|
+
keyVersion: e.keyVersion,
|
|
1542
|
+
signedAtLabel: t(e.signedAt),
|
|
1543
|
+
signerMemberId: e.signerMemberId
|
|
1544
|
+
})), [n]), i = _(() => [
|
|
1545
|
+
{
|
|
1546
|
+
dataIndex: "signerMemberId",
|
|
1547
|
+
key: "signerMemberId",
|
|
1548
|
+
title: "簽章者",
|
|
1549
|
+
width: 160
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
dataIndex: "algorithm",
|
|
1553
|
+
key: "algorithm",
|
|
1554
|
+
title: "演算法",
|
|
1555
|
+
width: 150
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
dataIndex: "keyVersion",
|
|
1559
|
+
key: "keyVersion",
|
|
1560
|
+
title: "Key 版本",
|
|
1561
|
+
width: 100
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
dataIndex: "hashLabel",
|
|
1565
|
+
key: "hashLabel",
|
|
1566
|
+
title: "Payload Hash",
|
|
1567
|
+
width: 180
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
dataIndex: "signedAtLabel",
|
|
1571
|
+
key: "signedAtLabel",
|
|
1572
|
+
title: "簽章時間",
|
|
1573
|
+
width: 220
|
|
1574
|
+
}
|
|
1575
|
+
], []);
|
|
1576
|
+
return /* @__PURE__ */ D("div", {
|
|
1577
|
+
style: On,
|
|
1578
|
+
children: [
|
|
1579
|
+
/* @__PURE__ */ E(w, {
|
|
1580
|
+
component: "h2",
|
|
1581
|
+
variant: "h3",
|
|
1582
|
+
children: "簽章"
|
|
1583
|
+
}),
|
|
1584
|
+
/* @__PURE__ */ E(w, {
|
|
1585
|
+
color: e?.valid ? "text-success" : "text-error",
|
|
1586
|
+
variant: "body",
|
|
1587
|
+
children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
|
|
1588
|
+
}),
|
|
1589
|
+
r.length > 0 ? /* @__PURE__ */ E(ge, {
|
|
1590
|
+
columns: i,
|
|
1591
|
+
dataSource: r,
|
|
1592
|
+
fullWidth: !0
|
|
1593
|
+
}) : null
|
|
1594
|
+
]
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
//#endregion
|
|
1598
|
+
//#region src/views/instances/detail/sections/InstanceHistorySection.tsx
|
|
1599
|
+
var An = {
|
|
1600
|
+
display: "grid",
|
|
1601
|
+
gap: 16
|
|
1602
|
+
}, jn = {
|
|
1603
|
+
cursor: "help",
|
|
1604
|
+
textDecoration: "underline dotted",
|
|
1605
|
+
textUnderlineOffset: 3
|
|
1606
|
+
}, Mn = {
|
|
1607
|
+
borderLeftColor: "var(--mzn-color-border)",
|
|
1608
|
+
borderLeftStyle: "solid",
|
|
1609
|
+
borderLeftWidth: 2,
|
|
1610
|
+
fontSize: "var(--mzn-typography-h3-font-size)",
|
|
1611
|
+
lineHeight: "var(--mzn-typography-h3-line-height)",
|
|
1612
|
+
marginTop: 4,
|
|
1613
|
+
paddingLeft: 8,
|
|
1614
|
+
whiteSpace: "pre-wrap"
|
|
1615
|
+
}, Nn = { color: "var(--mzn-color-text-secondary)" }, Pn = {
|
|
1616
|
+
...Mn,
|
|
1617
|
+
borderLeftColor: "var(--mzn-color-text-error)",
|
|
1618
|
+
color: "var(--mzn-color-text-error)"
|
|
1619
|
+
};
|
|
1620
|
+
function Fn(...e) {
|
|
1621
|
+
return e.filter((e) => H(e ?? null)).join(" ");
|
|
1622
|
+
}
|
|
1623
|
+
var In = re(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
|
|
1624
|
+
let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
|
|
1625
|
+
return /* @__PURE__ */ D("div", {
|
|
1626
|
+
...l,
|
|
1627
|
+
className: Fn(R.host, c === "dot" ? R.dot : null, n && d !== "processing" ? R.error : null, a === "horizontal" ? R.horizontal : null, c === "number" ? R.number : null, d === "pending" ? R.pending : null, d === "processing" ? R.processing : null, n && d === "processing" ? R.processingError : null, !n && d === "succeeded" ? R.succeeded : null, a === "vertical" ? R.vertical : null, e),
|
|
1628
|
+
ref: u,
|
|
1629
|
+
children: [c === "dot" ? /* @__PURE__ */ E("span", { className: Fn(R.statusIndicator, R.statusIndicatorDot) }) : /* @__PURE__ */ E("span", {
|
|
1630
|
+
className: R.statusIndicator,
|
|
1631
|
+
children: i + 1
|
|
1632
|
+
}), /* @__PURE__ */ D("div", {
|
|
1633
|
+
className: R.textContainer,
|
|
1634
|
+
children: [
|
|
1635
|
+
/* @__PURE__ */ D(w, {
|
|
1636
|
+
className: R.title,
|
|
1637
|
+
variant: "label-primary-highlight",
|
|
1638
|
+
children: [s, /* @__PURE__ */ E("span", { className: R.titleConnectLine })]
|
|
1639
|
+
}),
|
|
1640
|
+
f.length > 0 ? /* @__PURE__ */ E(w, {
|
|
1641
|
+
className: R.description,
|
|
1642
|
+
variant: "caption",
|
|
1643
|
+
children: f.map((e, t) => /* @__PURE__ */ D(h, { children: [t > 0 ? " · " : null, Ln(e)] }, `${e.type}-${t}`))
|
|
1644
|
+
}) : null,
|
|
1645
|
+
p.map((e, t) => /* @__PURE__ */ D(w, {
|
|
1646
|
+
style: e.tone === "danger" ? Pn : Mn,
|
|
1647
|
+
variant: "body",
|
|
1648
|
+
children: [/* @__PURE__ */ D("span", {
|
|
1649
|
+
style: e.tone === "danger" ? void 0 : Nn,
|
|
1650
|
+
children: [e.label, ":"]
|
|
1651
|
+
}), e.text]
|
|
1652
|
+
}, `comment-${t}`))
|
|
1653
|
+
]
|
|
1654
|
+
})]
|
|
1655
|
+
});
|
|
1656
|
+
});
|
|
1657
|
+
function Ln(e) {
|
|
1658
|
+
return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ D(T, { children: [
|
|
1659
|
+
e.prefix,
|
|
1660
|
+
":",
|
|
1661
|
+
/* @__PURE__ */ E(ve, {
|
|
1662
|
+
title: e.email,
|
|
1663
|
+
children: ({ ref: t, ...n }) => /* @__PURE__ */ E("span", {
|
|
1664
|
+
...n,
|
|
1665
|
+
"data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
|
|
1666
|
+
ref: t,
|
|
1667
|
+
style: jn,
|
|
1668
|
+
children: e.label
|
|
1669
|
+
})
|
|
1670
|
+
})
|
|
1671
|
+
] }) : `${e.prefix}:${e.label}`;
|
|
1672
|
+
}
|
|
1673
|
+
function Rn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
|
|
1674
|
+
let u = rn(e, s, l, c, n, r, o, a, i, t), d = Lt(u), f = u.map((e) => ({
|
|
1675
|
+
...e,
|
|
1676
|
+
descriptionParts: e.descriptionParts.filter(It)
|
|
1677
|
+
}));
|
|
1678
|
+
return /* @__PURE__ */ D("div", {
|
|
1679
|
+
style: An,
|
|
1680
|
+
children: [/* @__PURE__ */ E(w, {
|
|
1681
|
+
component: "h2",
|
|
1682
|
+
variant: "h3",
|
|
1683
|
+
children: "歷程"
|
|
1684
|
+
}), f.length > 0 ? /* @__PURE__ */ E(he, {
|
|
1685
|
+
currentStep: d,
|
|
1686
|
+
orientation: "vertical",
|
|
1687
|
+
type: "dot",
|
|
1688
|
+
children: f.map((e) => /* @__PURE__ */ E(In, {
|
|
1689
|
+
descriptionParts: e.descriptionParts,
|
|
1690
|
+
error: e.error,
|
|
1691
|
+
forcePending: e.forcePending,
|
|
1692
|
+
title: e.title
|
|
1693
|
+
}, e.id))
|
|
1694
|
+
}) : /* @__PURE__ */ E(w, {
|
|
1695
|
+
color: "text-neutral",
|
|
1696
|
+
variant: "body",
|
|
1697
|
+
children: "尚無歷程紀錄。"
|
|
1698
|
+
})]
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
//#endregion
|
|
1702
|
+
//#region src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
|
|
1703
|
+
var zn = {
|
|
1704
|
+
display: "grid",
|
|
1705
|
+
gap: 16
|
|
1706
|
+
}, Bn = {
|
|
1707
|
+
display: "grid",
|
|
1708
|
+
gap: 2
|
|
1709
|
+
}, Vn = {
|
|
1710
|
+
overflowWrap: "anywhere",
|
|
1711
|
+
whiteSpace: "pre-wrap"
|
|
1712
|
+
};
|
|
1713
|
+
function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
|
|
1714
|
+
let [r, i] = v(null), [a, o] = v(!1), [s, c] = v(null), l = _(() => e.map((e) => ({
|
|
1715
|
+
delivery: e,
|
|
1716
|
+
key: e.id
|
|
1717
|
+
})), [e]), u = _(() => [
|
|
1718
|
+
{
|
|
1719
|
+
key: "endpoint",
|
|
1720
|
+
render: ({ delivery: e }) => /* @__PURE__ */ D("div", {
|
|
1721
|
+
style: Bn,
|
|
1722
|
+
children: [/* @__PURE__ */ E(w, {
|
|
1723
|
+
component: "span",
|
|
1724
|
+
variant: "body",
|
|
1725
|
+
children: e.endpointLabel ?? e.endpointKey
|
|
1726
|
+
}), /* @__PURE__ */ D(w, {
|
|
1727
|
+
color: "text-neutral",
|
|
1728
|
+
component: "span",
|
|
1729
|
+
variant: "caption",
|
|
1730
|
+
children: [
|
|
1731
|
+
e.endpointKey,
|
|
1732
|
+
"@",
|
|
1733
|
+
e.endpointVersion,
|
|
1734
|
+
" ·",
|
|
1735
|
+
" ",
|
|
1736
|
+
n(e.nodeId)
|
|
1737
|
+
]
|
|
1738
|
+
})]
|
|
1739
|
+
}),
|
|
1740
|
+
title: "外部系統",
|
|
1741
|
+
width: 240
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
key: "status",
|
|
1745
|
+
render: ({ delivery: e }) => /* @__PURE__ */ E(Un, { status: e.status }),
|
|
1746
|
+
title: "狀態",
|
|
1747
|
+
width: 120
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
key: "attemptCount",
|
|
1751
|
+
render: ({ delivery: e }) => /* @__PURE__ */ E(w, {
|
|
1752
|
+
component: "span",
|
|
1753
|
+
variant: "body",
|
|
1754
|
+
children: e.attemptCount
|
|
1755
|
+
}),
|
|
1756
|
+
title: "嘗試次數",
|
|
1757
|
+
width: 100
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
key: "lastError",
|
|
1761
|
+
render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ D("div", {
|
|
1762
|
+
style: Bn,
|
|
1763
|
+
children: [/* @__PURE__ */ E(w, {
|
|
1764
|
+
color: "text-error",
|
|
1765
|
+
component: "span",
|
|
1766
|
+
variant: "body",
|
|
1767
|
+
children: e.lastErrorCode
|
|
1768
|
+
}), e.lastErrorDetail ? /* @__PURE__ */ E(w, {
|
|
1769
|
+
color: "text-neutral",
|
|
1770
|
+
component: "span",
|
|
1771
|
+
style: Vn,
|
|
1772
|
+
variant: "caption",
|
|
1773
|
+
children: e.lastErrorDetail
|
|
1774
|
+
}) : null]
|
|
1775
|
+
}) : /* @__PURE__ */ E(w, {
|
|
1776
|
+
color: "text-neutral",
|
|
1777
|
+
component: "span",
|
|
1778
|
+
variant: "body",
|
|
1779
|
+
children: "—"
|
|
1780
|
+
}),
|
|
1781
|
+
title: "最後錯誤",
|
|
1782
|
+
width: 280
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
key: "time",
|
|
1786
|
+
render: ({ delivery: e }) => /* @__PURE__ */ E(w, {
|
|
1787
|
+
component: "span",
|
|
1788
|
+
variant: "body",
|
|
1789
|
+
children: Wn(e)
|
|
1790
|
+
}),
|
|
1791
|
+
title: "時間",
|
|
1792
|
+
width: 220
|
|
1793
|
+
}
|
|
1794
|
+
], [n]), d = _(() => ({
|
|
1795
|
+
render: ({ delivery: e }) => e.status === "FAILED" && e.attemptCount > 0 ? [{
|
|
1796
|
+
disabled: () => a,
|
|
1797
|
+
icon: qe,
|
|
1798
|
+
iconType: "leading",
|
|
1799
|
+
name: "重新傳送",
|
|
1800
|
+
onClick: () => {
|
|
1801
|
+
c(null), i(e);
|
|
1802
|
+
}
|
|
1803
|
+
}] : [],
|
|
1804
|
+
variant: "base-secondary",
|
|
1805
|
+
width: 140
|
|
1806
|
+
}), [a]);
|
|
1807
|
+
async function f() {
|
|
1808
|
+
if (r) {
|
|
1809
|
+
o(!0), c(null);
|
|
1810
|
+
try {
|
|
1811
|
+
await t(r), i(null);
|
|
1812
|
+
} catch (e) {
|
|
1813
|
+
i(null), c(e instanceof Error && e.message ? e.message : "重新傳送失敗,請稍後再試。");
|
|
1814
|
+
} finally {
|
|
1815
|
+
o(!1);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
return /* @__PURE__ */ D("div", {
|
|
1820
|
+
style: zn,
|
|
1821
|
+
children: [
|
|
1822
|
+
/* @__PURE__ */ E(w, {
|
|
1823
|
+
component: "h2",
|
|
1824
|
+
variant: "h3",
|
|
1825
|
+
children: "外部系統通知"
|
|
1826
|
+
}),
|
|
1827
|
+
s ? /* @__PURE__ */ E(w, {
|
|
1828
|
+
color: "text-error",
|
|
1829
|
+
variant: "body",
|
|
1830
|
+
children: s
|
|
1831
|
+
}) : null,
|
|
1832
|
+
l.length > 0 ? /* @__PURE__ */ E(ge, {
|
|
1833
|
+
actions: d,
|
|
1834
|
+
columns: u,
|
|
1835
|
+
dataSource: l,
|
|
1836
|
+
fullWidth: !0
|
|
1837
|
+
}) : /* @__PURE__ */ E(w, {
|
|
1838
|
+
color: "text-neutral",
|
|
1839
|
+
variant: "body",
|
|
1840
|
+
children: "此案件沒有外部系統通知。"
|
|
1841
|
+
}),
|
|
1842
|
+
/* @__PURE__ */ E(S, {
|
|
1843
|
+
cancelText: "取消",
|
|
1844
|
+
confirmText: "重新傳送",
|
|
1845
|
+
loading: a,
|
|
1846
|
+
modalStatusType: "info",
|
|
1847
|
+
modalType: "standard",
|
|
1848
|
+
onCancel: () => i(null),
|
|
1849
|
+
onClose: () => i(null),
|
|
1850
|
+
onConfirm: () => void f(),
|
|
1851
|
+
open: !!r,
|
|
1852
|
+
showModalFooter: !0,
|
|
1853
|
+
showModalHeader: !0,
|
|
1854
|
+
supportingText: "會以相同的投遞編號重新送出,接收端可據此避免重複處理。",
|
|
1855
|
+
title: "重新傳送通知",
|
|
1856
|
+
children: /* @__PURE__ */ D(w, {
|
|
1857
|
+
variant: "body",
|
|
1858
|
+
children: [
|
|
1859
|
+
"確定要重新通知「",
|
|
1860
|
+
r?.endpointLabel ?? r?.endpointKey ?? "",
|
|
1861
|
+
"」嗎?"
|
|
1862
|
+
]
|
|
1863
|
+
})
|
|
1864
|
+
})
|
|
1865
|
+
]
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
function Un({ status: e }) {
|
|
1869
|
+
return e === "SENT" ? /* @__PURE__ */ E(ce, {
|
|
1870
|
+
size: "sub",
|
|
1871
|
+
text: "已送達",
|
|
1872
|
+
variant: "dot-success"
|
|
1873
|
+
}) : e === "FAILED" ? /* @__PURE__ */ E(ce, {
|
|
1874
|
+
size: "sub",
|
|
1875
|
+
text: "失敗",
|
|
1876
|
+
variant: "dot-error"
|
|
1877
|
+
}) : /* @__PURE__ */ E(ce, {
|
|
1878
|
+
size: "sub",
|
|
1879
|
+
text: e === "PENDING" ? "等待傳送" : "傳送中",
|
|
1880
|
+
variant: "dot-info"
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
function Wn(e) {
|
|
1884
|
+
return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
|
|
1885
|
+
}
|
|
1886
|
+
//#endregion
|
|
1887
|
+
//#region src/views/instances/viewer-field-access.ts
|
|
1888
|
+
function Gn(e, t) {
|
|
1889
|
+
let n = new Map(t.map((e) => [e.id, e]));
|
|
1890
|
+
return new Set(e.filter((e) => e.eventType === "TASK_CREATED").map((e) => e.taskId === null ? void 0 : n.get(e.taskId)).filter((e) => e !== void 0 && !e.isAdhoc).map((e) => e.nodeId));
|
|
1891
|
+
}
|
|
1892
|
+
function Kn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
|
|
1893
|
+
let i = n.workflowSnapshot;
|
|
1894
|
+
return Qe({
|
|
1895
|
+
definition: i,
|
|
1896
|
+
fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
|
|
1897
|
+
isAdhocTask: t?.isAdhoc ?? !1,
|
|
1898
|
+
nodeId: t?.nodeId ?? null,
|
|
1899
|
+
revealedFieldKeys: Xe(i, Gn(e, r))
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
//#endregion
|
|
1903
|
+
//#region src/views/instances/detail/InstanceDetailView.tsx
|
|
1904
|
+
function qn(e) {
|
|
1905
|
+
return `還有 ${new Set(Object.keys(e).map(Ze)).size} 個補填欄位需要完成`;
|
|
1906
|
+
}
|
|
1907
|
+
var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
|
|
1908
|
+
display: "grid",
|
|
1909
|
+
gap: 16
|
|
1910
|
+
}, $n = {
|
|
1911
|
+
background: "#f8fafc",
|
|
1912
|
+
border: "1px solid #e2e8f0",
|
|
1913
|
+
borderRadius: 8,
|
|
1914
|
+
height: "min(64vh, 620px)",
|
|
1915
|
+
minHeight: 440,
|
|
1916
|
+
overflow: "hidden",
|
|
1917
|
+
width: "min(80vw, 1040px)"
|
|
1918
|
+
}, er = {
|
|
1919
|
+
background: "#ffffff",
|
|
1920
|
+
border: "1px solid #cbd5e1",
|
|
1921
|
+
borderRadius: 8,
|
|
1922
|
+
boxShadow: "0 8px 18px rgba(15, 23, 42, 0.08)",
|
|
1923
|
+
display: "grid",
|
|
1924
|
+
gap: 6,
|
|
1925
|
+
minHeight: 82,
|
|
1926
|
+
padding: 12,
|
|
1927
|
+
width: 184
|
|
1928
|
+
}, tr = {
|
|
1929
|
+
borderRadius: 999,
|
|
1930
|
+
fontSize: 12,
|
|
1931
|
+
fontWeight: 600,
|
|
1932
|
+
justifySelf: "start",
|
|
1933
|
+
lineHeight: "18px",
|
|
1934
|
+
padding: "0 8px"
|
|
1935
|
+
}, nr = {
|
|
1936
|
+
color: "#64748b",
|
|
1937
|
+
fontSize: 12,
|
|
1938
|
+
overflow: "hidden",
|
|
1939
|
+
textOverflow: "ellipsis",
|
|
1940
|
+
whiteSpace: "nowrap"
|
|
1941
|
+
}, rr = { opacity: 0 }, ir = {
|
|
1942
|
+
display: "flex",
|
|
1943
|
+
flexWrap: "wrap",
|
|
1944
|
+
gap: 8
|
|
1945
|
+
}, ar = {
|
|
1946
|
+
alignItems: "center",
|
|
1947
|
+
background: "#ffffff",
|
|
1948
|
+
border: "1px solid #cbd5e1",
|
|
1949
|
+
borderRadius: 8,
|
|
1950
|
+
color: "#334155",
|
|
1951
|
+
display: "inline-flex",
|
|
1952
|
+
fontSize: 12,
|
|
1953
|
+
fontWeight: 600,
|
|
1954
|
+
gap: 6,
|
|
1955
|
+
lineHeight: "20px",
|
|
1956
|
+
padding: "4px 8px"
|
|
1957
|
+
}, or = {
|
|
1958
|
+
display: "grid",
|
|
1959
|
+
gap: 16
|
|
1960
|
+
}, sr = { workflowRuntime: _r };
|
|
1961
|
+
function cr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: h = !0, showSignatures: re = !0, showTasks: ae = !0, showWebhookDeliveries: se = !0 }) {
|
|
1962
|
+
let { member: ce } = e(), b = ce?.memberId ?? null, le = se && r(ce), [x, ue] = v([]), [C, he] = v(null), [ge, ve] = v([]), [ye, xe] = v([]), [Se, Ce] = v([]), [O, je] = v([]), [Me, Ne] = v(null), [k, ze] = v([]), [Be, He] = v([]), [Ue, qe] = v([]), [Ye, j] = v(null), [Xe, Ze] = v(!0), [Qe, N] = v(!1), [F, I] = v(!1), [L, it] = v(!1), [at, R] = v(""), [z, ot] = v(!1), [st, ct] = v({}), [lt, ut] = v({}), [dt, ft] = v({}), [B, mt] = v(null), [gt, _t] = v(null), [V, vt] = v([]), yt = at.trim(), U = oe(null), bt = oe(0), xt = O.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
|
|
1963
|
+
ie(() => {
|
|
1964
|
+
$t();
|
|
1965
|
+
}, [b, i]), ie(() => {
|
|
1966
|
+
if (!le || !xt || bt.current >= Yn) return;
|
|
1967
|
+
let e = setTimeout(() => {
|
|
1968
|
+
bt.current += 1, nn();
|
|
1969
|
+
}, Jn);
|
|
1970
|
+
return () => clearTimeout(e);
|
|
1971
|
+
}, [
|
|
1972
|
+
le,
|
|
1973
|
+
xt,
|
|
1974
|
+
O
|
|
1975
|
+
]), ie(() => {
|
|
1976
|
+
ut(C?.formData ?? {}), ft({});
|
|
1977
|
+
}, [C]);
|
|
1978
|
+
let St = g((e, t) => {
|
|
1979
|
+
ft((n) => {
|
|
1980
|
+
let r = n[e];
|
|
1981
|
+
return r?.hasValue === t.hasValue && r.status === t.status ? n : {
|
|
1982
|
+
...n,
|
|
1983
|
+
[e]: {
|
|
1984
|
+
hasValue: t.hasValue,
|
|
1985
|
+
status: t.status
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
});
|
|
1989
|
+
}, []), G = _(() => Ot(k, b), [b, k]), K = _(() => G && C ? C.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, C]), wt = K?.type === "userTask" && K.data.returnBehavior.allowReturn, Et = K?.type === "userTask" && K.data.allowReject !== !1, Dt = K?.type === "userTask" && K.data.allowTransfer !== !1, kt = K?.type === "userTask" && K.data.allowAddSigner, At = !(!C || C.initiatorMemberId !== b || C.state !== "RUNNING" && C.state !== "RETURNED"), jt = !!(C && C.initiatorMemberId === b && C.state === "RETURNED"), J = _(() => G && !G.isAdhoc && K?.type === "userTask" && M(K).size > 0 ? K : null, [G, K]), Mt = J ? G?.id ?? null : null, [Nt, Y] = v({}), [Pt, Ft] = v({}), [It, Lt] = v(!1);
|
|
1990
|
+
ie(() => {
|
|
1991
|
+
Y({}), Ft({}), Lt(!1);
|
|
1992
|
+
}, [Mt]);
|
|
1993
|
+
let X = C?.formDefinitionSnapshot.schema ?? null, Z = _(() => J && X ? o(X, J) : null, [J, X]), Q = _(() => Z && C ? $e(Z.fields, {
|
|
1994
|
+
...C.formData,
|
|
1995
|
+
...Nt
|
|
1996
|
+
}) : null, [
|
|
1997
|
+
Nt,
|
|
1998
|
+
Z,
|
|
1999
|
+
C
|
|
2000
|
+
]), Rt = _(() => J && Z && Q && C ? c({
|
|
2001
|
+
draft: Nt,
|
|
2002
|
+
node: J,
|
|
2003
|
+
schema: Z,
|
|
2004
|
+
stored: C.formData,
|
|
2005
|
+
values: Q
|
|
2006
|
+
}) : {}, [
|
|
2007
|
+
Nt,
|
|
2008
|
+
J,
|
|
2009
|
+
Z,
|
|
2010
|
+
Q,
|
|
2011
|
+
C
|
|
2012
|
+
]), zt = _(() => C ? Kn({
|
|
2013
|
+
activityLogs: x,
|
|
2014
|
+
actingTask: G,
|
|
2015
|
+
instance: C,
|
|
2016
|
+
tasks: k
|
|
2017
|
+
}) : void 0, [
|
|
2018
|
+
x,
|
|
2019
|
+
G,
|
|
2020
|
+
C,
|
|
2021
|
+
k
|
|
2022
|
+
]), Bt = _(() => C ? d(C.workflowSnapshot, J) : void 0, [J, C]), Vt = _(() => new Map(Ue.map((e) => [e.memberId, e])), [Ue]), Ht = _(() => J && Q && X && C?.formDataFingerprint ? {
|
|
2023
|
+
expectedFormDataFingerprint: C.formDataFingerprint,
|
|
2024
|
+
formData: p(Rt, J),
|
|
2025
|
+
summary: l(X, J, Rt, new Map([...Vt.keys()].map((e) => [e, q(e, Vt)])))
|
|
2026
|
+
} : null, [
|
|
2027
|
+
Rt,
|
|
2028
|
+
J,
|
|
2029
|
+
Q,
|
|
2030
|
+
C,
|
|
2031
|
+
Vt,
|
|
2032
|
+
X
|
|
2033
|
+
]);
|
|
2034
|
+
function Ut(e) {
|
|
2035
|
+
if (!J) return;
|
|
2036
|
+
let t = M(J), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Q?.[e]));
|
|
2037
|
+
Y((e) => ({
|
|
2038
|
+
...e,
|
|
2039
|
+
...Object.fromEntries(n)
|
|
2040
|
+
})), Ft({});
|
|
2041
|
+
}
|
|
2042
|
+
function Wt() {
|
|
2043
|
+
if (J && !C?.formDataFingerprint) de.error("無法確認表單版本,請重新整理頁面後再同意。");
|
|
2044
|
+
else {
|
|
2045
|
+
if (J && Q && X && C?.formDefinitionSnapshot.uiSchema) {
|
|
2046
|
+
let e = tt({
|
|
2047
|
+
schema: te(X, J),
|
|
2048
|
+
uiSchema: C.formDefinitionSnapshot.uiSchema,
|
|
2049
|
+
values: Q
|
|
2050
|
+
});
|
|
2051
|
+
if (!e.valid) {
|
|
2052
|
+
Ft(e.errors), e.firstInvalidFieldKey && et(e.firstInvalidFieldKey), de.warning(qn(e.errors));
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
U.current?.handleApprove();
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
function Gt(e) {
|
|
2060
|
+
if (!J || !X) return !1;
|
|
2061
|
+
if (ee(e)) return Lt(!0), !0;
|
|
2062
|
+
let t = s(e, X, J);
|
|
2063
|
+
return t ? (Ft(t), et(Object.keys(t)[0] ?? ""), de.warning(qn(t)), !0) : !1;
|
|
2064
|
+
}
|
|
2065
|
+
async function Kt() {
|
|
2066
|
+
await $t(), Lt(!1);
|
|
2067
|
+
}
|
|
2068
|
+
let qt = _(() => un(ge), [ge]), Jt = _(() => new Map(Se.map((e) => [e.id, e])), [Se]), Yt = _(() => C ? pr(C.workflowSnapshot) : null, [C]), Xt = _(() => C && Yt ? fr(Yt, k, Be, C.state) : [], [
|
|
2069
|
+
C,
|
|
2070
|
+
Yt,
|
|
2071
|
+
k,
|
|
2072
|
+
Be
|
|
2073
|
+
]), Zt = _(() => Yt ? mr(Yt) : [], [Yt]), Qt = _(() => C ? ur(C.workflowSnapshot) : [], [C]);
|
|
2074
|
+
async function $t() {
|
|
2075
|
+
Ze(!0), j(null);
|
|
2076
|
+
try {
|
|
2077
|
+
let e = await De(i);
|
|
2078
|
+
ue(e.activityLogs), he(e.instance), ze(e.tasks), He(e.workflowTokens);
|
|
2079
|
+
let t = await we(e.instance.id), [n, r, a, o, s] = await Promise.all([
|
|
2080
|
+
ln(e.tasks),
|
|
2081
|
+
sn({
|
|
2082
|
+
...e,
|
|
2083
|
+
adhocDirectives: t
|
|
2084
|
+
}),
|
|
2085
|
+
Te(e.instance.id),
|
|
2086
|
+
Ae(e.instance.id),
|
|
2087
|
+
en(e.instance.id)
|
|
2088
|
+
]);
|
|
2089
|
+
ve(n), qe(r), xe(a), Ce(o.signatures), Ne(o.verification), vt(t), je(s);
|
|
2090
|
+
} catch (e) {
|
|
2091
|
+
j(W(e));
|
|
2092
|
+
} finally {
|
|
2093
|
+
Ze(!1);
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
async function en(e) {
|
|
2097
|
+
return le ? Ee(e).catch(() => []) : [];
|
|
2098
|
+
}
|
|
2099
|
+
async function tn(e) {
|
|
2100
|
+
await Fe(e.id), bt.current = 0, await $t();
|
|
2101
|
+
}
|
|
2102
|
+
async function nn() {
|
|
2103
|
+
let e = await en(i);
|
|
2104
|
+
e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? je(e) : await $t();
|
|
2105
|
+
}
|
|
2106
|
+
async function rn(e, t) {
|
|
2107
|
+
if (!b) throw Error("尚未登入,無法上傳附件");
|
|
2108
|
+
return { id: (await Ie({
|
|
2109
|
+
file: t,
|
|
2110
|
+
formFieldPath: `form.${e.fieldKey}`
|
|
2111
|
+
})).id };
|
|
2112
|
+
}
|
|
2113
|
+
async function an(e) {
|
|
2114
|
+
if (!b) return;
|
|
2115
|
+
let t = await Oe({ id: e.id });
|
|
2116
|
+
window.open(t, "_blank", "noopener,noreferrer");
|
|
2117
|
+
}
|
|
2118
|
+
async function on(e) {
|
|
2119
|
+
if (!b) return;
|
|
2120
|
+
let t = await ke({ id: e.id });
|
|
2121
|
+
mt(e), _t(t);
|
|
2122
|
+
}
|
|
2123
|
+
async function cn() {
|
|
2124
|
+
if (b && C && At) {
|
|
2125
|
+
N(!0), j(null), ct({});
|
|
2126
|
+
try {
|
|
2127
|
+
await be({
|
|
2128
|
+
cancelledByMemberId: b,
|
|
2129
|
+
comment: yt || null,
|
|
2130
|
+
instanceId: C.id
|
|
2131
|
+
}), R(""), ot(!1), await $t();
|
|
2132
|
+
} catch (e) {
|
|
2133
|
+
j(W(e));
|
|
2134
|
+
} finally {
|
|
2135
|
+
N(!1);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
async function dn() {
|
|
2140
|
+
if (!b || !C || !jt) return;
|
|
2141
|
+
N(!0), j(null), ct({});
|
|
2142
|
+
let e = m(Object.values(dt));
|
|
2143
|
+
if (e) {
|
|
2144
|
+
j(e), N(!1);
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
let t = C.formDefinitionSnapshot.schema ? u(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = f(t ? $e(t.fields, lt) : lt, C.workflowSnapshot);
|
|
2148
|
+
if (t && C.formDefinitionSnapshot.uiSchema) {
|
|
2149
|
+
let e = tt({
|
|
2150
|
+
schema: t,
|
|
2151
|
+
uiSchema: C.formDefinitionSnapshot.uiSchema,
|
|
2152
|
+
values: n
|
|
2153
|
+
});
|
|
2154
|
+
if (!e.valid) {
|
|
2155
|
+
ct(e.errors), j("請先補齊必填欄位。"), e.firstInvalidFieldKey && et(e.firstInvalidFieldKey), N(!1);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
try {
|
|
2160
|
+
await Pe({
|
|
2161
|
+
formData: n,
|
|
2162
|
+
initiatorMemberId: b,
|
|
2163
|
+
instanceId: C.id,
|
|
2164
|
+
title: C.title
|
|
2165
|
+
}), await $t();
|
|
2166
|
+
} catch (e) {
|
|
2167
|
+
j(W(e));
|
|
2168
|
+
} finally {
|
|
2169
|
+
N(!1);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
let $ = Qe || F;
|
|
2173
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
2174
|
+
/* @__PURE__ */ E(fe, { children: /* @__PURE__ */ D(Le, {
|
|
2175
|
+
description: C ? [
|
|
2176
|
+
Ct(C.state),
|
|
2177
|
+
t(C.startedAt),
|
|
2178
|
+
ht(C, Vt)
|
|
2179
|
+
].filter(H).join(" · ") : "載入案件內容。",
|
|
2180
|
+
title: C?.title ?? "簽核案件",
|
|
2181
|
+
children: [
|
|
2182
|
+
C ? /* @__PURE__ */ E(y, {
|
|
2183
|
+
"aria-label": "查看流程圖",
|
|
2184
|
+
icon: A,
|
|
2185
|
+
iconType: "icon-only",
|
|
2186
|
+
onClick: () => it(!0),
|
|
2187
|
+
title: "查看流程圖",
|
|
2188
|
+
variant: "base-secondary",
|
|
2189
|
+
children: "流程圖"
|
|
2190
|
+
}) : null,
|
|
2191
|
+
At ? /* @__PURE__ */ E(y, {
|
|
2192
|
+
disabled: $,
|
|
2193
|
+
icon: Ve,
|
|
2194
|
+
iconType: "leading",
|
|
2195
|
+
onClick: () => ot(!0),
|
|
2196
|
+
variant: "destructive-secondary",
|
|
2197
|
+
children: "取消案件"
|
|
2198
|
+
}) : null,
|
|
2199
|
+
G ? /* @__PURE__ */ D(T, { children: [
|
|
2200
|
+
kt ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(y, {
|
|
2201
|
+
disabled: $,
|
|
2202
|
+
icon: Ge,
|
|
2203
|
+
iconType: "leading",
|
|
2204
|
+
onClick: () => U.current?.openAdhocModal("COUNTERSIGN"),
|
|
2205
|
+
variant: "base-secondary",
|
|
2206
|
+
children: "會簽"
|
|
2207
|
+
}, "adhoc-countersign"), /* @__PURE__ */ E(y, {
|
|
2208
|
+
disabled: $,
|
|
2209
|
+
icon: Ge,
|
|
2210
|
+
iconType: "leading",
|
|
2211
|
+
onClick: () => U.current?.openAdhocModal("PRE_APPROVAL"),
|
|
2212
|
+
variant: "base-secondary",
|
|
2213
|
+
children: "加簽"
|
|
2214
|
+
}, "adhoc-pre-approval")] }) : null,
|
|
2215
|
+
/* @__PURE__ */ E(y, {
|
|
2216
|
+
disabled: $,
|
|
2217
|
+
icon: We,
|
|
2218
|
+
iconType: "leading",
|
|
2219
|
+
onClick: () => U.current?.openAdhocModal("STAGE_NOTIFY"),
|
|
2220
|
+
variant: "base-secondary",
|
|
2221
|
+
children: "通知設定"
|
|
2222
|
+
}, "adhoc-notify"),
|
|
2223
|
+
wt ? /* @__PURE__ */ E(y, {
|
|
2224
|
+
disabled: $,
|
|
2225
|
+
icon: Ke,
|
|
2226
|
+
iconType: "leading",
|
|
2227
|
+
onClick: () => U.current?.openReturnModal(),
|
|
2228
|
+
variant: "base-secondary",
|
|
2229
|
+
children: "退回"
|
|
2230
|
+
}, "task-return") : null,
|
|
2231
|
+
Dt ? /* @__PURE__ */ E(y, {
|
|
2232
|
+
disabled: $,
|
|
2233
|
+
icon: Je,
|
|
2234
|
+
iconType: "leading",
|
|
2235
|
+
onClick: () => U.current?.openTransferModal(),
|
|
2236
|
+
variant: "base-secondary",
|
|
2237
|
+
children: "轉派"
|
|
2238
|
+
}, "task-transfer") : null,
|
|
2239
|
+
Et ? /* @__PURE__ */ E(y, {
|
|
2240
|
+
disabled: $,
|
|
2241
|
+
icon: Ve,
|
|
2242
|
+
iconType: "leading",
|
|
2243
|
+
onClick: () => U.current?.openRejectModal(),
|
|
2244
|
+
variant: "destructive-secondary",
|
|
2245
|
+
children: "拒絕"
|
|
2246
|
+
}, "task-reject") : null,
|
|
2247
|
+
/* @__PURE__ */ E(y, {
|
|
2248
|
+
disabled: $,
|
|
2249
|
+
icon: Re,
|
|
2250
|
+
iconType: "leading",
|
|
2251
|
+
onClick: Wt,
|
|
2252
|
+
variant: "base-primary",
|
|
2253
|
+
children: "同意"
|
|
2254
|
+
}, "task-approve")
|
|
2255
|
+
] }) : null
|
|
2256
|
+
]
|
|
2257
|
+
}) }),
|
|
2258
|
+
/* @__PURE__ */ D(me, { children: [
|
|
2259
|
+
ne ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(fn, {
|
|
2260
|
+
canResubmitInstance: jt,
|
|
2261
|
+
deciding: Qe,
|
|
2262
|
+
error: Ye,
|
|
2263
|
+
fieldAccess: zt,
|
|
2264
|
+
fieldLabelMarkers: Bt,
|
|
2265
|
+
fill: Z && Q && J ? {
|
|
2266
|
+
errors: Pt,
|
|
2267
|
+
fieldCount: M(J).size,
|
|
2268
|
+
onChange: Ut,
|
|
2269
|
+
schema: Z,
|
|
2270
|
+
value: Q
|
|
2271
|
+
} : null,
|
|
2272
|
+
instance: C,
|
|
2273
|
+
loading: Xe,
|
|
2274
|
+
onDataSourceStateChange: St,
|
|
2275
|
+
onReloadAfterConflict: It ? () => void Kt() : null,
|
|
2276
|
+
onResubmitFormChange: (e) => {
|
|
2277
|
+
ut(e), ct({});
|
|
2278
|
+
},
|
|
2279
|
+
onResubmitInstance: () => void dn(),
|
|
2280
|
+
onUploadAttachment: rn,
|
|
2281
|
+
resubmitFormData: lt,
|
|
2282
|
+
resubmitFormErrors: st
|
|
2283
|
+
}) }) : null,
|
|
2284
|
+
a ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(mn, {
|
|
2285
|
+
attachments: ye,
|
|
2286
|
+
onDownload: (e) => {
|
|
2287
|
+
an(e);
|
|
2288
|
+
},
|
|
2289
|
+
onPreview: (e) => {
|
|
2290
|
+
on(e);
|
|
2291
|
+
}
|
|
2292
|
+
}) }) : null,
|
|
2293
|
+
ae ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Tn, {
|
|
2294
|
+
adhocDirectives: V,
|
|
2295
|
+
currentMemberId: b,
|
|
2296
|
+
fill: Ht,
|
|
2297
|
+
instance: C,
|
|
2298
|
+
memberProfilesById: Vt,
|
|
2299
|
+
onChanged: $t,
|
|
2300
|
+
onDecidingChange: I,
|
|
2301
|
+
onFillApproveError: Gt,
|
|
2302
|
+
ref: U,
|
|
2303
|
+
tasks: k
|
|
2304
|
+
}) }) : null,
|
|
2305
|
+
re ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(kn, {
|
|
2306
|
+
signatureVerification: Me,
|
|
2307
|
+
signatures: Se
|
|
2308
|
+
}) }) : null,
|
|
2309
|
+
le && O.length > 0 ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Hn, {
|
|
2310
|
+
deliveries: O,
|
|
2311
|
+
onRetry: tn,
|
|
2312
|
+
readNodeLabel: (e) => Tt(e, C?.workflowSnapshot ?? null)
|
|
2313
|
+
}) }) : null,
|
|
2314
|
+
h ? /* @__PURE__ */ E(pe, { children: /* @__PURE__ */ E(Rn, {
|
|
2315
|
+
activityLogs: x,
|
|
2316
|
+
formSchema: X,
|
|
2317
|
+
instanceState: C?.state ?? "RUNNING",
|
|
2318
|
+
memberProfilesById: Vt,
|
|
2319
|
+
signatureVerification: Me,
|
|
2320
|
+
signaturesById: Jt,
|
|
2321
|
+
taskDecisionsByTaskId: qt,
|
|
2322
|
+
tasks: k,
|
|
2323
|
+
workflowSnapshot: C?.workflowSnapshot ?? null,
|
|
2324
|
+
workflowTokens: Be
|
|
2325
|
+
}) }) : null
|
|
2326
|
+
] }),
|
|
2327
|
+
C ? /* @__PURE__ */ E(S, {
|
|
2328
|
+
modalType: "standard",
|
|
2329
|
+
onClose: () => it(!1),
|
|
2330
|
+
open: L,
|
|
2331
|
+
showModalHeader: !0,
|
|
2332
|
+
size: "wide",
|
|
2333
|
+
supportingText: `${Ct(C.state)} · ${t(C.startedAt)}`,
|
|
2334
|
+
title: "流程圖",
|
|
2335
|
+
children: /* @__PURE__ */ D("div", {
|
|
2336
|
+
style: Qn,
|
|
2337
|
+
children: [/* @__PURE__ */ E("div", {
|
|
2338
|
+
style: $n,
|
|
2339
|
+
children: /* @__PURE__ */ D(rt, {
|
|
2340
|
+
edges: Zt,
|
|
2341
|
+
fitView: !0,
|
|
2342
|
+
fitViewOptions: { padding: .18 },
|
|
2343
|
+
maxZoom: 1.2,
|
|
2344
|
+
minZoom: .2,
|
|
2345
|
+
nodes: Xt,
|
|
2346
|
+
nodesDraggable: !1,
|
|
2347
|
+
nodesFocusable: !1,
|
|
2348
|
+
nodeTypes: sr,
|
|
2349
|
+
panOnDrag: !0,
|
|
2350
|
+
proOptions: { hideAttribution: !0 },
|
|
2351
|
+
children: [/* @__PURE__ */ E(nt, {}), /* @__PURE__ */ E(P, { showInteractive: !1 })]
|
|
2352
|
+
})
|
|
2353
|
+
}), Qt.length > 0 ? /* @__PURE__ */ E("div", {
|
|
2354
|
+
style: ir,
|
|
2355
|
+
children: Qt.map((e) => /* @__PURE__ */ E("span", {
|
|
2356
|
+
style: ar,
|
|
2357
|
+
children: e
|
|
2358
|
+
}, e))
|
|
2359
|
+
}) : null]
|
|
2360
|
+
})
|
|
2361
|
+
}) : null,
|
|
2362
|
+
/* @__PURE__ */ E(S, {
|
|
2363
|
+
modalType: "standard",
|
|
2364
|
+
onClose: () => {
|
|
2365
|
+
mt(null), _t(null);
|
|
2366
|
+
},
|
|
2367
|
+
open: !!(B && gt),
|
|
2368
|
+
showModalHeader: !0,
|
|
2369
|
+
size: "wide",
|
|
2370
|
+
supportingText: B?.filename ?? void 0,
|
|
2371
|
+
title: "PDF 預覽",
|
|
2372
|
+
children: gt ? /* @__PURE__ */ E(pt, {
|
|
2373
|
+
filename: B?.filename ?? "PDF 預覽",
|
|
2374
|
+
fileUrl: gt,
|
|
2375
|
+
onDownload: B ? () => void an(B) : void 0
|
|
2376
|
+
}) : null
|
|
2377
|
+
}),
|
|
2378
|
+
/* @__PURE__ */ E(S, {
|
|
2379
|
+
cancelText: "保留案件",
|
|
2380
|
+
confirmButtonProps: { variant: "destructive-primary" },
|
|
2381
|
+
confirmText: "確認取消",
|
|
2382
|
+
loading: Qe,
|
|
2383
|
+
modalStatusType: "error",
|
|
2384
|
+
modalType: "standard",
|
|
2385
|
+
onCancel: () => ot(!1),
|
|
2386
|
+
onClose: () => ot(!1),
|
|
2387
|
+
onConfirm: () => void cn(),
|
|
2388
|
+
open: z,
|
|
2389
|
+
showModalFooter: !0,
|
|
2390
|
+
showModalHeader: !0,
|
|
2391
|
+
supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
|
|
2392
|
+
title: "取消案件",
|
|
2393
|
+
children: /* @__PURE__ */ D("div", {
|
|
2394
|
+
style: or,
|
|
2395
|
+
children: [/* @__PURE__ */ D(w, {
|
|
2396
|
+
variant: "body",
|
|
2397
|
+
children: [
|
|
2398
|
+
"確定要取消「",
|
|
2399
|
+
C?.title ?? "",
|
|
2400
|
+
"」嗎?"
|
|
2401
|
+
]
|
|
2402
|
+
}), /* @__PURE__ */ E(n, {
|
|
2403
|
+
label: "取消原因",
|
|
2404
|
+
name: "cancelComment",
|
|
2405
|
+
children: /* @__PURE__ */ E(_e, {
|
|
2406
|
+
onChange: (e) => R(e.target.value),
|
|
2407
|
+
placeholder: "可填寫取消原因",
|
|
2408
|
+
resize: "vertical",
|
|
2409
|
+
rows: 3,
|
|
2410
|
+
value: at
|
|
2411
|
+
})
|
|
2412
|
+
})]
|
|
2413
|
+
})
|
|
2414
|
+
})
|
|
2415
|
+
] });
|
|
2416
|
+
}
|
|
2417
|
+
function lr(e) {
|
|
2418
|
+
return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
|
|
2419
|
+
}
|
|
2420
|
+
function ur(e) {
|
|
2421
|
+
return e.edges.map(lr).filter((e) => e.trim().length > 0);
|
|
2422
|
+
}
|
|
2423
|
+
function dr(e) {
|
|
2424
|
+
return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
|
|
2425
|
+
}
|
|
2426
|
+
function fr(e, t, n, r) {
|
|
2427
|
+
return e.nodes.map((e) => {
|
|
2428
|
+
let i = on(e, t, n, r);
|
|
2429
|
+
return {
|
|
2430
|
+
data: {
|
|
2431
|
+
kindLabel: dr(e.type),
|
|
2432
|
+
label: e.data.label,
|
|
2433
|
+
secondaryLabel: i.secondaryLabel,
|
|
2434
|
+
statusLabel: i.statusLabel,
|
|
2435
|
+
tone: i.tone
|
|
2436
|
+
},
|
|
2437
|
+
id: e.id,
|
|
2438
|
+
position: e.position,
|
|
2439
|
+
sourcePosition: I.Right,
|
|
2440
|
+
targetPosition: I.Left,
|
|
2441
|
+
type: "workflowRuntime"
|
|
2442
|
+
};
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
function pr(e) {
|
|
2446
|
+
let t = new L.graphlib.Graph();
|
|
2447
|
+
return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
|
|
2448
|
+
nodesep: 56,
|
|
2449
|
+
rankdir: "LR",
|
|
2450
|
+
ranksep: 120
|
|
2451
|
+
}), e.nodes.forEach((e) => {
|
|
2452
|
+
t.setNode(e.id, {
|
|
2453
|
+
height: Zn,
|
|
2454
|
+
width: Xn
|
|
2455
|
+
});
|
|
2456
|
+
}), e.edges.forEach((e) => {
|
|
2457
|
+
t.setEdge(e.source, e.target);
|
|
2458
|
+
}), L.layout(t), {
|
|
2459
|
+
...e,
|
|
2460
|
+
nodes: e.nodes.map((e) => {
|
|
2461
|
+
let n = t.node(e.id);
|
|
2462
|
+
return n ? {
|
|
2463
|
+
...e,
|
|
2464
|
+
position: {
|
|
2465
|
+
x: n.x - Xn / 2,
|
|
2466
|
+
y: n.y - Zn / 2
|
|
2467
|
+
}
|
|
2468
|
+
} : e;
|
|
2469
|
+
})
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
function mr(e) {
|
|
2473
|
+
return e.edges.map((e) => {
|
|
2474
|
+
let t = lr(e);
|
|
2475
|
+
return {
|
|
2476
|
+
animated: !1,
|
|
2477
|
+
id: e.id,
|
|
2478
|
+
label: t,
|
|
2479
|
+
labelBgBorderRadius: 6,
|
|
2480
|
+
labelBgPadding: [8, 4],
|
|
2481
|
+
labelBgStyle: {
|
|
2482
|
+
fill: e.data.isDefault ? "#f8fafc" : "#eff6ff",
|
|
2483
|
+
stroke: e.data.isDefault ? "#64748b" : "#2563eb",
|
|
2484
|
+
strokeWidth: 1
|
|
2485
|
+
},
|
|
2486
|
+
labelShowBg: !!t,
|
|
2487
|
+
labelStyle: {
|
|
2488
|
+
fill: e.data.isDefault ? "#475569" : "#2563eb",
|
|
2489
|
+
fontSize: 12,
|
|
2490
|
+
fontWeight: 600
|
|
2491
|
+
},
|
|
2492
|
+
source: e.source,
|
|
2493
|
+
style: {
|
|
2494
|
+
stroke: "#475569",
|
|
2495
|
+
strokeWidth: 1.5
|
|
2496
|
+
},
|
|
2497
|
+
target: e.target,
|
|
2498
|
+
type: e.type ?? "smoothstep"
|
|
2499
|
+
};
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
function hr(e) {
|
|
2503
|
+
return e === "current" ? {
|
|
2504
|
+
...er,
|
|
2505
|
+
border: "1px solid var(--mzn-color-primary, #0057ff)",
|
|
2506
|
+
boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
|
|
2507
|
+
} : e === "completed" ? {
|
|
2508
|
+
...er,
|
|
2509
|
+
border: "1px solid #16a34a"
|
|
2510
|
+
} : e === "cancelled" ? {
|
|
2511
|
+
...er,
|
|
2512
|
+
border: "1px solid #dc2626",
|
|
2513
|
+
opacity: .72
|
|
2514
|
+
} : e === "waiting" ? {
|
|
2515
|
+
...er,
|
|
2516
|
+
border: "1px dashed #64748b"
|
|
2517
|
+
} : er;
|
|
2518
|
+
}
|
|
2519
|
+
function gr(e) {
|
|
2520
|
+
let t = tr;
|
|
2521
|
+
return e === "current" ? {
|
|
2522
|
+
...t,
|
|
2523
|
+
background: "#eff6ff",
|
|
2524
|
+
color: "#2563eb"
|
|
2525
|
+
} : e === "completed" ? {
|
|
2526
|
+
...t,
|
|
2527
|
+
background: "#f0fdf4",
|
|
2528
|
+
color: "#15803d"
|
|
2529
|
+
} : e === "cancelled" ? {
|
|
2530
|
+
...t,
|
|
2531
|
+
background: "#fef2f2",
|
|
2532
|
+
color: "#dc2626"
|
|
2533
|
+
} : e === "waiting" ? {
|
|
2534
|
+
...t,
|
|
2535
|
+
background: "#f8fafc",
|
|
2536
|
+
color: "#475569"
|
|
2537
|
+
} : {
|
|
2538
|
+
...t,
|
|
2539
|
+
background: "#f1f5f9",
|
|
2540
|
+
color: "#64748b"
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
function _r({ data: e }) {
|
|
2544
|
+
return /* @__PURE__ */ D("div", {
|
|
2545
|
+
style: hr(e.tone),
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ E(F, {
|
|
2548
|
+
isConnectable: !1,
|
|
2549
|
+
position: I.Left,
|
|
2550
|
+
style: rr,
|
|
2551
|
+
type: "target"
|
|
2552
|
+
}),
|
|
2553
|
+
/* @__PURE__ */ E(w, {
|
|
2554
|
+
component: "span",
|
|
2555
|
+
ellipsis: !0,
|
|
2556
|
+
title: e.label,
|
|
2557
|
+
variant: "label-primary",
|
|
2558
|
+
children: e.label
|
|
2559
|
+
}),
|
|
2560
|
+
/* @__PURE__ */ E("span", {
|
|
2561
|
+
style: gr(e.tone),
|
|
2562
|
+
children: e.statusLabel
|
|
2563
|
+
}),
|
|
2564
|
+
/* @__PURE__ */ E("span", {
|
|
2565
|
+
title: e.secondaryLabel,
|
|
2566
|
+
style: nr,
|
|
2567
|
+
children: e.secondaryLabel || e.kindLabel
|
|
2568
|
+
}),
|
|
2569
|
+
/* @__PURE__ */ E(F, {
|
|
2570
|
+
isConnectable: !1,
|
|
2571
|
+
position: I.Right,
|
|
2572
|
+
style: rr,
|
|
2573
|
+
type: "source"
|
|
2574
|
+
})
|
|
2575
|
+
]
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
//#endregion
|
|
2579
|
+
export { Tn as a, kn as i, Hn as n, mn as o, Rn as r, fn as s, cr as t };
|
|
2580
|
+
|
|
2581
|
+
//# sourceMappingURL=detail-D6X61pkg.js.map
|