@baishuyun/ui-business 5.1.7 → 5.2.0
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/dist/DeptsMemberSelector/{DeptsMemberSelector-DjDAPVIj.js → DeptsMemberSelector-DD3yoWYQ.js} +2 -2
- package/dist/DeptsMemberSelector/DeptsUser-41XeJOIY.js +981 -0
- package/dist/DeptsMemberSelector/{Member-Ds_Qzw0L.js → Member-Bit-zWOE.js} +268 -129
- package/dist/DeptsMemberSelector/MemberPanel-BhuVgJdO.js +510 -0
- package/dist/DeptsMemberSelector/index.js +4 -4
- package/dist/DeptsMemberSelector/subcomponents/Entity/DeptsUser/index.js +2 -2
- package/dist/DeptsMemberSelector/subcomponents/Entity/Member/index.js +2 -2
- package/dist/DeptsMemberSelector/utils/index.js +11 -2
- package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +1 -1
- package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersExtraContactPanel/DeptUsersExtraContactPanel.d.ts +2 -0
- package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersExtraContactPanel/useDeptUsersExtraContactPanelData.d.ts +40 -0
- package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersRolePanel/useDeptUsersRolePanelData.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +4 -4
- package/dist/lang/en-US.json.d.ts +1 -0
- package/dist/lang/zh-CN.json.d.ts +1 -0
- package/dist/lang/zh-TW.json.d.ts +71 -0
- package/dist/vendors/useLocale.js +73 -7
- package/package.json +3 -3
- package/dist/DeptsMemberSelector/DeptsUser-Coh1rKPm.js +0 -790
- package/dist/DeptsMemberSelector/ExtraConcactPanel-CWKwVmbx.js +0 -647
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import { t as e } from "../vendors/simplebar-react.js";
|
|
2
|
+
import { t } from "../vendors/clsx.js";
|
|
3
|
+
import { t as n } from "./useDeptsMemberSelector-t7b8yu-A.js";
|
|
4
|
+
import { a as r, c as i, i as a, n as o, o as s, r as c, s as l } from "./services/contact/selector.service-CY5vQea8.js";
|
|
5
|
+
import { i as u } from "./TabGroup-Dht9ylk4.js";
|
|
6
|
+
import { t as d } from "../vendors/useLocale.js";
|
|
7
|
+
import { buildDeptTree as f, buildTree as p, getColorByName as m } from "./utils/index.js";
|
|
8
|
+
import { t as h } from "./OrganizationPanel-CT3v_KVr.js";
|
|
9
|
+
import { n as g, t as _ } from "./MemberPanel-BhuVgJdO.js";
|
|
10
|
+
import { t as v } from "./RelationShipList-BhiAdVjm.js";
|
|
11
|
+
import { t as y } from "./RelationShipDepts-kpemRPz1.js";
|
|
12
|
+
import { useMemo as b, useState as x } from "react";
|
|
13
|
+
import { Avatar as S, Spin as C } from "antd";
|
|
14
|
+
import { Checkbox as w, Icon as T, Tree as E } from "@baishuyun/ui-base";
|
|
15
|
+
import { useRequest as D } from "ahooks";
|
|
16
|
+
import { jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
17
|
+
//#region src/utils/recordSelectedNode.ts
|
|
18
|
+
function A(e, t) {
|
|
19
|
+
let n = "bsy_dept_member";
|
|
20
|
+
try {
|
|
21
|
+
let r = sessionStorage.getItem(n), i = r ? JSON.parse(r) : [];
|
|
22
|
+
if (i.some((t) => t._id === e)) return;
|
|
23
|
+
let a = t.find((t) => t._id === e);
|
|
24
|
+
if (!a) {
|
|
25
|
+
console.warn(`未找到 id 为 ${e} 的节点信息`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
i.push(a), sessionStorage.setItem(n, JSON.stringify(i));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error("记录选中节点时发生错误:", e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersPositionPanel/DeptUsersPositionPanel.module.scss
|
|
35
|
+
var j = {
|
|
36
|
+
"dept-users-position-panel": "_dept-users-position-panel_wnw63_1",
|
|
37
|
+
"dept-users-position-panel__department": "_dept-users-position-panel__department_wnw63_6",
|
|
38
|
+
"dept-users-position-panel__mode": "_dept-users-position-panel__mode_wnw63_11",
|
|
39
|
+
"dept-users-position-panel__mode-list": "_dept-users-position-panel__mode-list_wnw63_16",
|
|
40
|
+
"dept-users-position-panel__mode-item": "_dept-users-position-panel__mode-item_wnw63_22",
|
|
41
|
+
"dept-users-position-panel__mode-item--active": "_dept-users-position-panel__mode-item--active_wnw63_32",
|
|
42
|
+
"dept-users-position-panel__positions": "_dept-users-position-panel__positions_wnw63_39",
|
|
43
|
+
"dept-users-position-panel__position-group": "_dept-users-position-panel__position-group_wnw63_45",
|
|
44
|
+
"dept-users-position-panel__position-item": "_dept-users-position-panel__position-item_wnw63_50",
|
|
45
|
+
"dept-users-position-panel__position-checkbox": "_dept-users-position-panel__position-checkbox_wnw63_58",
|
|
46
|
+
"dept-users-position-panel__position-checkbox-row": "_dept-users-position-panel__position-checkbox-row_wnw63_61",
|
|
47
|
+
"dept-users-position-panel__position-name": "_dept-users-position-panel__position-name_wnw63_68",
|
|
48
|
+
"dept-users-position-panel__empty": "_dept-users-position-panel__empty_wnw63_77",
|
|
49
|
+
"dept-users-position-panel__switcher-icon": "_dept-users-position-panel__switcher-icon_wnw63_85",
|
|
50
|
+
"dept-users-position-panel__switcher-icon--expanded": "_dept-users-position-panel__switcher-icon--expanded_wnw63_90"
|
|
51
|
+
}, ee = [{
|
|
52
|
+
key: "current",
|
|
53
|
+
label: "当前部门的所有职位"
|
|
54
|
+
}, {
|
|
55
|
+
key: "currentSub",
|
|
56
|
+
label: "当前部门以及子部门的所有职位"
|
|
57
|
+
}], M = (e) => encodeURIComponent(e), N = (e) => e?._id === void 0 || e?._id === null ? "" : String(e._id), P = (e) => typeof e?.name == "string" ? e.name : "", te = (e) => e.find((e) => N(e) && P(e)), ne = (e) => typeof e == "string" ? e : e.job_title || e.name || "", F = (e) => {
|
|
58
|
+
if (typeof e != "string") return e._id || e.id;
|
|
59
|
+
}, I = ({ sourceItems: e, deptId: t, deptName: n, mode: r }) => e.map((e) => {
|
|
60
|
+
let i = ne(e);
|
|
61
|
+
if (!i) return null;
|
|
62
|
+
let a = [
|
|
63
|
+
M(t),
|
|
64
|
+
r,
|
|
65
|
+
M(i)
|
|
66
|
+
].join("__");
|
|
67
|
+
return {
|
|
68
|
+
_id: a,
|
|
69
|
+
id: a,
|
|
70
|
+
name: r === "current" ? `${n} - ${i}` : `${n}及子部门 - ${i}`,
|
|
71
|
+
positionName: i,
|
|
72
|
+
type: "jobtitle",
|
|
73
|
+
jobTitle: `${t}-${r}-${i}`,
|
|
74
|
+
rawId: F(e),
|
|
75
|
+
deptId: t,
|
|
76
|
+
deptName: n,
|
|
77
|
+
mode: r
|
|
78
|
+
};
|
|
79
|
+
}).filter((e) => e !== null), L = (e) => Array.isArray(e) ? e : Array.isArray(e?.items) ? e.items : Array.isArray(e?.list) ? e.list : [], re = () => {
|
|
80
|
+
let { containerHeight: e, requestContext: t, value: r = [], dispatch: i } = n(), [a, c] = x(""), [l, u] = x(""), [d, p] = x("current"), { data: m, loading: h } = D(() => o({
|
|
81
|
+
requestContext: t,
|
|
82
|
+
hasDeptDock: !1
|
|
83
|
+
}), {
|
|
84
|
+
refreshDeps: [t],
|
|
85
|
+
onSuccess: (e) => {
|
|
86
|
+
let t = te(e?.departments || []);
|
|
87
|
+
c(N(t)), u(P(t));
|
|
88
|
+
}
|
|
89
|
+
}), g = b(() => m?.departments || [], [m]), _ = b(() => f(g), [g]), v = b(() => _.map((e) => e._id).filter(Boolean), [_]), { data: y, loading: S } = D(async () => a ? {
|
|
90
|
+
sourceData: await s({
|
|
91
|
+
requestContext: t,
|
|
92
|
+
departmentId: a,
|
|
93
|
+
mode: d
|
|
94
|
+
}),
|
|
95
|
+
deptId: a,
|
|
96
|
+
deptName: l,
|
|
97
|
+
mode: d
|
|
98
|
+
} : {
|
|
99
|
+
sourceData: { items: [] },
|
|
100
|
+
deptId: "",
|
|
101
|
+
deptName: "",
|
|
102
|
+
mode: d
|
|
103
|
+
}, { refreshDeps: [
|
|
104
|
+
a,
|
|
105
|
+
d,
|
|
106
|
+
t?.appId,
|
|
107
|
+
t?.entryId
|
|
108
|
+
] }), C = b(() => !y || y.deptId !== a || y.mode !== d ? [] : I({
|
|
109
|
+
sourceItems: L(y.sourceData),
|
|
110
|
+
deptId: y.deptId,
|
|
111
|
+
deptName: y.deptName,
|
|
112
|
+
mode: y.mode
|
|
113
|
+
}), [
|
|
114
|
+
y,
|
|
115
|
+
a,
|
|
116
|
+
d
|
|
117
|
+
]), w = b(() => r.map((e) => e._id), [r]);
|
|
118
|
+
return {
|
|
119
|
+
containerHeight: e,
|
|
120
|
+
departmentTree: _,
|
|
121
|
+
defaultExpandedKeys: v,
|
|
122
|
+
canShowModeOptions: !!m && !h && g.length > 0 && !!a,
|
|
123
|
+
selectedDeptId: a,
|
|
124
|
+
selectedMode: d,
|
|
125
|
+
setSelectedMode: p,
|
|
126
|
+
modeOptions: ee,
|
|
127
|
+
positionList: C,
|
|
128
|
+
selectedIds: w,
|
|
129
|
+
loadingDepartments: h,
|
|
130
|
+
loadingPositions: S,
|
|
131
|
+
handleSelectDepartment: (e, t) => {
|
|
132
|
+
let n = String(t?._id || e || ""), r = g.find((e) => N(e) === n) || t;
|
|
133
|
+
c(N(r)), u(P(r));
|
|
134
|
+
},
|
|
135
|
+
handlePositionToggle: (e, t) => {
|
|
136
|
+
if (t) {
|
|
137
|
+
i({
|
|
138
|
+
type: "addOne",
|
|
139
|
+
payload: e
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
i({
|
|
144
|
+
type: "deleteOne",
|
|
145
|
+
payload: e._id
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}, ie = () => {
|
|
150
|
+
let { t: n } = d(), r = re(), i = r.containerHeight - 8;
|
|
151
|
+
return /* @__PURE__ */ k("div", {
|
|
152
|
+
className: j["dept-users-position-panel"],
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ O("section", {
|
|
155
|
+
className: j["dept-users-position-panel__department"],
|
|
156
|
+
children: /* @__PURE__ */ O(C, {
|
|
157
|
+
spinning: r.loadingDepartments,
|
|
158
|
+
tip: n("common.loading"),
|
|
159
|
+
children: /* @__PURE__ */ k(e, {
|
|
160
|
+
style: {
|
|
161
|
+
height: i,
|
|
162
|
+
padding: "4px"
|
|
163
|
+
},
|
|
164
|
+
children: [r.departmentTree.length > 0 && /* @__PURE__ */ O(E, {
|
|
165
|
+
data: r.departmentTree,
|
|
166
|
+
fieldNames: {
|
|
167
|
+
title: "name",
|
|
168
|
+
value: "_id",
|
|
169
|
+
children: "children"
|
|
170
|
+
},
|
|
171
|
+
selectedKeys: r.selectedDeptId ? [r.selectedDeptId] : [],
|
|
172
|
+
defaultExpandedKeys: r.defaultExpandedKeys,
|
|
173
|
+
parentCheckable: !0,
|
|
174
|
+
onSelect: (e, t) => r.handleSelectDepartment(e, t),
|
|
175
|
+
icon: () => /* @__PURE__ */ O(u, {
|
|
176
|
+
type: "department",
|
|
177
|
+
size: 16
|
|
178
|
+
}),
|
|
179
|
+
switcherIcon: (e) => /* @__PURE__ */ O(T, {
|
|
180
|
+
name: "xiangxiazhankai-11",
|
|
181
|
+
className: t(j["dept-users-position-panel__switcher-icon"], { [j["dept-users-position-panel__switcher-icon--expanded"]]: e })
|
|
182
|
+
})
|
|
183
|
+
}), r.departmentTree.length === 0 && !r.loadingDepartments && /* @__PURE__ */ O("div", {
|
|
184
|
+
className: j["dept-users-position-panel__empty"],
|
|
185
|
+
children: /* @__PURE__ */ O("span", { children: "没有可选部门" })
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ O("section", {
|
|
191
|
+
className: j["dept-users-position-panel__mode"],
|
|
192
|
+
children: r.canShowModeOptions && /* @__PURE__ */ O("ul", {
|
|
193
|
+
className: j["dept-users-position-panel__mode-list"],
|
|
194
|
+
children: r.modeOptions.map((e) => /* @__PURE__ */ O("li", {
|
|
195
|
+
className: t(j["dept-users-position-panel__mode-item"], { [j["dept-users-position-panel__mode-item--active"]]: r.selectedMode === e.key }),
|
|
196
|
+
onClick: () => r.setSelectedMode(e.key),
|
|
197
|
+
children: e.label
|
|
198
|
+
}, e.key))
|
|
199
|
+
})
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ k("section", {
|
|
202
|
+
className: j["dept-users-position-panel__positions"],
|
|
203
|
+
children: [/* @__PURE__ */ O(C, {
|
|
204
|
+
spinning: r.loadingPositions,
|
|
205
|
+
tip: n("common.loading"),
|
|
206
|
+
children: /* @__PURE__ */ O(e, {
|
|
207
|
+
style: {
|
|
208
|
+
height: i,
|
|
209
|
+
padding: "4px"
|
|
210
|
+
},
|
|
211
|
+
children: r.positionList.length > 0 && /* @__PURE__ */ O("div", {
|
|
212
|
+
className: j["dept-users-position-panel__position-group"],
|
|
213
|
+
children: r.positionList.map((e) => /* @__PURE__ */ O("div", {
|
|
214
|
+
className: j["dept-users-position-panel__position-item"],
|
|
215
|
+
children: /* @__PURE__ */ O(w, {
|
|
216
|
+
value: e._id,
|
|
217
|
+
checked: r.selectedIds.includes(e._id),
|
|
218
|
+
labelPosition: "left",
|
|
219
|
+
className: j["dept-users-position-panel__position-checkbox"],
|
|
220
|
+
onChange: (t) => r.handlePositionToggle(e, t),
|
|
221
|
+
children: /* @__PURE__ */ O("div", {
|
|
222
|
+
className: j["dept-users-position-panel__position-checkbox-row"],
|
|
223
|
+
children: /* @__PURE__ */ O("span", {
|
|
224
|
+
className: j["dept-users-position-panel__position-name"],
|
|
225
|
+
children: e.positionName
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
}, e._id))
|
|
230
|
+
})
|
|
231
|
+
})
|
|
232
|
+
}), r.positionList.length === 0 && !r.loadingPositions && /* @__PURE__ */ O("div", {
|
|
233
|
+
className: j["dept-users-position-panel__empty"],
|
|
234
|
+
children: /* @__PURE__ */ O("span", { children: "没有可选职位" })
|
|
235
|
+
})]
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
});
|
|
239
|
+
}, R = {
|
|
240
|
+
"dept-users-role-panel": "_dept-users-role-panel_2436w_1",
|
|
241
|
+
"dept-users-role-panel__menu": "_dept-users-role-panel__menu_2436w_6",
|
|
242
|
+
"dept-users-role-panel__menu-list": "_dept-users-role-panel__menu-list_2436w_11",
|
|
243
|
+
"dept-users-role-panel__option-list": "_dept-users-role-panel__option-list_2436w_11",
|
|
244
|
+
"dept-users-role-panel__menu-item": "_dept-users-role-panel__menu-item_2436w_15",
|
|
245
|
+
"dept-users-role-panel__option-item": "_dept-users-role-panel__option-item_2436w_15",
|
|
246
|
+
"dept-users-role-panel__menu-item--active": "_dept-users-role-panel__menu-item--active_2436w_26",
|
|
247
|
+
"dept-users-role-panel__option-item--active": "_dept-users-role-panel__option-item--active_2436w_26",
|
|
248
|
+
"dept-users-role-panel__tree-section": "_dept-users-role-panel__tree-section_2436w_33",
|
|
249
|
+
"dept-users-role-panel__options-section": "_dept-users-role-panel__options-section_2436w_33",
|
|
250
|
+
"dept-users-role-panel__option-checkbox": "_dept-users-role-panel__option-checkbox_2436w_39",
|
|
251
|
+
"dept-users-role-panel__option-checkbox-row": "_dept-users-role-panel__option-checkbox-row_2436w_42",
|
|
252
|
+
"dept-users-role-panel__option-name": "_dept-users-role-panel__option-name_2436w_48",
|
|
253
|
+
"dept-users-role-panel__tree-icon": "_dept-users-role-panel__tree-icon_2436w_56",
|
|
254
|
+
"dept-users-role-panel__switcher-icon": "_dept-users-role-panel__switcher-icon_2436w_59",
|
|
255
|
+
"dept-users-role-panel__switcher-icon--expanded": "_dept-users-role-panel__switcher-icon--expanded_2436w_64",
|
|
256
|
+
"dept-users-role-panel__empty": "_dept-users-role-panel__empty_2436w_67"
|
|
257
|
+
}, z = (e) => String(e), B = (e) => e ? String(e.type) === "1" : !1, ae = (e) => ({
|
|
258
|
+
...e,
|
|
259
|
+
role_id: z(e.role_id),
|
|
260
|
+
parent: e.parent === 0 || e.parent === "0" ? "0" : e.parent ? z(e.parent) : e.parent
|
|
261
|
+
}), oe = (e) => ({
|
|
262
|
+
_id: z(e.role_id),
|
|
263
|
+
name: e.name,
|
|
264
|
+
type: "dockrole",
|
|
265
|
+
label: e.name
|
|
266
|
+
}), se = (e, t) => {
|
|
267
|
+
if (!e) return [];
|
|
268
|
+
let n = z(e.role_id);
|
|
269
|
+
return B(e) ? [{
|
|
270
|
+
_id: `${n}-roleGroup`,
|
|
271
|
+
name: e.name,
|
|
272
|
+
type: "rolegroup",
|
|
273
|
+
label: t("role.currentGroup")
|
|
274
|
+
}, {
|
|
275
|
+
_id: `${n}-roleGroupSub`,
|
|
276
|
+
name: `${e.name}及子分组的角色`,
|
|
277
|
+
type: "rolegroup",
|
|
278
|
+
label: t("role.currentGroupSub")
|
|
279
|
+
}] : [{
|
|
280
|
+
_id: n,
|
|
281
|
+
name: e.name,
|
|
282
|
+
type: "role",
|
|
283
|
+
label: t("role.currentSelected")
|
|
284
|
+
}];
|
|
285
|
+
}, V = (e, t) => {
|
|
286
|
+
if (t) for (let n of e) {
|
|
287
|
+
if (z(n.role_id) === t) return n;
|
|
288
|
+
let e = V(n.children || [], t);
|
|
289
|
+
if (e) return e;
|
|
290
|
+
}
|
|
291
|
+
}, H = () => {
|
|
292
|
+
let { containerHeight: e, requestContext: t, value: r, dispatch: a } = n(), { t: o } = d(), [s, c] = x(), [l, u] = x(), [f, m] = x([]), [h, g] = x([]), _ = b(() => [{
|
|
293
|
+
key: "internal",
|
|
294
|
+
label: o("role.internal"),
|
|
295
|
+
visible: f.length > 0
|
|
296
|
+
}, {
|
|
297
|
+
key: "external",
|
|
298
|
+
label: o("role.external"),
|
|
299
|
+
visible: h.length > 0
|
|
300
|
+
}], [
|
|
301
|
+
h.length,
|
|
302
|
+
f.length,
|
|
303
|
+
o
|
|
304
|
+
]), { loading: v } = D(async () => {
|
|
305
|
+
let e = await i({ requestContext: t });
|
|
306
|
+
return {
|
|
307
|
+
roles: Array.isArray(e?.roles) ? e.roles.map(ae) : [],
|
|
308
|
+
dockRole: Array.isArray(e?.dock_role) ? e.dock_role : []
|
|
309
|
+
};
|
|
310
|
+
}, {
|
|
311
|
+
refreshDeps: [t?.appId, t?.entryId],
|
|
312
|
+
onSuccess: (e) => {
|
|
313
|
+
let t = p(e.roles, {
|
|
314
|
+
children: "children",
|
|
315
|
+
title: "name",
|
|
316
|
+
value: "role_id",
|
|
317
|
+
parentId: "parent"
|
|
318
|
+
}), n = e.dockRole;
|
|
319
|
+
if (m(t), g(n), t.length > 0) {
|
|
320
|
+
c("internal"), u(z(t[0].role_id));
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (n.length > 0) {
|
|
324
|
+
c("external"), u(void 0);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
c(void 0), u(void 0);
|
|
328
|
+
}
|
|
329
|
+
}), y = b(() => V(f, l), [f, l]), S = b(() => se(y, o), [y, o]);
|
|
330
|
+
return {
|
|
331
|
+
containerHeight: e,
|
|
332
|
+
menuItems: _,
|
|
333
|
+
activeKey: s,
|
|
334
|
+
setActiveKey: c,
|
|
335
|
+
internalRoleTree: f,
|
|
336
|
+
externalRoleList: b(() => h.map(oe), [h]),
|
|
337
|
+
selectedRoleId: l,
|
|
338
|
+
selectedIds: b(() => (r || []).map((e) => e._id), [r]),
|
|
339
|
+
currentOptions: S,
|
|
340
|
+
loading: v,
|
|
341
|
+
handleSelectInternalRole: (e) => {
|
|
342
|
+
u(z(e));
|
|
343
|
+
},
|
|
344
|
+
handleRoleToggle: (e, t) => {
|
|
345
|
+
let n = {
|
|
346
|
+
_id: e._id,
|
|
347
|
+
name: e.name,
|
|
348
|
+
type: e.type
|
|
349
|
+
};
|
|
350
|
+
if (t) {
|
|
351
|
+
a({
|
|
352
|
+
type: "addOne",
|
|
353
|
+
payload: n
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
a({
|
|
358
|
+
type: "deleteOne",
|
|
359
|
+
payload: e._id
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
isRoleGroupNode: B,
|
|
363
|
+
defaultExpandedKeys: b(() => [], [f])
|
|
364
|
+
};
|
|
365
|
+
}, U = () => {
|
|
366
|
+
let { t: n } = d(), r = H(), i = r.containerHeight - 8, a = r.activeKey === "external" ? r.externalRoleList : r.currentOptions;
|
|
367
|
+
return /* @__PURE__ */ k("div", {
|
|
368
|
+
className: R["dept-users-role-panel"],
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ O("aside", {
|
|
371
|
+
className: R["dept-users-role-panel__menu"],
|
|
372
|
+
children: /* @__PURE__ */ O("ul", {
|
|
373
|
+
className: R["dept-users-role-panel__menu-list"],
|
|
374
|
+
children: r.menuItems.filter((e) => e.visible).map((e) => /* @__PURE__ */ O("li", {
|
|
375
|
+
onClick: () => r.setActiveKey(e.key),
|
|
376
|
+
className: t(R["dept-users-role-panel__menu-item"], { [R["dept-users-role-panel__menu-item--active"]]: r.activeKey === e.key }),
|
|
377
|
+
children: e.label
|
|
378
|
+
}, e.key))
|
|
379
|
+
})
|
|
380
|
+
}),
|
|
381
|
+
r.activeKey === "internal" && /* @__PURE__ */ O("section", {
|
|
382
|
+
className: R["dept-users-role-panel__tree-section"],
|
|
383
|
+
children: /* @__PURE__ */ O(C, {
|
|
384
|
+
spinning: r.loading,
|
|
385
|
+
tip: n("common.loading"),
|
|
386
|
+
children: /* @__PURE__ */ k(e, {
|
|
387
|
+
style: {
|
|
388
|
+
height: i,
|
|
389
|
+
padding: "4px"
|
|
390
|
+
},
|
|
391
|
+
children: [r.internalRoleTree.length > 0 && /* @__PURE__ */ O(E, {
|
|
392
|
+
data: r.internalRoleTree,
|
|
393
|
+
fieldNames: {
|
|
394
|
+
title: "name",
|
|
395
|
+
value: "role_id",
|
|
396
|
+
children: "children"
|
|
397
|
+
},
|
|
398
|
+
selectedKeys: r.selectedRoleId ? [r.selectedRoleId] : [],
|
|
399
|
+
defaultExpandedKeys: r.defaultExpandedKeys,
|
|
400
|
+
parentCheckable: !0,
|
|
401
|
+
showSwitcher: !0,
|
|
402
|
+
onSelect: (e) => r.handleSelectInternalRole(e),
|
|
403
|
+
icon: (e) => /* @__PURE__ */ O(T, {
|
|
404
|
+
name: r.isRoleGroupNode(e) ? "rolegroup" : "role",
|
|
405
|
+
className: R["dept-users-role-panel__tree-icon"],
|
|
406
|
+
size: 16
|
|
407
|
+
}),
|
|
408
|
+
switcherIcon: (e) => /* @__PURE__ */ O(T, {
|
|
409
|
+
name: "xiangxiazhankai-11",
|
|
410
|
+
className: t(R["dept-users-role-panel__switcher-icon"], { [R["dept-users-role-panel__switcher-icon--expanded"]]: e })
|
|
411
|
+
})
|
|
412
|
+
}), r.internalRoleTree.length === 0 && !r.loading && /* @__PURE__ */ O("div", {
|
|
413
|
+
className: R["dept-users-role-panel__empty"],
|
|
414
|
+
children: /* @__PURE__ */ O("span", { children: n("role.noAvailable") })
|
|
415
|
+
})]
|
|
416
|
+
})
|
|
417
|
+
})
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ k("section", {
|
|
420
|
+
className: R["dept-users-role-panel__options-section"],
|
|
421
|
+
children: [/* @__PURE__ */ O(C, {
|
|
422
|
+
spinning: r.loading,
|
|
423
|
+
tip: n("common.loading"),
|
|
424
|
+
children: /* @__PURE__ */ O(e, {
|
|
425
|
+
style: {
|
|
426
|
+
height: i,
|
|
427
|
+
padding: "4px"
|
|
428
|
+
},
|
|
429
|
+
children: a.length > 0 && ((e) => /* @__PURE__ */ O("ul", {
|
|
430
|
+
className: R["dept-users-role-panel__option-list"],
|
|
431
|
+
children: e.map((e) => /* @__PURE__ */ O("li", {
|
|
432
|
+
className: R["dept-users-role-panel__option-item"],
|
|
433
|
+
children: /* @__PURE__ */ O(w, {
|
|
434
|
+
value: e._id,
|
|
435
|
+
checked: r.selectedIds.includes(e._id),
|
|
436
|
+
labelPosition: "left",
|
|
437
|
+
className: R["dept-users-role-panel__option-checkbox"],
|
|
438
|
+
onChange: (t) => r.handleRoleToggle(e, t),
|
|
439
|
+
children: /* @__PURE__ */ O("div", {
|
|
440
|
+
className: R["dept-users-role-panel__option-checkbox-row"],
|
|
441
|
+
children: /* @__PURE__ */ O("span", {
|
|
442
|
+
className: R["dept-users-role-panel__option-name"],
|
|
443
|
+
title: e.name,
|
|
444
|
+
children: e.label
|
|
445
|
+
})
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
}, e._id))
|
|
449
|
+
}))(a)
|
|
450
|
+
})
|
|
451
|
+
}), a.length === 0 && !r.loading && /* @__PURE__ */ O("div", {
|
|
452
|
+
className: R["dept-users-role-panel__empty"],
|
|
453
|
+
children: /* @__PURE__ */ O("span", { children: n("role.noAvailable") })
|
|
454
|
+
})]
|
|
455
|
+
})
|
|
456
|
+
]
|
|
457
|
+
});
|
|
458
|
+
}, W = {
|
|
459
|
+
"dept-users-extra-contact-panel": "_dept-users-extra-contact-panel_3l6lj_1",
|
|
460
|
+
"dept-users-extra-contact-panel__menu": "_dept-users-extra-contact-panel__menu_3l6lj_6",
|
|
461
|
+
"dept-users-extra-contact-panel__group-type-section": "_dept-users-extra-contact-panel__group-type-section_3l6lj_6",
|
|
462
|
+
"dept-users-extra-contact-panel__groups-section": "_dept-users-extra-contact-panel__groups-section_3l6lj_11",
|
|
463
|
+
"dept-users-extra-contact-panel__members-section": "_dept-users-extra-contact-panel__members-section_3l6lj_11",
|
|
464
|
+
"dept-users-extra-contact-panel__menu-list": "_dept-users-extra-contact-panel__menu-list_3l6lj_14",
|
|
465
|
+
"dept-users-extra-contact-panel__group-list": "_dept-users-extra-contact-panel__group-list_3l6lj_14",
|
|
466
|
+
"dept-users-extra-contact-panel__menu-item": "_dept-users-extra-contact-panel__menu-item_3l6lj_18",
|
|
467
|
+
"dept-users-extra-contact-panel__group-item": "_dept-users-extra-contact-panel__group-item_3l6lj_18",
|
|
468
|
+
"dept-users-extra-contact-panel__menu-item--active": "_dept-users-extra-contact-panel__menu-item--active_3l6lj_29",
|
|
469
|
+
"dept-users-extra-contact-panel__group-item--active": "_dept-users-extra-contact-panel__group-item--active_3l6lj_29",
|
|
470
|
+
"dept-users-extra-contact-panel__menu-item--selectable": "_dept-users-extra-contact-panel__menu-item--selectable_3l6lj_36",
|
|
471
|
+
"dept-users-extra-contact-panel__group-item--selectable": "_dept-users-extra-contact-panel__group-item--selectable_3l6lj_36",
|
|
472
|
+
"dept-users-extra-contact-panel__group-row": "_dept-users-extra-contact-panel__group-row_3l6lj_44",
|
|
473
|
+
"dept-users-extra-contact-panel__group-name": "_dept-users-extra-contact-panel__group-name_3l6lj_52",
|
|
474
|
+
"dept-users-extra-contact-panel__empty": "_dept-users-extra-contact-panel__empty_3l6lj_59"
|
|
475
|
+
}, G = (e) => {
|
|
476
|
+
let t = e.order ?? e.sort, n = Number(t);
|
|
477
|
+
return Number.isFinite(n) ? n : 2 ** 53 - 1;
|
|
478
|
+
}, ce = (e) => [...e].sort((e, t) => G(e) - G(t)), K = (e) => String(e.type) === "1", q = (e) => {
|
|
479
|
+
let t = ce(e);
|
|
480
|
+
return {
|
|
481
|
+
defaultGroups: t.filter(K),
|
|
482
|
+
customGroups: t.filter((e) => !K(e))
|
|
483
|
+
};
|
|
484
|
+
}, le = (e) => ({
|
|
485
|
+
...e,
|
|
486
|
+
type: e.type || "outsider"
|
|
487
|
+
}), ue = (e) => ({
|
|
488
|
+
_id: e._id,
|
|
489
|
+
name: e.name,
|
|
490
|
+
type: "group"
|
|
491
|
+
}), de = () => {
|
|
492
|
+
let { containerHeight: e, requestContext: t, value: i, dispatch: o } = n(), { t: s } = d(), [c, l] = x("group"), [u, f] = x("default"), [p, m] = x(), h = b(() => [{
|
|
493
|
+
key: "group",
|
|
494
|
+
label: s("externalContact.group")
|
|
495
|
+
}, {
|
|
496
|
+
key: "member",
|
|
497
|
+
label: s("externalContact.member")
|
|
498
|
+
}], [s]), g = b(() => [{
|
|
499
|
+
key: "default",
|
|
500
|
+
label: s("externalContact.defaultGroup")
|
|
501
|
+
}, {
|
|
502
|
+
key: "custom",
|
|
503
|
+
label: s("externalContact.customGroup")
|
|
504
|
+
}], [s]), { data: _, loading: v } = D(() => a({ requestContext: t }), {
|
|
505
|
+
refreshDeps: [t?.appId, t?.entryId],
|
|
506
|
+
onSuccess: (e) => {
|
|
507
|
+
let { defaultGroups: t, customGroups: n } = q(Array.isArray(e?.list) ? e.list : []);
|
|
508
|
+
if (t.length > 0) {
|
|
509
|
+
f("default"), m(t[0]._id);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (n.length > 0) {
|
|
513
|
+
f("custom"), m(n[0]._id);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
m(void 0);
|
|
517
|
+
}
|
|
518
|
+
}), { defaultGroups: y, customGroups: S } = b(() => q(Array.isArray(_?.list) ? _.list : []), [_]), C = u === "default" ? y : S, w = (e) => {
|
|
519
|
+
f(e), m((e === "default" ? y : S)[0]?._id);
|
|
520
|
+
}, { data: T, loading: E } = D(async () => c !== "member" || !p ? [] : ((await r({
|
|
521
|
+
requestContext: t,
|
|
522
|
+
groupId: p,
|
|
523
|
+
limit: 1e4
|
|
524
|
+
})).list || []).map(le), { refreshDeps: [
|
|
525
|
+
c,
|
|
526
|
+
p,
|
|
527
|
+
t?.appId,
|
|
528
|
+
t?.entryId
|
|
529
|
+
] }), O = b(() => new Set((i || []).map((e) => e._id)), [i]);
|
|
530
|
+
return {
|
|
531
|
+
containerHeight: e,
|
|
532
|
+
menuItems: h,
|
|
533
|
+
groupTypeItems: g,
|
|
534
|
+
activeEntry: c,
|
|
535
|
+
activeGroupType: u,
|
|
536
|
+
setActiveEntry: l,
|
|
537
|
+
setActiveGroupType: w,
|
|
538
|
+
groupId: p,
|
|
539
|
+
setGroupId: m,
|
|
540
|
+
currentGroups: C,
|
|
541
|
+
memberList: T || [],
|
|
542
|
+
selectedIdSet: O,
|
|
543
|
+
groupListLoading: v,
|
|
544
|
+
memberLoading: E,
|
|
545
|
+
handleGroupToggle: (e, t) => {
|
|
546
|
+
if (t) {
|
|
547
|
+
o({
|
|
548
|
+
type: "addOne",
|
|
549
|
+
payload: ue(e)
|
|
550
|
+
});
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
o({
|
|
554
|
+
type: "deleteOne",
|
|
555
|
+
payload: e._id
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
}, fe = () => {
|
|
560
|
+
let { t: n } = d(), r = de(), i = r.containerHeight - 8, a = r.activeEntry === "member";
|
|
561
|
+
return /* @__PURE__ */ k("div", {
|
|
562
|
+
className: W["dept-users-extra-contact-panel"],
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ O("aside", {
|
|
565
|
+
className: W["dept-users-extra-contact-panel__menu"],
|
|
566
|
+
children: /* @__PURE__ */ O("ul", {
|
|
567
|
+
className: W["dept-users-extra-contact-panel__menu-list"],
|
|
568
|
+
children: r.menuItems.map((e) => /* @__PURE__ */ O("li", {
|
|
569
|
+
onClick: () => r.setActiveEntry(e.key),
|
|
570
|
+
className: t(W["dept-users-extra-contact-panel__menu-item"], { [W["dept-users-extra-contact-panel__menu-item--active"]]: r.activeEntry === e.key }),
|
|
571
|
+
children: e.label
|
|
572
|
+
}, e.key))
|
|
573
|
+
})
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ O("section", {
|
|
576
|
+
className: W["dept-users-extra-contact-panel__group-type-section"],
|
|
577
|
+
children: /* @__PURE__ */ O("ul", {
|
|
578
|
+
className: W["dept-users-extra-contact-panel__menu-list"],
|
|
579
|
+
children: r.groupTypeItems.map((e) => /* @__PURE__ */ O("li", {
|
|
580
|
+
onClick: () => r.setActiveGroupType(e.key),
|
|
581
|
+
className: t(W["dept-users-extra-contact-panel__menu-item"], { [W["dept-users-extra-contact-panel__menu-item--active"]]: r.activeGroupType === e.key }),
|
|
582
|
+
children: e.label
|
|
583
|
+
}, e.key))
|
|
584
|
+
})
|
|
585
|
+
}),
|
|
586
|
+
/* @__PURE__ */ k("section", {
|
|
587
|
+
className: W["dept-users-extra-contact-panel__groups-section"],
|
|
588
|
+
children: [/* @__PURE__ */ O(C, {
|
|
589
|
+
spinning: r.groupListLoading,
|
|
590
|
+
tip: n("common.loading"),
|
|
591
|
+
children: /* @__PURE__ */ O(e, {
|
|
592
|
+
style: {
|
|
593
|
+
height: i,
|
|
594
|
+
padding: "4px"
|
|
595
|
+
},
|
|
596
|
+
children: r.currentGroups.length > 0 && /* @__PURE__ */ O("ul", {
|
|
597
|
+
className: W["dept-users-extra-contact-panel__group-list"],
|
|
598
|
+
children: r.currentGroups.map((e) => /* @__PURE__ */ O("li", {
|
|
599
|
+
onClick: () => r.setGroupId(e._id),
|
|
600
|
+
className: t(W["dept-users-extra-contact-panel__group-item"], {
|
|
601
|
+
[W["dept-users-extra-contact-panel__group-item--active"]]: a && r.groupId === e._id,
|
|
602
|
+
[W["dept-users-extra-contact-panel__group-item--selectable"]]: !a
|
|
603
|
+
}),
|
|
604
|
+
children: a ? /* @__PURE__ */ O("span", {
|
|
605
|
+
className: W["dept-users-extra-contact-panel__group-name"],
|
|
606
|
+
title: e.name,
|
|
607
|
+
children: e.name
|
|
608
|
+
}) : /* @__PURE__ */ O(w, {
|
|
609
|
+
checked: r.selectedIdSet.has(e._id),
|
|
610
|
+
labelPosition: "left",
|
|
611
|
+
style: { width: "100%" },
|
|
612
|
+
onChange: (t) => r.handleGroupToggle(e, t),
|
|
613
|
+
children: /* @__PURE__ */ O("div", {
|
|
614
|
+
className: W["dept-users-extra-contact-panel__group-row"],
|
|
615
|
+
children: /* @__PURE__ */ O("span", {
|
|
616
|
+
className: W["dept-users-extra-contact-panel__group-name"],
|
|
617
|
+
title: e.name,
|
|
618
|
+
children: e.name
|
|
619
|
+
})
|
|
620
|
+
})
|
|
621
|
+
})
|
|
622
|
+
}, e._id))
|
|
623
|
+
})
|
|
624
|
+
})
|
|
625
|
+
}), r.currentGroups.length === 0 && !r.groupListLoading && /* @__PURE__ */ O("div", {
|
|
626
|
+
className: W["dept-users-extra-contact-panel__empty"],
|
|
627
|
+
children: /* @__PURE__ */ O("span", { children: n("externalContact.noAvailableGroup") })
|
|
628
|
+
})]
|
|
629
|
+
}),
|
|
630
|
+
a && /* @__PURE__ */ k("section", {
|
|
631
|
+
className: W["dept-users-extra-contact-panel__members-section"],
|
|
632
|
+
children: [/* @__PURE__ */ O(C, {
|
|
633
|
+
spinning: r.memberLoading || r.groupListLoading,
|
|
634
|
+
tip: n("common.loading"),
|
|
635
|
+
children: /* @__PURE__ */ O(e, {
|
|
636
|
+
style: {
|
|
637
|
+
height: i,
|
|
638
|
+
padding: "4px"
|
|
639
|
+
},
|
|
640
|
+
children: r.memberList.length > 0 && /* @__PURE__ */ O(g, { list: r.memberList })
|
|
641
|
+
})
|
|
642
|
+
}), r.memberList.length === 0 && !r.memberLoading && !r.groupListLoading && /* @__PURE__ */ O("div", {
|
|
643
|
+
className: W["dept-users-extra-contact-panel__empty"],
|
|
644
|
+
children: /* @__PURE__ */ O("span", { children: n("member.noAvailable") })
|
|
645
|
+
})]
|
|
646
|
+
})
|
|
647
|
+
]
|
|
648
|
+
});
|
|
649
|
+
}, J = {
|
|
650
|
+
"member-relation-ship": "_member-relation-ship_1fjcv_1",
|
|
651
|
+
"member-relation-ship__menu": "_member-relation-ship__menu_1fjcv_6",
|
|
652
|
+
"member-relation-ship__menu-list": "_member-relation-ship__menu-list_1fjcv_11",
|
|
653
|
+
"member-relation-ship__menu-item": "_member-relation-ship__menu-item_1fjcv_15",
|
|
654
|
+
"member-relation-ship__menu-item--active": "_member-relation-ship__menu-item--active_1fjcv_26",
|
|
655
|
+
"member-relation-ship__column": "_member-relation-ship__column_1fjcv_33",
|
|
656
|
+
"member-relation-ship__column-header": "_member-relation-ship__column-header_1fjcv_42",
|
|
657
|
+
"member-relation-ship__column-content": "_member-relation-ship__column-content_1fjcv_50"
|
|
658
|
+
}, Y = {
|
|
659
|
+
"relation-ship-member": "_relation-ship-member_h6xr2_1",
|
|
660
|
+
"relation-ship-member__list": "_relation-ship-member__list_h6xr2_4",
|
|
661
|
+
"relation-ship-member__item": "_relation-ship-member__item_h6xr2_9",
|
|
662
|
+
"relation-ship-member__item--active": "_relation-ship-member__item--active_h6xr2_22",
|
|
663
|
+
"relation-ship-member__avatar": "_relation-ship-member__avatar_h6xr2_28",
|
|
664
|
+
"relation-ship-member__nickname": "_relation-ship-member__nickname_h6xr2_31",
|
|
665
|
+
"relation-ship-member__deptnames": "_relation-ship-member__deptnames_h6xr2_40",
|
|
666
|
+
"relation-ship-member__empty": "_relation-ship-member__empty_h6xr2_47"
|
|
667
|
+
}, X = (r) => {
|
|
668
|
+
let { t: i } = d(), { containerHeight: a } = n(), o = r.userList || [], s = (e) => {
|
|
669
|
+
r.onChange?.(e._id);
|
|
670
|
+
};
|
|
671
|
+
return /* @__PURE__ */ O(C, {
|
|
672
|
+
spinning: r.loading,
|
|
673
|
+
children: /* @__PURE__ */ O(e, {
|
|
674
|
+
className: Y["relation-ship-member"],
|
|
675
|
+
style: { height: a - 8 },
|
|
676
|
+
children: o.length > 0 ? /* @__PURE__ */ O("ul", {
|
|
677
|
+
className: Y["relation-ship-member__list"],
|
|
678
|
+
children: o.map((e) => /* @__PURE__ */ k("li", {
|
|
679
|
+
onClick: () => s(e),
|
|
680
|
+
className: t(Y["relation-ship-member__item"], { [Y["relation-ship-member__item--active"]]: r.value === e._id }),
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ O("div", {
|
|
683
|
+
className: Y["relation-ship-member__avatar"],
|
|
684
|
+
children: e.avatarurl ? /* @__PURE__ */ O(S, {
|
|
685
|
+
src: e.avatarurl,
|
|
686
|
+
size: 20
|
|
687
|
+
}) : /* @__PURE__ */ O(S, {
|
|
688
|
+
size: 20,
|
|
689
|
+
style: {
|
|
690
|
+
backgroundColor: m(e.nickname),
|
|
691
|
+
fontSize: "12px",
|
|
692
|
+
lineHeight: "13px"
|
|
693
|
+
},
|
|
694
|
+
children: e.nickname?.charAt(0) || "?"
|
|
695
|
+
})
|
|
696
|
+
}),
|
|
697
|
+
/* @__PURE__ */ O("div", {
|
|
698
|
+
className: Y["relation-ship-member__nickname"],
|
|
699
|
+
children: e.nickname
|
|
700
|
+
}),
|
|
701
|
+
/* @__PURE__ */ O("div", {
|
|
702
|
+
className: Y["relation-ship-member__deptnames"],
|
|
703
|
+
children: e.deptnames
|
|
704
|
+
})
|
|
705
|
+
]
|
|
706
|
+
}, e._id))
|
|
707
|
+
}) : !r.loading && /* @__PURE__ */ O("div", {
|
|
708
|
+
className: Y["relation-ship-member__empty"],
|
|
709
|
+
style: { height: a - 8 + "px" },
|
|
710
|
+
children: /* @__PURE__ */ O("span", { children: i("member.noAvailable") })
|
|
711
|
+
})
|
|
712
|
+
})
|
|
713
|
+
});
|
|
714
|
+
}, Z = /* @__PURE__ */ function(e) {
|
|
715
|
+
return e[e.DEPARTMENT = 0] = "DEPARTMENT", e[e.MEMBER = 1] = "MEMBER", e;
|
|
716
|
+
}(Z || {}), Q = (e) => e != null && e !== "" && e !== "undefined", pe = () => {
|
|
717
|
+
let { containerHeight: e, requestContext: t, value: r, dispatch: i } = n(), [a, s] = x(Z.DEPARTMENT), [u, d] = x({
|
|
718
|
+
deptFrom: "relation",
|
|
719
|
+
memberFrom: "relationUser"
|
|
720
|
+
}), { data: p, loading: h } = D(() => o({
|
|
721
|
+
requestContext: t,
|
|
722
|
+
hasDeptDock: !1
|
|
723
|
+
}), {
|
|
724
|
+
onSuccess: (e) => {
|
|
725
|
+
let t = f(e?.departments || [])[0];
|
|
726
|
+
t && !u.deptFromId && (d((e) => ({
|
|
727
|
+
...e,
|
|
728
|
+
deptFromId: t._id,
|
|
729
|
+
deptId: t.departmentId
|
|
730
|
+
})), A(t._id, e.departments));
|
|
731
|
+
},
|
|
732
|
+
refreshDeps: [t]
|
|
733
|
+
}), g = b(() => p?.departments?.length ? f(p.departments) : [], [p?.departments]), { data: _, loading: v } = D(async () => Q(u.deptId) && (await c({
|
|
734
|
+
requestContext: t,
|
|
735
|
+
deptId: u.deptId,
|
|
736
|
+
limit: 1e4
|
|
737
|
+
})).users || [], {
|
|
738
|
+
refreshDeps: [
|
|
739
|
+
u.deptId,
|
|
740
|
+
t?.appId,
|
|
741
|
+
t?.entryId
|
|
742
|
+
],
|
|
743
|
+
onSuccess: (e) => {
|
|
744
|
+
e?.length > 0 && !u.memberFromId && (d((t) => ({
|
|
745
|
+
...t,
|
|
746
|
+
memberFromId: e[0]._id
|
|
747
|
+
})), A(e[0]._id, e));
|
|
748
|
+
}
|
|
749
|
+
}), y = a === Z.DEPARTMENT ? u.deptFrom : u.memberFrom, S = a === Z.DEPARTMENT ? u.deptFromId : u.memberFromId, { data: C, loading: w } = D(() => l({ requestContext: t }), {
|
|
750
|
+
ready: !!(t?.appId && t?.entryId),
|
|
751
|
+
refreshDeps: [t?.appId, t?.entryId]
|
|
752
|
+
}), T = b(() => !y || !S ? [] : (C?.list || []).map((e) => ({
|
|
753
|
+
_id: `${S}-${y}-${e._id}`,
|
|
754
|
+
name: e.name
|
|
755
|
+
})), [
|
|
756
|
+
y,
|
|
757
|
+
S,
|
|
758
|
+
C?.list
|
|
759
|
+
]), E = r?.map((e) => e._id) || [];
|
|
760
|
+
return {
|
|
761
|
+
containerHeight: e,
|
|
762
|
+
activeKey: a,
|
|
763
|
+
setActiveKey: s,
|
|
764
|
+
relationData: u,
|
|
765
|
+
setDeptRelationType: (e) => d((t) => ({
|
|
766
|
+
...t,
|
|
767
|
+
deptFrom: e
|
|
768
|
+
})),
|
|
769
|
+
deptTreeData: g,
|
|
770
|
+
userList: _ || [],
|
|
771
|
+
relationList: T,
|
|
772
|
+
selectedIds: E,
|
|
773
|
+
departmentsLoading: h,
|
|
774
|
+
memberLoading: v,
|
|
775
|
+
relationsLoading: w,
|
|
776
|
+
handleSelectDepartment: (e, t) => {
|
|
777
|
+
A(e, p?.departments || []), d((n) => ({
|
|
778
|
+
...n,
|
|
779
|
+
deptFromId: e,
|
|
780
|
+
deptId: Q(t?.departmentId) ? t.departmentId : void 0,
|
|
781
|
+
memberFromId: void 0
|
|
782
|
+
}));
|
|
783
|
+
},
|
|
784
|
+
handleSelectMember: (e) => {
|
|
785
|
+
d((t) => ({
|
|
786
|
+
...t,
|
|
787
|
+
memberFromId: e
|
|
788
|
+
})), A(e, _ || []);
|
|
789
|
+
},
|
|
790
|
+
handleSelectRelation: (e) => {
|
|
791
|
+
let t = T.filter((t) => e.includes(t._id));
|
|
792
|
+
i({
|
|
793
|
+
type: "deleteAndInsert",
|
|
794
|
+
payload: {
|
|
795
|
+
oldIds: T.filter((t) => !e.includes(t._id)).map((e) => e._id),
|
|
796
|
+
newItems: t
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
},
|
|
800
|
+
relationShipType: Z,
|
|
801
|
+
departmentRelationTabs: [{
|
|
802
|
+
key: "relation",
|
|
803
|
+
label: "当前部门的所有关系"
|
|
804
|
+
}, {
|
|
805
|
+
key: "relationSub",
|
|
806
|
+
label: "当前部门及子部门的所有关系"
|
|
807
|
+
}],
|
|
808
|
+
menuItems: [{
|
|
809
|
+
key: Z.DEPARTMENT,
|
|
810
|
+
label: "department.title"
|
|
811
|
+
}, {
|
|
812
|
+
key: Z.MEMBER,
|
|
813
|
+
label: "member.title"
|
|
814
|
+
}],
|
|
815
|
+
getAvatarColor: (e) => m(e)
|
|
816
|
+
};
|
|
817
|
+
}, me = () => {
|
|
818
|
+
let { t: e } = d(), n = pe(), r = [{
|
|
819
|
+
key: n.relationShipType.DEPARTMENT,
|
|
820
|
+
label: e("department.title")
|
|
821
|
+
}, {
|
|
822
|
+
key: n.relationShipType.MEMBER,
|
|
823
|
+
label: e("member.title")
|
|
824
|
+
}];
|
|
825
|
+
return /* @__PURE__ */ k("div", {
|
|
826
|
+
className: J["member-relation-ship"],
|
|
827
|
+
children: [
|
|
828
|
+
/* @__PURE__ */ O("aside", {
|
|
829
|
+
className: J["member-relation-ship__menu"],
|
|
830
|
+
children: /* @__PURE__ */ O("ul", {
|
|
831
|
+
className: J["member-relation-ship__menu-list"],
|
|
832
|
+
children: r.map((e) => /* @__PURE__ */ O("li", {
|
|
833
|
+
onClick: () => n.setActiveKey(e.key),
|
|
834
|
+
className: t(J["member-relation-ship__menu-item"], { [J["member-relation-ship__menu-item--active"]]: n.activeKey === e.key }),
|
|
835
|
+
children: e.label
|
|
836
|
+
}, e.key))
|
|
837
|
+
})
|
|
838
|
+
}),
|
|
839
|
+
/* @__PURE__ */ O("section", {
|
|
840
|
+
className: J["member-relation-ship__column"],
|
|
841
|
+
children: /* @__PURE__ */ O(y, {
|
|
842
|
+
value: n.relationData.deptFromId,
|
|
843
|
+
treeData: n.deptTreeData,
|
|
844
|
+
loading: n.departmentsLoading,
|
|
845
|
+
onSelect: n.handleSelectDepartment
|
|
846
|
+
})
|
|
847
|
+
}),
|
|
848
|
+
/* @__PURE__ */ k("section", {
|
|
849
|
+
className: J["member-relation-ship__column"],
|
|
850
|
+
children: [n.activeKey === n.relationShipType.DEPARTMENT && /* @__PURE__ */ O("ul", {
|
|
851
|
+
className: J["member-relation-ship__menu-list"],
|
|
852
|
+
children: n.departmentRelationTabs.map((e) => /* @__PURE__ */ O("li", {
|
|
853
|
+
onClick: () => n.setDeptRelationType(e.key),
|
|
854
|
+
className: t(J["member-relation-ship__menu-item"], { [J["member-relation-ship__menu-item--active"]]: n.relationData.deptFrom === e.key }),
|
|
855
|
+
children: e.label
|
|
856
|
+
}, e.key))
|
|
857
|
+
}), n.activeKey === n.relationShipType.MEMBER && /* @__PURE__ */ O(X, {
|
|
858
|
+
deptId: n.relationData.deptId,
|
|
859
|
+
value: n.relationData.memberFromId,
|
|
860
|
+
userList: n.userList,
|
|
861
|
+
loading: n.memberLoading,
|
|
862
|
+
onChange: n.handleSelectMember
|
|
863
|
+
})]
|
|
864
|
+
}),
|
|
865
|
+
/* @__PURE__ */ O("section", {
|
|
866
|
+
className: J["member-relation-ship__column"],
|
|
867
|
+
children: /* @__PURE__ */ O(v, {
|
|
868
|
+
relationList: n.relationList,
|
|
869
|
+
selectedIds: n.selectedIds,
|
|
870
|
+
loading: n.relationsLoading,
|
|
871
|
+
onChange: n.handleSelectRelation
|
|
872
|
+
})
|
|
873
|
+
})
|
|
874
|
+
]
|
|
875
|
+
});
|
|
876
|
+
}, $ = {
|
|
877
|
+
"other-panel": "_other-panel_1fapn_1",
|
|
878
|
+
"other-panel__list": "_other-panel__list_1fapn_4",
|
|
879
|
+
"other-panel__item": "_other-panel__item_1fapn_10",
|
|
880
|
+
"other-panel__checkbox-row": "_other-panel__checkbox-row_1fapn_23",
|
|
881
|
+
"other-panel__name": "_other-panel__name_1fapn_28",
|
|
882
|
+
"other-panel__empty": "_other-panel__empty_1fapn_35"
|
|
883
|
+
}, he = (e) => {
|
|
884
|
+
let r = [], { dispatch: i, value: a } = n();
|
|
885
|
+
e.publicPermissionEnable && r.push({
|
|
886
|
+
_id: "111000000000000000000001",
|
|
887
|
+
name: "公开权限",
|
|
888
|
+
type: "public"
|
|
889
|
+
}), e.managerPermissionEnable && r.push({
|
|
890
|
+
_id: "111000000000000000000002",
|
|
891
|
+
name: "系统管理员组",
|
|
892
|
+
type: "public"
|
|
893
|
+
});
|
|
894
|
+
let o = a?.map((e) => e._id) || [];
|
|
895
|
+
return /* @__PURE__ */ O("div", {
|
|
896
|
+
className: $["other-panel"],
|
|
897
|
+
children: /* @__PURE__ */ O(w.Group, {
|
|
898
|
+
value: o,
|
|
899
|
+
onChange: (e) => {
|
|
900
|
+
let t = [], n = [];
|
|
901
|
+
for (let i = 0; i < r.length; i++) {
|
|
902
|
+
let a = r[i];
|
|
903
|
+
e.includes(a._id) ? t.push(a) : n.push(a);
|
|
904
|
+
}
|
|
905
|
+
i({
|
|
906
|
+
type: "deleteAndInsert",
|
|
907
|
+
payload: {
|
|
908
|
+
oldIds: n.map((e) => e._id),
|
|
909
|
+
newItems: t
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
},
|
|
913
|
+
className: $["other-panel__list"],
|
|
914
|
+
children: r.map((e) => /* @__PURE__ */ O("li", {
|
|
915
|
+
className: t($["other-panel__item"], $["other-panel__item--checkbox"]),
|
|
916
|
+
children: /* @__PURE__ */ O(w, {
|
|
917
|
+
labelPosition: "left",
|
|
918
|
+
value: e._id,
|
|
919
|
+
className: $["other-panel__checkbox"],
|
|
920
|
+
children: /* @__PURE__ */ O("div", {
|
|
921
|
+
className: $["other-panel__checkbox-row"],
|
|
922
|
+
children: /* @__PURE__ */ O("span", {
|
|
923
|
+
className: $["other-panel__name"],
|
|
924
|
+
children: e.name
|
|
925
|
+
})
|
|
926
|
+
})
|
|
927
|
+
})
|
|
928
|
+
}, e._id))
|
|
929
|
+
})
|
|
930
|
+
});
|
|
931
|
+
}, ge = () => {
|
|
932
|
+
let { t: e } = d(), { auth: t } = n();
|
|
933
|
+
return b(() => {
|
|
934
|
+
let n = [
|
|
935
|
+
{
|
|
936
|
+
label: e("department.organizationalStructure"),
|
|
937
|
+
key: "organizational",
|
|
938
|
+
view: /* @__PURE__ */ O(h, {})
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
label: e("member.title"),
|
|
942
|
+
key: "member",
|
|
943
|
+
view: /* @__PURE__ */ O(_, {})
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
label: e("position.title"),
|
|
947
|
+
key: "position",
|
|
948
|
+
view: /* @__PURE__ */ O(ie, {})
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
label: e("member.relation"),
|
|
952
|
+
key: "relation",
|
|
953
|
+
view: /* @__PURE__ */ O(me, {})
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
label: e("role.title"),
|
|
957
|
+
key: "role",
|
|
958
|
+
view: /* @__PURE__ */ O(U, {})
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
label: e("externalContact.title"),
|
|
962
|
+
key: "extraContact",
|
|
963
|
+
view: /* @__PURE__ */ O(fe, {})
|
|
964
|
+
}
|
|
965
|
+
];
|
|
966
|
+
return (t.managerPermissionEnable || t.publicPermissionEnable) && n.push({
|
|
967
|
+
label: e("common.other"),
|
|
968
|
+
key: "other",
|
|
969
|
+
view: /* @__PURE__ */ O(he, {
|
|
970
|
+
managerPermissionEnable: t.managerPermissionEnable,
|
|
971
|
+
publicPermissionEnable: t.publicPermissionEnable
|
|
972
|
+
})
|
|
973
|
+
}), n;
|
|
974
|
+
}, [
|
|
975
|
+
e,
|
|
976
|
+
t.managerPermissionEnable,
|
|
977
|
+
t.publicPermissionEnable
|
|
978
|
+
]);
|
|
979
|
+
};
|
|
980
|
+
//#endregion
|
|
981
|
+
export { A as n, ge as t };
|