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