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