cd-personselector 1.3.8 → 1.3.9
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 +209 -203
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/InputSelect.vue +14 -6
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as Se, ref as g, computed as D, watch as X, resolveComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as Se, ref as g, computed as D, watch as X, resolveComponent as N, openBlock as n, createBlock as W, withCtx as I, createElementVNode as u, createElementBlock as c, createVNode as k, Fragment as Q, renderList as oe, createCommentVNode as _, normalizeClass as ne, withModifiers as ue, toDisplayString as v, createTextVNode as Y, nextTick as $e, normalizeStyle as Ue } from "vue";
|
|
2
|
+
const we = { class: "cd-ps-container" }, ze = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "cd-ps-search"
|
|
5
5
|
}, Be = {
|
|
@@ -49,17 +49,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
49
49
|
multiple: { type: Boolean, default: !0 }
|
|
50
50
|
},
|
|
51
51
|
emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search", "org-change", "tab-change"],
|
|
52
|
-
setup(b, { expose: Z, emit:
|
|
52
|
+
setup(b, { expose: Z, emit: C }) {
|
|
53
53
|
var Ce, Ve;
|
|
54
|
-
const r = b,
|
|
54
|
+
const r = b, V = C, U = g(r.visible), S = g(((Ve = (Ce = r.tabs) == null ? void 0 : Ce[0]) == null ? void 0 : Ve.key) || ""), M = g(null), B = g(""), f = g([]), T = g(/* @__PURE__ */ new Map()), G = g({}), $ = g(!1), R = g(!1), L = g({}), K = D(() => r.tabs || []), ie = D(() => r.organizations || []);
|
|
55
55
|
D(() => r.tips || "");
|
|
56
|
-
const ee = D(() => r.showSearch),
|
|
56
|
+
const ee = D(() => r.showSearch), re = D(() => r.showOrg), pe = D(() => r.dialogWidth), O = g({});
|
|
57
57
|
X(() => r.tabs, (t) => {
|
|
58
58
|
if (t && t.length > 0) {
|
|
59
59
|
const e = {};
|
|
60
|
-
t.forEach((
|
|
61
|
-
e[
|
|
62
|
-
}), O.value = e, (!
|
|
60
|
+
t.forEach((s) => {
|
|
61
|
+
e[s.key] = JSON.parse(JSON.stringify(s.tree));
|
|
62
|
+
}), O.value = e, (!S.value || !t.find((s) => s.key === S.value)) && (S.value = t[0].key);
|
|
63
63
|
}
|
|
64
64
|
}, { immediate: !0, deep: !0 });
|
|
65
65
|
function ce() {
|
|
@@ -72,20 +72,20 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
72
72
|
f.value = [], T.value.clear();
|
|
73
73
|
}
|
|
74
74
|
X(() => r.modelValue, (t) => {
|
|
75
|
-
|
|
75
|
+
U.value && t && ce();
|
|
76
76
|
}, { deep: !0 }), X(() => r.visible, (t) => {
|
|
77
|
-
|
|
78
|
-
}), X(
|
|
79
|
-
|
|
77
|
+
U.value = t, t && (ce(), r.organizations.length > 0 && !M.value && (M.value = r.organizations[0].id));
|
|
78
|
+
}), X(U, (t) => {
|
|
79
|
+
V("update:visible", t);
|
|
80
80
|
});
|
|
81
81
|
function j(t, e) {
|
|
82
82
|
e && (G.value[t] = e);
|
|
83
83
|
}
|
|
84
84
|
function te(t, e) {
|
|
85
|
-
for (const
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
88
|
-
const p = te(
|
|
85
|
+
for (const s of t) {
|
|
86
|
+
if (s.id === e) return s;
|
|
87
|
+
if (s.children) {
|
|
88
|
+
const p = te(s.children, e);
|
|
89
89
|
if (p) return p;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -98,21 +98,21 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
98
98
|
function ae(t) {
|
|
99
99
|
f.value = f.value.filter((e) => e !== t), T.value.delete(t);
|
|
100
100
|
}
|
|
101
|
-
const
|
|
102
|
-
var
|
|
101
|
+
const ve = (t) => {
|
|
102
|
+
var s;
|
|
103
103
|
if (!$.value) return t.name;
|
|
104
|
-
const e = ((
|
|
104
|
+
const e = ((s = L.value[t.key]) == null ? void 0 : s.length) ?? 0;
|
|
105
105
|
return e > 0 ? `${t.name} (${e})` : t.name;
|
|
106
|
-
}, ve = (t) => {
|
|
107
|
-
$.value || (B.value = "", C("tab-change", { tabKey: t }));
|
|
108
106
|
}, fe = (t) => {
|
|
107
|
+
$.value || (B.value = "", V("tab-change", { tabKey: t }));
|
|
108
|
+
}, he = (t) => {
|
|
109
109
|
const e = {};
|
|
110
110
|
r.tabs.forEach((p) => {
|
|
111
111
|
e[p.key] = [];
|
|
112
112
|
}), O.value = e;
|
|
113
|
-
const
|
|
113
|
+
const s = () => {
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
V("org-change", { orgId: t, tabKey: S.value, callback: s });
|
|
116
116
|
};
|
|
117
117
|
let a = null;
|
|
118
118
|
const l = () => {
|
|
@@ -120,17 +120,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
120
120
|
E();
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
$.value = !0, R.value = !0, a = setTimeout(() =>
|
|
124
|
-
},
|
|
123
|
+
$.value = !0, R.value = !0, a = setTimeout(() => x(), 300);
|
|
124
|
+
}, x = () => {
|
|
125
125
|
L.value = {};
|
|
126
126
|
const t = (e) => {
|
|
127
|
-
const
|
|
127
|
+
const s = {};
|
|
128
128
|
e.forEach((p) => {
|
|
129
|
-
const m = { ...p, isUser: p.isUser !== !1 },
|
|
130
|
-
|
|
131
|
-
}), L.value =
|
|
129
|
+
const m = { ...p, isUser: p.isUser !== !1 }, w = p.nodeType || (p.isUser !== !1 ? "user" : "department");
|
|
130
|
+
s[w] || (s[w] = []), s[w].push(m);
|
|
131
|
+
}), L.value = s, R.value = !1;
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
V("search", { keyword: B.value, orgId: M.value || void 0, callback: t });
|
|
134
134
|
}, E = () => {
|
|
135
135
|
a && (clearTimeout(a), a = null), $.value = !1, B.value = "", L.value = {}, R.value = !1;
|
|
136
136
|
}, F = (t) => {
|
|
@@ -138,54 +138,54 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
138
138
|
ae(t.id);
|
|
139
139
|
else {
|
|
140
140
|
r.multiple || (f.value = [], T.value.clear());
|
|
141
|
-
const
|
|
142
|
-
de(t.id, { ...t, typeName:
|
|
141
|
+
const s = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
|
|
142
|
+
de(t.id, { ...t, typeName: s, orgId: M.value }), r.multiple || _e();
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function P(t) {
|
|
146
|
-
const e = [],
|
|
146
|
+
const e = [], s = (p) => {
|
|
147
147
|
for (const m of p)
|
|
148
|
-
e.push(m.id), m.children &&
|
|
148
|
+
e.push(m.id), m.children && s(m.children);
|
|
149
149
|
};
|
|
150
|
-
return
|
|
150
|
+
return s(t), e;
|
|
151
151
|
}
|
|
152
152
|
const q = (t, e) => {
|
|
153
|
-
var
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
156
|
-
const h =
|
|
153
|
+
var z, y;
|
|
154
|
+
const s = e == null ? void 0 : e.node;
|
|
155
|
+
if (s) {
|
|
156
|
+
const h = s.value ?? ((z = s.data) == null ? void 0 : z.id);
|
|
157
157
|
if (h !== void 0) {
|
|
158
|
-
if (
|
|
158
|
+
if (s.checked) {
|
|
159
159
|
r.multiple || (f.value = [], T.value.clear());
|
|
160
|
-
const H = r.tabs.find((se) => se.key ===
|
|
161
|
-
de(h, { ...
|
|
160
|
+
const H = r.tabs.find((se) => se.key === S.value), le = H ? H.name.replace(/^按/, "") : "";
|
|
161
|
+
de(h, { ...s.data, typeName: le, orgId: M.value }), !r.multiple && ((y = s.data) != null && y.isUser) && _e();
|
|
162
162
|
} else
|
|
163
163
|
ae(h);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
const p = O.value[
|
|
168
|
-
f.value = [...
|
|
167
|
+
const p = O.value[S.value] || [], m = P(p), w = f.value.filter((h) => !m.includes(h));
|
|
168
|
+
f.value = [...w, ...t];
|
|
169
169
|
};
|
|
170
|
-
function
|
|
170
|
+
function o(t, e, s) {
|
|
171
171
|
for (const p of t) {
|
|
172
172
|
if (p.id === e)
|
|
173
|
-
return p.children = p.children || [], p.children.push(...
|
|
174
|
-
if (p.children &&
|
|
173
|
+
return p.children = p.children || [], p.children.push(...s), p.loaded = !0, !0;
|
|
174
|
+
if (p.children && o(p.children, e, s))
|
|
175
175
|
return !0;
|
|
176
176
|
}
|
|
177
177
|
return !1;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
180
|
-
var
|
|
181
|
-
const
|
|
179
|
+
async function me(t, e) {
|
|
180
|
+
var w;
|
|
181
|
+
const s = t.value, p = G.value[e];
|
|
182
182
|
if (t.data.loaded) {
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
const y = te(
|
|
183
|
+
const z = O.value[e];
|
|
184
|
+
if (z) {
|
|
185
|
+
const y = te(z, s);
|
|
186
186
|
y && y.children && (y.children = y.children.filter((h) => !h.isUser));
|
|
187
187
|
}
|
|
188
|
-
p && (((
|
|
188
|
+
p && (((w = p.getItem(s)) == null ? void 0 : w.children) || []).filter((h) => {
|
|
189
189
|
var J;
|
|
190
190
|
return (J = h.data) == null ? void 0 : J.isUser;
|
|
191
191
|
}).forEach((h) => {
|
|
@@ -195,16 +195,16 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
195
195
|
}
|
|
196
196
|
}), t.data.loaded = !1;
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
if (
|
|
200
|
-
const y =
|
|
198
|
+
V("load-users", { tabKey: e, nodeId: s, node: t, callback: async (z) => {
|
|
199
|
+
if (z.length > 0) {
|
|
200
|
+
const y = z.map((J) => {
|
|
201
201
|
const { id: H, name: le, ...se } = J;
|
|
202
202
|
return { ...se, id: H, name: J.displayName || le, isUser: !0 };
|
|
203
203
|
}), h = O.value[e];
|
|
204
|
-
if (h &&
|
|
205
|
-
p.appendTo(
|
|
204
|
+
if (h && o(h, s, y), p) {
|
|
205
|
+
p.appendTo(s, y), t.data.loaded = !0, await $e();
|
|
206
206
|
try {
|
|
207
|
-
p.setItem(
|
|
207
|
+
p.setItem(s, { expanded: !0 });
|
|
208
208
|
} catch {
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -212,7 +212,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
212
212
|
t.data.loaded = !0;
|
|
213
213
|
const y = O.value[e];
|
|
214
214
|
if (y) {
|
|
215
|
-
const h = te(y,
|
|
215
|
+
const h = te(y, s);
|
|
216
216
|
h && (h.loaded = !0);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -222,52 +222,52 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
222
222
|
ae(t);
|
|
223
223
|
}, ke = () => {
|
|
224
224
|
f.value = [], T.value.clear();
|
|
225
|
-
},
|
|
226
|
-
|
|
225
|
+
}, _e = () => {
|
|
226
|
+
V("update:modelValue", f.value), V("confirm", A.value), U.value = !1;
|
|
227
227
|
}, be = () => {
|
|
228
|
-
|
|
228
|
+
U.value = !1, V("close");
|
|
229
229
|
};
|
|
230
230
|
return Z({
|
|
231
231
|
clearSelection: ke,
|
|
232
|
-
appendUsers: (t, e,
|
|
232
|
+
appendUsers: (t, e, s) => {
|
|
233
233
|
const p = G.value[t];
|
|
234
|
-
if (p &&
|
|
235
|
-
const m =
|
|
236
|
-
const { id:
|
|
237
|
-
return { ...h, id:
|
|
234
|
+
if (p && s.length > 0) {
|
|
235
|
+
const m = s.map((w) => {
|
|
236
|
+
const { id: z, name: y, ...h } = w;
|
|
237
|
+
return { ...h, id: z, name: w.displayName || y, isUser: !0 };
|
|
238
238
|
});
|
|
239
239
|
p.appendTo(e, m);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}), (t, e) => {
|
|
243
|
-
const
|
|
244
|
-
return
|
|
245
|
-
visible:
|
|
246
|
-
"onUpdate:visible": e[4] || (e[4] = (i) =>
|
|
243
|
+
const s = N("t-option"), p = N("t-select"), m = N("t-icon"), w = N("t-input"), z = N("t-loading"), y = N("t-checkbox"), h = N("t-button"), J = N("t-tree"), H = N("t-tab-panel"), le = N("t-tabs"), se = N("t-dialog");
|
|
244
|
+
return n(), W(se, {
|
|
245
|
+
visible: U.value,
|
|
246
|
+
"onUpdate:visible": e[4] || (e[4] = (i) => U.value = i),
|
|
247
247
|
header: "选择人员",
|
|
248
|
-
width:
|
|
248
|
+
width: pe.value,
|
|
249
249
|
footer: !0,
|
|
250
250
|
placement: "center",
|
|
251
251
|
"destroy-on-close": "",
|
|
252
252
|
attach: "body",
|
|
253
253
|
"close-on-overlay-click": !0,
|
|
254
|
-
onConfirm:
|
|
254
|
+
onConfirm: _e,
|
|
255
255
|
onClose: be,
|
|
256
256
|
onCancel: be
|
|
257
257
|
}, {
|
|
258
|
-
default:
|
|
259
|
-
u("div",
|
|
260
|
-
ee.value ? (
|
|
261
|
-
|
|
258
|
+
default: I(() => [
|
|
259
|
+
u("div", we, [
|
|
260
|
+
ee.value ? (n(), c("div", ze, [
|
|
261
|
+
re.value && ie.value.length > 0 ? (n(), c("div", Be, [
|
|
262
262
|
k(p, {
|
|
263
263
|
modelValue: M.value,
|
|
264
264
|
"onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
|
|
265
265
|
placeholder: "选择组织",
|
|
266
266
|
style: { width: "200px" },
|
|
267
|
-
onChange:
|
|
267
|
+
onChange: he
|
|
268
268
|
}, {
|
|
269
|
-
default:
|
|
270
|
-
(
|
|
269
|
+
default: I(() => [
|
|
270
|
+
(n(!0), c(Q, null, oe(ie.value, (i) => (n(), W(s, {
|
|
271
271
|
key: i.id,
|
|
272
272
|
value: i.id,
|
|
273
273
|
label: i.displayName || i.name
|
|
@@ -277,7 +277,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
277
277
|
}, 8, ["modelValue"])
|
|
278
278
|
])) : _("", !0),
|
|
279
279
|
u("div", Oe, [
|
|
280
|
-
k(
|
|
280
|
+
k(w, {
|
|
281
281
|
modelValue: B.value,
|
|
282
282
|
"onUpdate:modelValue": e[1] || (e[1] = (i) => B.value = i),
|
|
283
283
|
placeholder: "输入手机号/工号/姓名/部门/职位搜索",
|
|
@@ -286,7 +286,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
286
286
|
onInput: l,
|
|
287
287
|
onClear: E
|
|
288
288
|
}, {
|
|
289
|
-
"prefix-icon":
|
|
289
|
+
"prefix-icon": I(() => [
|
|
290
290
|
k(m, { name: "search" })
|
|
291
291
|
]),
|
|
292
292
|
_: 1
|
|
@@ -296,39 +296,39 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
296
296
|
u("div", Pe, [
|
|
297
297
|
u("div", De, [
|
|
298
298
|
k(le, {
|
|
299
|
-
modelValue:
|
|
300
|
-
"onUpdate:modelValue": e[3] || (e[3] = (i) =>
|
|
301
|
-
onChange:
|
|
299
|
+
modelValue: S.value,
|
|
300
|
+
"onUpdate:modelValue": e[3] || (e[3] = (i) => S.value = i),
|
|
301
|
+
onChange: fe
|
|
302
302
|
}, {
|
|
303
|
-
default:
|
|
304
|
-
(
|
|
303
|
+
default: I(() => [
|
|
304
|
+
(n(!0), c(Q, null, oe(K.value, (i) => (n(), W(H, {
|
|
305
305
|
key: i.key,
|
|
306
306
|
value: i.key,
|
|
307
|
-
label:
|
|
307
|
+
label: ve(i)
|
|
308
308
|
}, {
|
|
309
|
-
default:
|
|
310
|
-
var
|
|
309
|
+
default: I(() => {
|
|
310
|
+
var ge;
|
|
311
311
|
return [
|
|
312
|
-
$.value ? (
|
|
313
|
-
R.value ? (
|
|
314
|
-
k(
|
|
312
|
+
$.value ? (n(), c(Q, { key: 0 }, [
|
|
313
|
+
R.value ? (n(), c("div", Me, [
|
|
314
|
+
k(z),
|
|
315
315
|
e[5] || (e[5] = u("span", null, "搜索中...", -1))
|
|
316
|
-
])) : !L.value[i.key] || L.value[i.key].length === 0 ? (
|
|
316
|
+
])) : !L.value[i.key] || L.value[i.key].length === 0 ? (n(), c("div", Re, [
|
|
317
317
|
k(m, {
|
|
318
318
|
name: "search",
|
|
319
319
|
size: "48px",
|
|
320
320
|
style: { color: "#ddd" }
|
|
321
321
|
}),
|
|
322
322
|
e[6] || (e[6] = u("p", null, "暂无结果", -1))
|
|
323
|
-
])) : (
|
|
324
|
-
(
|
|
323
|
+
])) : (n(), c("div", Le, [
|
|
324
|
+
(n(!0), c(Q, null, oe(L.value[i.key], (d) => (n(), c("div", {
|
|
325
325
|
key: d.id,
|
|
326
326
|
class: ne(["cd-ps-result-item", { "cd-ps-selected": f.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
|
|
327
327
|
onClick: (Ne) => F(d)
|
|
328
328
|
}, [
|
|
329
329
|
k(y, {
|
|
330
330
|
checked: f.value.includes(d.id),
|
|
331
|
-
onClick: e[2] || (e[2] =
|
|
331
|
+
onClick: e[2] || (e[2] = ue(() => {
|
|
332
332
|
}, ["stop"]))
|
|
333
333
|
}, null, 8, ["checked"]),
|
|
334
334
|
u("div", {
|
|
@@ -341,17 +341,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
341
341
|
u("div", We, [
|
|
342
342
|
u("div", je, v(d.displayName || d.name), 1),
|
|
343
343
|
u("div", Je, [
|
|
344
|
-
d.isUser ? _("", !0) : (
|
|
345
|
-
d.position ? (
|
|
346
|
-
d.department ? (
|
|
347
|
-
d.phone ? (
|
|
348
|
-
d.userCount ? (
|
|
344
|
+
d.isUser ? _("", !0) : (n(), c("span", Ae, v(d.isPost ? "职位" : "部门"), 1)),
|
|
345
|
+
d.position ? (n(), c("span", Fe, v(d.position), 1)) : _("", !0),
|
|
346
|
+
d.department ? (n(), c("span", qe, v(d.department), 1)) : _("", !0),
|
|
347
|
+
d.phone ? (n(), c("span", Ge, v(d.phone), 1)) : _("", !0),
|
|
348
|
+
d.userCount ? (n(), c("span", He, v(d.userCount) + "人", 1)) : _("", !0)
|
|
349
349
|
])
|
|
350
350
|
])
|
|
351
351
|
], 10, Ee))), 128))
|
|
352
352
|
]))
|
|
353
|
-
], 64)) : (
|
|
354
|
-
((
|
|
353
|
+
], 64)) : (n(), c("div", Qe, [
|
|
354
|
+
((ge = O.value[i.key]) == null ? void 0 : ge.length) > 0 ? (n(), W(J, {
|
|
355
355
|
key: 0,
|
|
356
356
|
ref_for: !0,
|
|
357
357
|
ref: (d) => j(i.key, d),
|
|
@@ -363,7 +363,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
363
363
|
value: f.value,
|
|
364
364
|
onChange: q
|
|
365
365
|
}, {
|
|
366
|
-
label:
|
|
366
|
+
label: I(({ node: d }) => [
|
|
367
367
|
u("div", {
|
|
368
368
|
class: ne(["cd-ps-node", { "cd-ps-node-user": d.data.isUser }])
|
|
369
369
|
}, [
|
|
@@ -372,17 +372,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
372
372
|
}, null, 8, ["name"]),
|
|
373
373
|
u("span", Xe, [
|
|
374
374
|
Y(v(d.label) + " ", 1),
|
|
375
|
-
d.data.isUser && d.data.position ? (
|
|
375
|
+
d.data.isUser && d.data.position ? (n(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
|
|
376
376
|
]),
|
|
377
|
-
d.data.userCount && !d.data.isUser ? (
|
|
378
|
-
d.data.isUser ? _("", !0) : (
|
|
377
|
+
d.data.userCount && !d.data.isUser ? (n(), c("span", Ze, "(" + v(d.data.userCount) + ")", 1)) : _("", !0),
|
|
378
|
+
d.data.isUser ? _("", !0) : (n(), W(h, {
|
|
379
379
|
key: 1,
|
|
380
380
|
size: "small",
|
|
381
381
|
variant: "text",
|
|
382
382
|
class: "cd-ps-load-btn",
|
|
383
|
-
onClick:
|
|
383
|
+
onClick: ue((Ne) => me(d, i.key), ["stop"])
|
|
384
384
|
}, {
|
|
385
|
-
default:
|
|
385
|
+
default: I(() => [
|
|
386
386
|
Y(v(d.data.loaded ? "刷新人员" : "显示人员"), 1)
|
|
387
387
|
]),
|
|
388
388
|
_: 2
|
|
@@ -390,7 +390,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
390
390
|
], 2)
|
|
391
391
|
]),
|
|
392
392
|
_: 2
|
|
393
|
-
}, 1032, ["data", "value"])) : (
|
|
393
|
+
}, 1032, ["data", "value"])) : (n(), c("div", Ke, [
|
|
394
394
|
k(m, {
|
|
395
395
|
name: i.icon || "folder-open",
|
|
396
396
|
size: "48px",
|
|
@@ -411,28 +411,28 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
411
411
|
u("div", tt, [
|
|
412
412
|
e[9] || (e[9] = u("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
413
413
|
u("span", at, v(A.value.length) + " 项", 1),
|
|
414
|
-
A.value.length > 0 ? (
|
|
414
|
+
A.value.length > 0 ? (n(), W(h, {
|
|
415
415
|
key: 0,
|
|
416
416
|
size: "small",
|
|
417
417
|
variant: "text",
|
|
418
418
|
onClick: ke
|
|
419
419
|
}, {
|
|
420
|
-
default:
|
|
420
|
+
default: I(() => [...e[8] || (e[8] = [
|
|
421
421
|
Y("清空", -1)
|
|
422
422
|
])]),
|
|
423
423
|
_: 1
|
|
424
424
|
})) : _("", !0)
|
|
425
425
|
]),
|
|
426
426
|
u("div", lt, [
|
|
427
|
-
A.value.length === 0 ? (
|
|
427
|
+
A.value.length === 0 ? (n(), c("div", st, [
|
|
428
428
|
k(m, {
|
|
429
429
|
name: "user-checked",
|
|
430
430
|
size: "64px",
|
|
431
431
|
style: { color: "#ddd" }
|
|
432
432
|
}),
|
|
433
433
|
e[10] || (e[10] = u("p", null, "暂无选择", -1))
|
|
434
|
-
])) : (
|
|
435
|
-
(
|
|
434
|
+
])) : (n(), c("div", nt, [
|
|
435
|
+
(n(!0), c(Q, null, oe(A.value, (i) => (n(), c("div", {
|
|
436
436
|
key: i.id,
|
|
437
437
|
class: ne(["cd-ps-selected-item", { "cd-ps-dept-item": !i.isUser }])
|
|
438
438
|
}, [
|
|
@@ -447,10 +447,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
447
447
|
u("div", it, [
|
|
448
448
|
u("div", ct, v(i.displayName || i.name), 1),
|
|
449
449
|
u("div", dt, [
|
|
450
|
-
i.isUser && i.position ? (
|
|
451
|
-
i.isUser && i.department ? (
|
|
452
|
-
i.isUser ? _("", !0) : (
|
|
453
|
-
!i.isUser && i.userCount ? (
|
|
450
|
+
i.isUser && i.position ? (n(), c("span", ut, v(i.position), 1)) : _("", !0),
|
|
451
|
+
i.isUser && i.department ? (n(), c("span", rt, v(i.department), 1)) : _("", !0),
|
|
452
|
+
i.isUser ? _("", !0) : (n(), c("span", pt, v(i.typeName || "部门"), 1)),
|
|
453
|
+
!i.isUser && i.userCount ? (n(), c("span", vt, v(i.userCount) + "人", 1)) : _("", !0)
|
|
454
454
|
])
|
|
455
455
|
])
|
|
456
456
|
]),
|
|
@@ -458,9 +458,9 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
458
458
|
size: "small",
|
|
459
459
|
variant: "text",
|
|
460
460
|
shape: "circle",
|
|
461
|
-
onClick: (
|
|
461
|
+
onClick: (ge) => xe(i.id)
|
|
462
462
|
}, {
|
|
463
|
-
icon:
|
|
463
|
+
icon: I(() => [
|
|
464
464
|
k(m, { name: "close" })
|
|
465
465
|
]),
|
|
466
466
|
_: 1
|
|
@@ -477,10 +477,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
}), Ie = (b, Z) => {
|
|
480
|
-
const
|
|
481
|
-
for (const [r,
|
|
482
|
-
|
|
483
|
-
return
|
|
480
|
+
const C = b.__vccOpts || b;
|
|
481
|
+
for (const [r, V] of Z)
|
|
482
|
+
C[r] = V;
|
|
483
|
+
return C;
|
|
484
484
|
}, Te = /* @__PURE__ */ Ie(ft, [["__scopeId", "data-v-06746f32"]]), ht = { class: "cd-input-select" }, mt = { class: "cd-input-select__grid" }, _t = { class: "cd-input-select__option-content" }, gt = {
|
|
485
485
|
key: 0,
|
|
486
486
|
class: "cd-input-select__option-avatar"
|
|
@@ -499,7 +499,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
499
499
|
}, Nt = {
|
|
500
500
|
key: 2,
|
|
501
501
|
class: "cd-input-select__empty"
|
|
502
|
-
},
|
|
502
|
+
}, ye = 10, $t = /* @__PURE__ */ Se({
|
|
503
503
|
name: "CdInputPersonSelector",
|
|
504
504
|
__name: "InputSelect",
|
|
505
505
|
props: {
|
|
@@ -512,10 +512,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
512
512
|
},
|
|
513
513
|
emits: ["update:modelValue", "search", "load-users", "tab-change"],
|
|
514
514
|
setup(b, { emit: Z }) {
|
|
515
|
-
const
|
|
516
|
-
const a = (
|
|
517
|
-
return
|
|
518
|
-
}), B = D(() => Math.ceil(
|
|
515
|
+
const C = b, r = Z, V = g(!1), U = g([]), S = g(1), M = D(() => {
|
|
516
|
+
const a = (S.value - 1) * ye;
|
|
517
|
+
return U.value.slice(a, a + ye);
|
|
518
|
+
}), B = D(() => Math.ceil(U.value.length / ye)), f = g(!1), T = g([]), G = g([]), $ = g(!1), R = g(""), L = D(() => C.modelValue.map((a) => ({
|
|
519
519
|
label: a.name,
|
|
520
520
|
value: a.id
|
|
521
521
|
}))), K = {
|
|
@@ -531,13 +531,13 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
531
531
|
}, ee = (a) => {
|
|
532
532
|
var l;
|
|
533
533
|
return ((l = K[a || ""]) == null ? void 0 : l.color) || "#999";
|
|
534
|
-
},
|
|
534
|
+
}, re = (a) => {
|
|
535
535
|
var l;
|
|
536
536
|
return ((l = K[a || ""]) == null ? void 0 : l.icon) || "?";
|
|
537
|
-
},
|
|
537
|
+
}, pe = (a) => {
|
|
538
538
|
const l = String(a);
|
|
539
539
|
return l.startsWith("dept-") ? "warning" : l.startsWith("u-") ? "primary" : l.startsWith("pos-") ? "success" : l.startsWith("role-") ? "info" : "default";
|
|
540
|
-
}, O = (a) =>
|
|
540
|
+
}, O = (a) => C.modelValue.some((l) => l.id === a), ce = (a) => ({
|
|
541
541
|
id: a.id,
|
|
542
542
|
name: a.displayName || a.name || a.title || String(a.id),
|
|
543
543
|
avatar: a.avatar || "",
|
|
@@ -547,53 +547,57 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
547
547
|
isUser: a.isUser !== !1
|
|
548
548
|
}), j = (a) => {
|
|
549
549
|
r("update:modelValue", a), G.value = a;
|
|
550
|
-
}, te = (a) => {
|
|
551
|
-
|
|
550
|
+
}, te = (a, l) => {
|
|
551
|
+
if (a) {
|
|
552
|
+
$.value = !0;
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const x = (l == null ? void 0 : l.trigger) || "";
|
|
556
|
+
C.multiple && U.value.length > 0 && x !== "document" && x !== "keydown-esc" || ($.value = !1, U.value = [], R.value = "");
|
|
552
557
|
}, A = (a, l) => {
|
|
553
|
-
a ?
|
|
558
|
+
a ? C.multiple ? j([...C.modelValue, l]) : (j([l]), $.value = !1) : j(C.modelValue.filter((x) => x.id !== l.id));
|
|
554
559
|
}, de = (a, l) => {
|
|
555
|
-
const { trigger:
|
|
556
|
-
if ((
|
|
560
|
+
const { trigger: x, index: E } = l;
|
|
561
|
+
if ((x === "tag-remove" || x === "backspace") && ($.value = !1), x === "clear")
|
|
557
562
|
T.value = [], j([]);
|
|
558
|
-
else if (["tag-remove", "backspace"].includes(
|
|
563
|
+
else if (["tag-remove", "backspace"].includes(x)) {
|
|
559
564
|
const F = a.map((q) => q.value || q);
|
|
560
565
|
T.value = F;
|
|
561
|
-
const P = [...
|
|
566
|
+
const P = [...C.modelValue];
|
|
562
567
|
P.splice(E, 1), j(P);
|
|
563
568
|
}
|
|
564
569
|
}, ae = (a) => {
|
|
565
570
|
a.stopPropagation(), a.preventDefault(), $.value = !1, f.value = !0;
|
|
566
|
-
}, pe = (a) => {
|
|
567
|
-
const l = a.map(ce), z = new Set(S.modelValue.map((P) => P.id)), E = l.filter((P) => !z.has(P.id)), F = S.multiple ? [...S.modelValue, ...E] : l.slice(0, 1);
|
|
568
|
-
j(F), f.value = !1;
|
|
569
571
|
}, ve = (a) => {
|
|
570
|
-
|
|
572
|
+
const l = a.map(ce), x = new Set(C.modelValue.map((P) => P.id)), E = l.filter((P) => !x.has(P.id)), F = C.multiple ? [...C.modelValue, ...E] : l.slice(0, 1);
|
|
573
|
+
j(F), f.value = !1;
|
|
571
574
|
}, fe = (a) => {
|
|
575
|
+
r("load-users", a);
|
|
576
|
+
}, he = (a) => {
|
|
572
577
|
r("search", { keyword: a.keyword, callback: a.callback });
|
|
573
578
|
};
|
|
574
|
-
return X(() =>
|
|
579
|
+
return X(() => C.modelValue, (a) => {
|
|
575
580
|
T.value = a.map((l) => l.id), G.value = a;
|
|
576
581
|
}, { immediate: !0, deep: !0 }), X(R, (a) => {
|
|
577
582
|
if (!(a != null && a.trim())) {
|
|
578
|
-
|
|
583
|
+
U.value = [], V.value = !1;
|
|
579
584
|
return;
|
|
580
585
|
}
|
|
581
|
-
|
|
586
|
+
V.value = !0, r("search", {
|
|
582
587
|
keyword: a,
|
|
583
588
|
callback: (l) => {
|
|
584
|
-
|
|
589
|
+
U.value = l, S.value = 1, V.value = !1, l.length > 0 && ($.value = !0);
|
|
585
590
|
}
|
|
586
591
|
});
|
|
587
592
|
}), (a, l) => {
|
|
588
593
|
var q;
|
|
589
|
-
const
|
|
590
|
-
return
|
|
594
|
+
const x = N("t-checkbox"), E = N("t-button"), F = N("t-tag"), P = N("t-select-input");
|
|
595
|
+
return n(), c("div", ht, [
|
|
591
596
|
k(P, {
|
|
592
597
|
value: L.value,
|
|
593
598
|
inputValue: R.value,
|
|
594
|
-
"onUpdate:inputValue": l[
|
|
599
|
+
"onUpdate:inputValue": l[4] || (l[4] = (o) => R.value = o),
|
|
595
600
|
"popup-visible": $.value,
|
|
596
|
-
"onUpdate:popupVisible": l[4] || (l[4] = (s) => $.value = s),
|
|
597
601
|
"input-props": {
|
|
598
602
|
readonly: !1,
|
|
599
603
|
disabled: !1
|
|
@@ -606,7 +610,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
606
610
|
closeBtn: !0
|
|
607
611
|
},
|
|
608
612
|
placeholder: b.placeholder,
|
|
609
|
-
loading:
|
|
613
|
+
loading: V.value,
|
|
610
614
|
"allow-input": "",
|
|
611
615
|
clearable: "",
|
|
612
616
|
multiple: b.multiple,
|
|
@@ -614,94 +618,96 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
614
618
|
onPopupVisibleChange: te,
|
|
615
619
|
onTagChange: de
|
|
616
620
|
}, {
|
|
617
|
-
panel:
|
|
618
|
-
|
|
621
|
+
panel: I(() => [
|
|
622
|
+
U.value.length > 0 ? (n(), c("div", {
|
|
619
623
|
key: 0,
|
|
620
624
|
class: "cd-input-select__panel",
|
|
621
|
-
onMousedown: l[2] || (l[2] =
|
|
625
|
+
onMousedown: l[2] || (l[2] = ue(() => {
|
|
626
|
+
}, ["stop"])),
|
|
627
|
+
onClick: l[3] || (l[3] = ue(() => {
|
|
622
628
|
}, ["stop"]))
|
|
623
629
|
}, [
|
|
624
630
|
u("div", mt, [
|
|
625
|
-
(
|
|
626
|
-
key:
|
|
627
|
-
value:
|
|
628
|
-
checked: O(
|
|
631
|
+
(n(!0), c(Q, null, oe(M.value, (o) => (n(), W(x, {
|
|
632
|
+
key: o.id,
|
|
633
|
+
value: o.id,
|
|
634
|
+
checked: O(o.id),
|
|
629
635
|
class: "cd-input-select__option",
|
|
630
|
-
onChange: (
|
|
636
|
+
onChange: (me) => A(me, o)
|
|
631
637
|
}, {
|
|
632
|
-
default:
|
|
638
|
+
default: I(() => [
|
|
633
639
|
u("div", _t, [
|
|
634
|
-
|
|
640
|
+
o.avatar ? (n(), c("div", gt, [
|
|
635
641
|
u("img", {
|
|
636
|
-
src:
|
|
637
|
-
alt:
|
|
642
|
+
src: o.avatar,
|
|
643
|
+
alt: o.name
|
|
638
644
|
}, null, 8, yt)
|
|
639
|
-
])) : (
|
|
645
|
+
])) : (n(), c("div", {
|
|
640
646
|
key: 1,
|
|
641
647
|
class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
|
|
642
648
|
style: Ue({
|
|
643
|
-
backgroundColor: ee(
|
|
649
|
+
backgroundColor: ee(o.nodeType),
|
|
644
650
|
color: "#fff"
|
|
645
651
|
})
|
|
646
|
-
}, v(
|
|
652
|
+
}, v(re(o.nodeType)), 5)),
|
|
647
653
|
u("div", kt, [
|
|
648
|
-
u("div", bt, v(
|
|
649
|
-
|
|
654
|
+
u("div", bt, v(o.name), 1),
|
|
655
|
+
o.isUser && (o.department || o.post) ? (n(), c("div", Ct, v(o.department) + v(o.department && o.post ? " · " : "") + v(o.post), 1)) : o.fnumber ? (n(), c("div", Vt, v(o.fnumber), 1)) : _("", !0)
|
|
650
656
|
]),
|
|
651
657
|
u("span", {
|
|
652
658
|
class: "cd-input-select__option-tag",
|
|
653
|
-
style: Ue({ backgroundColor: ee(
|
|
654
|
-
}, v(ie(
|
|
659
|
+
style: Ue({ backgroundColor: ee(o.nodeType) + "18", color: ee(o.nodeType) })
|
|
660
|
+
}, v(ie(o.nodeType)), 5)
|
|
655
661
|
])
|
|
656
662
|
]),
|
|
657
663
|
_: 2
|
|
658
664
|
}, 1032, ["value", "checked", "onChange"]))), 128))
|
|
659
665
|
]),
|
|
660
|
-
B.value > 1 ? (
|
|
661
|
-
u("span", St, v(
|
|
666
|
+
B.value > 1 ? (n(), c("div", Ut, [
|
|
667
|
+
u("span", St, v(U.value.length) + " 条结果", 1),
|
|
662
668
|
u("div", It, [
|
|
663
669
|
k(E, {
|
|
664
670
|
size: "small",
|
|
665
671
|
variant: "text",
|
|
666
|
-
disabled:
|
|
667
|
-
onClick: l[0] || (l[0] = (
|
|
672
|
+
disabled: S.value <= 1,
|
|
673
|
+
onClick: l[0] || (l[0] = (o) => S.value--)
|
|
668
674
|
}, {
|
|
669
|
-
default:
|
|
675
|
+
default: I(() => [...l[9] || (l[9] = [
|
|
670
676
|
Y("上一页", -1)
|
|
671
677
|
])]),
|
|
672
678
|
_: 1
|
|
673
679
|
}, 8, ["disabled"]),
|
|
674
|
-
u("span", Tt, v(
|
|
680
|
+
u("span", Tt, v(S.value) + "/" + v(B.value), 1),
|
|
675
681
|
k(E, {
|
|
676
682
|
size: "small",
|
|
677
683
|
variant: "text",
|
|
678
|
-
disabled:
|
|
679
|
-
onClick: l[1] || (l[1] = (
|
|
684
|
+
disabled: S.value >= B.value,
|
|
685
|
+
onClick: l[1] || (l[1] = (o) => S.value++)
|
|
680
686
|
}, {
|
|
681
|
-
default:
|
|
687
|
+
default: I(() => [...l[10] || (l[10] = [
|
|
682
688
|
Y("下一页", -1)
|
|
683
689
|
])]),
|
|
684
690
|
_: 1
|
|
685
691
|
}, 8, ["disabled"])
|
|
686
692
|
])
|
|
687
693
|
])) : _("", !0)
|
|
688
|
-
], 32)) :
|
|
694
|
+
], 32)) : V.value ? (n(), c("div", xt, " 搜索中... ")) : (n(), c("div", Nt, " 暂无搜索结果 "))
|
|
689
695
|
]),
|
|
690
|
-
tag:
|
|
691
|
-
|
|
696
|
+
tag: I((o) => [
|
|
697
|
+
o && o.tag ? (n(), W(F, {
|
|
692
698
|
key: 0,
|
|
693
|
-
theme:
|
|
699
|
+
theme: pe(typeof o.tag == "object" ? o.tag.value : o.tag),
|
|
694
700
|
variant: "light",
|
|
695
701
|
closable: !0,
|
|
696
702
|
size: "medium"
|
|
697
703
|
}, {
|
|
698
|
-
default:
|
|
699
|
-
Y(v(typeof
|
|
704
|
+
default: I(() => [
|
|
705
|
+
Y(v(typeof o.tag == "object" ? o.tag.label : o.tag), 1)
|
|
700
706
|
]),
|
|
701
707
|
_: 2
|
|
702
708
|
}, 1032, ["theme"])) : _("", !0)
|
|
703
709
|
]),
|
|
704
|
-
suffixIcon:
|
|
710
|
+
suffixIcon: I(() => [
|
|
705
711
|
u("i", {
|
|
706
712
|
class: "ri-add-circle-line cd-input-select__add-icon",
|
|
707
713
|
onClick: ae
|
|
@@ -709,34 +715,34 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
709
715
|
]),
|
|
710
716
|
_: 1
|
|
711
717
|
}, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
|
|
712
|
-
(q = b.tabs) != null && q.length && f.value ? (
|
|
718
|
+
(q = b.tabs) != null && q.length && f.value ? (n(), W(Te, {
|
|
713
719
|
key: 0,
|
|
714
720
|
visible: f.value,
|
|
715
|
-
"onUpdate:visible": l[5] || (l[5] = (
|
|
721
|
+
"onUpdate:visible": l[5] || (l[5] = (o) => f.value = o),
|
|
716
722
|
modelValue: T.value,
|
|
717
|
-
"onUpdate:modelValue": l[6] || (l[6] = (
|
|
723
|
+
"onUpdate:modelValue": l[6] || (l[6] = (o) => T.value = o),
|
|
718
724
|
tabs: b.tabs,
|
|
719
725
|
organizations: b.organizations || [],
|
|
720
726
|
"show-org": b.showOrg !== !1,
|
|
721
727
|
"show-search": !0,
|
|
722
728
|
multiple: b.multiple,
|
|
723
|
-
onConfirm:
|
|
724
|
-
onLoadUsers:
|
|
725
|
-
onSearch:
|
|
726
|
-
onTabChange: l[7] || (l[7] = (
|
|
727
|
-
onClose: l[8] || (l[8] = (
|
|
729
|
+
onConfirm: ve,
|
|
730
|
+
onLoadUsers: fe,
|
|
731
|
+
onSearch: he,
|
|
732
|
+
onTabChange: l[7] || (l[7] = (o) => r("tab-change", o)),
|
|
733
|
+
onClose: l[8] || (l[8] = (o) => f.value = !1)
|
|
728
734
|
}, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
|
|
729
735
|
]);
|
|
730
736
|
};
|
|
731
737
|
}
|
|
732
|
-
}),
|
|
738
|
+
}), wt = /* @__PURE__ */ Ie($t, [["__scopeId", "data-v-29d7ef35"]]), Bt = {
|
|
733
739
|
install(b) {
|
|
734
|
-
b.component("PersonSelector", Te), b.component("CdInputPersonSelector",
|
|
740
|
+
b.component("PersonSelector", Te), b.component("CdInputPersonSelector", wt);
|
|
735
741
|
}
|
|
736
742
|
};
|
|
737
743
|
export {
|
|
738
|
-
|
|
739
|
-
|
|
744
|
+
wt as CdInputPersonSelector,
|
|
745
|
+
wt as InputSelect,
|
|
740
746
|
Te as PersonSelector,
|
|
741
747
|
Bt as default
|
|
742
748
|
};
|