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