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