cd-personselector 1.3.7 → 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 +220 -212
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/InputSelect.vue +14 -6
- package/src/PersonSelector.vue +3 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent 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 = {
|
|
@@ -35,7 +35,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
35
35
|
}, nt = {
|
|
36
36
|
key: 1,
|
|
37
37
|
class: "cd-ps-selected-list"
|
|
38
|
-
}, ot = { class: "cd-ps-item-info" }, it = { class: "cd-ps-info" }, ct = { class: "cd-ps-name" }, dt = { class: "cd-ps-meta" }, ut = { key: 0 }, rt = { key: 1 }, pt = { key: 2 }, vt = { key: 3 }, ft = /* @__PURE__ */
|
|
38
|
+
}, ot = { class: "cd-ps-item-info" }, it = { class: "cd-ps-info" }, ct = { class: "cd-ps-name" }, dt = { class: "cd-ps-meta" }, ut = { key: 0 }, rt = { key: 1 }, pt = { key: 2 }, vt = { key: 3 }, ft = /* @__PURE__ */ Se({
|
|
39
39
|
__name: "PersonSelector",
|
|
40
40
|
props: {
|
|
41
41
|
visible: { type: Boolean, default: !1 },
|
|
@@ -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:
|
|
53
|
-
var
|
|
54
|
-
const r = b,
|
|
52
|
+
setup(b, { expose: Z, emit: C }) {
|
|
53
|
+
var Ce, Ve;
|
|
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 = "", S("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,60 +212,62 @@ 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
|
}
|
|
219
219
|
} });
|
|
220
220
|
}
|
|
221
|
-
const
|
|
221
|
+
const xe = (t) => {
|
|
222
222
|
ae(t);
|
|
223
223
|
}, ke = () => {
|
|
224
224
|
f.value = [], T.value.clear();
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
|
|
225
|
+
}, _e = () => {
|
|
226
|
+
V("update:modelValue", f.value), V("confirm", A.value), U.value = !1;
|
|
227
|
+
}, be = () => {
|
|
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
|
-
|
|
254
|
-
|
|
253
|
+
"close-on-overlay-click": !0,
|
|
254
|
+
onConfirm: _e,
|
|
255
|
+
onClose: be,
|
|
256
|
+
onCancel: be
|
|
255
257
|
}, {
|
|
256
|
-
default:
|
|
257
|
-
u("div",
|
|
258
|
-
ee.value ? (
|
|
259
|
-
|
|
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, [
|
|
260
262
|
k(p, {
|
|
261
263
|
modelValue: M.value,
|
|
262
264
|
"onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
|
|
263
265
|
placeholder: "选择组织",
|
|
264
266
|
style: { width: "200px" },
|
|
265
|
-
onChange:
|
|
267
|
+
onChange: he
|
|
266
268
|
}, {
|
|
267
|
-
default:
|
|
268
|
-
(
|
|
269
|
+
default: I(() => [
|
|
270
|
+
(n(!0), c(Q, null, oe(ie.value, (i) => (n(), W(s, {
|
|
269
271
|
key: i.id,
|
|
270
272
|
value: i.id,
|
|
271
273
|
label: i.displayName || i.name
|
|
@@ -275,7 +277,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
275
277
|
}, 8, ["modelValue"])
|
|
276
278
|
])) : _("", !0),
|
|
277
279
|
u("div", Oe, [
|
|
278
|
-
k(
|
|
280
|
+
k(w, {
|
|
279
281
|
modelValue: B.value,
|
|
280
282
|
"onUpdate:modelValue": e[1] || (e[1] = (i) => B.value = i),
|
|
281
283
|
placeholder: "输入手机号/工号/姓名/部门/职位搜索",
|
|
@@ -284,7 +286,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
284
286
|
onInput: l,
|
|
285
287
|
onClear: E
|
|
286
288
|
}, {
|
|
287
|
-
"prefix-icon":
|
|
289
|
+
"prefix-icon": I(() => [
|
|
288
290
|
k(m, { name: "search" })
|
|
289
291
|
]),
|
|
290
292
|
_: 1
|
|
@@ -294,39 +296,39 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
294
296
|
u("div", Pe, [
|
|
295
297
|
u("div", De, [
|
|
296
298
|
k(le, {
|
|
297
|
-
modelValue:
|
|
298
|
-
"onUpdate:modelValue": e[3] || (e[3] = (i) =>
|
|
299
|
-
onChange:
|
|
299
|
+
modelValue: S.value,
|
|
300
|
+
"onUpdate:modelValue": e[3] || (e[3] = (i) => S.value = i),
|
|
301
|
+
onChange: fe
|
|
300
302
|
}, {
|
|
301
|
-
default:
|
|
302
|
-
(
|
|
303
|
+
default: I(() => [
|
|
304
|
+
(n(!0), c(Q, null, oe(K.value, (i) => (n(), W(H, {
|
|
303
305
|
key: i.key,
|
|
304
306
|
value: i.key,
|
|
305
|
-
label:
|
|
307
|
+
label: ve(i)
|
|
306
308
|
}, {
|
|
307
|
-
default:
|
|
308
|
-
var
|
|
309
|
+
default: I(() => {
|
|
310
|
+
var ge;
|
|
309
311
|
return [
|
|
310
|
-
$.value ? (
|
|
311
|
-
R.value ? (
|
|
312
|
-
k(
|
|
312
|
+
$.value ? (n(), c(Q, { key: 0 }, [
|
|
313
|
+
R.value ? (n(), c("div", Me, [
|
|
314
|
+
k(z),
|
|
313
315
|
e[5] || (e[5] = u("span", null, "搜索中...", -1))
|
|
314
|
-
])) : !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, [
|
|
315
317
|
k(m, {
|
|
316
318
|
name: "search",
|
|
317
319
|
size: "48px",
|
|
318
320
|
style: { color: "#ddd" }
|
|
319
321
|
}),
|
|
320
322
|
e[6] || (e[6] = u("p", null, "暂无结果", -1))
|
|
321
|
-
])) : (
|
|
322
|
-
(
|
|
323
|
+
])) : (n(), c("div", Le, [
|
|
324
|
+
(n(!0), c(Q, null, oe(L.value[i.key], (d) => (n(), c("div", {
|
|
323
325
|
key: d.id,
|
|
324
326
|
class: ne(["cd-ps-result-item", { "cd-ps-selected": f.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
|
|
325
327
|
onClick: (Ne) => F(d)
|
|
326
328
|
}, [
|
|
327
329
|
k(y, {
|
|
328
330
|
checked: f.value.includes(d.id),
|
|
329
|
-
onClick: e[2] || (e[2] =
|
|
331
|
+
onClick: e[2] || (e[2] = ue(() => {
|
|
330
332
|
}, ["stop"]))
|
|
331
333
|
}, null, 8, ["checked"]),
|
|
332
334
|
u("div", {
|
|
@@ -339,17 +341,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
339
341
|
u("div", We, [
|
|
340
342
|
u("div", je, v(d.displayName || d.name), 1),
|
|
341
343
|
u("div", Je, [
|
|
342
|
-
d.isUser ? _("", !0) : (
|
|
343
|
-
d.position ? (
|
|
344
|
-
d.department ? (
|
|
345
|
-
d.phone ? (
|
|
346
|
-
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)
|
|
347
349
|
])
|
|
348
350
|
])
|
|
349
351
|
], 10, Ee))), 128))
|
|
350
352
|
]))
|
|
351
|
-
], 64)) : (
|
|
352
|
-
((
|
|
353
|
+
], 64)) : (n(), c("div", Qe, [
|
|
354
|
+
((ge = O.value[i.key]) == null ? void 0 : ge.length) > 0 ? (n(), W(J, {
|
|
353
355
|
key: 0,
|
|
354
356
|
ref_for: !0,
|
|
355
357
|
ref: (d) => j(i.key, d),
|
|
@@ -361,7 +363,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
361
363
|
value: f.value,
|
|
362
364
|
onChange: q
|
|
363
365
|
}, {
|
|
364
|
-
label:
|
|
366
|
+
label: I(({ node: d }) => [
|
|
365
367
|
u("div", {
|
|
366
368
|
class: ne(["cd-ps-node", { "cd-ps-node-user": d.data.isUser }])
|
|
367
369
|
}, [
|
|
@@ -370,17 +372,17 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
370
372
|
}, null, 8, ["name"]),
|
|
371
373
|
u("span", Xe, [
|
|
372
374
|
Y(v(d.label) + " ", 1),
|
|
373
|
-
d.data.isUser && d.data.position ? (
|
|
375
|
+
d.data.isUser && d.data.position ? (n(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
|
|
374
376
|
]),
|
|
375
|
-
d.data.userCount && !d.data.isUser ? (
|
|
376
|
-
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, {
|
|
377
379
|
key: 1,
|
|
378
380
|
size: "small",
|
|
379
381
|
variant: "text",
|
|
380
382
|
class: "cd-ps-load-btn",
|
|
381
|
-
onClick:
|
|
383
|
+
onClick: ue((Ne) => me(d, i.key), ["stop"])
|
|
382
384
|
}, {
|
|
383
|
-
default:
|
|
385
|
+
default: I(() => [
|
|
384
386
|
Y(v(d.data.loaded ? "刷新人员" : "显示人员"), 1)
|
|
385
387
|
]),
|
|
386
388
|
_: 2
|
|
@@ -388,7 +390,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
388
390
|
], 2)
|
|
389
391
|
]),
|
|
390
392
|
_: 2
|
|
391
|
-
}, 1032, ["data", "value"])) : (
|
|
393
|
+
}, 1032, ["data", "value"])) : (n(), c("div", Ke, [
|
|
392
394
|
k(m, {
|
|
393
395
|
name: i.icon || "folder-open",
|
|
394
396
|
size: "48px",
|
|
@@ -409,28 +411,28 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
409
411
|
u("div", tt, [
|
|
410
412
|
e[9] || (e[9] = u("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
411
413
|
u("span", at, v(A.value.length) + " 项", 1),
|
|
412
|
-
A.value.length > 0 ? (
|
|
414
|
+
A.value.length > 0 ? (n(), W(h, {
|
|
413
415
|
key: 0,
|
|
414
416
|
size: "small",
|
|
415
417
|
variant: "text",
|
|
416
418
|
onClick: ke
|
|
417
419
|
}, {
|
|
418
|
-
default:
|
|
420
|
+
default: I(() => [...e[8] || (e[8] = [
|
|
419
421
|
Y("清空", -1)
|
|
420
422
|
])]),
|
|
421
423
|
_: 1
|
|
422
424
|
})) : _("", !0)
|
|
423
425
|
]),
|
|
424
426
|
u("div", lt, [
|
|
425
|
-
A.value.length === 0 ? (
|
|
427
|
+
A.value.length === 0 ? (n(), c("div", st, [
|
|
426
428
|
k(m, {
|
|
427
429
|
name: "user-checked",
|
|
428
430
|
size: "64px",
|
|
429
431
|
style: { color: "#ddd" }
|
|
430
432
|
}),
|
|
431
433
|
e[10] || (e[10] = u("p", null, "暂无选择", -1))
|
|
432
|
-
])) : (
|
|
433
|
-
(
|
|
434
|
+
])) : (n(), c("div", nt, [
|
|
435
|
+
(n(!0), c(Q, null, oe(A.value, (i) => (n(), c("div", {
|
|
434
436
|
key: i.id,
|
|
435
437
|
class: ne(["cd-ps-selected-item", { "cd-ps-dept-item": !i.isUser }])
|
|
436
438
|
}, [
|
|
@@ -445,10 +447,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
445
447
|
u("div", it, [
|
|
446
448
|
u("div", ct, v(i.displayName || i.name), 1),
|
|
447
449
|
u("div", dt, [
|
|
448
|
-
i.isUser && i.position ? (
|
|
449
|
-
i.isUser && i.department ? (
|
|
450
|
-
i.isUser ? _("", !0) : (
|
|
451
|
-
!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)
|
|
452
454
|
])
|
|
453
455
|
])
|
|
454
456
|
]),
|
|
@@ -456,9 +458,9 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
456
458
|
size: "small",
|
|
457
459
|
variant: "text",
|
|
458
460
|
shape: "circle",
|
|
459
|
-
onClick: (
|
|
461
|
+
onClick: (ge) => xe(i.id)
|
|
460
462
|
}, {
|
|
461
|
-
icon:
|
|
463
|
+
icon: I(() => [
|
|
462
464
|
k(m, { name: "close" })
|
|
463
465
|
]),
|
|
464
466
|
_: 1
|
|
@@ -474,12 +476,12 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
474
476
|
}, 8, ["visible", "width"]);
|
|
475
477
|
};
|
|
476
478
|
}
|
|
477
|
-
}),
|
|
478
|
-
const
|
|
479
|
-
for (const [r,
|
|
480
|
-
|
|
481
|
-
return
|
|
482
|
-
},
|
|
479
|
+
}), Ie = (b, Z) => {
|
|
480
|
+
const C = b.__vccOpts || b;
|
|
481
|
+
for (const [r, V] of Z)
|
|
482
|
+
C[r] = V;
|
|
483
|
+
return C;
|
|
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 = {
|
|
483
485
|
key: 0,
|
|
484
486
|
class: "cd-input-select__option-avatar"
|
|
485
487
|
}, yt = ["src", "alt"], kt = { class: "cd-input-select__option-info" }, bt = { class: "cd-input-select__option-name" }, Ct = {
|
|
@@ -497,7 +499,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
497
499
|
}, Nt = {
|
|
498
500
|
key: 2,
|
|
499
501
|
class: "cd-input-select__empty"
|
|
500
|
-
},
|
|
502
|
+
}, ye = 10, $t = /* @__PURE__ */ Se({
|
|
501
503
|
name: "CdInputPersonSelector",
|
|
502
504
|
__name: "InputSelect",
|
|
503
505
|
props: {
|
|
@@ -510,10 +512,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
510
512
|
},
|
|
511
513
|
emits: ["update:modelValue", "search", "load-users", "tab-change"],
|
|
512
514
|
setup(b, { emit: Z }) {
|
|
513
|
-
const
|
|
514
|
-
const a = (
|
|
515
|
-
return
|
|
516
|
-
}), 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) => ({
|
|
517
519
|
label: a.name,
|
|
518
520
|
value: a.id
|
|
519
521
|
}))), K = {
|
|
@@ -529,13 +531,13 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
529
531
|
}, ee = (a) => {
|
|
530
532
|
var l;
|
|
531
533
|
return ((l = K[a || ""]) == null ? void 0 : l.color) || "#999";
|
|
532
|
-
},
|
|
534
|
+
}, re = (a) => {
|
|
533
535
|
var l;
|
|
534
536
|
return ((l = K[a || ""]) == null ? void 0 : l.icon) || "?";
|
|
535
|
-
},
|
|
537
|
+
}, pe = (a) => {
|
|
536
538
|
const l = String(a);
|
|
537
539
|
return l.startsWith("dept-") ? "warning" : l.startsWith("u-") ? "primary" : l.startsWith("pos-") ? "success" : l.startsWith("role-") ? "info" : "default";
|
|
538
|
-
}, O = (a) =>
|
|
540
|
+
}, O = (a) => C.modelValue.some((l) => l.id === a), ce = (a) => ({
|
|
539
541
|
id: a.id,
|
|
540
542
|
name: a.displayName || a.name || a.title || String(a.id),
|
|
541
543
|
avatar: a.avatar || "",
|
|
@@ -545,53 +547,57 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
545
547
|
isUser: a.isUser !== !1
|
|
546
548
|
}), j = (a) => {
|
|
547
549
|
r("update:modelValue", a), G.value = a;
|
|
548
|
-
}, te = (a) => {
|
|
549
|
-
|
|
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 = "");
|
|
550
557
|
}, A = (a, l) => {
|
|
551
|
-
a ?
|
|
558
|
+
a ? C.multiple ? j([...C.modelValue, l]) : (j([l]), $.value = !1) : j(C.modelValue.filter((x) => x.id !== l.id));
|
|
552
559
|
}, de = (a, l) => {
|
|
553
|
-
const { trigger:
|
|
554
|
-
if ((
|
|
560
|
+
const { trigger: x, index: E } = l;
|
|
561
|
+
if ((x === "tag-remove" || x === "backspace") && ($.value = !1), x === "clear")
|
|
555
562
|
T.value = [], j([]);
|
|
556
|
-
else if (["tag-remove", "backspace"].includes(
|
|
563
|
+
else if (["tag-remove", "backspace"].includes(x)) {
|
|
557
564
|
const F = a.map((q) => q.value || q);
|
|
558
565
|
T.value = F;
|
|
559
|
-
const P = [...
|
|
566
|
+
const P = [...C.modelValue];
|
|
560
567
|
P.splice(E, 1), j(P);
|
|
561
568
|
}
|
|
562
569
|
}, ae = (a) => {
|
|
563
570
|
a.stopPropagation(), a.preventDefault(), $.value = !1, f.value = !0;
|
|
564
|
-
}, pe = (a) => {
|
|
565
|
-
const l = a.map(ce), z = new Set(U.modelValue.map((P) => P.id)), E = l.filter((P) => !z.has(P.id)), F = U.multiple ? [...U.modelValue, ...E] : l.slice(0, 1);
|
|
566
|
-
j(F), f.value = !1;
|
|
567
571
|
}, ve = (a) => {
|
|
568
|
-
|
|
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;
|
|
569
574
|
}, fe = (a) => {
|
|
575
|
+
r("load-users", a);
|
|
576
|
+
}, he = (a) => {
|
|
570
577
|
r("search", { keyword: a.keyword, callback: a.callback });
|
|
571
578
|
};
|
|
572
|
-
return X(() =>
|
|
579
|
+
return X(() => C.modelValue, (a) => {
|
|
573
580
|
T.value = a.map((l) => l.id), G.value = a;
|
|
574
581
|
}, { immediate: !0, deep: !0 }), X(R, (a) => {
|
|
575
582
|
if (!(a != null && a.trim())) {
|
|
576
|
-
|
|
583
|
+
U.value = [], V.value = !1;
|
|
577
584
|
return;
|
|
578
585
|
}
|
|
579
|
-
|
|
586
|
+
V.value = !0, r("search", {
|
|
580
587
|
keyword: a,
|
|
581
588
|
callback: (l) => {
|
|
582
|
-
|
|
589
|
+
U.value = l, S.value = 1, V.value = !1, l.length > 0 && ($.value = !0);
|
|
583
590
|
}
|
|
584
591
|
});
|
|
585
592
|
}), (a, l) => {
|
|
586
593
|
var q;
|
|
587
|
-
const
|
|
588
|
-
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, [
|
|
589
596
|
k(P, {
|
|
590
597
|
value: L.value,
|
|
591
598
|
inputValue: R.value,
|
|
592
|
-
"onUpdate:inputValue": l[
|
|
599
|
+
"onUpdate:inputValue": l[4] || (l[4] = (o) => R.value = o),
|
|
593
600
|
"popup-visible": $.value,
|
|
594
|
-
"onUpdate:popupVisible": l[4] || (l[4] = (s) => $.value = s),
|
|
595
601
|
"input-props": {
|
|
596
602
|
readonly: !1,
|
|
597
603
|
disabled: !1
|
|
@@ -604,7 +610,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
604
610
|
closeBtn: !0
|
|
605
611
|
},
|
|
606
612
|
placeholder: b.placeholder,
|
|
607
|
-
loading:
|
|
613
|
+
loading: V.value,
|
|
608
614
|
"allow-input": "",
|
|
609
615
|
clearable: "",
|
|
610
616
|
multiple: b.multiple,
|
|
@@ -612,94 +618,96 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
612
618
|
onPopupVisibleChange: te,
|
|
613
619
|
onTagChange: de
|
|
614
620
|
}, {
|
|
615
|
-
panel:
|
|
616
|
-
|
|
621
|
+
panel: I(() => [
|
|
622
|
+
U.value.length > 0 ? (n(), c("div", {
|
|
617
623
|
key: 0,
|
|
618
624
|
class: "cd-input-select__panel",
|
|
619
|
-
onMousedown: l[2] || (l[2] =
|
|
625
|
+
onMousedown: l[2] || (l[2] = ue(() => {
|
|
626
|
+
}, ["stop"])),
|
|
627
|
+
onClick: l[3] || (l[3] = ue(() => {
|
|
620
628
|
}, ["stop"]))
|
|
621
629
|
}, [
|
|
622
630
|
u("div", mt, [
|
|
623
|
-
(
|
|
624
|
-
key:
|
|
625
|
-
value:
|
|
626
|
-
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),
|
|
627
635
|
class: "cd-input-select__option",
|
|
628
|
-
onChange: (
|
|
636
|
+
onChange: (me) => A(me, o)
|
|
629
637
|
}, {
|
|
630
|
-
default:
|
|
638
|
+
default: I(() => [
|
|
631
639
|
u("div", _t, [
|
|
632
|
-
|
|
640
|
+
o.avatar ? (n(), c("div", gt, [
|
|
633
641
|
u("img", {
|
|
634
|
-
src:
|
|
635
|
-
alt:
|
|
642
|
+
src: o.avatar,
|
|
643
|
+
alt: o.name
|
|
636
644
|
}, null, 8, yt)
|
|
637
|
-
])) : (
|
|
645
|
+
])) : (n(), c("div", {
|
|
638
646
|
key: 1,
|
|
639
647
|
class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
|
|
640
|
-
style:
|
|
641
|
-
backgroundColor: ee(
|
|
648
|
+
style: Ue({
|
|
649
|
+
backgroundColor: ee(o.nodeType),
|
|
642
650
|
color: "#fff"
|
|
643
651
|
})
|
|
644
|
-
}, v(
|
|
652
|
+
}, v(re(o.nodeType)), 5)),
|
|
645
653
|
u("div", kt, [
|
|
646
|
-
u("div", bt, v(
|
|
647
|
-
|
|
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)
|
|
648
656
|
]),
|
|
649
657
|
u("span", {
|
|
650
658
|
class: "cd-input-select__option-tag",
|
|
651
|
-
style:
|
|
652
|
-
}, v(ie(
|
|
659
|
+
style: Ue({ backgroundColor: ee(o.nodeType) + "18", color: ee(o.nodeType) })
|
|
660
|
+
}, v(ie(o.nodeType)), 5)
|
|
653
661
|
])
|
|
654
662
|
]),
|
|
655
663
|
_: 2
|
|
656
664
|
}, 1032, ["value", "checked", "onChange"]))), 128))
|
|
657
665
|
]),
|
|
658
|
-
B.value > 1 ? (
|
|
659
|
-
u("span", St, v(
|
|
666
|
+
B.value > 1 ? (n(), c("div", Ut, [
|
|
667
|
+
u("span", St, v(U.value.length) + " 条结果", 1),
|
|
660
668
|
u("div", It, [
|
|
661
669
|
k(E, {
|
|
662
670
|
size: "small",
|
|
663
671
|
variant: "text",
|
|
664
|
-
disabled:
|
|
665
|
-
onClick: l[0] || (l[0] = (
|
|
672
|
+
disabled: S.value <= 1,
|
|
673
|
+
onClick: l[0] || (l[0] = (o) => S.value--)
|
|
666
674
|
}, {
|
|
667
|
-
default:
|
|
675
|
+
default: I(() => [...l[9] || (l[9] = [
|
|
668
676
|
Y("上一页", -1)
|
|
669
677
|
])]),
|
|
670
678
|
_: 1
|
|
671
679
|
}, 8, ["disabled"]),
|
|
672
|
-
u("span", Tt, v(
|
|
680
|
+
u("span", Tt, v(S.value) + "/" + v(B.value), 1),
|
|
673
681
|
k(E, {
|
|
674
682
|
size: "small",
|
|
675
683
|
variant: "text",
|
|
676
|
-
disabled:
|
|
677
|
-
onClick: l[1] || (l[1] = (
|
|
684
|
+
disabled: S.value >= B.value,
|
|
685
|
+
onClick: l[1] || (l[1] = (o) => S.value++)
|
|
678
686
|
}, {
|
|
679
|
-
default:
|
|
687
|
+
default: I(() => [...l[10] || (l[10] = [
|
|
680
688
|
Y("下一页", -1)
|
|
681
689
|
])]),
|
|
682
690
|
_: 1
|
|
683
691
|
}, 8, ["disabled"])
|
|
684
692
|
])
|
|
685
693
|
])) : _("", !0)
|
|
686
|
-
], 32)) :
|
|
694
|
+
], 32)) : V.value ? (n(), c("div", xt, " 搜索中... ")) : (n(), c("div", Nt, " 暂无搜索结果 "))
|
|
687
695
|
]),
|
|
688
|
-
tag:
|
|
689
|
-
|
|
696
|
+
tag: I((o) => [
|
|
697
|
+
o && o.tag ? (n(), W(F, {
|
|
690
698
|
key: 0,
|
|
691
|
-
theme:
|
|
699
|
+
theme: pe(typeof o.tag == "object" ? o.tag.value : o.tag),
|
|
692
700
|
variant: "light",
|
|
693
701
|
closable: !0,
|
|
694
702
|
size: "medium"
|
|
695
703
|
}, {
|
|
696
|
-
default:
|
|
697
|
-
Y(v(typeof
|
|
704
|
+
default: I(() => [
|
|
705
|
+
Y(v(typeof o.tag == "object" ? o.tag.label : o.tag), 1)
|
|
698
706
|
]),
|
|
699
707
|
_: 2
|
|
700
708
|
}, 1032, ["theme"])) : _("", !0)
|
|
701
709
|
]),
|
|
702
|
-
suffixIcon:
|
|
710
|
+
suffixIcon: I(() => [
|
|
703
711
|
u("i", {
|
|
704
712
|
class: "ri-add-circle-line cd-input-select__add-icon",
|
|
705
713
|
onClick: ae
|
|
@@ -707,34 +715,34 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
707
715
|
]),
|
|
708
716
|
_: 1
|
|
709
717
|
}, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
|
|
710
|
-
(q = b.tabs) != null && q.length && f.value ? (
|
|
718
|
+
(q = b.tabs) != null && q.length && f.value ? (n(), W(Te, {
|
|
711
719
|
key: 0,
|
|
712
720
|
visible: f.value,
|
|
713
|
-
"onUpdate:visible": l[5] || (l[5] = (
|
|
721
|
+
"onUpdate:visible": l[5] || (l[5] = (o) => f.value = o),
|
|
714
722
|
modelValue: T.value,
|
|
715
|
-
"onUpdate:modelValue": l[6] || (l[6] = (
|
|
723
|
+
"onUpdate:modelValue": l[6] || (l[6] = (o) => T.value = o),
|
|
716
724
|
tabs: b.tabs,
|
|
717
725
|
organizations: b.organizations || [],
|
|
718
726
|
"show-org": b.showOrg !== !1,
|
|
719
727
|
"show-search": !0,
|
|
720
728
|
multiple: b.multiple,
|
|
721
|
-
onConfirm:
|
|
722
|
-
onLoadUsers:
|
|
723
|
-
onSearch:
|
|
724
|
-
onTabChange: l[7] || (l[7] = (
|
|
725
|
-
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)
|
|
726
734
|
}, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
|
|
727
735
|
]);
|
|
728
736
|
};
|
|
729
737
|
}
|
|
730
|
-
}),
|
|
738
|
+
}), wt = /* @__PURE__ */ Ie($t, [["__scopeId", "data-v-29d7ef35"]]), Bt = {
|
|
731
739
|
install(b) {
|
|
732
|
-
b.component("PersonSelector",
|
|
740
|
+
b.component("PersonSelector", Te), b.component("CdInputPersonSelector", wt);
|
|
733
741
|
}
|
|
734
742
|
};
|
|
735
743
|
export {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
744
|
+
wt as CdInputPersonSelector,
|
|
745
|
+
wt as InputSelect,
|
|
746
|
+
Te as PersonSelector,
|
|
739
747
|
Bt as default
|
|
740
748
|
};
|