@bwg-ui/core 1.2.4 → 1.2.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.
@@ -0,0 +1,1740 @@
1
+ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
+ import { SearchOutlined as V, TeamOutlined as pe, RestOutlined as ge, CheckCircleFilled as he, CheckCircleOutlined as fe, UserOutlined as ce, CloseOutlined as me } from "@ant-design/icons";
3
+ import { message as q, Splitter as A, Flex as X, Row as ue, Col as se, Input as Z, Spin as _, Tree as ee, Button as G, Checkbox as ye, Divider as ae } from "antd";
4
+ import { useState as w, useCallback as k, useEffect as te, useMemo as B } from "react";
5
+ import { callService as ne } from "../../utils/index.js";
6
+ import { b as re, C as le, c as de, d as Q } from "../../chunks/common-components-CnAjT_Gi.js";
7
+ const Ce = (o) => {
8
+ if (o == null) return "";
9
+ const c = String(o).trim();
10
+ return !c || c.toUpperCase() === "NULL" ? "" : c.toUpperCase();
11
+ }, oe = (o, c = 0) => {
12
+ const S = Number(o);
13
+ return Number.isFinite(S) ? S : c;
14
+ };
15
+ function J(o) {
16
+ return {
17
+ crprCd: o.crprCd || void 0,
18
+ wkplCd: o.wkplCd || void 0,
19
+ deptCd: Ce(o.deptCd),
20
+ deptNm: (o.deptNm ?? "").toString().trim(),
21
+ hrnkDeptCd: o.hrnkDeptCd || null,
22
+ hrnkDeptNm: o.hrnkDeptNm || null,
23
+ deptGbCd: o.deptGbCd || null,
24
+ deptLvl: oe(o.deptLvl, o.hrnkDeptCd ? 2 : 1),
25
+ orgSortOrd: oe(o.orgSortOrd, 0),
26
+ orgOtptOrd: oe(o.orgOtptOrd, 0),
27
+ deptAbrv: o.deptAbrv || null,
28
+ deptFullNm: o.deptFullNm || null,
29
+ deptEnglNm: o.deptEnglNm || null,
30
+ isLeaf: o.isLeaf || null
31
+ };
32
+ }
33
+ function xe(o) {
34
+ const c = /* @__PURE__ */ new Set(), S = o.map(J).filter((l) => l.deptCd).filter((l) => (l.deptCd === l.hrnkDeptCd && (l.hrnkDeptCd = ""), !0)).filter((l) => c.has(l.deptCd) ? !1 : (c.add(l.deptCd), !0));
35
+ S.sort(
36
+ (l, g) => (l.deptLvl || 0) - (g.deptLvl || 0) || (l.orgSortOrd || 0) - (g.orgSortOrd || 0) || l.deptCd.localeCompare(g.deptCd)
37
+ );
38
+ const y = /* @__PURE__ */ new Map();
39
+ for (const l of S)
40
+ y.set(l.deptCd, {
41
+ ...l,
42
+ children: []
43
+ });
44
+ const N = [];
45
+ for (const l of S) {
46
+ const g = y.get(l.deptCd), p = l.hrnkDeptCd;
47
+ p && y.has(p) ? y.get(p).children.push(g) : N.push(g);
48
+ }
49
+ const E = (l) => {
50
+ !l || l.length === 0 || (l.sort((g, p) => g.deptCd.localeCompare(p.deptCd)), l.forEach((g) => E(g.children)));
51
+ };
52
+ E(N);
53
+ const z = (l) => {
54
+ if (!l.children || l.children.length === 0) {
55
+ delete l.children;
56
+ return;
57
+ }
58
+ l.children.forEach(z);
59
+ };
60
+ if (N.forEach(z), N.length > 1) {
61
+ const l = N.find((g) => g.deptCd === "D00");
62
+ if (l) return [l];
63
+ }
64
+ return N;
65
+ }
66
+ function ke(o) {
67
+ const c = o.map(J), S = c.filter((y) => y.isLeaf !== "Y").map((y) => y.deptCd);
68
+ return S.length > 200 ? c.filter((y) => (y.deptLvl || 0) <= 2).map((y) => y.deptCd) : S;
69
+ }
70
+ const Oe = ({ popup: o }) => {
71
+ const [c, S] = w(""), [y, N] = w([]), [E, z] = w([]), [l, g] = w([]), [p, P] = w(!1), j = k(
72
+ async (C) => {
73
+ try {
74
+ P(!0);
75
+ const b = await ne("SCMUTIL00103", {
76
+ ...o?.popupParams,
77
+ ...C
78
+ }), O = Array.isArray(b?.data) ? b.data : Array.isArray(b?.deptList) ? b.deptList : Array.isArray(b) ? b : [], D = xe(O);
79
+ g(D);
80
+ const R = ke(O);
81
+ N(R);
82
+ const d = D[0]?.deptCd || J(
83
+ O.find((f) => J(f).deptLvl === 1) || {}
84
+ ).deptCd || J(O[0] || {}).deptCd || "";
85
+ z(d ? [d] : []);
86
+ } catch {
87
+ q.error("조직 데이터를 불러오는 중 오류가 발생했습니다.");
88
+ } finally {
89
+ P(!1);
90
+ }
91
+ },
92
+ [o?.popupParams]
93
+ );
94
+ te(() => {
95
+ j();
96
+ }, [j]);
97
+ const W = k(
98
+ (C, b) => {
99
+ for (const O of C) {
100
+ if (O.deptCd === b) return O;
101
+ if (O.children) {
102
+ const D = W(O.children, b);
103
+ if (D) return D;
104
+ }
105
+ }
106
+ return null;
107
+ },
108
+ []
109
+ ), v = B(() => {
110
+ const C = E[0];
111
+ return C ? W(l, C) : null;
112
+ }, [E, l, W]), I = B(() => {
113
+ const C = (O) => O.map((D) => ({
114
+ title: D.deptNm,
115
+ key: D.deptCd,
116
+ meta: D,
117
+ children: D.children ? C(D.children) : void 0
118
+ }));
119
+ return C(l);
120
+ }, [l]), Y = B(() => {
121
+ const C = c.trim().toLowerCase();
122
+ if (!C) return I;
123
+ const b = (O) => O.map((D) => {
124
+ const R = D.meta, d = (R?.deptNm || "").toLowerCase().includes(C) || (R?.deptCd || "").toLowerCase().includes(C), f = D.children ? b(D.children) : void 0;
125
+ return d || f && f.length ? { ...D, children: f } : null;
126
+ }).filter(Boolean);
127
+ return b(I);
128
+ }, [I, c]), F = k((C) => {
129
+ z(C.slice(0, 1).map(String));
130
+ }, []), M = k(
131
+ (C) => N(C.map(String)),
132
+ []
133
+ ), K = k(
134
+ (C, b) => {
135
+ if (C.stopPropagation(), !b.children || b.children.length === 0) return;
136
+ const O = y.includes(b.key);
137
+ N(
138
+ (D) => O ? D.filter((R) => R !== b.key) : [...D, b.key]
139
+ );
140
+ },
141
+ [y]
142
+ ), U = k(() => z([]), []);
143
+ return /* @__PURE__ */ r(re, { popup: o, popupEvent: {
144
+ // search: () => {
145
+ // //console.log('🔍 검색 키워드:', searchKeyword);
146
+ // // 검색 키워드가 있으면 검색 파라미터로 전달
147
+ // const searchParams = searchKeyword.trim()
148
+ // ? { searchKeyword: searchKeyword.trim() }
149
+ // : {};
150
+ // loadDepartmentData(searchParams);
151
+ // },
152
+ confirm: () => {
153
+ if (!v) {
154
+ q.error("부서를 선택해주세요.");
155
+ return;
156
+ }
157
+ const C = {
158
+ deptCd: v.deptCd,
159
+ deptNm: v.deptNm,
160
+ hrnkDeptCd: v.hrnkDeptCd,
161
+ hrnkDeptNm: v.hrnkDeptNm,
162
+ deptLvl: v.deptLvl,
163
+ orgSortOrd: v.orgSortOrd
164
+ };
165
+ o?.config?.callback?.(JSON.stringify(C)), o?.close?.();
166
+ }
167
+ }, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { border: !1, style: { paddingBottom: 20 }, children: /* @__PURE__ */ a(A, { layout: "vertical", style: { height: "100%" }, children: [
168
+ /* @__PURE__ */ a(A.Panel, { defaultSize: "70%", min: "70%", max: "75%", children: [
169
+ /* @__PURE__ */ r(
170
+ "div",
171
+ {
172
+ style: {
173
+ position: "sticky",
174
+ top: 0,
175
+ zIndex: 10,
176
+ backgroundColor: "white",
177
+ borderBottom: "1px solid #e0e0e0",
178
+ padding: 8
179
+ },
180
+ children: /* @__PURE__ */ a(X, { gap: 8, vertical: !0, style: { marginBottom: 6 }, children: [
181
+ /* @__PURE__ */ r(Q, { title: "조직도" }),
182
+ /* @__PURE__ */ r(ue, { gutter: [16, 16], children: /* @__PURE__ */ r(se, { span: 24, children: /* @__PURE__ */ r(
183
+ Z,
184
+ {
185
+ placeholder: "부서명, 부서코드 검색",
186
+ prefix: /* @__PURE__ */ r(V, {}),
187
+ value: c,
188
+ allowClear: !0,
189
+ onChange: (C) => S(C.target.value)
190
+ }
191
+ ) }) })
192
+ ] })
193
+ }
194
+ ),
195
+ /* @__PURE__ */ r("div", { style: { padding: 16, overflowY: "hidden" }, children: /* @__PURE__ */ r(_, { spinning: p, children: /* @__PURE__ */ r(
196
+ ee,
197
+ {
198
+ treeData: Y,
199
+ expandedKeys: y,
200
+ selectedKeys: E,
201
+ onSelect: F,
202
+ onExpand: M,
203
+ onDoubleClick: K,
204
+ showLine: !0,
205
+ showIcon: !1,
206
+ selectable: !0,
207
+ style: { overflow: "hidden" },
208
+ titleRender: (C) => {
209
+ const b = C.meta;
210
+ return /* @__PURE__ */ a(
211
+ "span",
212
+ {
213
+ style: {
214
+ display: "flex",
215
+ justifyContent: "space-between",
216
+ alignItems: "center",
217
+ padding: "2px 4px",
218
+ width: "100%",
219
+ fontWeight: E.includes(C.key) ? "bold" : "normal"
220
+ },
221
+ children: [
222
+ /* @__PURE__ */ r("span", { children: b.deptNm }),
223
+ /* @__PURE__ */ r(
224
+ "span",
225
+ {
226
+ style: {
227
+ fontSize: 11,
228
+ color: "#999",
229
+ marginLeft: 8
230
+ },
231
+ children: b.deptCd
232
+ }
233
+ )
234
+ ]
235
+ }
236
+ );
237
+ }
238
+ }
239
+ ) }) })
240
+ ] }),
241
+ /* @__PURE__ */ r(A.Panel, { collapsible: !0, children: /* @__PURE__ */ a("div", { style: { padding: 16, overflowY: "hidden", height: "100%" }, children: [
242
+ /* @__PURE__ */ r(
243
+ "h3",
244
+ {
245
+ style: {
246
+ margin: "0 0 12px 0",
247
+ fontSize: 16,
248
+ fontWeight: 700
249
+ },
250
+ children: "선택된 부서"
251
+ }
252
+ ),
253
+ v ? /* @__PURE__ */ a(
254
+ "div",
255
+ {
256
+ style: {
257
+ display: "flex",
258
+ alignItems: "center",
259
+ padding: 14,
260
+ border: "1px solid #e0e0e0",
261
+ borderRadius: 12,
262
+ background: "#fafafa"
263
+ },
264
+ children: [
265
+ /* @__PURE__ */ r(
266
+ "div",
267
+ {
268
+ style: {
269
+ width: 42,
270
+ height: 42,
271
+ borderRadius: "50%",
272
+ border: "1px solid #e6e6e6",
273
+ display: "flex",
274
+ alignItems: "center",
275
+ justifyContent: "center",
276
+ marginRight: 12,
277
+ fontSize: 18,
278
+ color: "#8c8c8c",
279
+ background: "#fff",
280
+ flex: "0 0 auto"
281
+ },
282
+ children: /* @__PURE__ */ r(pe, {})
283
+ }
284
+ ),
285
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
286
+ /* @__PURE__ */ a(
287
+ "div",
288
+ {
289
+ style: {
290
+ fontSize: 15,
291
+ fontWeight: 700,
292
+ marginBottom: 4
293
+ },
294
+ children: [
295
+ v.deptNm,
296
+ " ",
297
+ /* @__PURE__ */ a("span", { style: { color: "#8c8c8c", fontSize: 12 }, children: [
298
+ "(",
299
+ v.deptCd,
300
+ ")"
301
+ ] })
302
+ ]
303
+ }
304
+ ),
305
+ /* @__PURE__ */ a(
306
+ "div",
307
+ {
308
+ style: { fontSize: 12, color: "#666", marginBottom: 2 },
309
+ children: [
310
+ "상위부서: ",
311
+ v.hrnkDeptNm || "-"
312
+ ]
313
+ }
314
+ )
315
+ ] }),
316
+ /* @__PURE__ */ r(
317
+ G,
318
+ {
319
+ type: "text",
320
+ onClick: U,
321
+ icon: /* @__PURE__ */ r(
322
+ ge,
323
+ {
324
+ style: { fontSize: 24, color: "#FF6363" }
325
+ }
326
+ )
327
+ }
328
+ )
329
+ ]
330
+ }
331
+ ) : /* @__PURE__ */ r("div", { style: { color: "#999", fontSize: 14 }, children: "부서를 선택해주세요." })
332
+ ] }) })
333
+ ] }) }) }) });
334
+ }, ve = (o) => {
335
+ if (o == null) return "";
336
+ const c = String(o).trim();
337
+ return !c || c.toUpperCase() === "NULL" ? "" : c.toUpperCase();
338
+ }, ie = (o, c = 0) => {
339
+ const S = Number(o);
340
+ return Number.isFinite(S) ? S : c;
341
+ };
342
+ function H(o) {
343
+ return {
344
+ crprCd: o.crprCd || void 0,
345
+ wkplCd: o.wkplCd || void 0,
346
+ deptCd: ve(o.deptCd),
347
+ deptNm: (o.deptNm ?? "").toString().trim(),
348
+ hrnkDeptCd: o.hrnkDeptCd || null,
349
+ hrnkDeptNm: o.hrnkDeptNm || null,
350
+ deptGbCd: o.deptGbCd || null,
351
+ deptLvl: ie(o.deptLvl, o.hrnkDeptCd ? 2 : 1),
352
+ orgSortOrd: ie(o.orgSortOrd, 0),
353
+ orgOtptOrd: ie(o.orgOtptOrd, 0),
354
+ deptAbrv: o.deptAbrv || null,
355
+ deptFullNm: o.deptFullNm || null,
356
+ deptEnglNm: o.deptEnglNm || null,
357
+ isLeaf: o.isLeaf || null
358
+ };
359
+ }
360
+ function be(o) {
361
+ const c = /* @__PURE__ */ new Set(), S = o.map(H).filter((l) => l.deptCd).filter((l) => (l.deptCd === l.hrnkDeptCd && (l.hrnkDeptCd = ""), !0)).filter((l) => c.has(l.deptCd) ? !1 : (c.add(l.deptCd), !0));
362
+ S.sort(
363
+ (l, g) => (l.deptLvl || 0) - (g.deptLvl || 0) || (l.orgSortOrd || 0) - (g.orgSortOrd || 0) || l.deptCd.localeCompare(g.deptCd)
364
+ );
365
+ const y = /* @__PURE__ */ new Map();
366
+ for (const l of S)
367
+ y.set(l.deptCd, {
368
+ ...l,
369
+ children: []
370
+ });
371
+ const N = [];
372
+ for (const l of S) {
373
+ const g = y.get(l.deptCd), p = l.hrnkDeptCd;
374
+ p && y.has(p) ? y.get(p).children.push(g) : N.push(g);
375
+ }
376
+ const E = (l) => {
377
+ !l || l.length === 0 || (l.sort((g, p) => g.deptCd.localeCompare(p.deptCd)), l.forEach((g) => E(g.children)));
378
+ };
379
+ E(N);
380
+ const z = (l) => {
381
+ if (!l.children || l.children.length === 0) {
382
+ delete l.children;
383
+ return;
384
+ }
385
+ l.children.forEach(z);
386
+ };
387
+ if (N.forEach(z), N.length > 1) {
388
+ const l = N.find((g) => g.deptCd === "D00");
389
+ if (l) return [l];
390
+ }
391
+ return N;
392
+ }
393
+ function Se(o) {
394
+ const c = o.map(H), S = c.filter((y) => y.isLeaf !== "Y").map((y) => y.deptCd);
395
+ return S.length > 200 ? c.filter((y) => (y.deptLvl || 0) <= 2).map((y) => y.deptCd) : S;
396
+ }
397
+ const je = ({ popup: o }) => {
398
+ const [c, S] = w(""), [y, N] = w(""), [E, z] = w([]), [l, g] = w([]), [p, P] = w([]), [j, W] = w(!1), [v, I] = w([]), [Y, F] = w(!1), M = k(
399
+ async (e) => {
400
+ try {
401
+ F(!0);
402
+ const t = await ne("SCMUTIL00103", {
403
+ ...o?.popupParams,
404
+ ...e
405
+ }), n = Array.isArray(t?.data) ? t.data : Array.isArray(t?.deptList) ? t.deptList : Array.isArray(t) ? t : [], i = be(n);
406
+ I(i);
407
+ const s = Se(n);
408
+ z(s);
409
+ const h = i[0]?.deptCd || H(
410
+ n.find((u) => H(u).deptLvl === 1) || {}
411
+ ).deptCd || H(n[0] || {}).deptCd || "";
412
+ g(h ? [h] : []);
413
+ } catch {
414
+ q.error("조직 데이터를 불러오는 중 오류가 발생했습니다.");
415
+ } finally {
416
+ F(!1);
417
+ }
418
+ },
419
+ [o?.popupParams]
420
+ );
421
+ te(() => {
422
+ M();
423
+ }, [M]);
424
+ const K = k(
425
+ (e, t) => {
426
+ for (const n of e) {
427
+ if (n.deptCd === t) return n;
428
+ if (n.children) {
429
+ const i = K(n.children, t);
430
+ if (i) return i;
431
+ }
432
+ }
433
+ return null;
434
+ },
435
+ [v]
436
+ ), U = B(() => p.map((e) => {
437
+ const t = K(v, e);
438
+ if (!t) return null;
439
+ const { children: n, ...i } = t;
440
+ return i;
441
+ }).filter(Boolean), [p, v, K]), T = B(() => {
442
+ const e = (t) => t.map((n) => ({
443
+ title: n.deptNm,
444
+ key: n.deptCd,
445
+ meta: n,
446
+ // ★ 원본
447
+ children: n.children ? e(n.children) : void 0,
448
+ isLeaf: !n.children || n.children.length === 0
449
+ }));
450
+ return e(v);
451
+ }, [v]), C = B(() => {
452
+ const e = c.trim().toLowerCase();
453
+ if (!e) return T;
454
+ const t = (n) => n.map((i) => {
455
+ const s = i.meta, h = (s?.deptNm || "").toLowerCase().includes(e) || (s?.deptCd || "").toLowerCase().includes(e), u = i.children ? t(i.children) : void 0;
456
+ return h || u && u.length > 0 ? { ...i, children: u } : null;
457
+ }).filter(Boolean);
458
+ return t(T);
459
+ }, [T, c]), b = k(
460
+ (e) => {
461
+ const t = [], n = (i) => {
462
+ for (const s of i)
463
+ if (s.deptCd === e && s.children) {
464
+ const h = (u) => {
465
+ for (const x of u)
466
+ t.push(x.deptCd), x.children && h(x.children);
467
+ };
468
+ h(s.children);
469
+ } else s.children && n(s.children);
470
+ };
471
+ return n(v), t;
472
+ },
473
+ [v]
474
+ ), O = k(
475
+ (e, t) => {
476
+ let n = Array.isArray(e) ? e : e?.checked ?? [];
477
+ if (j && t?.node?.key) {
478
+ const i = t.node.key, s = b(i);
479
+ if (t.checked) {
480
+ const h = new Set(n);
481
+ for (const u of s) h.add(u);
482
+ n = Array.from(h);
483
+ } else {
484
+ const h = /* @__PURE__ */ new Set([i, ...s]);
485
+ n = n.filter((u) => !h.has(u));
486
+ }
487
+ }
488
+ P(n);
489
+ },
490
+ [j, b]
491
+ ), D = k(
492
+ (e) => {
493
+ const t = e.map(String);
494
+ if (g(t), t.length > 0) {
495
+ const n = t[0], i = (h, u) => {
496
+ for (const x of h) {
497
+ if (x.deptCd === u) return x.deptNm;
498
+ if (x.children) {
499
+ const $ = i(x.children, u);
500
+ if ($) return $;
501
+ }
502
+ }
503
+ return null;
504
+ }, s = i(v, n);
505
+ s && N(s);
506
+ }
507
+ },
508
+ [v]
509
+ ), R = k(
510
+ (e) => z(e.map(String)),
511
+ []
512
+ ), d = k(
513
+ (e, t) => {
514
+ if (e.stopPropagation(), t.children && t.children.length > 0) {
515
+ const n = E.includes(t.key);
516
+ z(
517
+ (i) => n ? i.filter((s) => s !== t.key) : [...i, t.key]
518
+ );
519
+ }
520
+ },
521
+ [E]
522
+ ), f = k((e) => {
523
+ P((t) => t.filter((n) => n !== e));
524
+ }, []), m = k(() => {
525
+ P([]);
526
+ }, []);
527
+ return /* @__PURE__ */ r(re, { popup: o, popupEvent: {
528
+ // search: () => {
529
+ // //console.log('🔍 검색 키워드:', searchKeyword);
530
+ // // 검색 키워드가 있으면 검색 파라미터로 전달
531
+ // const searchParams = searchKeyword.trim()
532
+ // ? { searchKeyword: searchKeyword.trim() }
533
+ // : {};
534
+ // loadDepartmentData(searchParams);
535
+ // },
536
+ confirm: () => {
537
+ if (p.length === 0) {
538
+ q.error("부서를 선택해주세요.");
539
+ return;
540
+ }
541
+ const t = Array.from(new Set(p)).map((n) => {
542
+ const i = K(v, n);
543
+ return i ? {
544
+ deptCd: i.deptCd,
545
+ deptNm: i.deptNm,
546
+ hrnkDeptCd: i.hrnkDeptCd,
547
+ hrnkDeptNm: i.hrnkDeptNm
548
+ } : null;
549
+ }).filter(Boolean);
550
+ o?.config?.callback?.(JSON.stringify(t)), o?.close?.();
551
+ }
552
+ }, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { border: !1, style: { paddingBottom: 20 }, children: /* @__PURE__ */ a(A, { layout: "vertical", style: { height: "100%" }, children: [
553
+ /* @__PURE__ */ a(A.Panel, { defaultSize: "60%", min: "20%", max: "80%", children: [
554
+ /* @__PURE__ */ r(
555
+ "div",
556
+ {
557
+ style: {
558
+ position: "sticky",
559
+ top: 0,
560
+ zIndex: 10,
561
+ backgroundColor: "white",
562
+ borderBottom: "1px solid #e0e0e0",
563
+ padding: "8px"
564
+ },
565
+ children: /* @__PURE__ */ a(X, { gap: 8, vertical: !0, style: { marginBottom: 6 }, children: [
566
+ /* @__PURE__ */ r(Q, { title: "조직도" }),
567
+ /* @__PURE__ */ r(
568
+ "div",
569
+ {
570
+ style: {
571
+ fontSize: 14,
572
+ color: "#666",
573
+ padding: 8,
574
+ backgroundColor: "#f8f8f8",
575
+ borderRadius: 4
576
+ },
577
+ children: y
578
+ }
579
+ ),
580
+ /* @__PURE__ */ a(ue, { gutter: [16, 16], children: [
581
+ /* @__PURE__ */ r(se, { span: 18, children: /* @__PURE__ */ r(
582
+ Z,
583
+ {
584
+ placeholder: "부서명, 부서장명, 부서코드 검색",
585
+ prefix: /* @__PURE__ */ r(V, {}),
586
+ value: c,
587
+ allowClear: !0,
588
+ onChange: (e) => S(e.target.value)
589
+ }
590
+ ) }),
591
+ /* @__PURE__ */ r(
592
+ se,
593
+ {
594
+ span: 6,
595
+ style: {
596
+ justifyContent: "center",
597
+ display: "flex",
598
+ alignItems: "center"
599
+ },
600
+ children: /* @__PURE__ */ r(
601
+ ye,
602
+ {
603
+ checked: j,
604
+ onChange: (e) => W(e.target.checked),
605
+ children: "하위까지 선택"
606
+ }
607
+ )
608
+ }
609
+ )
610
+ ] })
611
+ ] })
612
+ }
613
+ ),
614
+ /* @__PURE__ */ r("div", { style: { padding: 16, overflowY: "hidden" }, children: /* @__PURE__ */ r(_, { spinning: Y, children: /* @__PURE__ */ r(
615
+ ee,
616
+ {
617
+ className: "bwg-ogrn-tree",
618
+ treeData: C,
619
+ expandedKeys: E,
620
+ selectedKeys: l,
621
+ checkedKeys: p,
622
+ checkable: !0,
623
+ checkStrictly: !0,
624
+ showLine: !0,
625
+ showIcon: !1,
626
+ selectable: !0,
627
+ onSelect: D,
628
+ onExpand: R,
629
+ onCheck: O,
630
+ onDoubleClick: d,
631
+ style: { overflow: "hidden" },
632
+ titleRender: (e) => {
633
+ const t = e.meta;
634
+ return /* @__PURE__ */ a(
635
+ "span",
636
+ {
637
+ style: {
638
+ display: "flex",
639
+ justifyContent: "space-between",
640
+ alignItems: "center",
641
+ padding: "2px 4px",
642
+ width: "100%"
643
+ },
644
+ children: [
645
+ /* @__PURE__ */ r(
646
+ "span",
647
+ {
648
+ style: {
649
+ fontWeight: l.includes(e.key) ? "bold" : "normal"
650
+ },
651
+ children: t.deptNm
652
+ }
653
+ ),
654
+ /* @__PURE__ */ r(
655
+ "span",
656
+ {
657
+ style: {
658
+ fontSize: 11,
659
+ color: "#999",
660
+ marginLeft: 8
661
+ },
662
+ children: t.deptCd
663
+ }
664
+ )
665
+ ]
666
+ }
667
+ );
668
+ }
669
+ }
670
+ ) }) })
671
+ ] }),
672
+ /* @__PURE__ */ r(A.Panel, { collapsible: !0, children: /* @__PURE__ */ a("div", { style: { padding: 16, overflowY: "hidden" }, children: [
673
+ /* @__PURE__ */ a(
674
+ "div",
675
+ {
676
+ style: {
677
+ marginBottom: 12,
678
+ display: "flex",
679
+ alignItems: "center",
680
+ gap: 8
681
+ },
682
+ children: [
683
+ /* @__PURE__ */ a("h3", { style: { margin: 0, fontSize: 16, fontWeight: 700 }, children: [
684
+ "선택된 부서 (",
685
+ U.length,
686
+ "개)"
687
+ ] }),
688
+ U.length > 0 && /* @__PURE__ */ r(
689
+ "button",
690
+ {
691
+ onClick: m,
692
+ style: {
693
+ border: "none",
694
+ background: "transparent",
695
+ color: "#8c8c8c",
696
+ cursor: "pointer",
697
+ fontSize: 12,
698
+ padding: 4
699
+ },
700
+ title: "전체 해제",
701
+ children: "전체 해제"
702
+ }
703
+ )
704
+ ]
705
+ }
706
+ ),
707
+ /* @__PURE__ */ r(
708
+ "div",
709
+ {
710
+ style: {
711
+ display: "flex",
712
+ flexWrap: "wrap",
713
+ gap: 8,
714
+ alignItems: "flex-start",
715
+ minHeight: 48
716
+ },
717
+ children: U.length === 0 ? /* @__PURE__ */ r("div", { style: { color: "#999", fontSize: 14 }, children: "선택된 부서가 없습니다." }) : U.map((e) => /* @__PURE__ */ a(
718
+ "span",
719
+ {
720
+ style: {
721
+ display: "inline-flex",
722
+ alignItems: "center",
723
+ gap: 8,
724
+ padding: "4px 8px",
725
+ borderRadius: 999,
726
+ border: "1px solid #e6e6e6",
727
+ background: "#fafafa",
728
+ lineHeight: 1.1,
729
+ cursor: "default",
730
+ maxWidth: 260
731
+ },
732
+ title: `${e.deptNm}`,
733
+ children: [
734
+ /* @__PURE__ */ r(
735
+ "span",
736
+ {
737
+ style: {
738
+ width: 18,
739
+ height: 18,
740
+ borderRadius: "50%",
741
+ border: "1px solid #e6e6e6",
742
+ display: "inline-flex",
743
+ alignItems: "center",
744
+ justifyContent: "center",
745
+ fontSize: 12,
746
+ color: "#8c8c8c",
747
+ background: "#fff",
748
+ flex: "0 0 auto"
749
+ },
750
+ children: /* @__PURE__ */ r(pe, {})
751
+ }
752
+ ),
753
+ /* @__PURE__ */ a(
754
+ "span",
755
+ {
756
+ style: {
757
+ display: "inline-flex",
758
+ flexDirection: "column",
759
+ gap: 2,
760
+ overflow: "hidden"
761
+ },
762
+ children: [
763
+ /* @__PURE__ */ r(
764
+ "span",
765
+ {
766
+ style: {
767
+ fontSize: 13,
768
+ fontWeight: 600,
769
+ whiteSpace: "nowrap",
770
+ overflow: "hidden",
771
+ textOverflow: "ellipsis",
772
+ maxWidth: 180
773
+ },
774
+ children: e.deptNm
775
+ }
776
+ ),
777
+ /* @__PURE__ */ r(
778
+ "span",
779
+ {
780
+ style: {
781
+ fontSize: 11,
782
+ color: "#8c8c8c",
783
+ whiteSpace: "nowrap",
784
+ overflow: "hidden",
785
+ textOverflow: "ellipsis",
786
+ maxWidth: 180
787
+ },
788
+ children: e.deptCd
789
+ }
790
+ )
791
+ ]
792
+ }
793
+ ),
794
+ /* @__PURE__ */ r(
795
+ "button",
796
+ {
797
+ onClick: () => f(e.deptCd),
798
+ style: {
799
+ border: "none",
800
+ background: "transparent",
801
+ color: "#8c8c8c",
802
+ cursor: "pointer",
803
+ padding: 2,
804
+ lineHeight: 0
805
+ },
806
+ "aria-label": `${e.deptNm} 선택 해제`,
807
+ title: "선택 해제",
808
+ children: "×"
809
+ }
810
+ )
811
+ ]
812
+ },
813
+ e.deptCd
814
+ ))
815
+ }
816
+ )
817
+ ] }) })
818
+ ] }) }) }) });
819
+ }, Ae = ({ popup: o }) => {
820
+ const [c, S] = w(""), [y, N] = w(""), [E, z] = w([]), [l, g] = w([]), [p, P] = w(
821
+ null
822
+ ), [j, W] = w([]), [v, I] = w(!1), Y = k(async () => {
823
+ try {
824
+ I(!0);
825
+ const d = await ne("SCMUTIL00105", {
826
+ ...o?.popupParams
827
+ });
828
+ console.log("📊 조직도 API 응답:", d);
829
+ const f = Array.isArray(d?.data) ? d.data : Array.isArray(d?.orgnList) ? d.orgnList : Array.isArray(d) ? d : [];
830
+ if (f.length === 0) {
831
+ console.warn("⚠️ 조직도 데이터가 없습니다.");
832
+ return;
833
+ }
834
+ const m = F(f);
835
+ console.log("🌳 구성된 조직도 트리:", m), W(m);
836
+ const L = f.filter((e) => e.deptLvl <= 2).map((e) => e.deptCd);
837
+ if (z(L), m.length > 0) {
838
+ const e = m[0];
839
+ g([e.deptCd]), N(e.deptNm);
840
+ }
841
+ console.log("✅ 조직도 데이터 로딩 완료");
842
+ } catch (d) {
843
+ console.error("❌ 조직도 데이터 로딩 실패:", d), q.error("조직도 데이터를 불러오는 중 오류가 발생했습니다.");
844
+ } finally {
845
+ I(!1);
846
+ }
847
+ }, [o?.popupParams]), F = k((d) => {
848
+ const f = [...d].sort(
849
+ (t, n) => t.deptLvl - n.deptLvl || t.orgSortOrd - n.orgSortOrd || t.deptCd.localeCompare(n.deptCd)
850
+ ), m = /* @__PURE__ */ new Map();
851
+ for (const t of f)
852
+ m.set(t.deptCd, {
853
+ ...t,
854
+ children: []
855
+ });
856
+ const L = [];
857
+ for (const t of f) {
858
+ const n = m.get(t.deptCd), i = t.hrnkDeptCd;
859
+ i && m.has(i) ? m.get(i).children.push(n) : L.push(n);
860
+ }
861
+ const e = (t) => {
862
+ if (!t.children || t.children.length === 0) {
863
+ delete t.children;
864
+ return;
865
+ }
866
+ t.children.forEach(e);
867
+ };
868
+ return L.forEach(e), L;
869
+ }, []);
870
+ te(() => {
871
+ Y();
872
+ }, [Y]);
873
+ const M = B(() => {
874
+ const d = (L) => {
875
+ let e = [];
876
+ return L.forEach((t) => {
877
+ t.employees && (e = e.concat(t.employees)), t.children && (e = e.concat(d(t.children)));
878
+ }), e;
879
+ }, f = d(j), m = f.filter(
880
+ (L, e, t) => e === t.findIndex((n) => n.empNo === L.empNo)
881
+ );
882
+ return console.log(
883
+ `👥 전체 사원 수: ${f.length}, 중복 제거 후: ${m.length}`
884
+ ), m;
885
+ }, [j]), K = B(() => {
886
+ const d = (f) => f.map((m) => ({
887
+ title: m.deptNm,
888
+ key: m.deptCd,
889
+ children: m.children ? d(m.children) : void 0,
890
+ isLeaf: !m.children || m.children.length === 0
891
+ }));
892
+ return d(j);
893
+ }, [j]), U = B(() => {
894
+ if (!c.trim())
895
+ return K;
896
+ const d = (f) => f.map((m) => {
897
+ const L = m.title.toLowerCase().includes(c.toLowerCase()), e = m.children ? d(m.children) : void 0;
898
+ return L || e && e.length > 0 ? {
899
+ ...m,
900
+ children: e
901
+ } : null;
902
+ }).filter(Boolean);
903
+ return d(K);
904
+ }, [K, c]), T = B(() => {
905
+ if (!c.trim()) {
906
+ const d = (t) => {
907
+ let n = [];
908
+ return t.forEach((i) => {
909
+ i.employees && (n = n.concat(i.employees)), i.children && (n = n.concat(d(i.children)));
910
+ }), n;
911
+ }, f = (t, n) => {
912
+ for (const i of t) {
913
+ if (i.deptCd === n) {
914
+ let s = [...i.employees || []];
915
+ return i.children && (s = s.concat(d(i.children))), s;
916
+ }
917
+ if (i.children) {
918
+ const s = f(
919
+ i.children,
920
+ n
921
+ );
922
+ if (s.length > 0) return s;
923
+ }
924
+ }
925
+ return [];
926
+ }, m = l[0];
927
+ if (!m) return [];
928
+ const L = f(
929
+ j,
930
+ m
931
+ ), e = L.filter(
932
+ (t, n, i) => n === i.findIndex((s) => s.empNo === t.empNo)
933
+ );
934
+ return console.log(
935
+ `🔍 선택된 부서: ${m}, 반환된 사원 수: ${L.length}, 중복 제거 후: ${e.length}`
936
+ ), e;
937
+ }
938
+ return M.filter((d) => d.empNm.toLowerCase().includes(c.toLowerCase()) || d.empNo.toLowerCase().includes(c.toLowerCase()) || d.deptNm.toLowerCase().includes(c.toLowerCase()) || d.jbpsCd.includes(c) || d.jbgdCd.includes(c) || d.emplyStCd.includes(c));
939
+ }, [c, l, M, j]), C = k((d) => {
940
+ P(d);
941
+ }, []), b = k(
942
+ (d) => {
943
+ const f = d.map(String);
944
+ if (console.log(`🌳 트리 선택: ${f.join(", ")}`), g(f), f.length > 0) {
945
+ const m = f[0], L = (t, n) => {
946
+ for (const i of t) {
947
+ if (i.deptCd === n)
948
+ return i.deptNm;
949
+ if (i.children) {
950
+ const s = L(i.children, n);
951
+ if (s) return s;
952
+ }
953
+ }
954
+ return null;
955
+ }, e = L(j, m);
956
+ e && N(e);
957
+ }
958
+ },
959
+ [j]
960
+ ), O = k((d) => {
961
+ z(d.map(String));
962
+ }, []), D = k(
963
+ (d, f) => {
964
+ if (d.stopPropagation(), f.children && f.children.length > 0) {
965
+ const m = E.includes(f.key);
966
+ z(m ? (L) => L.filter((e) => e !== f.key) : (L) => [...L, f.key]);
967
+ }
968
+ },
969
+ [E]
970
+ );
971
+ return /* @__PURE__ */ r(re, { popup: o, popupEvent: {
972
+ confirm: () => {
973
+ p ? (o?.popupParams?.onSelect ? o.popupParams.onSelect(p) : o?.config?.callback && o.config.callback(JSON.stringify(p, null, 2)), o?.close?.()) : q.error("사원을 선택해주세요.");
974
+ }
975
+ }, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { border: !1, style: { paddingBottom: 20 }, children: /* @__PURE__ */ a(A, { layout: "vertical", style: { height: "100%" }, children: [
976
+ /* @__PURE__ */ a(A.Panel, { defaultSize: "60%", min: "20%", max: "80%", children: [
977
+ /* @__PURE__ */ r(
978
+ "div",
979
+ {
980
+ style: {
981
+ position: "sticky",
982
+ top: 0,
983
+ zIndex: 10,
984
+ backgroundColor: "white",
985
+ borderBottom: "1px solid #e0e0e0",
986
+ padding: "8px"
987
+ },
988
+ children: /* @__PURE__ */ a(X, { gap: 8, vertical: !0, style: { marginBottom: "6px" }, children: [
989
+ /* @__PURE__ */ r(Q, { title: "조직도" }),
990
+ /* @__PURE__ */ r(
991
+ Z,
992
+ {
993
+ placeholder: "이름, 소속, 전화번호 검색",
994
+ prefix: /* @__PURE__ */ r(V, {}),
995
+ value: c,
996
+ allowClear: !0,
997
+ onChange: (d) => S(d.target.value)
998
+ }
999
+ )
1000
+ ] })
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ r(
1004
+ "div",
1005
+ {
1006
+ style: {
1007
+ padding: "16px",
1008
+ overflowY: "hidden"
1009
+ },
1010
+ children: /* @__PURE__ */ r(_, { spinning: v, children: /* @__PURE__ */ r(
1011
+ ee,
1012
+ {
1013
+ className: "bwg-ogrn-tree",
1014
+ treeData: U,
1015
+ expandedKeys: E,
1016
+ selectedKeys: l,
1017
+ onSelect: b,
1018
+ onExpand: O,
1019
+ onDoubleClick: D,
1020
+ showLine: !0,
1021
+ showIcon: !1,
1022
+ style: { overflow: "hidden" },
1023
+ titleRender: (d) => /* @__PURE__ */ r(
1024
+ "span",
1025
+ {
1026
+ style: {
1027
+ padding: "4px 8px",
1028
+ borderRadius: "4px",
1029
+ fontWeight: l.includes(d.key) ? "bold" : "normal",
1030
+ display: "inline-block",
1031
+ width: "100%"
1032
+ },
1033
+ children: d.title
1034
+ }
1035
+ )
1036
+ }
1037
+ ) })
1038
+ }
1039
+ )
1040
+ ] }),
1041
+ /* @__PURE__ */ r(A.Panel, { collapsible: !0, children: /* @__PURE__ */ a(
1042
+ "div",
1043
+ {
1044
+ style: {
1045
+ padding: "16px",
1046
+ overflowY: "hidden"
1047
+ },
1048
+ children: [
1049
+ /* @__PURE__ */ r("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ r(
1050
+ "h3",
1051
+ {
1052
+ style: {
1053
+ margin: "0 0 8px 0",
1054
+ fontSize: "16px",
1055
+ fontWeight: "bold"
1056
+ },
1057
+ children: c ? "검색 결과" : y
1058
+ }
1059
+ ) }),
1060
+ /* @__PURE__ */ a("div", { style: { overflow: "hidden", height: "100%" }, children: [
1061
+ T.map((d) => /* @__PURE__ */ a(
1062
+ "div",
1063
+ {
1064
+ style: {
1065
+ display: "flex",
1066
+ alignItems: "center",
1067
+ padding: "12px",
1068
+ border: "1px solid #e0e0e0",
1069
+ borderRadius: "8px",
1070
+ marginBottom: "8px",
1071
+ cursor: "pointer",
1072
+ backgroundColor: p && p.crprCd === d.crprCd && p.wkplCd === d.wkplCd && p.empNo === d.empNo && p.jbpsCd === d.jbpsCd && p.jbgdCd === d.jbgdCd && p.empMarkOrd === d.empMarkOrd ? "#efebff" : "white"
1073
+ },
1074
+ onClick: () => C(d),
1075
+ children: [
1076
+ /* @__PURE__ */ r(
1077
+ "div",
1078
+ {
1079
+ style: {
1080
+ marginRight: "12px",
1081
+ cursor: "pointer",
1082
+ display: "flex",
1083
+ alignItems: "center",
1084
+ justifyContent: "center",
1085
+ width: "20px",
1086
+ height: "20px"
1087
+ },
1088
+ onClick: (f) => {
1089
+ f.stopPropagation(), P(d);
1090
+ },
1091
+ children: p && p.crprCd === d.crprCd && p.wkplCd === d.wkplCd && p.empNo === d.empNo && p.jbpsCd === d.jbpsCd && p.jbgdCd === d.jbgdCd && p.empMarkOrd === d.empMarkOrd ? /* @__PURE__ */ r(
1092
+ he,
1093
+ {
1094
+ style: {
1095
+ fontSize: "20px",
1096
+ color: "#6449fc"
1097
+ }
1098
+ }
1099
+ ) : /* @__PURE__ */ r(
1100
+ fe,
1101
+ {
1102
+ style: {
1103
+ fontSize: "20px",
1104
+ color: "#d9d9d9"
1105
+ }
1106
+ }
1107
+ )
1108
+ }
1109
+ ),
1110
+ /* @__PURE__ */ r(
1111
+ "div",
1112
+ {
1113
+ style: {
1114
+ width: "40px",
1115
+ height: "40px",
1116
+ borderRadius: "50%",
1117
+ backgroundColor: "#e0e0e0",
1118
+ display: "flex",
1119
+ alignItems: "center",
1120
+ justifyContent: "center",
1121
+ marginRight: "12px",
1122
+ fontSize: "18px",
1123
+ color: "#666"
1124
+ },
1125
+ children: /* @__PURE__ */ r(ce, {})
1126
+ }
1127
+ ),
1128
+ /* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
1129
+ /* @__PURE__ */ a(
1130
+ "div",
1131
+ {
1132
+ style: {
1133
+ fontSize: "14px",
1134
+ fontWeight: "bold",
1135
+ marginBottom: "4px"
1136
+ },
1137
+ children: [
1138
+ d.empNm,
1139
+ /* @__PURE__ */ a(
1140
+ "span",
1141
+ {
1142
+ style: {
1143
+ fontSize: "12px",
1144
+ fontWeight: "normal",
1145
+ color: "#666",
1146
+ marginLeft: "8px"
1147
+ },
1148
+ children: [
1149
+ "(",
1150
+ d.empNo,
1151
+ ")"
1152
+ ]
1153
+ }
1154
+ )
1155
+ ]
1156
+ }
1157
+ ),
1158
+ /* @__PURE__ */ a(
1159
+ "div",
1160
+ {
1161
+ style: {
1162
+ fontSize: "12px",
1163
+ color: "#666",
1164
+ marginBottom: "2px"
1165
+ },
1166
+ children: [
1167
+ d.deptNm,
1168
+ " (",
1169
+ d.deptCd,
1170
+ ") | 직급:",
1171
+ " ",
1172
+ d.jbpsCd,
1173
+ " | 등급: ",
1174
+ d.jbgdCd
1175
+ ]
1176
+ }
1177
+ )
1178
+ ] })
1179
+ ]
1180
+ },
1181
+ `emp-${d.crprCd}-${d.wkplCd}-${d.empNo}-${d.jbpsCd}-${d.jbgdCd}-${d.empMarkOrd}`
1182
+ )),
1183
+ T.length === 0 && /* @__PURE__ */ r(
1184
+ "div",
1185
+ {
1186
+ style: {
1187
+ textAlign: "center",
1188
+ padding: "40px",
1189
+ color: "#999",
1190
+ fontSize: "14px"
1191
+ },
1192
+ children: c ? "검색 결과가 없습니다." : "해당 부서에 직원이 없습니다."
1193
+ }
1194
+ )
1195
+ ] })
1196
+ ]
1197
+ }
1198
+ ) })
1199
+ ] }) }) }) });
1200
+ }, Ie = ({ popup: o }) => {
1201
+ const [c, S] = w(""), [y, N] = w(""), [E, z] = w([]), [l, g] = w([]), [p, P] = w([]), [j, W] = w(!1), [v, I] = w({}), Y = k(async () => {
1202
+ try {
1203
+ W(!0);
1204
+ const e = await ne("SCMUTIL00105", {
1205
+ ...o?.popupParams
1206
+ });
1207
+ console.log("📊 조직도 API 응답:", e);
1208
+ const t = Array.isArray(e?.data) ? e.data : Array.isArray(e?.orgnList) ? e.orgnList : Array.isArray(e) ? e : [];
1209
+ if (t.length === 0) {
1210
+ console.warn("⚠️ 조직도 데이터가 없습니다.");
1211
+ return;
1212
+ }
1213
+ const n = F(t);
1214
+ console.log("🌳 구성된 조직도 트리:", n), P(n);
1215
+ const i = t.filter((s) => s.deptLvl <= 2).map((s) => s.deptCd);
1216
+ if (z(i), n.length > 0) {
1217
+ const s = n[0];
1218
+ g([s.deptCd]), N(s.deptNm);
1219
+ }
1220
+ console.log("✅ 조직도 데이터 로딩 완료");
1221
+ } catch (e) {
1222
+ console.error("❌ 조직도 데이터 로딩 실패:", e), q.error("조직도 데이터를 불러오는 중 오류가 발생했습니다.");
1223
+ } finally {
1224
+ W(!1);
1225
+ }
1226
+ }, [o?.popupParams]), F = k((e) => {
1227
+ const t = [...e].sort(
1228
+ (h, u) => h.deptLvl - u.deptLvl || h.orgSortOrd - u.orgSortOrd || h.deptCd.localeCompare(u.deptCd)
1229
+ ), n = /* @__PURE__ */ new Map();
1230
+ for (const h of t)
1231
+ n.set(h.deptCd, {
1232
+ ...h,
1233
+ children: []
1234
+ });
1235
+ const i = [];
1236
+ for (const h of t) {
1237
+ const u = n.get(h.deptCd), x = h.hrnkDeptCd;
1238
+ x && n.has(x) ? n.get(x).children.push(u) : i.push(u);
1239
+ }
1240
+ const s = (h) => {
1241
+ if (!h.children || h.children.length === 0) {
1242
+ delete h.children;
1243
+ return;
1244
+ }
1245
+ h.children.forEach(s);
1246
+ };
1247
+ return i.forEach(s), i;
1248
+ }, []);
1249
+ te(() => {
1250
+ Y();
1251
+ }, [Y]);
1252
+ const M = B(() => {
1253
+ const e = (i) => {
1254
+ let s = [];
1255
+ return i.forEach((h) => {
1256
+ h.employees && (s = s.concat(h.employees)), h.children && (s = s.concat(e(h.children)));
1257
+ }), s;
1258
+ }, t = e(p), n = t.filter(
1259
+ (i, s, h) => s === h.findIndex((u) => u.empNo === i.empNo)
1260
+ );
1261
+ return console.log(
1262
+ `👥 전체 사원 수: ${t.length}, 중복 제거 후: ${n.length}`
1263
+ ), n;
1264
+ }, [p]), K = B(() => {
1265
+ const e = (t) => t.map((n) => ({
1266
+ title: n.deptNm,
1267
+ key: n.deptCd,
1268
+ children: n.children ? e(n.children) : void 0,
1269
+ isLeaf: !n.children || n.children.length === 0
1270
+ }));
1271
+ return e(p);
1272
+ }, [p]), U = B(() => {
1273
+ if (!c.trim())
1274
+ return K;
1275
+ const e = (t) => t.map((n) => {
1276
+ const i = n.title.toLowerCase().includes(c.toLowerCase()), s = n.children ? e(n.children) : void 0;
1277
+ return i || s && s.length > 0 ? {
1278
+ ...n,
1279
+ children: s
1280
+ } : null;
1281
+ }).filter(Boolean);
1282
+ return e(K);
1283
+ }, [K, c]), T = B(() => {
1284
+ if (!c.trim()) {
1285
+ const e = (h) => {
1286
+ let u = [];
1287
+ return h.forEach((x) => {
1288
+ x.employees && (u = u.concat(x.employees)), x.children && (u = u.concat(e(x.children)));
1289
+ }), u;
1290
+ }, t = (h, u) => {
1291
+ for (const x of h) {
1292
+ if (x.deptCd === u) {
1293
+ let $ = [...x.employees || []];
1294
+ return x.children && ($ = $.concat(e(x.children))), $;
1295
+ }
1296
+ if (x.children) {
1297
+ const $ = t(
1298
+ x.children,
1299
+ u
1300
+ );
1301
+ if ($.length > 0) return $;
1302
+ }
1303
+ }
1304
+ return [];
1305
+ }, n = l[0];
1306
+ if (!n) return [];
1307
+ const i = t(
1308
+ p,
1309
+ n
1310
+ ), s = i.filter(
1311
+ (h, u, x) => u === x.findIndex(($) => $.empNo === h.empNo)
1312
+ );
1313
+ return console.log(
1314
+ `🔍 선택된 부서: ${n}, 반환된 사원 수: ${i.length}, 중복 제거 후: ${s.length}`
1315
+ ), s;
1316
+ }
1317
+ return M.filter((e) => e.empNm.toLowerCase().includes(c.toLowerCase()) || e.empNo.toLowerCase().includes(c.toLowerCase()) || e.deptNm.toLowerCase().includes(c.toLowerCase()) || e.jbpsCd.includes(c) || e.jbgdCd.includes(c) || e.emplyStCd.includes(c));
1318
+ }, [c, l, M, p]), C = k((e) => {
1319
+ I((t) => {
1320
+ const n = { ...t };
1321
+ return n[e.empNo] ? delete n[e.empNo] : n[e.empNo] = e, n;
1322
+ });
1323
+ }, []), b = k((e) => {
1324
+ I((t) => {
1325
+ const n = { ...t };
1326
+ return delete n[e], n;
1327
+ });
1328
+ }, []), O = k(() => I({}), []), D = k(() => {
1329
+ I((e) => {
1330
+ const t = { ...e };
1331
+ for (const n of T) t[n.empNo] = n;
1332
+ return t;
1333
+ });
1334
+ }, [T]), R = k(() => {
1335
+ I((e) => {
1336
+ const t = { ...e };
1337
+ for (const n of T) delete t[n.empNo];
1338
+ return t;
1339
+ });
1340
+ }, [T]), d = k(
1341
+ (e) => {
1342
+ const t = e.map(String);
1343
+ if (console.log(`🌳 트리 선택: ${t.join(", ")}`), g(t), t.length > 0) {
1344
+ const n = t[0], i = (h, u) => {
1345
+ for (const x of h) {
1346
+ if (x.deptCd === u)
1347
+ return x.deptNm;
1348
+ if (x.children) {
1349
+ const $ = i(x.children, u);
1350
+ if ($) return $;
1351
+ }
1352
+ }
1353
+ return null;
1354
+ }, s = i(p, n);
1355
+ s && N(s);
1356
+ }
1357
+ },
1358
+ [p]
1359
+ ), f = k((e) => {
1360
+ z(e.map(String));
1361
+ }, []), m = k(
1362
+ (e, t) => {
1363
+ if (e.stopPropagation(), !t.children || !t.children.length) return;
1364
+ const n = E.includes(t.key);
1365
+ z(
1366
+ (i) => n ? i.filter((s) => s !== t.key) : [...i, t.key]
1367
+ );
1368
+ },
1369
+ [E]
1370
+ );
1371
+ return /* @__PURE__ */ r(re, { popup: o, popupEvent: {
1372
+ confirm: () => {
1373
+ const e = Object.values(v).map((t) => ({
1374
+ crprCd: t.crprCd,
1375
+ wkplCd: t.wkplCd,
1376
+ empNo: t.empNo,
1377
+ deptCd: t.deptCd,
1378
+ deptNm: t.deptNm,
1379
+ empNm: t.empNm,
1380
+ jbpsCd: t.jbpsCd,
1381
+ jbgdCd: t.jbgdCd,
1382
+ empMarkOrd: t.empMarkOrd,
1383
+ emplyStCd: t.emplyStCd
1384
+ }));
1385
+ if (e.length === 0) {
1386
+ q.error("직원을 선택해주세요.");
1387
+ return;
1388
+ }
1389
+ o?.config?.callback?.(JSON.stringify(e)), o?.close?.();
1390
+ }
1391
+ }, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { border: !1, style: { paddingBottom: 20 }, children: /* @__PURE__ */ a(A, { style: { height: "100%" }, children: [
1392
+ /* @__PURE__ */ r(A.Panel, { defaultSize: "50%", min: "50%", max: "70%", children: /* @__PURE__ */ a(A, { layout: "vertical", style: { height: "100%" }, children: [
1393
+ /* @__PURE__ */ a(A.Panel, { defaultSize: "60%", min: "35%", max: "75%", children: [
1394
+ /* @__PURE__ */ r(
1395
+ "div",
1396
+ {
1397
+ style: {
1398
+ position: "sticky",
1399
+ top: 0,
1400
+ zIndex: 10,
1401
+ backgroundColor: "white",
1402
+ borderBottom: "1px solid #e0e0e0",
1403
+ padding: 8
1404
+ },
1405
+ children: /* @__PURE__ */ a(X, { gap: 8, vertical: !0, style: { marginBottom: 6 }, children: [
1406
+ /* @__PURE__ */ r(Q, { title: "조직도" }),
1407
+ /* @__PURE__ */ r(
1408
+ Z,
1409
+ {
1410
+ placeholder: "이름, 소속, 직급/직위, 사번 검색",
1411
+ prefix: /* @__PURE__ */ r(V, {}),
1412
+ value: c,
1413
+ allowClear: !0,
1414
+ onChange: (e) => S(e.target.value)
1415
+ }
1416
+ )
1417
+ ] })
1418
+ }
1419
+ ),
1420
+ /* @__PURE__ */ r("div", { style: { padding: 16, overflowY: "hidden" }, children: /* @__PURE__ */ r(_, { spinning: j, children: /* @__PURE__ */ r(
1421
+ ee,
1422
+ {
1423
+ className: "bwg-ogrn-tree",
1424
+ treeData: U,
1425
+ expandedKeys: E,
1426
+ selectedKeys: l,
1427
+ onSelect: d,
1428
+ onExpand: f,
1429
+ onDoubleClick: m,
1430
+ showLine: !0,
1431
+ showIcon: !1,
1432
+ style: { overflow: "hidden" },
1433
+ titleRender: (e) => /* @__PURE__ */ r(
1434
+ "span",
1435
+ {
1436
+ style: {
1437
+ padding: "4px 8px",
1438
+ borderRadius: 4,
1439
+ fontWeight: l.includes(e.key) ? "bold" : "normal",
1440
+ display: "inline-block",
1441
+ width: "100%"
1442
+ },
1443
+ children: e.title
1444
+ }
1445
+ )
1446
+ }
1447
+ ) }) })
1448
+ ] }),
1449
+ /* @__PURE__ */ r(A.Panel, { children: /* @__PURE__ */ a(
1450
+ "div",
1451
+ {
1452
+ style: {
1453
+ padding: 16,
1454
+ height: "100%",
1455
+ display: "flex",
1456
+ flexDirection: "column"
1457
+ },
1458
+ children: [
1459
+ /* @__PURE__ */ a(
1460
+ "div",
1461
+ {
1462
+ style: {
1463
+ display: "flex",
1464
+ alignItems: "center",
1465
+ justifyContent: "space-between"
1466
+ },
1467
+ children: [
1468
+ /* @__PURE__ */ r("h3", { style: { margin: 0, fontSize: 16, fontWeight: 700 }, children: c ? "검색 결과" : `${y} 사용자` }),
1469
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 8 }, children: [
1470
+ /* @__PURE__ */ r(G, { size: "small", onClick: D, children: "현재 목록 전체 선택" }),
1471
+ /* @__PURE__ */ r(G, { size: "small", onClick: R, children: "현재 목록 전체 해제" })
1472
+ ] })
1473
+ ]
1474
+ }
1475
+ ),
1476
+ /* @__PURE__ */ r(ae, { style: { margin: "8px 0" } }),
1477
+ /* @__PURE__ */ a("div", { style: { overflowY: "auto" }, children: [
1478
+ T.map((e) => {
1479
+ const t = !!v[e.empNo];
1480
+ return /* @__PURE__ */ a(
1481
+ "div",
1482
+ {
1483
+ style: {
1484
+ display: "flex",
1485
+ alignItems: "center",
1486
+ padding: 10,
1487
+ border: "1px solid #e0e0e0",
1488
+ borderRadius: 8,
1489
+ marginBottom: 8,
1490
+ cursor: "pointer",
1491
+ background: t ? "#efebff" : "#fff"
1492
+ },
1493
+ onClick: () => C(e),
1494
+ children: [
1495
+ /* @__PURE__ */ r(
1496
+ "div",
1497
+ {
1498
+ style: {
1499
+ marginRight: 12,
1500
+ width: 22,
1501
+ height: 22,
1502
+ display: "flex",
1503
+ alignItems: "center",
1504
+ justifyContent: "center"
1505
+ },
1506
+ onClick: (n) => {
1507
+ n.stopPropagation(), C(e);
1508
+ },
1509
+ children: t ? /* @__PURE__ */ r(
1510
+ he,
1511
+ {
1512
+ style: { fontSize: 20, color: "#6449fc" }
1513
+ }
1514
+ ) : /* @__PURE__ */ r(
1515
+ fe,
1516
+ {
1517
+ style: { fontSize: 20, color: "#d9d9d9" }
1518
+ }
1519
+ )
1520
+ }
1521
+ ),
1522
+ /* @__PURE__ */ r(
1523
+ "div",
1524
+ {
1525
+ style: {
1526
+ width: 36,
1527
+ height: 36,
1528
+ borderRadius: "50%",
1529
+ backgroundColor: "#e0e0e0",
1530
+ display: "flex",
1531
+ alignItems: "center",
1532
+ justifyContent: "center",
1533
+ marginRight: 12,
1534
+ fontSize: 16,
1535
+ color: "#666",
1536
+ flex: "0 0 auto"
1537
+ },
1538
+ children: /* @__PURE__ */ r(ce, {})
1539
+ }
1540
+ ),
1541
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
1542
+ /* @__PURE__ */ a(
1543
+ "div",
1544
+ {
1545
+ style: {
1546
+ fontSize: 14,
1547
+ fontWeight: 600,
1548
+ marginBottom: 2
1549
+ },
1550
+ children: [
1551
+ e.empNm,
1552
+ /* @__PURE__ */ a(
1553
+ "span",
1554
+ {
1555
+ style: {
1556
+ fontSize: 12,
1557
+ fontWeight: "normal",
1558
+ color: "#666",
1559
+ marginLeft: "8px"
1560
+ },
1561
+ children: [
1562
+ "(",
1563
+ e.empNo,
1564
+ ")"
1565
+ ]
1566
+ }
1567
+ )
1568
+ ]
1569
+ }
1570
+ ),
1571
+ /* @__PURE__ */ a("div", { style: { fontSize: 12, color: "#666" }, children: [
1572
+ e.deptNm,
1573
+ " (",
1574
+ e.deptCd,
1575
+ ") | 직급: ",
1576
+ e.jbpsCd,
1577
+ " | 등급: ",
1578
+ e.jbgdCd
1579
+ ] })
1580
+ ] })
1581
+ ]
1582
+ },
1583
+ `emp-${e.crprCd}-${e.wkplCd}-${e.empNo}-${e.jbpsCd}-${e.jbgdCd}-${e.empMarkOrd}`
1584
+ );
1585
+ }),
1586
+ T.length === 0 && /* @__PURE__ */ r(
1587
+ "div",
1588
+ {
1589
+ style: {
1590
+ textAlign: "center",
1591
+ padding: 32,
1592
+ color: "#999",
1593
+ fontSize: 14
1594
+ },
1595
+ children: c ? "검색 결과가 없습니다." : "해당 부서에 사용자 없음"
1596
+ }
1597
+ )
1598
+ ] })
1599
+ ]
1600
+ }
1601
+ ) })
1602
+ ] }) }),
1603
+ /* @__PURE__ */ r(A.Panel, { collapsible: !0, children: /* @__PURE__ */ a(
1604
+ "div",
1605
+ {
1606
+ style: {
1607
+ padding: 16,
1608
+ height: "100%",
1609
+ display: "flex",
1610
+ flexDirection: "column"
1611
+ },
1612
+ children: [
1613
+ /* @__PURE__ */ a(
1614
+ "div",
1615
+ {
1616
+ style: {
1617
+ display: "flex",
1618
+ alignItems: "center",
1619
+ justifyContent: "space-between"
1620
+ },
1621
+ children: [
1622
+ /* @__PURE__ */ r(
1623
+ Q,
1624
+ {
1625
+ title: `선택된 사용자 (${Object.keys(v).length})`
1626
+ }
1627
+ ),
1628
+ /* @__PURE__ */ r(G, { type: "link", size: "small", onClick: O, children: "전체 해제" })
1629
+ ]
1630
+ }
1631
+ ),
1632
+ /* @__PURE__ */ r(ae, { style: { margin: "8px 0" } }),
1633
+ /* @__PURE__ */ a("div", { style: { overflowY: "auto", flex: 1 }, children: [
1634
+ Object.values(v).map((e) => /* @__PURE__ */ a(
1635
+ "div",
1636
+ {
1637
+ style: {
1638
+ display: "flex",
1639
+ alignItems: "center",
1640
+ padding: 10,
1641
+ border: "1px solid #e0e0e0",
1642
+ borderRadius: 8,
1643
+ marginBottom: 8,
1644
+ background: "#fafafa"
1645
+ },
1646
+ children: [
1647
+ /* @__PURE__ */ r(
1648
+ "div",
1649
+ {
1650
+ style: {
1651
+ width: 32,
1652
+ height: 32,
1653
+ borderRadius: "50%",
1654
+ backgroundColor: "#e0e0e0",
1655
+ display: "flex",
1656
+ alignItems: "center",
1657
+ justifyContent: "center",
1658
+ marginRight: 10,
1659
+ color: "#666"
1660
+ },
1661
+ children: /* @__PURE__ */ r(ce, {})
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
1665
+ /* @__PURE__ */ a(
1666
+ "div",
1667
+ {
1668
+ style: {
1669
+ fontSize: 13,
1670
+ fontWeight: 600,
1671
+ marginBottom: 2
1672
+ },
1673
+ children: [
1674
+ e.empNm,
1675
+ /* @__PURE__ */ a(
1676
+ "span",
1677
+ {
1678
+ style: {
1679
+ fontSize: 11,
1680
+ fontWeight: "normal",
1681
+ color: "#666",
1682
+ marginLeft: "6px"
1683
+ },
1684
+ children: [
1685
+ "(",
1686
+ e.empNo,
1687
+ ")"
1688
+ ]
1689
+ }
1690
+ )
1691
+ ]
1692
+ }
1693
+ ),
1694
+ /* @__PURE__ */ a("div", { style: { fontSize: 12, color: "#666" }, children: [
1695
+ e.deptNm,
1696
+ " (",
1697
+ e.deptCd,
1698
+ ") | 직급: ",
1699
+ e.jbpsCd,
1700
+ " | 등급: ",
1701
+ e.jbgdCd
1702
+ ] })
1703
+ ] }),
1704
+ /* @__PURE__ */ r(
1705
+ G,
1706
+ {
1707
+ type: "text",
1708
+ shape: "circle",
1709
+ icon: /* @__PURE__ */ r(me, {}),
1710
+ onClick: () => b(e.empNo)
1711
+ }
1712
+ )
1713
+ ]
1714
+ },
1715
+ `selected-${e.crprCd}-${e.wkplCd}-${e.empNo}-${e.jbpsCd}-${e.jbgdCd}-${e.empMarkOrd}`
1716
+ )),
1717
+ Object.keys(v).length === 0 && /* @__PURE__ */ r(
1718
+ "div",
1719
+ {
1720
+ style: {
1721
+ color: "#999",
1722
+ fontSize: 14,
1723
+ textAlign: "center",
1724
+ padding: 24
1725
+ },
1726
+ children: "선택된 사용자가 없습니다."
1727
+ }
1728
+ )
1729
+ ] })
1730
+ ]
1731
+ }
1732
+ ) })
1733
+ ] }) }) }) });
1734
+ };
1735
+ export {
1736
+ Oe as SearchDepartmentP01,
1737
+ je as SearchDepartmentP02,
1738
+ Ae as SearchOrganizationP01,
1739
+ Ie as SearchOrganizationP02
1740
+ };