@rytass/bpm-core-react 0.7.1 → 0.7.3
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 +37 -0
- package/dist/chunks/orgs-BcaGmB_x.cjs +2 -0
- package/dist/chunks/orgs-BcaGmB_x.cjs.map +1 -0
- package/dist/chunks/{orgs-BywlqXaG.js → orgs-oYd1GaLX.js} +629 -530
- package/dist/chunks/orgs-oYd1GaLX.js.map +1 -0
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.js +1 -1
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/orgs-BbniWPB_.cjs +0 -2
- package/dist/chunks/orgs-BbniWPB_.cjs.map +0 -1
- package/dist/chunks/orgs-BywlqXaG.js.map +0 -1
|
@@ -7,16 +7,16 @@ import { resolveMembers as j } from "@rytass/bpm-core-client";
|
|
|
7
7
|
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
8
8
|
import F from "@mezzanine-ui/react/ContentHeader";
|
|
9
9
|
import { FormFieldLayout as I } from "@mezzanine-ui/core/form";
|
|
10
|
-
import { CloseIcon as ee, EditIcon as L, PlusIcon as R, SaveIcon as
|
|
11
|
-
import { commitOrgUnitTreeDraft as
|
|
12
|
-
import { Background as
|
|
13
|
-
import * as
|
|
10
|
+
import { CloseIcon as ee, EditIcon as L, PlusIcon as R, SaveIcon as z } from "@mezzanine-ui/icons";
|
|
11
|
+
import { commitOrgUnitTreeDraft as te, createManagerResolution as B, createMembership as ne, createOrgUnit as re, createPosition as ie, deleteManagerResolution as ae, deleteMembership as oe, deleteOrgUnit as se, readOrganizationDashboard as ce, updateManagerResolution as le, updateMembership as ue, updateOrgUnit as de, updatePosition as fe } from "@rytass/bpm-core-client/organization";
|
|
12
|
+
import { Background as pe, ConnectionMode as me, Controls as he, Handle as ge, MiniMap as _e, Position as V, ReactFlow as ve, applyNodeChanges as ye } from "@xyflow/react";
|
|
13
|
+
import * as be from "dagre";
|
|
14
14
|
import '../orgs.css';//#region src/lib/org-tree-draft.ts
|
|
15
|
-
function
|
|
15
|
+
function H(e) {
|
|
16
16
|
return new Map(e.map((e) => [e.id, e.parentId]));
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
let r = n === e ? e : n, i =
|
|
18
|
+
function xe({ orgUnitId: e, parentDraft: t, parentId: n }) {
|
|
19
|
+
let r = n === e ? e : n, i = Ce({
|
|
20
20
|
orgUnitId: e,
|
|
21
21
|
parentDraft: t,
|
|
22
22
|
parentId: r
|
|
@@ -38,7 +38,7 @@ function Te({ orgUnitId: e, parentDraft: t, parentId: n }) {
|
|
|
38
38
|
status: "UPDATED"
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Se({ orgUnits: e, parentDraft: t }) {
|
|
42
42
|
return e.map((e) => {
|
|
43
43
|
let n = t.get(e.id) ?? null;
|
|
44
44
|
return n === e.parentId ? null : {
|
|
@@ -48,14 +48,14 @@ function Ee({ orgUnits: e, parentDraft: t }) {
|
|
|
48
48
|
};
|
|
49
49
|
}).filter((e) => !!e);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return t.has(e) ? n ? t.has(n) ? n === e ? "組織不可成為自己的上層。" :
|
|
51
|
+
function Ce({ orgUnitId: e, parentDraft: t, parentId: n }) {
|
|
52
|
+
return t.has(e) ? n ? t.has(n) ? n === e ? "組織不可成為自己的上層。" : we({
|
|
53
53
|
orgUnitId: e,
|
|
54
54
|
parentDraft: t,
|
|
55
55
|
parentId: n
|
|
56
56
|
}) ? "不可搬移到自己的下層組織。" : null : "找不到新的上層組織。" : null : "找不到要搬移的組織節點。";
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function we({ orgUnitId: e, parentDraft: t, parentId: n }) {
|
|
59
59
|
let r = /* @__PURE__ */ new Set(), i = n;
|
|
60
60
|
for (; i;) {
|
|
61
61
|
if (i === e || r.has(i)) return !0;
|
|
@@ -63,7 +63,7 @@ function Oe({ orgUnitId: e, parentDraft: t, parentId: n }) {
|
|
|
63
63
|
}
|
|
64
64
|
return !1;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var U = {
|
|
67
67
|
orgTreeEditor: "bpm_orgTreeEditor_TMOtD",
|
|
68
68
|
orgTreeSummary: "bpm_orgTreeSummary_vpcV8",
|
|
69
69
|
orgTreeChangeList: "bpm_orgTreeChangeList_EzmOv",
|
|
@@ -76,157 +76,199 @@ var z = {
|
|
|
76
76
|
orgTreeNodeHeader: "bpm_orgTreeNodeHeader_LEXl-",
|
|
77
77
|
orgTreeNodeBadge: "bpm_orgTreeNodeBadge_zLc7t",
|
|
78
78
|
orgTreeNodeActions: "bpm_orgTreeNodeActions_cMldI"
|
|
79
|
-
},
|
|
79
|
+
}, W = "__org-tree-root__", G = 232, K = 118, Te = 232, Ee = 86, De = 320, Oe = 1.4, ke = .25, Ae = .005, je = 250, Me = 80, Ne = .85, q = .7, Pe = 1200, Fe = 600, Ie = 60, Le = 3, Re = 12, ze = {
|
|
80
80
|
COMPANY: "公司",
|
|
81
81
|
DEPARTMENT: "部門",
|
|
82
82
|
DIVISION: "事業群",
|
|
83
83
|
TEAM: "小組"
|
|
84
|
-
},
|
|
85
|
-
let [s,
|
|
84
|
+
}, Be = { orgUnit: He }, Ve = s(function({ onCreateChild: e, onCreateRoot: t, onEditOrgUnit: n, onSaveDraft: r, onStateChange: i, orgUnits: a }, o) {
|
|
85
|
+
let [s, m] = p(!1), [h, g] = p(null), [_, v] = p(null), [y, b] = p(() => H(a)), [x, S] = p(() => Ge(a, H(a))), [C, w] = p([]), T = f(null), E = f(null), D = c((e) => {
|
|
86
|
+
E.current = e, S((t) => {
|
|
87
|
+
let n = new Set(t);
|
|
88
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
89
|
+
});
|
|
90
|
+
}, []), O = d(() => new Map(a.map((e) => [e.id, e])), [a]), k = d(() => Se({
|
|
86
91
|
orgUnits: a,
|
|
87
|
-
parentDraft:
|
|
88
|
-
}), [a,
|
|
92
|
+
parentDraft: y
|
|
93
|
+
}), [a, y]), j = d(() => Ke({
|
|
94
|
+
collapsedIds: x,
|
|
89
95
|
isEditing: s,
|
|
90
96
|
onCreateChild: (n) => {
|
|
91
97
|
n ? e(n) : t();
|
|
92
98
|
},
|
|
93
99
|
onEditOrgUnit: (e) => {
|
|
94
|
-
let t =
|
|
100
|
+
let t = O.get(e);
|
|
95
101
|
t && n(t);
|
|
96
102
|
},
|
|
103
|
+
onToggleCollapse: D,
|
|
97
104
|
orgUnits: a,
|
|
98
|
-
orgUnitsById:
|
|
99
|
-
parentDraft:
|
|
100
|
-
selectedOrgUnitId:
|
|
105
|
+
orgUnitsById: O,
|
|
106
|
+
parentDraft: y,
|
|
107
|
+
selectedOrgUnitId: _
|
|
101
108
|
}), [
|
|
109
|
+
x,
|
|
110
|
+
D,
|
|
102
111
|
s,
|
|
103
112
|
e,
|
|
104
113
|
t,
|
|
105
114
|
n,
|
|
106
115
|
a,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
]),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
O,
|
|
117
|
+
y,
|
|
118
|
+
_
|
|
119
|
+
]), M = f(j);
|
|
120
|
+
M.current = j;
|
|
121
|
+
let F = k.length > 0, I = d(() => {
|
|
122
|
+
let e = Math.max(j.bounds.width, j.bounds.height);
|
|
123
|
+
return e <= 0 ? ke : Math.min(ke, Math.max(Ae, je / e));
|
|
124
|
+
}, [j.bounds.height, j.bounds.width]), ee = a.length <= Me, L = c(() => {
|
|
125
|
+
let e = T.current;
|
|
126
|
+
if (!e) return;
|
|
127
|
+
let { bounds: t, rootCenter: n } = M.current, r = t.width > 0 ? Pe / t.width : Infinity, i = t.height > 0 ? Fe / t.height : Infinity, a = Math.min(r, i);
|
|
128
|
+
if (!Number.isFinite(a) || a >= q) {
|
|
129
|
+
e.fitView({ padding: .18 });
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
let o = Fe / (2 * Ne);
|
|
133
|
+
e.setCenter(n.x, Math.min(t.height / 2, o), {
|
|
134
|
+
duration: 0,
|
|
135
|
+
zoom: Ne
|
|
136
|
+
});
|
|
137
|
+
}, []), R = c((e) => {
|
|
138
|
+
T.current = e, L();
|
|
139
|
+
}, [L]);
|
|
114
140
|
u(o, () => ({
|
|
115
|
-
cancelEditing:
|
|
116
|
-
saveDraft:
|
|
117
|
-
startEditing:
|
|
141
|
+
cancelEditing: ie,
|
|
142
|
+
saveDraft: ae,
|
|
143
|
+
startEditing: re
|
|
118
144
|
})), l(() => {
|
|
119
145
|
i({
|
|
120
|
-
hasDraftChanges:
|
|
146
|
+
hasDraftChanges: F,
|
|
121
147
|
isEditing: s
|
|
122
148
|
});
|
|
123
149
|
}, [
|
|
124
|
-
|
|
150
|
+
F,
|
|
125
151
|
s,
|
|
126
152
|
i
|
|
127
153
|
]), l(() => {
|
|
128
|
-
|
|
154
|
+
let e = H(a);
|
|
155
|
+
b(e), S(Ge(a, e)), v(null), g(null), m(!1);
|
|
129
156
|
}, [a]), l(() => {
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
w(j.nodes);
|
|
158
|
+
}, [j.nodes]), l(() => {
|
|
159
|
+
if (typeof window > "u") return () => void 0;
|
|
160
|
+
let e = window.requestAnimationFrame(() => {
|
|
161
|
+
L();
|
|
162
|
+
});
|
|
163
|
+
return () => window.cancelAnimationFrame(e);
|
|
164
|
+
}, [L, a]), l(() => {
|
|
165
|
+
let e = E.current;
|
|
166
|
+
if (!e) return;
|
|
167
|
+
E.current = null;
|
|
168
|
+
let t = T.current, n = j.nodes.find((t) => t.id === e);
|
|
169
|
+
!t || !n || t.setCenter(n.position.x + (n.width ?? G) / 2, n.position.y + (n.height ?? K) / 2, {
|
|
170
|
+
duration: 200,
|
|
171
|
+
zoom: t.getZoom()
|
|
172
|
+
});
|
|
173
|
+
}, [j.nodes]);
|
|
174
|
+
let z = c((e, t) => {
|
|
175
|
+
b((n) => {
|
|
176
|
+
let r = xe({
|
|
135
177
|
orgUnitId: e,
|
|
136
178
|
parentDraft: n,
|
|
137
179
|
parentId: t
|
|
138
180
|
});
|
|
139
|
-
return
|
|
181
|
+
return g(r.message), r.parentDraft;
|
|
140
182
|
});
|
|
141
|
-
}, []),
|
|
183
|
+
}, []), te = c((e) => {
|
|
142
184
|
if (!s || !e.target || !e.source) return;
|
|
143
|
-
let t = e.source ===
|
|
144
|
-
if (e.target ===
|
|
145
|
-
|
|
185
|
+
let t = e.source === W ? null : e.source;
|
|
186
|
+
if (e.target === W) {
|
|
187
|
+
g("根節點不能搬移到其他節點下。");
|
|
146
188
|
return;
|
|
147
189
|
}
|
|
148
|
-
|
|
149
|
-
}, [
|
|
150
|
-
s &&
|
|
151
|
-
}, [s]),
|
|
152
|
-
if (!s || t.id ===
|
|
153
|
-
let r =
|
|
190
|
+
z(e.target, t);
|
|
191
|
+
}, [z, s]), B = c((e) => {
|
|
192
|
+
s && w((t) => ye(e, [...t]));
|
|
193
|
+
}, [s]), ne = c((e, t, n) => {
|
|
194
|
+
if (!s || t.id === W) return;
|
|
195
|
+
let r = Ye(e, t.id) ?? Je(t, n);
|
|
154
196
|
if (r === void 0) {
|
|
155
|
-
|
|
197
|
+
g("拖曳到目標父節點附近,或從父節點拉線到子節點。");
|
|
156
198
|
return;
|
|
157
199
|
}
|
|
158
|
-
|
|
159
|
-
}, [
|
|
160
|
-
function
|
|
161
|
-
|
|
200
|
+
z(t.id, r === W ? null : r);
|
|
201
|
+
}, [z, s]);
|
|
202
|
+
function re() {
|
|
203
|
+
m(!0), b(H(a)), g("已進入編輯模式,拖曳節點或拉線只會更新前端草稿。");
|
|
162
204
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
205
|
+
function ie() {
|
|
206
|
+
m(!1), b(H(a)), g("已取消草稿變更。");
|
|
165
207
|
}
|
|
166
|
-
async function
|
|
208
|
+
async function ae() {
|
|
167
209
|
if (!r) {
|
|
168
|
-
|
|
210
|
+
g("批次儲存 API 尚未接上,草稿仍保留在前端。");
|
|
169
211
|
return;
|
|
170
212
|
}
|
|
171
|
-
await r(
|
|
213
|
+
await r(k), m(!1), g("組織樹草稿已儲存。");
|
|
172
214
|
}
|
|
173
215
|
return /* @__PURE__ */ P("div", {
|
|
174
|
-
className:
|
|
216
|
+
className: U.orgTreeEditor,
|
|
175
217
|
children: [/* @__PURE__ */ P("div", {
|
|
176
|
-
className:
|
|
218
|
+
className: U.orgTreeSummary,
|
|
177
219
|
children: [/* @__PURE__ */ N(A, {
|
|
178
220
|
color: "text-neutral",
|
|
179
221
|
variant: "caption",
|
|
180
|
-
children:
|
|
181
|
-
}),
|
|
182
|
-
className:
|
|
183
|
-
children:
|
|
184
|
-
|
|
222
|
+
children: h ?? (F ? `目前有 ${k.length} 筆父子關係草稿變更。` : "目前沒有草稿變更。")
|
|
223
|
+
}), F ? /* @__PURE__ */ N("ul", {
|
|
224
|
+
className: U.orgTreeChangeList,
|
|
225
|
+
children: k.map((e) => /* @__PURE__ */ P("li", { children: [
|
|
226
|
+
J(e.orgUnitId, O),
|
|
185
227
|
":",
|
|
186
|
-
|
|
228
|
+
J(e.previousParentId, O),
|
|
187
229
|
" -> ",
|
|
188
|
-
|
|
230
|
+
J(e.parentId, O)
|
|
189
231
|
] }, e.orgUnitId))
|
|
190
232
|
}) : null]
|
|
191
233
|
}), /* @__PURE__ */ N("div", {
|
|
192
|
-
className:
|
|
193
|
-
children: /* @__PURE__ */ P(
|
|
194
|
-
connectionMode:
|
|
195
|
-
edges: [...
|
|
196
|
-
fitView: !0,
|
|
234
|
+
className: U.orgTreeCanvas,
|
|
235
|
+
children: /* @__PURE__ */ P(ve, {
|
|
236
|
+
connectionMode: me.Strict,
|
|
237
|
+
edges: [...j.edges],
|
|
197
238
|
fitViewOptions: {
|
|
198
|
-
minZoom:
|
|
239
|
+
minZoom: I,
|
|
199
240
|
padding: .18
|
|
200
241
|
},
|
|
201
|
-
isValidConnection: (e) =>
|
|
242
|
+
isValidConnection: (e) => et({
|
|
202
243
|
source: e.source,
|
|
203
244
|
target: e.target
|
|
204
|
-
},
|
|
205
|
-
maxZoom:
|
|
206
|
-
minZoom:
|
|
207
|
-
nodeTypes:
|
|
208
|
-
nodes: [...
|
|
245
|
+
}, y),
|
|
246
|
+
maxZoom: Oe,
|
|
247
|
+
minZoom: I,
|
|
248
|
+
nodeTypes: Be,
|
|
249
|
+
nodes: [...C],
|
|
209
250
|
nodesConnectable: s,
|
|
210
251
|
nodesDraggable: s,
|
|
211
|
-
onConnect:
|
|
252
|
+
onConnect: te,
|
|
253
|
+
onInit: R,
|
|
212
254
|
onNodeClick: (e, t) => {
|
|
213
|
-
|
|
255
|
+
v(t.id === W ? null : t.id);
|
|
214
256
|
},
|
|
215
257
|
onNodeDoubleClick: (e, t) => {
|
|
216
|
-
if (t.id !==
|
|
217
|
-
let e =
|
|
258
|
+
if (t.id !== W) {
|
|
259
|
+
let e = O.get(t.id);
|
|
218
260
|
e && n(e);
|
|
219
261
|
}
|
|
220
262
|
},
|
|
221
|
-
onNodeDragStop:
|
|
222
|
-
onNodesChange:
|
|
223
|
-
onPaneClick: () =>
|
|
263
|
+
onNodeDragStop: ne,
|
|
264
|
+
onNodesChange: B,
|
|
265
|
+
onPaneClick: () => v(null),
|
|
224
266
|
panOnDrag: !0,
|
|
225
267
|
proOptions: { hideAttribution: !0 },
|
|
226
268
|
children: [
|
|
269
|
+
/* @__PURE__ */ N(pe, {}),
|
|
227
270
|
/* @__PURE__ */ N(he, {}),
|
|
228
|
-
/* @__PURE__ */ N(_e, {
|
|
229
|
-
D ? /* @__PURE__ */ N(ye, {
|
|
271
|
+
ee ? /* @__PURE__ */ N(_e, {
|
|
230
272
|
pannable: !0,
|
|
231
273
|
zoomable: !0
|
|
232
274
|
}) : null
|
|
@@ -235,30 +277,30 @@ var z = {
|
|
|
235
277
|
})]
|
|
236
278
|
});
|
|
237
279
|
});
|
|
238
|
-
function
|
|
280
|
+
function He({ data: e, selected: t }) {
|
|
239
281
|
return /* @__PURE__ */ P("div", {
|
|
240
282
|
className: [
|
|
241
|
-
|
|
242
|
-
e.isSyntheticRoot ?
|
|
243
|
-
e.changed ?
|
|
244
|
-
e.deleted ?
|
|
245
|
-
t ?
|
|
283
|
+
U.orgTreeNode,
|
|
284
|
+
e.isSyntheticRoot ? U.orgTreeNodeRoot : "",
|
|
285
|
+
e.changed ? U.orgTreeNodeChanged : "",
|
|
286
|
+
e.deleted ? U.orgTreeNodeDeleted : "",
|
|
287
|
+
t ? U.orgTreeNodeSelected : ""
|
|
246
288
|
].filter(Boolean).join(" "),
|
|
247
289
|
children: [
|
|
248
|
-
e.isSyntheticRoot ? null : /* @__PURE__ */ N(
|
|
290
|
+
e.isSyntheticRoot ? null : /* @__PURE__ */ N(ge, {
|
|
249
291
|
id: "target",
|
|
250
292
|
isConnectable: e.isEditing,
|
|
251
|
-
position:
|
|
293
|
+
position: V.Top,
|
|
252
294
|
type: "target"
|
|
253
295
|
}),
|
|
254
|
-
/* @__PURE__ */ N(
|
|
296
|
+
/* @__PURE__ */ N(ge, {
|
|
255
297
|
id: "source",
|
|
256
298
|
isConnectable: e.isEditing,
|
|
257
|
-
position:
|
|
299
|
+
position: V.Bottom,
|
|
258
300
|
type: "source"
|
|
259
301
|
}),
|
|
260
302
|
/* @__PURE__ */ P("div", {
|
|
261
|
-
className:
|
|
303
|
+
className: U.orgTreeNodeHeader,
|
|
262
304
|
children: [/* @__PURE__ */ N(A, {
|
|
263
305
|
component: "span",
|
|
264
306
|
ellipsis: !0,
|
|
@@ -266,7 +308,7 @@ function Be({ data: e, selected: t }) {
|
|
|
266
308
|
variant: "label-primary",
|
|
267
309
|
children: e.name
|
|
268
310
|
}), e.changed ? /* @__PURE__ */ N("span", {
|
|
269
|
-
className:
|
|
311
|
+
className: U.orgTreeNodeBadge,
|
|
270
312
|
children: "草稿"
|
|
271
313
|
}) : null]
|
|
272
314
|
}),
|
|
@@ -286,9 +328,16 @@ function Be({ data: e, selected: t }) {
|
|
|
286
328
|
variant: "caption",
|
|
287
329
|
children: ["上層:", e.parentLabel]
|
|
288
330
|
}),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
className:
|
|
291
|
-
children: e.
|
|
331
|
+
/* @__PURE__ */ P("div", {
|
|
332
|
+
className: `${U.orgTreeNodeActions} nodrag nopan`,
|
|
333
|
+
children: [e.childCount > 0 ? /* @__PURE__ */ N(h, {
|
|
334
|
+
onClick: (t) => {
|
|
335
|
+
t.stopPropagation(), e.onToggleCollapse(e.orgUnitId ?? W);
|
|
336
|
+
},
|
|
337
|
+
size: "sub",
|
|
338
|
+
variant: "base-secondary",
|
|
339
|
+
children: e.collapsed ? `展開 (${e.childCount})` : `收合 (${e.childCount})`
|
|
340
|
+
}) : null, e.isSyntheticRoot ? /* @__PURE__ */ N(h, {
|
|
292
341
|
icon: R,
|
|
293
342
|
iconType: "leading",
|
|
294
343
|
onClick: () => e.onCreateChild(null),
|
|
@@ -311,100 +360,150 @@ function Be({ data: e, selected: t }) {
|
|
|
311
360
|
size: "sub",
|
|
312
361
|
variant: "base-secondary",
|
|
313
362
|
children: "新增子節點"
|
|
314
|
-
})] })
|
|
363
|
+
})] })]
|
|
315
364
|
})
|
|
316
365
|
]
|
|
317
366
|
});
|
|
318
367
|
}
|
|
319
|
-
function
|
|
320
|
-
let
|
|
321
|
-
|
|
368
|
+
function Ue(e, t) {
|
|
369
|
+
let n = /* @__PURE__ */ new Map();
|
|
370
|
+
return e.forEach((e) => {
|
|
371
|
+
let r = t.get(e.id) ?? W;
|
|
372
|
+
n.set(r, [...n.get(r) ?? [], e.id]);
|
|
373
|
+
}), n;
|
|
374
|
+
}
|
|
375
|
+
function We({ childrenMap: e, collapsedIds: t }) {
|
|
376
|
+
let n = /* @__PURE__ */ new Set(), r = (i) => {
|
|
377
|
+
t.has(i) || (e.get(i) ?? []).forEach((e) => {
|
|
378
|
+
n.add(e), r(e);
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
return r(W), n;
|
|
382
|
+
}
|
|
383
|
+
function Ge(e, t) {
|
|
384
|
+
if (e.length <= Ie) return /* @__PURE__ */ new Set();
|
|
385
|
+
let n = Ue(e, t), r = /* @__PURE__ */ new Set(), i = [W], a = 0;
|
|
386
|
+
for (; i.length > 0 && a < Le;) {
|
|
387
|
+
let e = i.flatMap((e) => n.get(e) ?? []);
|
|
388
|
+
if (e.length > Re) break;
|
|
389
|
+
i.forEach((e) => {
|
|
390
|
+
r.add(e);
|
|
391
|
+
}), i = e, a += 1;
|
|
392
|
+
}
|
|
393
|
+
let o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
394
|
+
let t = n.get(e) ?? [];
|
|
395
|
+
t.length !== 0 && (r.has(e) || o.add(e), t.forEach(s));
|
|
396
|
+
};
|
|
397
|
+
return s(W), o;
|
|
398
|
+
}
|
|
399
|
+
function Ke({ collapsedIds: e, isEditing: t, onCreateChild: n, onEditOrgUnit: r, onToggleCollapse: i, orgUnits: a, orgUnitsById: o, parentDraft: s, selectedOrgUnitId: c }) {
|
|
400
|
+
let l = Ue(a, s), u = We({
|
|
401
|
+
childrenMap: l,
|
|
402
|
+
collapsedIds: e
|
|
403
|
+
}), d = a.filter((e) => u.has(e.id)), f = (e) => l.get(e)?.length ?? 0, p = new be.graphlib.Graph();
|
|
404
|
+
p.setDefaultEdgeLabel(() => ({})), p.setGraph({
|
|
322
405
|
marginx: 36,
|
|
323
406
|
marginy: 36,
|
|
324
407
|
nodesep: 44,
|
|
325
408
|
rankdir: "TB"
|
|
326
|
-
}),
|
|
327
|
-
height:
|
|
328
|
-
width:
|
|
329
|
-
}),
|
|
330
|
-
|
|
331
|
-
height:
|
|
332
|
-
width:
|
|
409
|
+
}), p.setNode(W, {
|
|
410
|
+
height: Ee,
|
|
411
|
+
width: Te
|
|
412
|
+
}), d.forEach((e) => {
|
|
413
|
+
p.setNode(e.id, {
|
|
414
|
+
height: K,
|
|
415
|
+
width: G
|
|
333
416
|
});
|
|
334
|
-
}),
|
|
335
|
-
let t =
|
|
336
|
-
|
|
337
|
-
}),
|
|
338
|
-
let
|
|
339
|
-
height:
|
|
340
|
-
width:
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
417
|
+
}), d.forEach((e) => {
|
|
418
|
+
let t = s.get(e.id) ?? null;
|
|
419
|
+
p.setEdge(t ?? W, e.id);
|
|
420
|
+
}), be.layout(p);
|
|
421
|
+
let m = p.graph(), h = {
|
|
422
|
+
height: m.height ?? 0,
|
|
423
|
+
width: m.width ?? 0
|
|
424
|
+
}, g = p.node(W), _ = {
|
|
425
|
+
x: h.width > 0 ? h.width / 2 : g?.x ?? 0,
|
|
426
|
+
y: g?.y ?? 0
|
|
427
|
+
}, v = {
|
|
428
|
+
...qe({
|
|
429
|
+
data: {
|
|
430
|
+
changed: !1,
|
|
431
|
+
childCount: f(W),
|
|
432
|
+
code: W,
|
|
433
|
+
collapsed: e.has(W),
|
|
434
|
+
deleted: !1,
|
|
435
|
+
isEditing: t,
|
|
436
|
+
isSyntheticRoot: !0,
|
|
437
|
+
name: "組織根節點",
|
|
438
|
+
onCreateChild: n,
|
|
439
|
+
onEdit: r,
|
|
440
|
+
onToggleCollapse: i,
|
|
441
|
+
orgUnitId: null,
|
|
442
|
+
parentLabel: "",
|
|
443
|
+
path: "",
|
|
444
|
+
typeLabel: ""
|
|
445
|
+
},
|
|
446
|
+
graph: p,
|
|
447
|
+
height: Ee,
|
|
448
|
+
id: W,
|
|
449
|
+
selected: c === null,
|
|
450
|
+
width: Te
|
|
451
|
+
}),
|
|
452
|
+
position: {
|
|
453
|
+
x: _.x - Te / 2,
|
|
454
|
+
y: _.y - Ee / 2
|
|
455
|
+
}
|
|
456
|
+
}, y = d.map((a) => {
|
|
457
|
+
let l = s.get(a.id) ?? null, u = J(l, o);
|
|
458
|
+
return qe({
|
|
364
459
|
data: {
|
|
365
|
-
changed:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
460
|
+
changed: l !== a.parentId,
|
|
461
|
+
childCount: f(a.id),
|
|
462
|
+
code: a.code,
|
|
463
|
+
collapsed: e.has(a.id),
|
|
464
|
+
deleted: !!a.deletedAt,
|
|
465
|
+
isEditing: t,
|
|
369
466
|
isSyntheticRoot: !1,
|
|
370
|
-
name:
|
|
371
|
-
onCreateChild:
|
|
372
|
-
onEdit:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
467
|
+
name: a.name,
|
|
468
|
+
onCreateChild: n,
|
|
469
|
+
onEdit: r,
|
|
470
|
+
onToggleCollapse: i,
|
|
471
|
+
orgUnitId: a.id,
|
|
472
|
+
parentLabel: u,
|
|
473
|
+
path: a.path,
|
|
474
|
+
typeLabel: tt(a.type)
|
|
377
475
|
},
|
|
378
|
-
graph:
|
|
379
|
-
height:
|
|
380
|
-
id:
|
|
381
|
-
selected:
|
|
382
|
-
width:
|
|
476
|
+
graph: p,
|
|
477
|
+
height: K,
|
|
478
|
+
id: a.id,
|
|
479
|
+
selected: c === a.id,
|
|
480
|
+
width: G
|
|
383
481
|
});
|
|
384
482
|
});
|
|
385
483
|
return {
|
|
386
|
-
bounds:
|
|
387
|
-
edges:
|
|
388
|
-
let n =
|
|
484
|
+
bounds: h,
|
|
485
|
+
edges: d.map((e) => {
|
|
486
|
+
let n = s.get(e.id) ?? null, r = n !== e.parentId;
|
|
389
487
|
return {
|
|
390
|
-
animated:
|
|
488
|
+
animated: t && r,
|
|
391
489
|
data: {},
|
|
392
|
-
id: `org-tree-edge-${n ?? "root"}-${
|
|
393
|
-
source: n ??
|
|
490
|
+
id: `org-tree-edge-${n ?? "root"}-${e.id}`,
|
|
491
|
+
source: n ?? W,
|
|
394
492
|
sourceHandle: "source",
|
|
395
493
|
style: r ? {
|
|
396
494
|
stroke: "var(--mzn-color-primary, #0057ff)",
|
|
397
495
|
strokeWidth: 2
|
|
398
496
|
} : void 0,
|
|
399
|
-
target:
|
|
497
|
+
target: e.id,
|
|
400
498
|
targetHandle: "target",
|
|
401
499
|
type: "smoothstep"
|
|
402
500
|
};
|
|
403
501
|
}),
|
|
404
|
-
nodes: [
|
|
502
|
+
nodes: [v, ...y],
|
|
503
|
+
rootCenter: _
|
|
405
504
|
};
|
|
406
505
|
}
|
|
407
|
-
function
|
|
506
|
+
function qe({ data: e, graph: t, height: n, id: r, selected: i, width: a }) {
|
|
408
507
|
let o = t.node(r);
|
|
409
508
|
return {
|
|
410
509
|
data: e,
|
|
@@ -420,68 +519,68 @@ function He({ data: e, graph: t, height: n, id: r, selected: i, width: a }) {
|
|
|
420
519
|
y: 0
|
|
421
520
|
},
|
|
422
521
|
selected: i,
|
|
423
|
-
sourcePosition:
|
|
424
|
-
targetPosition:
|
|
522
|
+
sourcePosition: V.Bottom,
|
|
523
|
+
targetPosition: V.Top,
|
|
425
524
|
type: "orgUnit",
|
|
426
525
|
width: a
|
|
427
526
|
};
|
|
428
527
|
}
|
|
429
|
-
function
|
|
430
|
-
let n =
|
|
528
|
+
function Je(e, t) {
|
|
529
|
+
let n = Qe(e);
|
|
431
530
|
return t.filter((t) => t.id !== e.id).map((e) => ({
|
|
432
|
-
distance:
|
|
531
|
+
distance: $e(n, Qe(e)),
|
|
433
532
|
id: e.id
|
|
434
|
-
})).filter((e) => e.distance <=
|
|
533
|
+
})).filter((e) => e.distance <= De).sort((e, t) => e.distance - t.distance)[0]?.id;
|
|
435
534
|
}
|
|
436
|
-
function
|
|
437
|
-
let n =
|
|
535
|
+
function Ye(e, t) {
|
|
536
|
+
let n = Xe(e);
|
|
438
537
|
if (n) return Array.from(document.querySelectorAll(".react-flow__node[data-id]")).map((e) => {
|
|
439
538
|
let r = e.dataset.id;
|
|
440
539
|
if (!r || r === t) return null;
|
|
441
540
|
let i = e.getBoundingClientRect();
|
|
442
541
|
return {
|
|
443
|
-
distance:
|
|
542
|
+
distance: $e(n, {
|
|
444
543
|
x: i.left + i.width / 2,
|
|
445
544
|
y: i.top + i.height / 2
|
|
446
545
|
}),
|
|
447
546
|
id: r
|
|
448
547
|
};
|
|
449
|
-
}).filter((e) => !!e).filter((e) => e.distance <=
|
|
548
|
+
}).filter((e) => !!e).filter((e) => e.distance <= De).sort((e, t) => e.distance - t.distance)[0]?.id;
|
|
450
549
|
}
|
|
451
|
-
function
|
|
452
|
-
return
|
|
550
|
+
function Xe(e) {
|
|
551
|
+
return Ze(e) ? {
|
|
453
552
|
x: e.clientX,
|
|
454
553
|
y: e.clientY
|
|
455
554
|
} : null;
|
|
456
555
|
}
|
|
457
|
-
function
|
|
556
|
+
function Ze(e) {
|
|
458
557
|
return typeof e == "object" && !!e && "clientX" in e && "clientY" in e && typeof e.clientX == "number" && typeof e.clientY == "number";
|
|
459
558
|
}
|
|
460
|
-
function
|
|
559
|
+
function Qe(e) {
|
|
461
560
|
return {
|
|
462
|
-
x: e.position.x + (e.width ??
|
|
463
|
-
y: e.position.y + (e.height ??
|
|
561
|
+
x: e.position.x + (e.width ?? G) / 2,
|
|
562
|
+
y: e.position.y + (e.height ?? K) / 2
|
|
464
563
|
};
|
|
465
564
|
}
|
|
466
|
-
function
|
|
565
|
+
function $e(e, t) {
|
|
467
566
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
468
567
|
}
|
|
469
|
-
function
|
|
470
|
-
return !e.source || !e.target || e.target ===
|
|
568
|
+
function et(e, t) {
|
|
569
|
+
return !e.source || !e.target || e.target === W ? !1 : Ce({
|
|
471
570
|
orgUnitId: e.target,
|
|
472
571
|
parentDraft: t,
|
|
473
|
-
parentId: e.source ===
|
|
572
|
+
parentId: e.source === W ? null : e.source
|
|
474
573
|
}) === null;
|
|
475
574
|
}
|
|
476
|
-
function
|
|
575
|
+
function J(e, t) {
|
|
477
576
|
if (!e) return "根節點";
|
|
478
577
|
let n = t.get(e);
|
|
479
578
|
return n ? `${n.name} · ${n.code}` : "未知組織";
|
|
480
579
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
580
|
+
function tt(e) {
|
|
581
|
+
return ze[e.toUpperCase()] ?? "未知類型";
|
|
483
582
|
}
|
|
484
|
-
var
|
|
583
|
+
var Y = {
|
|
485
584
|
tableIntroActions: "bpm_tableIntroActions_WO4XU",
|
|
486
585
|
modalFields: "bpm_modalFields_juyv6",
|
|
487
586
|
tableIntro: "bpm_tableIntro_u3hcm",
|
|
@@ -489,10 +588,10 @@ var W = {
|
|
|
489
588
|
orgFilterArea: "bpm_orgFilterArea_Xjbbp",
|
|
490
589
|
membershipFilterArea: "bpm_membershipFilterArea_zob-Y",
|
|
491
590
|
scopeLabel: "bpm_scopeLabel_TLHMC"
|
|
492
|
-
},
|
|
591
|
+
}, nt = {
|
|
493
592
|
hasDraftChanges: !1,
|
|
494
593
|
isEditing: !1
|
|
495
|
-
},
|
|
594
|
+
}, X = [
|
|
496
595
|
{
|
|
497
596
|
id: "COMPANY",
|
|
498
597
|
name: "公司"
|
|
@@ -509,10 +608,10 @@ var W = {
|
|
|
509
608
|
id: "TEAM",
|
|
510
609
|
name: "小組"
|
|
511
610
|
}
|
|
512
|
-
],
|
|
611
|
+
], rt = {
|
|
513
612
|
id: "ALL",
|
|
514
613
|
name: "全部類型"
|
|
515
|
-
},
|
|
614
|
+
}, it = [rt, ...X], Z = [
|
|
516
615
|
{
|
|
517
616
|
id: "MEMBER",
|
|
518
617
|
name: "指定會員"
|
|
@@ -525,18 +624,18 @@ var W = {
|
|
|
525
624
|
id: "POSITION",
|
|
526
625
|
name: "指定職位"
|
|
527
626
|
}
|
|
528
|
-
],
|
|
627
|
+
], at = {
|
|
529
628
|
id: "ALL",
|
|
530
629
|
name: "全部範圍"
|
|
531
|
-
},
|
|
630
|
+
}, ot = [at, ...Z], st = {
|
|
532
631
|
activeOnly: !1,
|
|
533
632
|
id: "ALL",
|
|
534
633
|
name: "全部狀態"
|
|
535
|
-
},
|
|
634
|
+
}, ct = [st, {
|
|
536
635
|
activeOnly: !0,
|
|
537
636
|
id: "ACTIVE",
|
|
538
637
|
name: "目前有效"
|
|
539
|
-
}],
|
|
638
|
+
}], Q = [{
|
|
540
639
|
id: "true",
|
|
541
640
|
name: "主要歸屬",
|
|
542
641
|
value: !0
|
|
@@ -544,40 +643,40 @@ var W = {
|
|
|
544
643
|
id: "false",
|
|
545
644
|
name: "一般歸屬",
|
|
546
645
|
value: !1
|
|
547
|
-
}],
|
|
646
|
+
}], lt = [
|
|
548
647
|
10,
|
|
549
648
|
20,
|
|
550
649
|
50
|
|
551
|
-
],
|
|
552
|
-
function
|
|
553
|
-
let [e, t] = p("ORG_UNITS"), [n, r] = p(null), [i, a] = p(null), [o, s] = p(null), [u, f] = p(!0), [m, h] = p(null), [g, _] = p(
|
|
650
|
+
], ut = 1368, dt = 908, ft = 1292, pt = 1124;
|
|
651
|
+
function mt() {
|
|
652
|
+
let [e, t] = p("ORG_UNITS"), [n, r] = p(null), [i, a] = p(null), [o, s] = p(null), [u, f] = p(!0), [m, h] = p(null), [g, _] = p(st), [v, y] = p(1), [b, x] = p(10), [E, k] = p(at), [I, ee] = p(0), [L, R] = p([]), [z, pe] = p(null), [me, he] = p(null), [ge, _e] = p(null), [V, ve] = p(1), [ye, be] = p(10), [H, xe] = p(null), [Se, Ce] = p(0), [we, U] = p(null), [W, G] = p(1), [K, Te] = p(10), [Ee, De] = p(""), [Oe, ke] = p(0), [Ae, je] = p(rt), [Me, Ne] = p("TABLE"), [q, Pe] = p([]), [Fe, Ie] = p([]), [Le, Re] = p([]), [ze, Be] = p(null), [Ve, He] = p(1), [Ue, We] = p(10), [Ge, Ke] = p(""), [qe, Je] = p(0), [Ye, Xe] = p([]), [Ze, Qe] = p([]), [$e, et] = p([]), [J, tt] = p(!1);
|
|
554
653
|
l(() => {
|
|
555
654
|
n && a(n);
|
|
556
655
|
}, [n]);
|
|
557
|
-
let
|
|
656
|
+
let Y = n ?? i, nt = c(async () => {
|
|
558
657
|
f(!0), s(null);
|
|
559
658
|
try {
|
|
560
|
-
let e = await
|
|
659
|
+
let e = await ce({
|
|
561
660
|
managerActiveOnly: g.activeOnly,
|
|
562
661
|
managerPage: v,
|
|
563
662
|
managerPageSize: b,
|
|
564
663
|
managerScopeType: E.id === "ALL" ? null : E.id,
|
|
565
|
-
membershipActiveOnly:
|
|
566
|
-
membershipOrgUnitId:
|
|
567
|
-
membershipPage:
|
|
568
|
-
membershipPageSize:
|
|
569
|
-
membershipPositionId:
|
|
570
|
-
orgUnitPage:
|
|
571
|
-
orgUnitPageSize:
|
|
572
|
-
orgUnitSearchText:
|
|
573
|
-
orgUnitType:
|
|
574
|
-
positionPage:
|
|
575
|
-
positionPageSize:
|
|
576
|
-
positionSearchText:
|
|
664
|
+
membershipActiveOnly: z?.activeOnly ?? !1,
|
|
665
|
+
membershipOrgUnitId: ge?.id ?? null,
|
|
666
|
+
membershipPage: V,
|
|
667
|
+
membershipPageSize: ye,
|
|
668
|
+
membershipPositionId: H?.id ?? null,
|
|
669
|
+
orgUnitPage: W,
|
|
670
|
+
orgUnitPageSize: K,
|
|
671
|
+
orgUnitSearchText: Ee,
|
|
672
|
+
orgUnitType: Ae.id === "ALL" ? null : Ae.id,
|
|
673
|
+
positionPage: Ve,
|
|
674
|
+
positionPageSize: Ue,
|
|
675
|
+
positionSearchText: Ge
|
|
577
676
|
});
|
|
578
|
-
R(await j(
|
|
677
|
+
R(await j(kt(e.memberships, e.managerResolutions))), Pe(e.orgUnits), ke(e.orgUnitCount), Ie(e.filteredOrgUnits), Xe(e.positions), Je(e.positionCount), Re(e.filteredPositions), Ce(e.membershipCount), et(e.filteredMemberships), ee(e.managerResolutionCount), Qe(e.filteredManagerResolutions);
|
|
579
678
|
} catch (e) {
|
|
580
|
-
s(
|
|
679
|
+
s(Qt(e));
|
|
581
680
|
} finally {
|
|
582
681
|
f(!1);
|
|
583
682
|
}
|
|
@@ -586,59 +685,59 @@ function st() {
|
|
|
586
685
|
v,
|
|
587
686
|
b,
|
|
588
687
|
E,
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
688
|
+
z,
|
|
689
|
+
ge,
|
|
690
|
+
V,
|
|
691
|
+
ye,
|
|
692
|
+
H,
|
|
693
|
+
W,
|
|
694
|
+
K,
|
|
695
|
+
Ee,
|
|
696
|
+
Ae,
|
|
697
|
+
Ve,
|
|
698
|
+
Ue,
|
|
699
|
+
Ge
|
|
601
700
|
]);
|
|
602
701
|
l(() => {
|
|
603
|
-
|
|
604
|
-
}, [
|
|
605
|
-
let
|
|
702
|
+
nt();
|
|
703
|
+
}, [nt]);
|
|
704
|
+
let X = d(() => new Map(q.map((e) => [e.id, e])), [q]), it = d(() => new Map(Ye.map((e) => [e.id, e])), [Ye]), Z = d(() => new Map(L.map((e) => [e.memberId, e])), [L]), ot = d(() => Fe.map((e) => ({
|
|
606
705
|
...e,
|
|
607
706
|
key: e.id,
|
|
608
|
-
parentName: e.parentId ?
|
|
609
|
-
typeLabel:
|
|
610
|
-
})), [
|
|
707
|
+
parentName: e.parentId ? Mt(X.get(e.parentId)) : "根節點",
|
|
708
|
+
typeLabel: Nt(e.type)
|
|
709
|
+
})), [Fe, X]), ct = d(() => Le.map((e) => ({
|
|
611
710
|
...e,
|
|
612
711
|
key: e.id
|
|
613
|
-
})), [
|
|
712
|
+
})), [Le]), Q = d(() => $e.map((e) => ({
|
|
614
713
|
...e,
|
|
615
714
|
key: e.id,
|
|
616
|
-
memberName:
|
|
617
|
-
orgUnitName:
|
|
618
|
-
positionName: e.positionId ?
|
|
715
|
+
memberName: jt(Z.get(e.memberId)),
|
|
716
|
+
orgUnitName: Mt(X.get(e.orgUnitId)),
|
|
717
|
+
positionName: e.positionId ? Pt(it.get(e.positionId)) : "未指定"
|
|
619
718
|
})), [
|
|
719
|
+
Z,
|
|
720
|
+
$e,
|
|
620
721
|
X,
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
st
|
|
624
|
-
]), ht = d(() => K.map((e) => ({
|
|
722
|
+
it
|
|
723
|
+
]), lt = d(() => Ze.map((e) => ({
|
|
625
724
|
...e,
|
|
626
725
|
key: e.id,
|
|
627
|
-
managerName:
|
|
628
|
-
scopeLabel:
|
|
629
|
-
membersById:
|
|
630
|
-
orgUnitsById:
|
|
631
|
-
positionsById:
|
|
726
|
+
managerName: jt(Z.get(e.managerMemberId)),
|
|
727
|
+
scopeLabel: At(e, {
|
|
728
|
+
membersById: Z,
|
|
729
|
+
orgUnitsById: X,
|
|
730
|
+
positionsById: it
|
|
632
731
|
})
|
|
633
732
|
})), [
|
|
634
|
-
|
|
733
|
+
Ze,
|
|
734
|
+
Z,
|
|
635
735
|
X,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
]), Z = d(() => ({
|
|
736
|
+
it
|
|
737
|
+
]), ut = d(() => ({
|
|
639
738
|
render: (e) => [{
|
|
640
739
|
name: "編輯",
|
|
641
|
-
onClick: () =>
|
|
740
|
+
onClick: () => U({
|
|
642
741
|
record: e,
|
|
643
742
|
type: "EDIT"
|
|
644
743
|
})
|
|
@@ -655,20 +754,20 @@ function st() {
|
|
|
655
754
|
}],
|
|
656
755
|
variant: "base-secondary",
|
|
657
756
|
width: 128
|
|
658
|
-
}), []),
|
|
757
|
+
}), []), dt = d(() => ({
|
|
659
758
|
render: (e) => [{
|
|
660
759
|
name: "編輯",
|
|
661
|
-
onClick: () =>
|
|
760
|
+
onClick: () => Be({
|
|
662
761
|
record: e,
|
|
663
762
|
type: "EDIT"
|
|
664
763
|
})
|
|
665
764
|
}],
|
|
666
765
|
variant: "base-secondary",
|
|
667
766
|
width: 88
|
|
668
|
-
}), []),
|
|
767
|
+
}), []), ft = d(() => ({
|
|
669
768
|
render: (e) => [{
|
|
670
769
|
name: "編輯",
|
|
671
|
-
onClick: () =>
|
|
770
|
+
onClick: () => he({
|
|
672
771
|
record: e,
|
|
673
772
|
type: "EDIT"
|
|
674
773
|
})
|
|
@@ -685,7 +784,7 @@ function st() {
|
|
|
685
784
|
}],
|
|
686
785
|
variant: "base-secondary",
|
|
687
786
|
width: 128
|
|
688
|
-
}), []),
|
|
787
|
+
}), []), pt = d(() => ({
|
|
689
788
|
render: (e) => [{
|
|
690
789
|
name: "編輯",
|
|
691
790
|
onClick: () => h({
|
|
@@ -706,60 +805,60 @@ function st() {
|
|
|
706
805
|
variant: "base-secondary",
|
|
707
806
|
width: 128
|
|
708
807
|
}), []);
|
|
709
|
-
function
|
|
710
|
-
|
|
808
|
+
function mt(e) {
|
|
809
|
+
G(1), De(e);
|
|
711
810
|
}
|
|
712
|
-
function
|
|
713
|
-
|
|
811
|
+
function yt(e) {
|
|
812
|
+
G(1), je(e);
|
|
714
813
|
}
|
|
715
|
-
function
|
|
716
|
-
|
|
814
|
+
function bt(e) {
|
|
815
|
+
He(1), Ke(e);
|
|
717
816
|
}
|
|
718
|
-
function
|
|
719
|
-
|
|
817
|
+
function xt(e) {
|
|
818
|
+
ve(1), pe(e);
|
|
720
819
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
820
|
+
function St(e) {
|
|
821
|
+
ve(1), _e(e);
|
|
723
822
|
}
|
|
724
|
-
function
|
|
725
|
-
|
|
823
|
+
function Ct(e) {
|
|
824
|
+
ve(1), xe(e);
|
|
726
825
|
}
|
|
727
|
-
function
|
|
826
|
+
function $(e) {
|
|
728
827
|
y(1), _(e);
|
|
729
828
|
}
|
|
730
|
-
function
|
|
829
|
+
function Ot(e) {
|
|
731
830
|
y(1), k(e);
|
|
732
831
|
}
|
|
733
|
-
function
|
|
832
|
+
function It() {
|
|
734
833
|
J || r(null);
|
|
735
834
|
}
|
|
736
|
-
async function
|
|
737
|
-
n && await
|
|
738
|
-
n.type === "ORG_UNIT" && await
|
|
835
|
+
async function Lt() {
|
|
836
|
+
n && await zt(async () => {
|
|
837
|
+
n.type === "ORG_UNIT" && await se(n.id), n.type === "MEMBERSHIP" && await oe(n.id), n.type === "MANAGER_RESOLUTION" && await ae(n.id), r(null);
|
|
739
838
|
});
|
|
740
839
|
}
|
|
741
|
-
async function
|
|
742
|
-
|
|
840
|
+
async function Rt(e) {
|
|
841
|
+
tt(!0), s(null);
|
|
743
842
|
try {
|
|
744
|
-
await
|
|
745
|
-
baseUpdatedAt:
|
|
843
|
+
await te({ moves: e.map((e) => ({
|
|
844
|
+
baseUpdatedAt: X.get(e.orgUnitId)?.updatedAt ?? "",
|
|
746
845
|
id: e.orgUnitId,
|
|
747
846
|
parentId: e.parentId
|
|
748
|
-
})) }), await
|
|
847
|
+
})) }), await nt();
|
|
749
848
|
} catch (e) {
|
|
750
|
-
throw s(
|
|
849
|
+
throw s(Qt(e)), e;
|
|
751
850
|
} finally {
|
|
752
|
-
|
|
851
|
+
tt(!1);
|
|
753
852
|
}
|
|
754
853
|
}
|
|
755
|
-
async function
|
|
756
|
-
|
|
854
|
+
async function zt(e) {
|
|
855
|
+
tt(!0), s(null);
|
|
757
856
|
try {
|
|
758
|
-
await e(), await
|
|
857
|
+
await e(), await nt();
|
|
759
858
|
} catch (e) {
|
|
760
|
-
s(
|
|
859
|
+
s(Qt(e));
|
|
761
860
|
} finally {
|
|
762
|
-
|
|
861
|
+
tt(!1);
|
|
763
862
|
}
|
|
764
863
|
}
|
|
765
864
|
return /* @__PURE__ */ P(M, { children: [
|
|
@@ -770,7 +869,7 @@ function st() {
|
|
|
770
869
|
/* @__PURE__ */ N(T, { children: /* @__PURE__ */ P(w, {
|
|
771
870
|
tab: /* @__PURE__ */ P(D, {
|
|
772
871
|
activeKey: e,
|
|
773
|
-
onChange: (e) => t(
|
|
872
|
+
onChange: (e) => t(Ft(e)),
|
|
774
873
|
children: [
|
|
775
874
|
/* @__PURE__ */ N(O, { children: "組織樹" }, "ORG_UNITS"),
|
|
776
875
|
/* @__PURE__ */ N(O, { children: "職位" }, "POSITIONS"),
|
|
@@ -784,172 +883,172 @@ function st() {
|
|
|
784
883
|
variant: "body",
|
|
785
884
|
children: o
|
|
786
885
|
}) : null,
|
|
787
|
-
e === "ORG_UNITS" ? /* @__PURE__ */ N(
|
|
788
|
-
actions:
|
|
886
|
+
e === "ORG_UNITS" ? /* @__PURE__ */ N(ht, {
|
|
887
|
+
actions: ut,
|
|
789
888
|
loading: u,
|
|
790
|
-
onCreate: () =>
|
|
889
|
+
onCreate: () => U({
|
|
791
890
|
parentId: null,
|
|
792
891
|
record: null,
|
|
793
892
|
type: "CREATE"
|
|
794
893
|
}),
|
|
795
|
-
onCreateChild: (e) =>
|
|
894
|
+
onCreateChild: (e) => U({
|
|
796
895
|
parentId: e,
|
|
797
896
|
record: null,
|
|
798
897
|
type: "CREATE"
|
|
799
898
|
}),
|
|
800
|
-
onEditOrgUnit: (e) =>
|
|
899
|
+
onEditOrgUnit: (e) => U({
|
|
801
900
|
record: e,
|
|
802
901
|
type: "EDIT"
|
|
803
902
|
}),
|
|
804
|
-
onPageChange:
|
|
805
|
-
onSaveDraft:
|
|
903
|
+
onPageChange: G,
|
|
904
|
+
onSaveDraft: Rt,
|
|
806
905
|
onPageSizeChange: (e) => {
|
|
807
|
-
|
|
906
|
+
G(1), Te(e);
|
|
808
907
|
},
|
|
809
|
-
onSearchTextChange:
|
|
810
|
-
onTypeFilterChange:
|
|
811
|
-
orgUnits:
|
|
812
|
-
page:
|
|
813
|
-
pageSize:
|
|
814
|
-
rows:
|
|
815
|
-
searchText:
|
|
908
|
+
onSearchTextChange: mt,
|
|
909
|
+
onTypeFilterChange: yt,
|
|
910
|
+
orgUnits: q,
|
|
911
|
+
page: W,
|
|
912
|
+
pageSize: K,
|
|
913
|
+
rows: ot,
|
|
914
|
+
searchText: Ee,
|
|
816
915
|
saving: J,
|
|
817
|
-
total:
|
|
818
|
-
typeFilter:
|
|
819
|
-
viewMode:
|
|
820
|
-
onViewModeChange:
|
|
916
|
+
total: Oe,
|
|
917
|
+
typeFilter: Ae,
|
|
918
|
+
viewMode: Me,
|
|
919
|
+
onViewModeChange: Ne
|
|
821
920
|
}) : null,
|
|
822
|
-
e === "POSITIONS" ? /* @__PURE__ */ N(
|
|
823
|
-
actions:
|
|
921
|
+
e === "POSITIONS" ? /* @__PURE__ */ N(gt, {
|
|
922
|
+
actions: dt,
|
|
824
923
|
loading: u,
|
|
825
|
-
onCreate: () =>
|
|
924
|
+
onCreate: () => Be({
|
|
826
925
|
record: null,
|
|
827
926
|
type: "CREATE"
|
|
828
927
|
}),
|
|
829
|
-
onPageChange:
|
|
928
|
+
onPageChange: He,
|
|
830
929
|
onPageSizeChange: (e) => {
|
|
831
|
-
|
|
930
|
+
He(1), We(e);
|
|
832
931
|
},
|
|
833
|
-
onSearchTextChange:
|
|
834
|
-
page:
|
|
835
|
-
pageSize:
|
|
836
|
-
rows:
|
|
837
|
-
searchText:
|
|
838
|
-
total:
|
|
932
|
+
onSearchTextChange: bt,
|
|
933
|
+
page: Ve,
|
|
934
|
+
pageSize: Ue,
|
|
935
|
+
rows: ct,
|
|
936
|
+
searchText: Ge,
|
|
937
|
+
total: qe
|
|
839
938
|
}) : null,
|
|
840
|
-
e === "MEMBERSHIPS" ? /* @__PURE__ */ N(
|
|
841
|
-
actions:
|
|
939
|
+
e === "MEMBERSHIPS" ? /* @__PURE__ */ N(_t, {
|
|
940
|
+
actions: ft,
|
|
842
941
|
loading: u,
|
|
843
|
-
onCreate: () =>
|
|
942
|
+
onCreate: () => he({
|
|
844
943
|
record: null,
|
|
845
944
|
type: "CREATE"
|
|
846
945
|
}),
|
|
847
|
-
onActiveFilterChange:
|
|
848
|
-
onOrgUnitFilterChange:
|
|
849
|
-
onPageChange:
|
|
946
|
+
onActiveFilterChange: xt,
|
|
947
|
+
onOrgUnitFilterChange: St,
|
|
948
|
+
onPageChange: ve,
|
|
850
949
|
onPageSizeChange: (e) => {
|
|
851
|
-
|
|
950
|
+
ve(1), be(e);
|
|
852
951
|
},
|
|
853
|
-
onPositionFilterChange:
|
|
854
|
-
orgUnitFilter:
|
|
855
|
-
orgUnits:
|
|
856
|
-
page:
|
|
857
|
-
pageSize:
|
|
858
|
-
positionFilter:
|
|
859
|
-
positions:
|
|
860
|
-
rows:
|
|
861
|
-
statusFilter:
|
|
862
|
-
total:
|
|
952
|
+
onPositionFilterChange: Ct,
|
|
953
|
+
orgUnitFilter: ge,
|
|
954
|
+
orgUnits: q,
|
|
955
|
+
page: V,
|
|
956
|
+
pageSize: ye,
|
|
957
|
+
positionFilter: H,
|
|
958
|
+
positions: Ye,
|
|
959
|
+
rows: Q,
|
|
960
|
+
statusFilter: z,
|
|
961
|
+
total: Se
|
|
863
962
|
}) : null,
|
|
864
|
-
e === "MANAGERS" ? /* @__PURE__ */ N(
|
|
865
|
-
actions:
|
|
963
|
+
e === "MANAGERS" ? /* @__PURE__ */ N(vt, {
|
|
964
|
+
actions: pt,
|
|
866
965
|
loading: u,
|
|
867
966
|
onCreate: () => h({
|
|
868
967
|
record: null,
|
|
869
968
|
type: "CREATE"
|
|
870
969
|
}),
|
|
871
|
-
onActiveFilterChange:
|
|
970
|
+
onActiveFilterChange: $,
|
|
872
971
|
onPageChange: y,
|
|
873
972
|
onPageSizeChange: (e) => {
|
|
874
973
|
y(1), x(e);
|
|
875
974
|
},
|
|
876
|
-
onScopeTypeFilterChange:
|
|
975
|
+
onScopeTypeFilterChange: Ot,
|
|
877
976
|
page: v,
|
|
878
977
|
pageSize: b,
|
|
879
|
-
rows:
|
|
978
|
+
rows: lt,
|
|
880
979
|
scopeTypeFilter: E,
|
|
881
980
|
statusFilter: g,
|
|
882
981
|
total: I
|
|
883
982
|
}) : null
|
|
884
983
|
]
|
|
885
984
|
}) }),
|
|
886
|
-
/* @__PURE__ */ N(
|
|
887
|
-
modal:
|
|
888
|
-
onClose: () =>
|
|
889
|
-
onSubmit: (e) =>
|
|
890
|
-
|
|
985
|
+
/* @__PURE__ */ N(wt, {
|
|
986
|
+
modal: we,
|
|
987
|
+
onClose: () => U(null),
|
|
988
|
+
onSubmit: (e) => zt(async () => {
|
|
989
|
+
we?.type === "EDIT" && we.record ? await de({
|
|
891
990
|
...e,
|
|
892
|
-
id:
|
|
991
|
+
id: we.record.id,
|
|
893
992
|
metadataJson: null
|
|
894
|
-
}) : await
|
|
993
|
+
}) : await re({
|
|
895
994
|
code: e.code ?? "",
|
|
896
995
|
metadataJson: "{}",
|
|
897
996
|
name: e.name ?? "",
|
|
898
997
|
parentId: e.parentId,
|
|
899
998
|
type: e.type ?? "DEPARTMENT"
|
|
900
|
-
}),
|
|
999
|
+
}), U(null);
|
|
901
1000
|
}),
|
|
902
|
-
orgUnits:
|
|
1001
|
+
orgUnits: q,
|
|
903
1002
|
saving: J
|
|
904
1003
|
}),
|
|
905
|
-
/* @__PURE__ */ N(
|
|
906
|
-
modal:
|
|
907
|
-
onClose: () =>
|
|
908
|
-
onSubmit: (e) =>
|
|
909
|
-
|
|
1004
|
+
/* @__PURE__ */ N(Tt, {
|
|
1005
|
+
modal: ze,
|
|
1006
|
+
onClose: () => Be(null),
|
|
1007
|
+
onSubmit: (e) => zt(async () => {
|
|
1008
|
+
ze?.type === "EDIT" && ze.record ? await fe({
|
|
910
1009
|
...e,
|
|
911
|
-
id:
|
|
1010
|
+
id: ze.record.id,
|
|
912
1011
|
metadataJson: null
|
|
913
|
-
}) : await
|
|
1012
|
+
}) : await ie({
|
|
914
1013
|
code: e.code ?? "",
|
|
915
1014
|
level: e.level ?? 0,
|
|
916
1015
|
metadataJson: "{}",
|
|
917
1016
|
name: e.name ?? ""
|
|
918
|
-
}),
|
|
1017
|
+
}), Be(null);
|
|
919
1018
|
}),
|
|
920
1019
|
saving: J
|
|
921
1020
|
}),
|
|
922
|
-
/* @__PURE__ */ N(
|
|
923
|
-
membersById:
|
|
924
|
-
modal:
|
|
925
|
-
onClose: () =>
|
|
926
|
-
onSubmit: (e) =>
|
|
927
|
-
|
|
1021
|
+
/* @__PURE__ */ N(Et, {
|
|
1022
|
+
membersById: Z,
|
|
1023
|
+
modal: me,
|
|
1024
|
+
onClose: () => he(null),
|
|
1025
|
+
onSubmit: (e) => zt(async () => {
|
|
1026
|
+
me?.type === "EDIT" && me.record ? await ue({
|
|
928
1027
|
...e,
|
|
929
|
-
id:
|
|
930
|
-
}) : await
|
|
931
|
-
effectiveFrom: e.effectiveFrom ??
|
|
1028
|
+
id: me.record.id
|
|
1029
|
+
}) : await ne({
|
|
1030
|
+
effectiveFrom: e.effectiveFrom ?? Jt(),
|
|
932
1031
|
effectiveTo: e.effectiveTo,
|
|
933
1032
|
isPrimary: e.isPrimary ?? !1,
|
|
934
1033
|
memberId: e.memberId ?? "",
|
|
935
1034
|
orgUnitId: e.orgUnitId ?? "",
|
|
936
1035
|
positionId: e.positionId
|
|
937
|
-
}),
|
|
1036
|
+
}), he(null);
|
|
938
1037
|
}),
|
|
939
|
-
orgUnits:
|
|
940
|
-
positions:
|
|
1038
|
+
orgUnits: q,
|
|
1039
|
+
positions: Ye,
|
|
941
1040
|
saving: J
|
|
942
1041
|
}),
|
|
943
|
-
/* @__PURE__ */ N(
|
|
944
|
-
membersById:
|
|
1042
|
+
/* @__PURE__ */ N(Dt, {
|
|
1043
|
+
membersById: Z,
|
|
945
1044
|
modal: m,
|
|
946
1045
|
onClose: () => h(null),
|
|
947
|
-
onSubmit: (e) =>
|
|
948
|
-
m?.type === "EDIT" && m.record ? await
|
|
1046
|
+
onSubmit: (e) => zt(async () => {
|
|
1047
|
+
m?.type === "EDIT" && m.record ? await le({
|
|
949
1048
|
...e,
|
|
950
1049
|
id: m.record.id
|
|
951
|
-
}) : await
|
|
952
|
-
effectiveFrom: e.effectiveFrom ??
|
|
1050
|
+
}) : await B({
|
|
1051
|
+
effectiveFrom: e.effectiveFrom ?? Jt(),
|
|
953
1052
|
effectiveTo: e.effectiveTo,
|
|
954
1053
|
managerMemberId: e.managerMemberId ?? "",
|
|
955
1054
|
priority: e.priority ?? 0,
|
|
@@ -957,48 +1056,48 @@ function st() {
|
|
|
957
1056
|
scopeType: e.scopeType ?? "MEMBER"
|
|
958
1057
|
}), h(null);
|
|
959
1058
|
}),
|
|
960
|
-
orgUnits:
|
|
961
|
-
positions:
|
|
1059
|
+
orgUnits: q,
|
|
1060
|
+
positions: Ye,
|
|
962
1061
|
saving: J
|
|
963
1062
|
}),
|
|
964
1063
|
/* @__PURE__ */ N(S, {
|
|
965
1064
|
cancelText: "取消",
|
|
966
1065
|
confirmButtonProps: { variant: "destructive-primary" },
|
|
967
|
-
confirmText:
|
|
1066
|
+
confirmText: Y?.confirmText ?? "",
|
|
968
1067
|
loading: J,
|
|
969
1068
|
modalStatusType: "error",
|
|
970
1069
|
modalType: "standard",
|
|
971
|
-
onCancel:
|
|
972
|
-
onClose:
|
|
973
|
-
onConfirm: () => void
|
|
1070
|
+
onCancel: It,
|
|
1071
|
+
onClose: It,
|
|
1072
|
+
onConfirm: () => void Lt(),
|
|
974
1073
|
open: !!n,
|
|
975
1074
|
showModalFooter: !0,
|
|
976
1075
|
showModalHeader: !0,
|
|
977
1076
|
size: "regular",
|
|
978
1077
|
supportingText: "此操作會立即套用,請確認後再繼續。",
|
|
979
|
-
title:
|
|
1078
|
+
title: Y?.title ?? "",
|
|
980
1079
|
children: /* @__PURE__ */ N(A, {
|
|
981
1080
|
color: "text-neutral",
|
|
982
1081
|
variant: "body",
|
|
983
|
-
children:
|
|
1082
|
+
children: Y?.description ?? ""
|
|
984
1083
|
})
|
|
985
1084
|
})
|
|
986
1085
|
] });
|
|
987
1086
|
}
|
|
988
|
-
function
|
|
989
|
-
let F = f(null), [L, R] = p(
|
|
990
|
-
isTreeMode:
|
|
1087
|
+
function ht({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUnit: i, onPageChange: a, onSaveDraft: o, onPageSizeChange: s, onSearchTextChange: c, onTypeFilterChange: u, onViewModeChange: m, orgUnits: g, page: S, pageSize: C, rows: w, searchText: T, saving: D, total: O, typeFilter: A, viewMode: j }) {
|
|
1088
|
+
let F = f(null), [L, R] = p(nt), z = j === "TABLE" ? "FLOW" : "TABLE", te = j === "TABLE" ? "切換樹狀圖" : "切換表格", B = j === "FLOW", ne = bt({
|
|
1089
|
+
isTreeMode: B,
|
|
991
1090
|
isTreeEditing: L.isEditing
|
|
992
|
-
}),
|
|
993
|
-
isTreeMode:
|
|
1091
|
+
}), re = xt({
|
|
1092
|
+
isTreeMode: B,
|
|
994
1093
|
isTreeEditing: L.isEditing
|
|
995
|
-
}),
|
|
1094
|
+
}), ie = St({
|
|
996
1095
|
hasDraftChanges: L.hasDraftChanges,
|
|
997
1096
|
isTreeEditing: L.isEditing,
|
|
998
|
-
isTreeMode:
|
|
1097
|
+
isTreeMode: B,
|
|
999
1098
|
loading: t,
|
|
1000
1099
|
saving: D
|
|
1001
|
-
}),
|
|
1100
|
+
}), ae = d(() => [
|
|
1002
1101
|
{
|
|
1003
1102
|
dataIndex: "code",
|
|
1004
1103
|
key: "code",
|
|
@@ -1031,16 +1130,16 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1031
1130
|
}
|
|
1032
1131
|
], []);
|
|
1033
1132
|
return l(() => {
|
|
1034
|
-
j === "TABLE" && R(
|
|
1035
|
-
}, [j]), /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(
|
|
1036
|
-
actionDisabled:
|
|
1037
|
-
actionIcon:
|
|
1038
|
-
actionLabel:
|
|
1133
|
+
j === "TABLE" && R(nt);
|
|
1134
|
+
}, [j]), /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Ct, {
|
|
1135
|
+
actionDisabled: ie,
|
|
1136
|
+
actionIcon: re,
|
|
1137
|
+
actionLabel: ne,
|
|
1039
1138
|
actions: /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(h, {
|
|
1040
|
-
onClick: () => m(
|
|
1139
|
+
onClick: () => m(z),
|
|
1041
1140
|
variant: "base-secondary",
|
|
1042
|
-
children:
|
|
1043
|
-
}),
|
|
1141
|
+
children: te
|
|
1142
|
+
}), B && L.isEditing ? /* @__PURE__ */ N(h, {
|
|
1044
1143
|
disabled: D,
|
|
1045
1144
|
icon: ee,
|
|
1046
1145
|
iconType: "leading",
|
|
@@ -1050,7 +1149,7 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1050
1149
|
}) : null] }),
|
|
1051
1150
|
description: "組織節點使用 ltree path 維護階層,搬移節點會同步更新子節點 path。",
|
|
1052
1151
|
onCreate: () => {
|
|
1053
|
-
if (!
|
|
1152
|
+
if (!B) {
|
|
1054
1153
|
n();
|
|
1055
1154
|
return;
|
|
1056
1155
|
}
|
|
@@ -1062,7 +1161,7 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1062
1161
|
},
|
|
1063
1162
|
title: "組織樹"
|
|
1064
1163
|
}), j === "TABLE" ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(v, {
|
|
1065
|
-
className:
|
|
1164
|
+
className: Y.orgFilterArea,
|
|
1066
1165
|
size: "sub",
|
|
1067
1166
|
children: /* @__PURE__ */ P(y, { children: [/* @__PURE__ */ N(_, {
|
|
1068
1167
|
span: 3,
|
|
@@ -1088,8 +1187,8 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1088
1187
|
children: /* @__PURE__ */ N(E, {
|
|
1089
1188
|
clearable: !1,
|
|
1090
1189
|
fullWidth: !0,
|
|
1091
|
-
onChange: (e) => u(
|
|
1092
|
-
options: [
|
|
1190
|
+
onChange: (e) => u(Lt(e)),
|
|
1191
|
+
options: [...it],
|
|
1093
1192
|
placeholder: "類型",
|
|
1094
1193
|
size: "sub",
|
|
1095
1194
|
value: A
|
|
@@ -1097,23 +1196,23 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1097
1196
|
})
|
|
1098
1197
|
})] })
|
|
1099
1198
|
}), /* @__PURE__ */ N("div", {
|
|
1100
|
-
className:
|
|
1199
|
+
className: Y.tableFrame,
|
|
1101
1200
|
children: /* @__PURE__ */ N(k, {
|
|
1102
1201
|
actions: e,
|
|
1103
|
-
columns:
|
|
1202
|
+
columns: ae,
|
|
1104
1203
|
dataSource: [...w],
|
|
1105
1204
|
fullWidth: !0,
|
|
1106
1205
|
loading: t,
|
|
1107
|
-
pagination:
|
|
1206
|
+
pagination: yt({
|
|
1108
1207
|
onPageChange: a,
|
|
1109
1208
|
onPageSizeChange: s,
|
|
1110
1209
|
page: S,
|
|
1111
1210
|
pageSize: C,
|
|
1112
1211
|
total: O
|
|
1113
1212
|
}),
|
|
1114
|
-
style: { minWidth:
|
|
1213
|
+
style: { minWidth: ut }
|
|
1115
1214
|
})
|
|
1116
|
-
})] }) : /* @__PURE__ */ N(
|
|
1215
|
+
})] }) : /* @__PURE__ */ N(Ve, {
|
|
1117
1216
|
ref: F,
|
|
1118
1217
|
onCreateChild: r,
|
|
1119
1218
|
onCreateRoot: n,
|
|
@@ -1124,7 +1223,7 @@ function ct({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
|
|
|
1124
1223
|
saving: D
|
|
1125
1224
|
})] });
|
|
1126
1225
|
}
|
|
1127
|
-
function
|
|
1226
|
+
function gt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeChange: i, onSearchTextChange: a, page: o, pageSize: s, rows: c, searchText: l, total: u }) {
|
|
1128
1227
|
let f = d(() => [
|
|
1129
1228
|
{
|
|
1130
1229
|
dataIndex: "code",
|
|
@@ -1152,14 +1251,14 @@ function lt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeCh
|
|
|
1152
1251
|
}
|
|
1153
1252
|
], []);
|
|
1154
1253
|
return /* @__PURE__ */ P(M, { children: [
|
|
1155
|
-
/* @__PURE__ */ N(
|
|
1254
|
+
/* @__PURE__ */ N(Ct, {
|
|
1156
1255
|
actionLabel: "新增職位",
|
|
1157
1256
|
description: "職位提供會員歸屬與主管解析規則使用。",
|
|
1158
1257
|
onCreate: n,
|
|
1159
1258
|
title: "職位"
|
|
1160
1259
|
}),
|
|
1161
1260
|
/* @__PURE__ */ N(v, {
|
|
1162
|
-
className:
|
|
1261
|
+
className: Y.orgFilterArea,
|
|
1163
1262
|
size: "sub",
|
|
1164
1263
|
children: /* @__PURE__ */ N(y, { children: /* @__PURE__ */ N(_, {
|
|
1165
1264
|
span: 3,
|
|
@@ -1179,26 +1278,26 @@ function lt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeCh
|
|
|
1179
1278
|
}) })
|
|
1180
1279
|
}),
|
|
1181
1280
|
/* @__PURE__ */ N("div", {
|
|
1182
|
-
className:
|
|
1281
|
+
className: Y.tableFrame,
|
|
1183
1282
|
children: /* @__PURE__ */ N(k, {
|
|
1184
1283
|
actions: e,
|
|
1185
1284
|
columns: f,
|
|
1186
1285
|
dataSource: [...c],
|
|
1187
1286
|
fullWidth: !0,
|
|
1188
1287
|
loading: t,
|
|
1189
|
-
pagination:
|
|
1288
|
+
pagination: yt({
|
|
1190
1289
|
onPageChange: r,
|
|
1191
1290
|
onPageSizeChange: i,
|
|
1192
1291
|
page: o,
|
|
1193
1292
|
pageSize: s,
|
|
1194
1293
|
total: u
|
|
1195
1294
|
}),
|
|
1196
|
-
style: { minWidth:
|
|
1295
|
+
style: { minWidth: dt }
|
|
1197
1296
|
})
|
|
1198
1297
|
})
|
|
1199
1298
|
] });
|
|
1200
1299
|
}
|
|
1201
|
-
function
|
|
1300
|
+
function _t({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOrgUnitFilterChange: o, onPageChange: s, onPageSizeChange: c, onPositionFilterChange: l, orgUnitFilter: u, orgUnits: f, page: p, pageSize: h, positionFilter: g, positions: x, rows: S, statusFilter: C, total: w }) {
|
|
1202
1301
|
let T = d(() => [
|
|
1203
1302
|
{
|
|
1204
1303
|
dataIndex: "memberName",
|
|
@@ -1238,14 +1337,14 @@ function ut({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOr
|
|
|
1238
1337
|
}
|
|
1239
1338
|
], []), E = d(() => f.map(e), [f]), D = d(() => x.map(r), [x]);
|
|
1240
1339
|
return /* @__PURE__ */ P(M, { children: [
|
|
1241
|
-
/* @__PURE__ */ N(
|
|
1340
|
+
/* @__PURE__ */ N(Ct, {
|
|
1242
1341
|
actionLabel: "新增歸屬",
|
|
1243
1342
|
description: "會員歸屬是 BPM 內部組織權限、主管解析與條件判斷的來源。",
|
|
1244
1343
|
onCreate: i,
|
|
1245
1344
|
title: "會員歸屬"
|
|
1246
1345
|
}),
|
|
1247
1346
|
/* @__PURE__ */ N(v, {
|
|
1248
|
-
className: [
|
|
1347
|
+
className: [Y.orgFilterArea, Y.membershipFilterArea].join(" "),
|
|
1249
1348
|
size: "sub",
|
|
1250
1349
|
children: /* @__PURE__ */ P(y, { children: [
|
|
1251
1350
|
/* @__PURE__ */ N(_, {
|
|
@@ -1265,7 +1364,7 @@ function ut({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOr
|
|
|
1265
1364
|
},
|
|
1266
1365
|
mode: "single",
|
|
1267
1366
|
name: "membershipOrgUnitFilter",
|
|
1268
|
-
onChange: (e) => o(
|
|
1367
|
+
onChange: (e) => o(Ht(e)),
|
|
1269
1368
|
options: [...E],
|
|
1270
1369
|
placeholder: "全部組織",
|
|
1271
1370
|
size: "sub",
|
|
@@ -1290,7 +1389,7 @@ function ut({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOr
|
|
|
1290
1389
|
},
|
|
1291
1390
|
mode: "single",
|
|
1292
1391
|
name: "membershipPositionFilter",
|
|
1293
|
-
onChange: (e) => l(
|
|
1392
|
+
onChange: (e) => l(Ut(e)),
|
|
1294
1393
|
options: [...D],
|
|
1295
1394
|
placeholder: "全部職位",
|
|
1296
1395
|
size: "sub",
|
|
@@ -1315,8 +1414,8 @@ function ut({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOr
|
|
|
1315
1414
|
},
|
|
1316
1415
|
mode: "single",
|
|
1317
1416
|
name: "membershipStatusFilter",
|
|
1318
|
-
onChange: (e) => a(
|
|
1319
|
-
options: [...
|
|
1417
|
+
onChange: (e) => a(Vt(e)),
|
|
1418
|
+
options: [...ct],
|
|
1320
1419
|
placeholder: "全部狀態",
|
|
1321
1420
|
size: "sub",
|
|
1322
1421
|
value: C
|
|
@@ -1326,26 +1425,26 @@ function ut({ actions: t, loading: n, onCreate: i, onActiveFilterChange: a, onOr
|
|
|
1326
1425
|
] })
|
|
1327
1426
|
}),
|
|
1328
1427
|
/* @__PURE__ */ N("div", {
|
|
1329
|
-
className:
|
|
1428
|
+
className: Y.tableFrame,
|
|
1330
1429
|
children: /* @__PURE__ */ N(k, {
|
|
1331
1430
|
actions: t,
|
|
1332
1431
|
columns: T,
|
|
1333
1432
|
dataSource: [...S],
|
|
1334
1433
|
fullWidth: !0,
|
|
1335
1434
|
loading: n,
|
|
1336
|
-
pagination:
|
|
1435
|
+
pagination: yt({
|
|
1337
1436
|
onPageChange: s,
|
|
1338
1437
|
onPageSizeChange: c,
|
|
1339
1438
|
page: p,
|
|
1340
1439
|
pageSize: h,
|
|
1341
1440
|
total: w
|
|
1342
1441
|
}),
|
|
1343
|
-
style: { minWidth:
|
|
1442
|
+
style: { minWidth: ft }
|
|
1344
1443
|
})
|
|
1345
1444
|
})
|
|
1346
1445
|
] });
|
|
1347
1446
|
}
|
|
1348
|
-
function
|
|
1447
|
+
function vt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPageChange: i, onPageSizeChange: a, onScopeTypeFilterChange: o, page: s, pageSize: c, rows: l, scopeTypeFilter: u, statusFilter: f, total: p }) {
|
|
1349
1448
|
let m = d(() => [
|
|
1350
1449
|
{
|
|
1351
1450
|
dataIndex: "scopeLabel",
|
|
@@ -1379,14 +1478,14 @@ function dt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPa
|
|
|
1379
1478
|
}
|
|
1380
1479
|
], []);
|
|
1381
1480
|
return /* @__PURE__ */ P(M, { children: [
|
|
1382
|
-
/* @__PURE__ */ N(
|
|
1481
|
+
/* @__PURE__ */ N(Ct, {
|
|
1383
1482
|
actionLabel: "新增主管規則",
|
|
1384
1483
|
description: "簽核主管規則獨立於組織樹 parent,解析優先序為會員、組織、職位。",
|
|
1385
1484
|
onCreate: n,
|
|
1386
1485
|
title: "簽核主管"
|
|
1387
1486
|
}),
|
|
1388
1487
|
/* @__PURE__ */ N(v, {
|
|
1389
|
-
className:
|
|
1488
|
+
className: Y.orgFilterArea,
|
|
1390
1489
|
size: "sub",
|
|
1391
1490
|
children: /* @__PURE__ */ P(y, { children: [/* @__PURE__ */ N(_, {
|
|
1392
1491
|
span: 3,
|
|
@@ -1397,8 +1496,8 @@ function dt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPa
|
|
|
1397
1496
|
children: /* @__PURE__ */ N(E, {
|
|
1398
1497
|
clearable: !1,
|
|
1399
1498
|
fullWidth: !0,
|
|
1400
|
-
onChange: (e) => o(
|
|
1401
|
-
options: [...
|
|
1499
|
+
onChange: (e) => o(zt(e)),
|
|
1500
|
+
options: [...ot],
|
|
1402
1501
|
placeholder: "套用範圍",
|
|
1403
1502
|
size: "sub",
|
|
1404
1503
|
value: u
|
|
@@ -1413,8 +1512,8 @@ function dt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPa
|
|
|
1413
1512
|
children: /* @__PURE__ */ N(E, {
|
|
1414
1513
|
clearable: !1,
|
|
1415
1514
|
fullWidth: !0,
|
|
1416
|
-
onChange: (e) => r(
|
|
1417
|
-
options: [...
|
|
1515
|
+
onChange: (e) => r(Bt(e)),
|
|
1516
|
+
options: [...ct],
|
|
1418
1517
|
placeholder: "狀態",
|
|
1419
1518
|
size: "sub",
|
|
1420
1519
|
value: f
|
|
@@ -1423,50 +1522,50 @@ function dt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPa
|
|
|
1423
1522
|
})] })
|
|
1424
1523
|
}),
|
|
1425
1524
|
/* @__PURE__ */ N("div", {
|
|
1426
|
-
className:
|
|
1525
|
+
className: Y.tableFrame,
|
|
1427
1526
|
children: /* @__PURE__ */ N(k, {
|
|
1428
1527
|
actions: e,
|
|
1429
1528
|
columns: m,
|
|
1430
1529
|
dataSource: [...l],
|
|
1431
1530
|
fullWidth: !0,
|
|
1432
1531
|
loading: t,
|
|
1433
|
-
pagination:
|
|
1532
|
+
pagination: yt({
|
|
1434
1533
|
onPageChange: i,
|
|
1435
1534
|
onPageSizeChange: a,
|
|
1436
1535
|
page: s,
|
|
1437
1536
|
pageSize: c,
|
|
1438
1537
|
total: p
|
|
1439
1538
|
}),
|
|
1440
|
-
style: { minWidth:
|
|
1539
|
+
style: { minWidth: pt }
|
|
1441
1540
|
})
|
|
1442
1541
|
})
|
|
1443
1542
|
] });
|
|
1444
1543
|
}
|
|
1445
|
-
function
|
|
1544
|
+
function yt({ onPageChange: e, onPageSizeChange: t, page: n, pageSize: r, total: i }) {
|
|
1446
1545
|
return {
|
|
1447
1546
|
current: n,
|
|
1448
1547
|
onChange: e,
|
|
1449
1548
|
onChangePageSize: t,
|
|
1450
1549
|
pageSize: r,
|
|
1451
1550
|
pageSizeLabel: "每頁筆數",
|
|
1452
|
-
pageSizeOptions: [...
|
|
1551
|
+
pageSizeOptions: [...lt],
|
|
1453
1552
|
renderResultSummary: (e, t, n) => `顯示 ${e}-${t} 筆,共 ${n} 筆`,
|
|
1454
1553
|
showPageSizeOptions: !0,
|
|
1455
1554
|
total: i
|
|
1456
1555
|
};
|
|
1457
1556
|
}
|
|
1458
|
-
function
|
|
1557
|
+
function bt({ isTreeEditing: e, isTreeMode: t }) {
|
|
1459
1558
|
return t ? e ? "儲存" : "開始編輯" : "新增組織";
|
|
1460
1559
|
}
|
|
1461
|
-
function
|
|
1462
|
-
return t ? e ?
|
|
1560
|
+
function xt({ isTreeEditing: e, isTreeMode: t }) {
|
|
1561
|
+
return t ? e ? z : L : R;
|
|
1463
1562
|
}
|
|
1464
|
-
function
|
|
1563
|
+
function St({ hasDraftChanges: e, isTreeEditing: t, isTreeMode: n, loading: r, saving: i }) {
|
|
1465
1564
|
return n ? t ? !e || i : r : !1;
|
|
1466
1565
|
}
|
|
1467
|
-
function
|
|
1566
|
+
function Ct({ actionDisabled: e = !1, actionIcon: t = R, actionLabel: n, actions: r, description: i, onCreate: a, title: o }) {
|
|
1468
1567
|
return /* @__PURE__ */ P("div", {
|
|
1469
|
-
className:
|
|
1568
|
+
className: Y.tableIntro,
|
|
1470
1569
|
children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N(A, {
|
|
1471
1570
|
component: "h2",
|
|
1472
1571
|
variant: "h3",
|
|
@@ -1476,7 +1575,7 @@ function ht({ actionDisabled: e = !1, actionIcon: t = R, actionLabel: n, actions
|
|
|
1476
1575
|
variant: "body",
|
|
1477
1576
|
children: i
|
|
1478
1577
|
})] }), /* @__PURE__ */ P("div", {
|
|
1479
|
-
className:
|
|
1578
|
+
className: Y.tableIntroActions,
|
|
1480
1579
|
children: [r, /* @__PURE__ */ N(h, {
|
|
1481
1580
|
disabled: e,
|
|
1482
1581
|
icon: t,
|
|
@@ -1487,12 +1586,12 @@ function ht({ actionDisabled: e = !1, actionIcon: t = R, actionLabel: n, actions
|
|
|
1487
1586
|
})]
|
|
1488
1587
|
});
|
|
1489
1588
|
}
|
|
1490
|
-
function
|
|
1491
|
-
let [c, u] = p(""), [d, f] = p(""), [m, h] = p(null), [g, _] = p(
|
|
1589
|
+
function wt({ modal: t, onClose: r, onSubmit: i, orgUnits: a, saving: s }) {
|
|
1590
|
+
let [c, u] = p(""), [d, f] = p(""), [m, h] = p(null), [g, _] = p(X[2]);
|
|
1492
1591
|
return l(() => {
|
|
1493
1592
|
if (!t) return;
|
|
1494
1593
|
let n = t.record, r = n?.parentId ?? t.parentId ?? null, i = r ? a.find((e) => e.id === r) ?? null : null;
|
|
1495
|
-
u(n?.code ?? ""), f(n?.name ?? ""), h(i ? e(i) : null), _(
|
|
1594
|
+
u(n?.code ?? ""), f(n?.name ?? ""), h(i ? e(i) : null), _(X.find((e) => e.id === n?.type) ?? X[2]);
|
|
1496
1595
|
}, [t, a]), /* @__PURE__ */ N(S, {
|
|
1497
1596
|
cancelText: "取消",
|
|
1498
1597
|
confirmButtonProps: { disabled: !c || !d },
|
|
@@ -1513,16 +1612,16 @@ function gt({ modal: t, onClose: r, onSubmit: i, orgUnits: a, saving: s }) {
|
|
|
1513
1612
|
size: "regular",
|
|
1514
1613
|
title: t?.type === "EDIT" ? "編輯組織" : "新增組織",
|
|
1515
1614
|
children: /* @__PURE__ */ P("div", {
|
|
1516
|
-
className:
|
|
1615
|
+
className: Y.modalFields,
|
|
1517
1616
|
children: [
|
|
1518
|
-
/* @__PURE__ */ N(
|
|
1617
|
+
/* @__PURE__ */ N($, {
|
|
1519
1618
|
label: "代碼",
|
|
1520
1619
|
name: "orgCode",
|
|
1521
1620
|
onChange: u,
|
|
1522
1621
|
placeholder: "例如 FIN-TW",
|
|
1523
1622
|
value: c
|
|
1524
1623
|
}),
|
|
1525
|
-
/* @__PURE__ */ N(
|
|
1624
|
+
/* @__PURE__ */ N($, {
|
|
1526
1625
|
label: "名稱",
|
|
1527
1626
|
name: "orgName",
|
|
1528
1627
|
onChange: f,
|
|
@@ -1535,8 +1634,8 @@ function gt({ modal: t, onClose: r, onSubmit: i, orgUnits: a, saving: s }) {
|
|
|
1535
1634
|
children: /* @__PURE__ */ N(E, {
|
|
1536
1635
|
clearable: !1,
|
|
1537
1636
|
fullWidth: !0,
|
|
1538
|
-
onChange: (e) => _(
|
|
1539
|
-
options: [...
|
|
1637
|
+
onChange: (e) => _(It(e)),
|
|
1638
|
+
options: [...X],
|
|
1540
1639
|
placeholder: "選擇組織類型",
|
|
1541
1640
|
value: g
|
|
1542
1641
|
})
|
|
@@ -1556,7 +1655,7 @@ function gt({ modal: t, onClose: r, onSubmit: i, orgUnits: a, saving: s }) {
|
|
|
1556
1655
|
})
|
|
1557
1656
|
});
|
|
1558
1657
|
}
|
|
1559
|
-
function
|
|
1658
|
+
function Tt({ modal: e, onClose: t, onSubmit: n, saving: r }) {
|
|
1560
1659
|
let [i, a] = p(""), [o, s] = p("0"), [c, u] = p("");
|
|
1561
1660
|
return l(() => {
|
|
1562
1661
|
e && (a(e.record?.code ?? ""), s(String(e.record?.level ?? 0)), u(e.record?.name ?? ""));
|
|
@@ -1579,23 +1678,23 @@ function _t({ modal: e, onClose: t, onSubmit: n, saving: r }) {
|
|
|
1579
1678
|
size: "regular",
|
|
1580
1679
|
title: e?.type === "EDIT" ? "編輯職位" : "新增職位",
|
|
1581
1680
|
children: /* @__PURE__ */ P("div", {
|
|
1582
|
-
className:
|
|
1681
|
+
className: Y.modalFields,
|
|
1583
1682
|
children: [
|
|
1584
|
-
/* @__PURE__ */ N(
|
|
1683
|
+
/* @__PURE__ */ N($, {
|
|
1585
1684
|
label: "代碼",
|
|
1586
1685
|
name: "positionCode",
|
|
1587
1686
|
onChange: a,
|
|
1588
1687
|
placeholder: "例如 FIN-MGR",
|
|
1589
1688
|
value: i
|
|
1590
1689
|
}),
|
|
1591
|
-
/* @__PURE__ */ N(
|
|
1690
|
+
/* @__PURE__ */ N($, {
|
|
1592
1691
|
label: "名稱",
|
|
1593
1692
|
name: "positionName",
|
|
1594
1693
|
onChange: u,
|
|
1595
1694
|
placeholder: "例如 財務主管",
|
|
1596
1695
|
value: c
|
|
1597
1696
|
}),
|
|
1598
|
-
/* @__PURE__ */ N(
|
|
1697
|
+
/* @__PURE__ */ N($, {
|
|
1599
1698
|
label: "職等",
|
|
1600
1699
|
name: "positionLevel",
|
|
1601
1700
|
onChange: s,
|
|
@@ -1606,12 +1705,12 @@ function _t({ modal: e, onClose: t, onSubmit: n, saving: r }) {
|
|
|
1606
1705
|
})
|
|
1607
1706
|
});
|
|
1608
1707
|
}
|
|
1609
|
-
function
|
|
1610
|
-
let [g, _] = p(
|
|
1708
|
+
function Et({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, positions: m, saving: h }) {
|
|
1709
|
+
let [g, _] = p(Jt()), [v, y] = p(""), [b, x] = p(Q[1]), [C, w] = p(null), [T, D] = p(null), [O, k] = p(null);
|
|
1611
1710
|
return l(() => {
|
|
1612
1711
|
if (!c) return;
|
|
1613
1712
|
let n = c.record, i = n ? s.get(n.memberId) : null;
|
|
1614
|
-
_(n?.effectiveFrom ??
|
|
1713
|
+
_(n?.effectiveFrom ?? Jt()), y(n?.effectiveTo ?? ""), x(Q.find((e) => e.value === n?.isPrimary) ?? Q[1]), w(i ? t(i) : null), D(qt(f.find((e) => e.id === n?.orgUnitId), e)), k(qt(m.find((e) => e.id === n?.positionId), r));
|
|
1615
1714
|
}, [
|
|
1616
1715
|
s,
|
|
1617
1716
|
c,
|
|
@@ -1639,7 +1738,7 @@ function vt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1639
1738
|
size: "regular",
|
|
1640
1739
|
title: c?.type === "EDIT" ? "編輯會員歸屬" : "新增會員歸屬",
|
|
1641
1740
|
children: /* @__PURE__ */ P("div", {
|
|
1642
|
-
className:
|
|
1741
|
+
className: Y.modalFields,
|
|
1643
1742
|
children: [
|
|
1644
1743
|
/* @__PURE__ */ N(o, {
|
|
1645
1744
|
label: "會員",
|
|
@@ -1679,20 +1778,20 @@ function vt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1679
1778
|
children: /* @__PURE__ */ N(E, {
|
|
1680
1779
|
clearable: !1,
|
|
1681
1780
|
fullWidth: !0,
|
|
1682
|
-
onChange: (e) => x(
|
|
1683
|
-
options: [...
|
|
1781
|
+
onChange: (e) => x(Wt(e)),
|
|
1782
|
+
options: [...Q],
|
|
1684
1783
|
placeholder: "選擇歸屬類型",
|
|
1685
1784
|
value: b
|
|
1686
1785
|
})
|
|
1687
1786
|
}),
|
|
1688
|
-
/* @__PURE__ */ N(
|
|
1787
|
+
/* @__PURE__ */ N(Ot, {
|
|
1689
1788
|
label: "生效日",
|
|
1690
1789
|
name: "membershipEffectiveFrom",
|
|
1691
1790
|
onChange: _,
|
|
1692
1791
|
placeholder: "YYYY-MM-DD",
|
|
1693
1792
|
value: g
|
|
1694
1793
|
}),
|
|
1695
|
-
/* @__PURE__ */ N(
|
|
1794
|
+
/* @__PURE__ */ N(Ot, {
|
|
1696
1795
|
label: "結束日",
|
|
1697
1796
|
name: "membershipEffectiveTo",
|
|
1698
1797
|
onChange: y,
|
|
@@ -1703,12 +1802,12 @@ function vt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1703
1802
|
})
|
|
1704
1803
|
});
|
|
1705
1804
|
}
|
|
1706
|
-
function
|
|
1707
|
-
let [g, _] = p(
|
|
1805
|
+
function Dt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, positions: m, saving: h }) {
|
|
1806
|
+
let [g, _] = p(Jt()), [v, y] = p(""), [b, x] = p(null), [C, w] = p("0"), [T, D] = p(null), [O, k] = p(null), [j, M] = p(null), [F, I] = p(Z[0]);
|
|
1708
1807
|
l(() => {
|
|
1709
1808
|
if (!c) return;
|
|
1710
|
-
let n = c.record, i =
|
|
1711
|
-
_(n?.effectiveFrom ??
|
|
1809
|
+
let n = c.record, i = Z.find((e) => e.id === n?.scopeType) ?? Z[0];
|
|
1810
|
+
_(n?.effectiveFrom ?? Jt()), y(n?.effectiveTo ?? ""), x(qt(n ? s.get(n.managerMemberId) : null, t)), w(String(n?.priority ?? 0)), D(i.id === "MEMBER" ? qt(n ? s.get(n.scopeId) : null, t) : null), k(i.id === "ORG_UNIT" ? qt(f.find((e) => e.id === n?.scopeId), e) : null), M(i.id === "POSITION" ? qt(m.find((e) => e.id === n?.scopeId), r) : null), I(i);
|
|
1712
1811
|
}, [
|
|
1713
1812
|
s,
|
|
1714
1813
|
c,
|
|
@@ -1738,7 +1837,7 @@ function yt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1738
1837
|
size: "regular",
|
|
1739
1838
|
title: c?.type === "EDIT" ? "編輯主管規則" : "新增主管規則",
|
|
1740
1839
|
children: /* @__PURE__ */ P("div", {
|
|
1741
|
-
className:
|
|
1840
|
+
className: Y.modalFields,
|
|
1742
1841
|
children: [
|
|
1743
1842
|
/* @__PURE__ */ N(o, {
|
|
1744
1843
|
label: "套用範圍",
|
|
@@ -1746,8 +1845,8 @@ function yt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1746
1845
|
children: /* @__PURE__ */ N(E, {
|
|
1747
1846
|
clearable: !1,
|
|
1748
1847
|
fullWidth: !0,
|
|
1749
|
-
onChange: (e) => I(
|
|
1750
|
-
options: [...
|
|
1848
|
+
onChange: (e) => I(Rt(e)),
|
|
1849
|
+
options: [...Z],
|
|
1751
1850
|
placeholder: "選擇套用範圍",
|
|
1752
1851
|
value: F
|
|
1753
1852
|
})
|
|
@@ -1799,21 +1898,21 @@ function yt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1799
1898
|
variant: "caption",
|
|
1800
1899
|
children: "簽核主管不可設定為套用會員本人。"
|
|
1801
1900
|
}) : null,
|
|
1802
|
-
/* @__PURE__ */ N(
|
|
1901
|
+
/* @__PURE__ */ N($, {
|
|
1803
1902
|
label: "優先序",
|
|
1804
1903
|
name: "managerPriority",
|
|
1805
1904
|
onChange: w,
|
|
1806
1905
|
placeholder: "例如 10",
|
|
1807
1906
|
value: C
|
|
1808
1907
|
}),
|
|
1809
|
-
/* @__PURE__ */ N(
|
|
1908
|
+
/* @__PURE__ */ N(Ot, {
|
|
1810
1909
|
label: "生效日",
|
|
1811
1910
|
name: "managerEffectiveFrom",
|
|
1812
1911
|
onChange: _,
|
|
1813
1912
|
placeholder: "YYYY-MM-DD",
|
|
1814
1913
|
value: g
|
|
1815
1914
|
}),
|
|
1816
|
-
/* @__PURE__ */ N(
|
|
1915
|
+
/* @__PURE__ */ N(Ot, {
|
|
1817
1916
|
label: "結束日",
|
|
1818
1917
|
name: "managerEffectiveTo",
|
|
1819
1918
|
onChange: y,
|
|
@@ -1824,7 +1923,7 @@ function yt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
|
|
|
1824
1923
|
})
|
|
1825
1924
|
});
|
|
1826
1925
|
}
|
|
1827
|
-
function
|
|
1926
|
+
function $({ label: e, name: t, onChange: n, placeholder: r, value: i }) {
|
|
1828
1927
|
return /* @__PURE__ */ N(o, {
|
|
1829
1928
|
label: e,
|
|
1830
1929
|
name: t,
|
|
@@ -1837,7 +1936,7 @@ function Z({ label: e, name: t, onChange: n, placeholder: r, value: i }) {
|
|
|
1837
1936
|
})
|
|
1838
1937
|
});
|
|
1839
1938
|
}
|
|
1840
|
-
function
|
|
1939
|
+
function Ot({ label: e, name: t, onChange: n, placeholder: r, value: i }) {
|
|
1841
1940
|
return /* @__PURE__ */ N(o, {
|
|
1842
1941
|
label: e,
|
|
1843
1942
|
name: t,
|
|
@@ -1845,110 +1944,110 @@ function bt({ label: e, name: t, onChange: n, placeholder: r, value: i }) {
|
|
|
1845
1944
|
format: "YYYY-MM-DD",
|
|
1846
1945
|
fullWidth: !0,
|
|
1847
1946
|
inputProps: { name: t },
|
|
1848
|
-
onChange: (e) => n(
|
|
1947
|
+
onChange: (e) => n(Yt(e)),
|
|
1849
1948
|
placeholder: r,
|
|
1850
1949
|
value: i.trim() ? i : void 0
|
|
1851
1950
|
})
|
|
1852
1951
|
});
|
|
1853
1952
|
}
|
|
1854
|
-
function
|
|
1953
|
+
function kt(e, t) {
|
|
1855
1954
|
return [...new Set([
|
|
1856
1955
|
...e.map((e) => e.memberId),
|
|
1857
1956
|
...t.map((e) => e.managerMemberId),
|
|
1858
1957
|
...t.filter((e) => e.scopeType === "MEMBER").map((e) => e.scopeId)
|
|
1859
1958
|
])];
|
|
1860
1959
|
}
|
|
1861
|
-
function
|
|
1862
|
-
return e.scopeType === "MEMBER" ? `會員:${
|
|
1960
|
+
function At(e, t) {
|
|
1961
|
+
return e.scopeType === "MEMBER" ? `會員:${jt(t.membersById.get(e.scopeId))}` : e.scopeType === "ORG_UNIT" ? `組織:${Mt(t.orgUnitsById.get(e.scopeId))}` : `職位:${Pt(t.positionsById.get(e.scopeId))}`;
|
|
1863
1962
|
}
|
|
1864
|
-
function
|
|
1963
|
+
function jt(e) {
|
|
1865
1964
|
return e ? `${e.name} · ${e.email}` : "未知會員";
|
|
1866
1965
|
}
|
|
1867
|
-
function
|
|
1966
|
+
function Mt(e) {
|
|
1868
1967
|
return e ? `${e.name} · ${e.code}` : "未知組織";
|
|
1869
1968
|
}
|
|
1870
|
-
function
|
|
1871
|
-
return
|
|
1969
|
+
function Nt(e) {
|
|
1970
|
+
return X.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? "未知類型";
|
|
1872
1971
|
}
|
|
1873
|
-
function
|
|
1972
|
+
function Pt(e) {
|
|
1874
1973
|
return e ? `${e.name} · ${e.code}` : "未指定";
|
|
1875
1974
|
}
|
|
1876
|
-
function
|
|
1975
|
+
function Ft(e) {
|
|
1877
1976
|
return e === "MANAGERS" || e === "MEMBERSHIPS" || e === "POSITIONS" ? e : "ORG_UNITS";
|
|
1878
1977
|
}
|
|
1879
|
-
function
|
|
1880
|
-
let t =
|
|
1978
|
+
function It(e) {
|
|
1979
|
+
let t = Kt(e) ? e : null;
|
|
1881
1980
|
if (typeof t?.id == "string") {
|
|
1882
1981
|
let e = t.id;
|
|
1883
|
-
return
|
|
1982
|
+
return X.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? X[2];
|
|
1884
1983
|
}
|
|
1885
|
-
return
|
|
1984
|
+
return X[2];
|
|
1886
1985
|
}
|
|
1887
|
-
function
|
|
1888
|
-
let t =
|
|
1986
|
+
function Lt(e) {
|
|
1987
|
+
let t = Kt(e) ? e : null;
|
|
1889
1988
|
if (typeof t?.id == "string") {
|
|
1890
1989
|
let e = t.id;
|
|
1891
|
-
return
|
|
1990
|
+
return it.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? rt;
|
|
1892
1991
|
}
|
|
1893
|
-
return
|
|
1992
|
+
return rt;
|
|
1894
1993
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return
|
|
1994
|
+
function Rt(e) {
|
|
1995
|
+
return Gt(e, Z, Z[0]);
|
|
1897
1996
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1997
|
+
function zt(e) {
|
|
1998
|
+
return Gt(e, ot, at);
|
|
1900
1999
|
}
|
|
1901
|
-
function
|
|
1902
|
-
return
|
|
2000
|
+
function Bt(e) {
|
|
2001
|
+
return Gt(e, ct, st);
|
|
1903
2002
|
}
|
|
1904
|
-
function
|
|
1905
|
-
let t =
|
|
1906
|
-
return
|
|
2003
|
+
function Vt(e) {
|
|
2004
|
+
let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null;
|
|
2005
|
+
return ct.find((e) => e.id === n) ?? null;
|
|
1907
2006
|
}
|
|
1908
|
-
function
|
|
1909
|
-
let t =
|
|
2007
|
+
function Ht(e) {
|
|
2008
|
+
let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
|
|
1910
2009
|
return n && r ? {
|
|
1911
2010
|
id: n,
|
|
1912
2011
|
name: r
|
|
1913
2012
|
} : null;
|
|
1914
2013
|
}
|
|
1915
|
-
function
|
|
1916
|
-
let t =
|
|
2014
|
+
function Ut(e) {
|
|
2015
|
+
let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
|
|
1917
2016
|
return n && r ? {
|
|
1918
2017
|
id: n,
|
|
1919
2018
|
name: r
|
|
1920
2019
|
} : null;
|
|
1921
2020
|
}
|
|
1922
|
-
function
|
|
1923
|
-
return
|
|
2021
|
+
function Wt(e) {
|
|
2022
|
+
return Gt(e, Q, Q[1]);
|
|
1924
2023
|
}
|
|
1925
|
-
function
|
|
1926
|
-
let r =
|
|
2024
|
+
function Gt(e, t, n) {
|
|
2025
|
+
let r = Kt(e) ? e : null, i = typeof r?.id == "string" ? r.id : null;
|
|
1927
2026
|
return t.find((e) => e.id === i) ?? n;
|
|
1928
2027
|
}
|
|
1929
|
-
function
|
|
2028
|
+
function Kt(e) {
|
|
1930
2029
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1931
2030
|
}
|
|
1932
|
-
function
|
|
2031
|
+
function qt(e, t) {
|
|
1933
2032
|
return e ? t(e) : null;
|
|
1934
2033
|
}
|
|
1935
|
-
function
|
|
1936
|
-
return
|
|
2034
|
+
function Jt() {
|
|
2035
|
+
return Xt(/* @__PURE__ */ new Date());
|
|
1937
2036
|
}
|
|
1938
|
-
function
|
|
2037
|
+
function Yt(e) {
|
|
1939
2038
|
let t = e ? new Date(e) : null;
|
|
1940
|
-
return t && !Number.isNaN(t.getTime()) ?
|
|
2039
|
+
return t && !Number.isNaN(t.getTime()) ? Xt(t) : "";
|
|
1941
2040
|
}
|
|
1942
|
-
function
|
|
1943
|
-
return `${e.getFullYear()}-${
|
|
2041
|
+
function Xt(e) {
|
|
2042
|
+
return `${e.getFullYear()}-${Zt(e.getMonth() + 1)}-${Zt(e.getDate())}`;
|
|
1944
2043
|
}
|
|
1945
|
-
function
|
|
2044
|
+
function Zt(e) {
|
|
1946
2045
|
return String(e).padStart(2, "0");
|
|
1947
2046
|
}
|
|
1948
|
-
function
|
|
2047
|
+
function Qt(e) {
|
|
1949
2048
|
return e instanceof Error ? e.message : "讀取組織資料失敗。";
|
|
1950
2049
|
}
|
|
1951
2050
|
//#endregion
|
|
1952
|
-
export {
|
|
2051
|
+
export { mt as t };
|
|
1953
2052
|
|
|
1954
|
-
//# sourceMappingURL=orgs-
|
|
2053
|
+
//# sourceMappingURL=orgs-oYd1GaLX.js.map
|