cd-personselector 1.3.3 → 1.3.4
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/index.js +1 -1
- package/dist/index.mjs +138 -136
- package/dist/src/InputSelect.vue.d.ts +9 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/InputSelect.vue +5 -3
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as ge, ref as y, computed as A, watch as H, resolveComponent as x, openBlock as l, createBlock as E, withCtx as N, createElementVNode as p, createElementBlock as c, createVNode as S, Fragment as G, renderList as te, createCommentVNode as _, normalizeClass as ee, withModifiers as _e, toDisplayString as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as ge, ref as y, computed as A, watch as H, resolveComponent as x, openBlock as l, createBlock as E, withCtx as N, createElementVNode as p, createElementBlock as c, createVNode as S, Fragment as G, renderList as te, createCommentVNode as _, normalizeClass as ee, withModifiers as _e, toDisplayString as f, createTextVNode as oe, nextTick as Ne, normalizeStyle as Te } from "vue";
|
|
2
|
+
const we = { class: "cd-ps-container" }, ze = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "cd-ps-search"
|
|
5
|
-
},
|
|
5
|
+
}, $e = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "cd-ps-org-select"
|
|
8
8
|
}, Be = { class: "cd-ps-search-input" }, De = { class: "cd-ps-content" }, Oe = { class: "cd-ps-left" }, Pe = {
|
|
@@ -35,7 +35,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
35
35
|
}, lt = {
|
|
36
36
|
key: 1,
|
|
37
37
|
class: "cd-ps-selected-list"
|
|
38
|
-
}, nt = { class: "cd-ps-item-info" }, ot = { class: "cd-ps-info" }, it = { class: "cd-ps-name" }, ct = { class: "cd-ps-meta" }, dt = { key: 0 },
|
|
38
|
+
}, nt = { class: "cd-ps-item-info" }, ot = { class: "cd-ps-info" }, it = { class: "cd-ps-name" }, ct = { class: "cd-ps-meta" }, dt = { key: 0 }, rt = { key: 1 }, ut = { key: 2 }, pt = { key: 3 }, vt = /* @__PURE__ */ ge({
|
|
39
39
|
__name: "PersonSelector",
|
|
40
40
|
props: {
|
|
41
41
|
visible: { type: Boolean, default: !1 },
|
|
@@ -50,8 +50,8 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
50
50
|
},
|
|
51
51
|
emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search", "org-change", "tab-change"],
|
|
52
52
|
setup(b, { expose: Q, emit: C }) {
|
|
53
|
-
var
|
|
54
|
-
const r = b, V = C, T = y(r.visible), U = y(((me = (
|
|
53
|
+
var fe, me;
|
|
54
|
+
const r = b, V = C, T = y(r.visible), U = y(((me = (fe = r.tabs) == null ? void 0 : fe[0]) == null ? void 0 : me.key) || ""), w = y(null), W = y(""), v = y([]), I = y(/* @__PURE__ */ new Map()), X = y({}), j = y(!1), F = y(!1), D = y({}), ie = A(() => r.tabs || []), ae = A(() => r.organizations || []);
|
|
55
55
|
A(() => r.tips || "");
|
|
56
56
|
const ce = A(() => r.showSearch), L = A(() => r.showOrg), de = A(() => r.dialogWidth), R = y({});
|
|
57
57
|
H(() => r.tabs, (t) => {
|
|
@@ -74,11 +74,11 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
74
74
|
H(() => r.modelValue, (t) => {
|
|
75
75
|
T.value && t && se();
|
|
76
76
|
}, { deep: !0 }), H(() => r.visible, (t) => {
|
|
77
|
-
T.value = t, t && (se(), r.organizations.length > 0 && !
|
|
77
|
+
T.value = t, t && (se(), r.organizations.length > 0 && !w.value && (w.value = r.organizations[0].id));
|
|
78
78
|
}), H(T, (t) => {
|
|
79
79
|
V("update:visible", t);
|
|
80
80
|
});
|
|
81
|
-
function
|
|
81
|
+
function re(t, e) {
|
|
82
82
|
e && (X.value[t] = e);
|
|
83
83
|
}
|
|
84
84
|
function Y(t, e) {
|
|
@@ -114,32 +114,32 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
114
114
|
};
|
|
115
115
|
V("org-change", { orgId: t, tabKey: U.value, callback: s });
|
|
116
116
|
};
|
|
117
|
-
let
|
|
117
|
+
let $ = null;
|
|
118
118
|
const P = () => {
|
|
119
|
-
if (
|
|
119
|
+
if ($ && clearTimeout($), !W.value.trim()) {
|
|
120
120
|
ne();
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
j.value = !0, F.value = !0,
|
|
124
|
-
},
|
|
123
|
+
j.value = !0, F.value = !0, $ = setTimeout(() => n(), 300);
|
|
124
|
+
}, n = () => {
|
|
125
125
|
D.value = {};
|
|
126
126
|
const t = (e) => {
|
|
127
127
|
const s = {};
|
|
128
128
|
e.forEach((u) => {
|
|
129
|
-
const m = { ...u, isUser: u.isUser !== !1 },
|
|
130
|
-
s[
|
|
129
|
+
const m = { ...u, isUser: u.isUser !== !1 }, z = u.nodeType || (u.isUser !== !1 ? "user" : "department");
|
|
130
|
+
s[z] || (s[z] = []), s[z].push(m);
|
|
131
131
|
}), D.value = s, F.value = !1;
|
|
132
132
|
};
|
|
133
|
-
V("search", { keyword: W.value, orgId:
|
|
133
|
+
V("search", { keyword: W.value, orgId: w.value || void 0, callback: t });
|
|
134
134
|
}, ne = () => {
|
|
135
|
-
|
|
135
|
+
$ && (clearTimeout($), $ = null), j.value = !1, W.value = "", D.value = {}, F.value = !1;
|
|
136
136
|
}, be = (t) => {
|
|
137
137
|
if (v.value.indexOf(t.id) > -1)
|
|
138
138
|
a(t.id);
|
|
139
139
|
else {
|
|
140
140
|
r.multiple || (v.value = [], I.value.clear());
|
|
141
141
|
const s = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
|
|
142
|
-
le(t.id, { ...t, typeName: s, orgId:
|
|
142
|
+
le(t.id, { ...t, typeName: s, orgId: w.value }), r.multiple || ue();
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function Ce(t) {
|
|
@@ -153,19 +153,19 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
153
153
|
var B, g;
|
|
154
154
|
const s = e == null ? void 0 : e.node;
|
|
155
155
|
if (s) {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
156
|
+
const h = s.value ?? ((B = s.data) == null ? void 0 : B.id);
|
|
157
|
+
if (h !== void 0) {
|
|
158
158
|
if (s.checked) {
|
|
159
159
|
r.multiple || (v.value = [], I.value.clear());
|
|
160
160
|
const q = r.tabs.find((K) => K.key === U.value), Z = q ? q.name.replace(/^按/, "") : "";
|
|
161
|
-
le(
|
|
161
|
+
le(h, { ...s.data, typeName: Z, orgId: w.value }), !r.multiple && ((g = s.data) != null && g.isUser) && ue();
|
|
162
162
|
} else
|
|
163
|
-
a(
|
|
163
|
+
a(h);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
const u = R.value[U.value] || [], m = Ce(u),
|
|
168
|
-
v.value = [
|
|
167
|
+
const u = R.value[U.value] || [], m = Ce(u), z = v.value.filter((h) => !m.includes(h));
|
|
168
|
+
v.value = [...z, ...t];
|
|
169
169
|
};
|
|
170
170
|
function ve(t, e, s) {
|
|
171
171
|
for (const u of t) {
|
|
@@ -177,20 +177,20 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
177
177
|
return !1;
|
|
178
178
|
}
|
|
179
179
|
async function Ue(t, e) {
|
|
180
|
-
var
|
|
180
|
+
var z;
|
|
181
181
|
const s = t.value, u = X.value[e];
|
|
182
182
|
if (t.data.loaded) {
|
|
183
183
|
const B = R.value[e];
|
|
184
184
|
if (B) {
|
|
185
185
|
const g = Y(B, s);
|
|
186
|
-
g && g.children && (g.children = g.children.filter((
|
|
186
|
+
g && g.children && (g.children = g.children.filter((h) => !h.isUser));
|
|
187
187
|
}
|
|
188
|
-
u && (((
|
|
188
|
+
u && (((z = u.getItem(s)) == null ? void 0 : z.children) || []).filter((h) => {
|
|
189
189
|
var M;
|
|
190
|
-
return (M =
|
|
191
|
-
}).forEach((
|
|
190
|
+
return (M = h.data) == null ? void 0 : M.isUser;
|
|
191
|
+
}).forEach((h) => {
|
|
192
192
|
try {
|
|
193
|
-
u.remove(
|
|
193
|
+
u.remove(h.value);
|
|
194
194
|
} catch {
|
|
195
195
|
}
|
|
196
196
|
}), t.data.loaded = !1;
|
|
@@ -200,8 +200,8 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
200
200
|
const g = B.map((M) => {
|
|
201
201
|
const { id: q, name: Z, ...K } = M;
|
|
202
202
|
return { ...K, id: q, name: M.displayName || Z, isUser: !0 };
|
|
203
|
-
}),
|
|
204
|
-
if (
|
|
203
|
+
}), h = R.value[e];
|
|
204
|
+
if (h && ve(h, s, g), u) {
|
|
205
205
|
u.appendTo(s, g), t.data.loaded = !0, await Ne();
|
|
206
206
|
try {
|
|
207
207
|
u.setItem(s, { expanded: !0 });
|
|
@@ -212,71 +212,71 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
212
212
|
t.data.loaded = !0;
|
|
213
213
|
const g = R.value[e];
|
|
214
214
|
if (g) {
|
|
215
|
-
const
|
|
216
|
-
|
|
215
|
+
const h = Y(g, s);
|
|
216
|
+
h && (h.loaded = !0);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
} });
|
|
220
220
|
}
|
|
221
221
|
const Se = (t) => {
|
|
222
222
|
a(t);
|
|
223
|
-
},
|
|
223
|
+
}, he = () => {
|
|
224
224
|
v.value = [], I.value.clear();
|
|
225
|
-
},
|
|
225
|
+
}, ue = () => {
|
|
226
226
|
V("update:modelValue", v.value), V("confirm", J.value), T.value = !1;
|
|
227
227
|
}, Ie = () => {
|
|
228
228
|
T.value = !1;
|
|
229
229
|
};
|
|
230
230
|
return Q({
|
|
231
|
-
clearSelection:
|
|
231
|
+
clearSelection: he,
|
|
232
232
|
appendUsers: (t, e, s) => {
|
|
233
233
|
const u = X.value[t];
|
|
234
234
|
if (u && s.length > 0) {
|
|
235
|
-
const m = s.map((
|
|
236
|
-
const { id: B, name: g, ...
|
|
237
|
-
return { ...
|
|
235
|
+
const m = s.map((z) => {
|
|
236
|
+
const { id: B, name: g, ...h } = z;
|
|
237
|
+
return { ...h, id: B, name: z.displayName || g, isUser: !0 };
|
|
238
238
|
});
|
|
239
239
|
u.appendTo(e, m);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}), (t, e) => {
|
|
243
|
-
const s = x("t-option"), u = x("t-select"), m = x("t-icon"),
|
|
243
|
+
const s = x("t-option"), u = x("t-select"), m = x("t-icon"), z = x("t-input"), B = x("t-loading"), g = x("t-checkbox"), h = x("t-button"), M = x("t-tree"), q = x("t-tab-panel"), Z = x("t-tabs"), K = x("t-dialog");
|
|
244
244
|
return l(), E(K, {
|
|
245
245
|
visible: T.value,
|
|
246
|
-
"onUpdate:visible": e[4] || (e[4] = (
|
|
246
|
+
"onUpdate:visible": e[4] || (e[4] = (o) => T.value = o),
|
|
247
247
|
header: "选择人员",
|
|
248
248
|
width: de.value,
|
|
249
249
|
footer: !0,
|
|
250
250
|
placement: "center",
|
|
251
251
|
"destroy-on-close": "",
|
|
252
|
-
onConfirm:
|
|
252
|
+
onConfirm: ue,
|
|
253
253
|
onClose: Ie
|
|
254
254
|
}, {
|
|
255
255
|
default: N(() => [
|
|
256
|
-
p("div",
|
|
257
|
-
ce.value ? (l(), c("div",
|
|
258
|
-
L.value && ae.value.length > 0 ? (l(), c("div",
|
|
256
|
+
p("div", we, [
|
|
257
|
+
ce.value ? (l(), c("div", ze, [
|
|
258
|
+
L.value && ae.value.length > 0 ? (l(), c("div", $e, [
|
|
259
259
|
S(u, {
|
|
260
|
-
modelValue:
|
|
261
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
260
|
+
modelValue: w.value,
|
|
261
|
+
"onUpdate:modelValue": e[0] || (e[0] = (o) => w.value = o),
|
|
262
262
|
placeholder: "选择组织",
|
|
263
263
|
style: { width: "200px" },
|
|
264
264
|
onChange: O
|
|
265
265
|
}, {
|
|
266
266
|
default: N(() => [
|
|
267
|
-
(l(!0), c(G, null, te(ae.value, (
|
|
268
|
-
key:
|
|
269
|
-
value:
|
|
270
|
-
label:
|
|
267
|
+
(l(!0), c(G, null, te(ae.value, (o) => (l(), E(s, {
|
|
268
|
+
key: o.id,
|
|
269
|
+
value: o.id,
|
|
270
|
+
label: o.displayName || o.name
|
|
271
271
|
}, null, 8, ["value", "label"]))), 128))
|
|
272
272
|
]),
|
|
273
273
|
_: 1
|
|
274
274
|
}, 8, ["modelValue"])
|
|
275
275
|
])) : _("", !0),
|
|
276
276
|
p("div", Be, [
|
|
277
|
-
S(
|
|
277
|
+
S(z, {
|
|
278
278
|
modelValue: W.value,
|
|
279
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
279
|
+
"onUpdate:modelValue": e[1] || (e[1] = (o) => W.value = o),
|
|
280
280
|
placeholder: "输入手机号/工号/姓名/部门/职位搜索",
|
|
281
281
|
clearable: "",
|
|
282
282
|
inputProps: { autocomplete: "off" },
|
|
@@ -294,14 +294,14 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
294
294
|
p("div", Oe, [
|
|
295
295
|
S(Z, {
|
|
296
296
|
modelValue: U.value,
|
|
297
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
297
|
+
"onUpdate:modelValue": e[3] || (e[3] = (o) => U.value = o),
|
|
298
298
|
onChange: k
|
|
299
299
|
}, {
|
|
300
300
|
default: N(() => [
|
|
301
|
-
(l(!0), c(G, null, te(ie.value, (
|
|
302
|
-
key:
|
|
303
|
-
value:
|
|
304
|
-
label: i(
|
|
301
|
+
(l(!0), c(G, null, te(ie.value, (o) => (l(), E(q, {
|
|
302
|
+
key: o.key,
|
|
303
|
+
value: o.key,
|
|
304
|
+
label: i(o)
|
|
305
305
|
}, {
|
|
306
306
|
default: N(() => {
|
|
307
307
|
var pe;
|
|
@@ -310,7 +310,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
310
310
|
F.value ? (l(), c("div", Pe, [
|
|
311
311
|
S(B),
|
|
312
312
|
e[5] || (e[5] = p("span", null, "搜索中...", -1))
|
|
313
|
-
])) : !D.value[
|
|
313
|
+
])) : !D.value[o.key] || D.value[o.key].length === 0 ? (l(), c("div", Re, [
|
|
314
314
|
S(m, {
|
|
315
315
|
name: "search",
|
|
316
316
|
size: "48px",
|
|
@@ -318,7 +318,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
318
318
|
}),
|
|
319
319
|
e[6] || (e[6] = p("p", null, "暂无结果", -1))
|
|
320
320
|
])) : (l(), c("div", We, [
|
|
321
|
-
(l(!0), c(G, null, te(D.value[
|
|
321
|
+
(l(!0), c(G, null, te(D.value[o.key], (d) => (l(), c("div", {
|
|
322
322
|
key: d.id,
|
|
323
323
|
class: ee(["cd-ps-result-item", { "cd-ps-selected": v.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
|
|
324
324
|
onClick: (xe) => be(d)
|
|
@@ -336,23 +336,23 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
336
336
|
}, null, 8, ["name"])
|
|
337
337
|
], 2),
|
|
338
338
|
p("div", Le, [
|
|
339
|
-
p("div", Me,
|
|
339
|
+
p("div", Me, f(d.displayName || d.name), 1),
|
|
340
340
|
p("div", Ae, [
|
|
341
|
-
d.isUser ? _("", !0) : (l(), c("span", je,
|
|
342
|
-
d.position ? (l(), c("span", Je,
|
|
343
|
-
d.department ? (l(), c("span", Fe,
|
|
344
|
-
d.phone ? (l(), c("span", qe,
|
|
345
|
-
d.userCount ? (l(), c("span", Ge,
|
|
341
|
+
d.isUser ? _("", !0) : (l(), c("span", je, f(d.isPost ? "职位" : "部门"), 1)),
|
|
342
|
+
d.position ? (l(), c("span", Je, f(d.position), 1)) : _("", !0),
|
|
343
|
+
d.department ? (l(), c("span", Fe, f(d.department), 1)) : _("", !0),
|
|
344
|
+
d.phone ? (l(), c("span", qe, f(d.phone), 1)) : _("", !0),
|
|
345
|
+
d.userCount ? (l(), c("span", Ge, f(d.userCount) + "人", 1)) : _("", !0)
|
|
346
346
|
])
|
|
347
347
|
])
|
|
348
348
|
], 10, Ee))), 128))
|
|
349
349
|
]))
|
|
350
350
|
], 64)) : (l(), c("div", He, [
|
|
351
|
-
((pe = R.value[
|
|
351
|
+
((pe = R.value[o.key]) == null ? void 0 : pe.length) > 0 ? (l(), E(M, {
|
|
352
352
|
key: 0,
|
|
353
353
|
ref_for: !0,
|
|
354
|
-
ref: (d) =>
|
|
355
|
-
data: R.value[
|
|
354
|
+
ref: (d) => re(o.key, d),
|
|
355
|
+
data: R.value[o.key],
|
|
356
356
|
keys: { value: "id", label: "name", children: "children" },
|
|
357
357
|
hover: "",
|
|
358
358
|
checkable: "",
|
|
@@ -365,22 +365,22 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
365
365
|
class: ee(["cd-ps-node", { "cd-ps-node-user": d.data.isUser }])
|
|
366
366
|
}, [
|
|
367
367
|
S(m, {
|
|
368
|
-
name: d.data.isUser ? "user" :
|
|
368
|
+
name: d.data.isUser ? "user" : o.icon || "folder"
|
|
369
369
|
}, null, 8, ["name"]),
|
|
370
370
|
p("span", Qe, [
|
|
371
|
-
oe(
|
|
372
|
-
d.data.isUser && d.data.position ? (l(), c("span", Xe,
|
|
371
|
+
oe(f(d.label) + " ", 1),
|
|
372
|
+
d.data.isUser && d.data.position ? (l(), c("span", Xe, f(d.data.position), 1)) : _("", !0)
|
|
373
373
|
]),
|
|
374
|
-
d.data.userCount && !d.data.isUser ? (l(), c("span", Ye, "(" +
|
|
375
|
-
d.data.isUser ? _("", !0) : (l(), E(
|
|
374
|
+
d.data.userCount && !d.data.isUser ? (l(), c("span", Ye, "(" + f(d.data.userCount) + ")", 1)) : _("", !0),
|
|
375
|
+
d.data.isUser ? _("", !0) : (l(), E(h, {
|
|
376
376
|
key: 1,
|
|
377
377
|
size: "small",
|
|
378
378
|
variant: "text",
|
|
379
379
|
class: "cd-ps-load-btn",
|
|
380
|
-
onClick: _e((xe) => Ue(d,
|
|
380
|
+
onClick: _e((xe) => Ue(d, o.key), ["stop"])
|
|
381
381
|
}, {
|
|
382
382
|
default: N(() => [
|
|
383
|
-
oe(
|
|
383
|
+
oe(f(d.data.loaded ? "刷新人员" : "显示人员"), 1)
|
|
384
384
|
]),
|
|
385
385
|
_: 2
|
|
386
386
|
}, 1032, ["onClick"]))
|
|
@@ -389,7 +389,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
389
389
|
_: 2
|
|
390
390
|
}, 1032, ["data", "value"])) : (l(), c("div", Ze, [
|
|
391
391
|
S(m, {
|
|
392
|
-
name:
|
|
392
|
+
name: o.icon || "folder-open",
|
|
393
393
|
size: "48px",
|
|
394
394
|
style: { color: "#ddd" }
|
|
395
395
|
}, null, 8, ["name"]),
|
|
@@ -407,12 +407,12 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
407
407
|
p("div", Ke, [
|
|
408
408
|
p("div", et, [
|
|
409
409
|
e[9] || (e[9] = p("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
410
|
-
p("span", tt,
|
|
411
|
-
J.value.length > 0 ? (l(), E(
|
|
410
|
+
p("span", tt, f(J.value.length) + " 项", 1),
|
|
411
|
+
J.value.length > 0 ? (l(), E(h, {
|
|
412
412
|
key: 0,
|
|
413
413
|
size: "small",
|
|
414
414
|
variant: "text",
|
|
415
|
-
onClick:
|
|
415
|
+
onClick: he
|
|
416
416
|
}, {
|
|
417
417
|
default: N(() => [...e[8] || (e[8] = [
|
|
418
418
|
oe("清空", -1)
|
|
@@ -429,33 +429,33 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
429
429
|
}),
|
|
430
430
|
e[10] || (e[10] = p("p", null, "暂无选择", -1))
|
|
431
431
|
])) : (l(), c("div", lt, [
|
|
432
|
-
(l(!0), c(G, null, te(J.value, (
|
|
433
|
-
key:
|
|
434
|
-
class: ee(["cd-ps-selected-item", { "cd-ps-dept-item": !
|
|
432
|
+
(l(!0), c(G, null, te(J.value, (o) => (l(), c("div", {
|
|
433
|
+
key: o.id,
|
|
434
|
+
class: ee(["cd-ps-selected-item", { "cd-ps-dept-item": !o.isUser }])
|
|
435
435
|
}, [
|
|
436
436
|
p("div", nt, [
|
|
437
437
|
p("div", {
|
|
438
|
-
class: ee(["cd-ps-avatar", { "cd-ps-avatar-dept": !
|
|
438
|
+
class: ee(["cd-ps-avatar", { "cd-ps-avatar-dept": !o.isUser }])
|
|
439
439
|
}, [
|
|
440
440
|
S(m, {
|
|
441
|
-
name:
|
|
441
|
+
name: o.isUser ? "user" : "folder"
|
|
442
442
|
}, null, 8, ["name"])
|
|
443
443
|
], 2),
|
|
444
444
|
p("div", ot, [
|
|
445
|
-
p("div", it,
|
|
445
|
+
p("div", it, f(o.displayName || o.name), 1),
|
|
446
446
|
p("div", ct, [
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
!
|
|
447
|
+
o.isUser && o.position ? (l(), c("span", dt, f(o.position), 1)) : _("", !0),
|
|
448
|
+
o.isUser && o.department ? (l(), c("span", rt, f(o.department), 1)) : _("", !0),
|
|
449
|
+
o.isUser ? _("", !0) : (l(), c("span", ut, f(o.typeName || "部门"), 1)),
|
|
450
|
+
!o.isUser && o.userCount ? (l(), c("span", pt, f(o.userCount) + "人", 1)) : _("", !0)
|
|
451
451
|
])
|
|
452
452
|
])
|
|
453
453
|
]),
|
|
454
|
-
S(
|
|
454
|
+
S(h, {
|
|
455
455
|
size: "small",
|
|
456
456
|
variant: "text",
|
|
457
457
|
shape: "circle",
|
|
458
|
-
onClick: (pe) => Se(
|
|
458
|
+
onClick: (pe) => Se(o.id)
|
|
459
459
|
}, {
|
|
460
460
|
icon: N(() => [
|
|
461
461
|
S(m, { name: "close" })
|
|
@@ -478,7 +478,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
478
478
|
for (const [r, V] of Q)
|
|
479
479
|
C[r] = V;
|
|
480
480
|
return C;
|
|
481
|
-
}, ke = /* @__PURE__ */ ye(vt, [["__scopeId", "data-v-19347ac6"]]),
|
|
481
|
+
}, ke = /* @__PURE__ */ ye(vt, [["__scopeId", "data-v-19347ac6"]]), ht = { class: "cd-input-select" }, ft = {
|
|
482
482
|
key: 0,
|
|
483
483
|
class: "cd-input-select__panel"
|
|
484
484
|
}, mt = { class: "cd-input-select__option-content" }, _t = {
|
|
@@ -502,13 +502,14 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
502
502
|
props: {
|
|
503
503
|
modelValue: {},
|
|
504
504
|
multiple: { type: Boolean, default: !0 },
|
|
505
|
-
placeholder: { default: "
|
|
505
|
+
placeholder: { default: "搜索用户、部门、职位、岗位" },
|
|
506
506
|
tabs: {},
|
|
507
|
-
organizations: {}
|
|
507
|
+
organizations: {},
|
|
508
|
+
showOrg: { type: Boolean }
|
|
508
509
|
},
|
|
509
|
-
emits: ["update:modelValue", "search", "load-users"],
|
|
510
|
+
emits: ["update:modelValue", "search", "load-users", "tab-change"],
|
|
510
511
|
setup(b, { emit: Q }) {
|
|
511
|
-
const C = b, r = Q, V = y(!1), T = y([]), U = y(!1),
|
|
512
|
+
const C = b, r = Q, V = y(!1), T = y([]), U = y(!1), w = y([]), W = y([]), v = y(!1), I = y(""), X = A(() => C.modelValue.map((a) => ({
|
|
512
513
|
label: a.name,
|
|
513
514
|
value: a.id
|
|
514
515
|
}))), j = (a) => a ? a.substring(0, 2).toUpperCase() : "", F = (a) => {
|
|
@@ -537,25 +538,25 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
537
538
|
}, se = (a, i) => {
|
|
538
539
|
const { trigger: k, index: O } = i;
|
|
539
540
|
if ((k === "tag-remove" || k === "backspace") && (v.value = !1), k === "clear")
|
|
540
|
-
|
|
541
|
+
w.value = [], L([]);
|
|
541
542
|
else if (["tag-remove", "backspace"].includes(k)) {
|
|
542
|
-
const
|
|
543
|
-
|
|
543
|
+
const $ = a.map((n) => n.value || n);
|
|
544
|
+
w.value = $;
|
|
544
545
|
const P = [...C.modelValue];
|
|
545
546
|
P.splice(O, 1), L(P);
|
|
546
547
|
}
|
|
547
|
-
},
|
|
548
|
+
}, re = (a) => {
|
|
548
549
|
a.stopPropagation(), a.preventDefault(), v.value = !1, U.value = !0;
|
|
549
550
|
}, Y = (a) => {
|
|
550
|
-
const i = a.map(ce), k = new Set(C.modelValue.map((P) => P.id)), O = i.filter((P) => !k.has(P.id)),
|
|
551
|
-
L(
|
|
551
|
+
const i = a.map(ce), k = new Set(C.modelValue.map((P) => P.id)), O = i.filter((P) => !k.has(P.id)), $ = C.multiple ? [...C.modelValue, ...O] : i.slice(0, 1);
|
|
552
|
+
L($), U.value = !1;
|
|
552
553
|
}, J = (a) => {
|
|
553
554
|
r("load-users", a);
|
|
554
555
|
}, le = (a) => {
|
|
555
556
|
r("search", { keyword: a.keyword, callback: a.callback });
|
|
556
557
|
};
|
|
557
558
|
return H(() => C.modelValue, (a) => {
|
|
558
|
-
|
|
559
|
+
w.value = a.map((i) => i.id), W.value = a;
|
|
559
560
|
}, { immediate: !0, deep: !0 }), H(I, (a) => {
|
|
560
561
|
if (!(a != null && a.trim())) {
|
|
561
562
|
T.value = [], V.value = !1;
|
|
@@ -569,14 +570,14 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
569
570
|
});
|
|
570
571
|
}), (a, i) => {
|
|
571
572
|
var P;
|
|
572
|
-
const k = x("t-checkbox"), O = x("t-tag"),
|
|
573
|
-
return l(), c("div",
|
|
574
|
-
S(
|
|
573
|
+
const k = x("t-checkbox"), O = x("t-tag"), $ = x("t-select-input");
|
|
574
|
+
return l(), c("div", ht, [
|
|
575
|
+
S($, {
|
|
575
576
|
value: X.value,
|
|
576
577
|
inputValue: I.value,
|
|
577
|
-
"onUpdate:inputValue": i[0] || (i[0] = (
|
|
578
|
+
"onUpdate:inputValue": i[0] || (i[0] = (n) => I.value = n),
|
|
578
579
|
"popup-visible": v.value,
|
|
579
|
-
"onUpdate:popupVisible": i[1] || (i[1] = (
|
|
580
|
+
"onUpdate:popupVisible": i[1] || (i[1] = (n) => v.value = n),
|
|
580
581
|
"input-props": {
|
|
581
582
|
readonly: !1,
|
|
582
583
|
disabled: !1
|
|
@@ -598,50 +599,50 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
598
599
|
onTagChange: se
|
|
599
600
|
}, {
|
|
600
601
|
panel: N(() => [
|
|
601
|
-
T.value.length > 0 ? (l(), c("div",
|
|
602
|
-
(l(!0), c(G, null, te(T.value, (
|
|
603
|
-
key:
|
|
604
|
-
value:
|
|
605
|
-
checked: ae(
|
|
602
|
+
T.value.length > 0 ? (l(), c("div", ft, [
|
|
603
|
+
(l(!0), c(G, null, te(T.value, (n) => (l(), E(k, {
|
|
604
|
+
key: n.id,
|
|
605
|
+
value: n.id,
|
|
606
|
+
checked: ae(n.id),
|
|
606
607
|
class: "cd-input-select__option",
|
|
607
|
-
onChange: (ne) => R(ne,
|
|
608
|
+
onChange: (ne) => R(ne, n)
|
|
608
609
|
}, {
|
|
609
610
|
default: N(() => [
|
|
610
611
|
p("div", mt, [
|
|
611
|
-
|
|
612
|
+
n.avatar ? (l(), c("div", _t, [
|
|
612
613
|
p("img", {
|
|
613
|
-
src:
|
|
614
|
-
alt:
|
|
614
|
+
src: n.avatar,
|
|
615
|
+
alt: n.name
|
|
615
616
|
}, null, 8, gt)
|
|
616
617
|
])) : (l(), c("div", {
|
|
617
618
|
key: 1,
|
|
618
619
|
class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
|
|
619
620
|
style: Te({
|
|
620
|
-
backgroundColor: D(
|
|
621
|
-
color: D(
|
|
621
|
+
backgroundColor: D(n.id) ? "#e6f4ff" : F(n.name),
|
|
622
|
+
color: D(n.id) ? "#0052d9" : "#fff"
|
|
622
623
|
})
|
|
623
|
-
},
|
|
624
|
+
}, f(j(n.name)), 5)),
|
|
624
625
|
p("div", yt, [
|
|
625
|
-
p("div", kt,
|
|
626
|
-
|
|
626
|
+
p("div", kt, f(n.name), 1),
|
|
627
|
+
n.department || n.position ? (l(), c("div", bt, f(n.department) + f(n.department && n.position ? " · " : "") + f(n.position), 1)) : _("", !0)
|
|
627
628
|
]),
|
|
628
|
-
D(
|
|
629
|
+
D(n.id) ? (l(), c("i", Ct)) : _("", !0)
|
|
629
630
|
])
|
|
630
631
|
]),
|
|
631
632
|
_: 2
|
|
632
633
|
}, 1032, ["value", "checked", "onChange"]))), 128))
|
|
633
634
|
])) : V.value ? (l(), c("div", Vt, " 搜索中... ")) : (l(), c("div", Ut, " 暂无搜索结果 "))
|
|
634
635
|
]),
|
|
635
|
-
tag: N((
|
|
636
|
-
|
|
636
|
+
tag: N((n) => [
|
|
637
|
+
n && n.tag ? (l(), E(O, {
|
|
637
638
|
key: 0,
|
|
638
|
-
theme: ie(typeof
|
|
639
|
+
theme: ie(typeof n.tag == "object" ? n.tag.value : n.tag),
|
|
639
640
|
variant: "light",
|
|
640
641
|
closable: !0,
|
|
641
642
|
size: "medium"
|
|
642
643
|
}, {
|
|
643
644
|
default: N(() => [
|
|
644
|
-
oe(
|
|
645
|
+
oe(f(typeof n.tag == "object" ? n.tag.label : n.tag), 1)
|
|
645
646
|
]),
|
|
646
647
|
_: 2
|
|
647
648
|
}, 1032, ["theme"])) : _("", !0)
|
|
@@ -649,7 +650,7 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
649
650
|
suffixIcon: N(() => [
|
|
650
651
|
p("i", {
|
|
651
652
|
class: "ri-add-circle-line cd-input-select__add-icon",
|
|
652
|
-
onClick:
|
|
653
|
+
onClick: re
|
|
653
654
|
})
|
|
654
655
|
]),
|
|
655
656
|
_: 1
|
|
@@ -657,23 +658,24 @@ const ze = { class: "cd-ps-container" }, $e = {
|
|
|
657
658
|
(P = b.tabs) != null && P.length && U.value ? (l(), E(ke, {
|
|
658
659
|
key: 0,
|
|
659
660
|
visible: U.value,
|
|
660
|
-
"onUpdate:visible": i[2] || (i[2] = (
|
|
661
|
-
modelValue:
|
|
662
|
-
"onUpdate:modelValue": i[3] || (i[3] = (
|
|
661
|
+
"onUpdate:visible": i[2] || (i[2] = (n) => U.value = n),
|
|
662
|
+
modelValue: w.value,
|
|
663
|
+
"onUpdate:modelValue": i[3] || (i[3] = (n) => w.value = n),
|
|
663
664
|
tabs: b.tabs,
|
|
664
665
|
organizations: b.organizations || [],
|
|
665
|
-
"show-org": !1,
|
|
666
|
+
"show-org": b.showOrg !== !1,
|
|
666
667
|
"show-search": !0,
|
|
667
668
|
multiple: b.multiple,
|
|
668
669
|
onConfirm: Y,
|
|
669
670
|
onLoadUsers: J,
|
|
670
671
|
onSearch: le,
|
|
671
|
-
|
|
672
|
-
|
|
672
|
+
onTabChange: i[4] || (i[4] = (n) => r("tab-change", n)),
|
|
673
|
+
onClose: i[5] || (i[5] = (n) => U.value = !1)
|
|
674
|
+
}, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
|
|
673
675
|
]);
|
|
674
676
|
};
|
|
675
677
|
}
|
|
676
|
-
}), It = /* @__PURE__ */ ye(St, [["__scopeId", "data-v-
|
|
678
|
+
}), It = /* @__PURE__ */ ye(St, [["__scopeId", "data-v-5807a0b3"]]), Nt = {
|
|
677
679
|
install(b) {
|
|
678
680
|
b.component("PersonSelector", ke), b.component("CdInputPersonSelector", It);
|
|
679
681
|
}
|
|
@@ -6,6 +6,7 @@ interface Props {
|
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
tabs?: any[];
|
|
8
8
|
organizations?: any[];
|
|
9
|
+
showOrg?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
11
12
|
multiple: boolean;
|
|
@@ -21,6 +22,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
21
22
|
nodeId: string | number;
|
|
22
23
|
callback: (users: any[]) => void;
|
|
23
24
|
}) => void;
|
|
25
|
+
"tab-change": (payload: {
|
|
26
|
+
tabKey: string;
|
|
27
|
+
orgId?: string | number;
|
|
28
|
+
}) => void;
|
|
24
29
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
25
30
|
multiple: boolean;
|
|
26
31
|
placeholder: string;
|
|
@@ -35,6 +40,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
35
40
|
keyword: string;
|
|
36
41
|
callback: (users: UserItem[]) => void;
|
|
37
42
|
}) => any) | undefined;
|
|
43
|
+
"onTab-change"?: ((payload: {
|
|
44
|
+
tabKey: string;
|
|
45
|
+
orgId?: string | number;
|
|
46
|
+
}) => any) | undefined;
|
|
38
47
|
}>, {
|
|
39
48
|
multiple: boolean;
|
|
40
49
|
placeholder: string;
|