@mingminghahayu/profession-select-dialog-vue3 1.0.1 → 1.0.2

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.
@@ -1,7 +1,7 @@
1
- import { defineComponent as A, openBlock as _, createElementBlock as B, createElementVNode as m, computed as E, ref as b, watch as K, resolveComponent as I, resolveDirective as Q, createBlock as T, withCtx as u, createVNode as c, createTextVNode as N, unref as k, withDirectives as W, toDisplayString as X, createCommentVNode as Y, nextTick as L } from "vue";
1
+ import { defineComponent as x, openBlock as _, createElementBlock as B, createElementVNode as u, computed as L, ref as w, watch as K, resolveComponent as b, resolveDirective as Q, createBlock as j, withCtx as m, createVNode as c, createTextVNode as I, unref as T, withDirectives as W, toDisplayString as X, createCommentVNode as Y, nextTick as P } from "vue";
2
2
  import { ElMessageBox as Z, ElMessage as V } from "element-plus";
3
3
  /*! Element Plus Icons Vue v2.3.2 */
4
- var ee = /* @__PURE__ */ A({
4
+ var ee = /* @__PURE__ */ x({
5
5
  name: "Check",
6
6
  __name: "check",
7
7
  setup(p) {
@@ -9,13 +9,13 @@ var ee = /* @__PURE__ */ A({
9
9
  xmlns: "http://www.w3.org/2000/svg",
10
10
  viewBox: "0 0 1024 1024"
11
11
  }, [
12
- m("path", {
12
+ u("path", {
13
13
  fill: "currentColor",
14
14
  d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
15
15
  })
16
16
  ]));
17
17
  }
18
- }), te = ee, oe = /* @__PURE__ */ A({
18
+ }), te = ee, se = /* @__PURE__ */ x({
19
19
  name: "Delete",
20
20
  __name: "delete",
21
21
  setup(p) {
@@ -23,19 +23,19 @@ var ee = /* @__PURE__ */ A({
23
23
  xmlns: "http://www.w3.org/2000/svg",
24
24
  viewBox: "0 0 1024 1024"
25
25
  }, [
26
- m("path", {
26
+ u("path", {
27
27
  fill: "currentColor",
28
28
  d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
29
29
  })
30
30
  ]));
31
31
  }
32
- }), P = oe;
33
- const se = (p, v) => {
32
+ }), A = se;
33
+ const ae = (p, v) => {
34
34
  const i = p.__vccOpts || p;
35
35
  for (const [h, S] of v)
36
36
  i[h] = S;
37
37
  return i;
38
- }, ae = { class: "dialog-body" }, le = { class: "left-panel" }, ne = { class: "select-all-btn-wrap" }, ie = { class: "right-panel" }, re = { class: "selected-header" }, de = {
38
+ }, oe = { class: "dialog-body" }, ne = { class: "left-panel" }, le = { class: "select-all-btn-wrap" }, ie = { class: "right-panel" }, re = { class: "selected-header" }, de = {
39
39
  __name: "ProfessionSelectDialog",
40
40
  props: {
41
41
  modelValue: { type: Boolean, default: !1 },
@@ -48,64 +48,69 @@ const se = (p, v) => {
48
48
  },
49
49
  emits: ["update:modelValue", "confirm"],
50
50
  setup(p, { emit: v }) {
51
- const i = p, h = v, S = E({
51
+ const i = p, h = v, S = L({
52
52
  get: () => i.modelValue,
53
- set: (o) => h("update:modelValue", o)
54
- }), y = b(!1), f = b([]), n = b([]), g = b(), D = E(() => i.multiple ? i.multipleLimit > 0 && n.value.length > i.multipleLimit ? !1 : n.value.length > 0 : n.value.length === 1);
55
- function C(o) {
56
- return n.value.some((e) => String(e.professionId) === String(o));
53
+ set: (s) => h("update:modelValue", s)
54
+ }), y = w(!1), f = w([]), l = w([]), g = w(), D = L(() => i.multiple ? i.multipleLimit > 0 && l.value.length > i.multipleLimit ? !1 : l.value.length > 0 : l.value.length === 1);
55
+ function k(s) {
56
+ return l.value.some((e) => String(e.professionId) === String(s));
57
57
  }
58
- function z(o) {
59
- return i.disabledItems.some((e) => String(e.id) === String(o));
58
+ function z(s) {
59
+ return i.disabledItems.some((e) => String(e.id) === String(s));
60
60
  }
61
- function $(o) {
62
- const e = o.users || o.userList || o.members || o.children || [], a = (Array.isArray(e) ? e : []).map((t) => {
63
- var l, r;
61
+ function $(s) {
62
+ const e = s.users || s.userList || s.members || s.children || [], o = (Array.isArray(e) ? e : []).map((t) => {
63
+ var n, r;
64
64
  return {
65
- id: (r = (l = t.id) != null ? l : t.userId) != null ? r : t.value,
66
- name: t.name || t.nickName || t.username || t.userName || t.label || "-",
65
+ id: (r = (n = t.id) != null ? n : t.userId) != null ? r : t.value,
66
+ userName: t.userName || t.username || "-",
67
+ nickName: t.nickName || t.name || t.label || "-",
67
68
  userType: t.userType || "",
68
69
  majorCode: t.majorCode || ""
69
70
  };
70
- }), s = a.map((t) => t.name).filter(Boolean).join("\u3001");
71
+ }), a = o.map((t) => t.nickName).filter(Boolean).join("\u3001");
71
72
  return {
72
- id: o.id,
73
- profession: o.profession || o.departmentName || o.name || "-",
74
- majorName: o.majorName || o.profession || o.name || "-",
75
- majorCode: o.majorCode || "",
76
- users: a,
77
- userNames: s
73
+ id: s.id,
74
+ profession: s.profession || s.departmentName || s.name || "-",
75
+ majorName: s.majorName || s.profession || s.name || "-",
76
+ majorCode: s.majorCode || "",
77
+ users: o,
78
+ userNames: a
78
79
  };
79
80
  }
80
- function w(o) {
81
- const e = o.id, a = o.profession, s = o.majorName || a, t = o.majorCode || "", l = o.users || [];
82
- return l.length === 0 ? [{
81
+ function N(s) {
82
+ const e = s.id, o = s.profession, a = s.majorName || o, t = s.majorCode || "", n = s.users || [];
83
+ return n.length === 0 ? [{
83
84
  id: `p_${e}`,
84
85
  professionId: e,
85
- profession: a,
86
- majorName: s,
86
+ profession: o,
87
+ majorName: a,
87
88
  majorCode: t,
88
89
  userType: "",
89
90
  userId: "",
90
- userName: "-"
91
- }] : l.map((r) => ({
91
+ userName: "-",
92
+ username: "-",
93
+ nickName: "-"
94
+ }] : n.map((r) => ({
92
95
  id: `p_${e}_u_${r.id}`,
93
96
  professionId: e,
94
- profession: a,
95
- majorName: s,
97
+ profession: o,
98
+ majorName: a,
96
99
  majorCode: r.majorCode || t,
97
100
  userType: r.userType || "",
98
101
  userId: r.id,
99
- userName: r.name || "-"
102
+ userName: r.userName || "-",
103
+ username: r.userName || "-",
104
+ nickName: r.nickName || "-"
100
105
  }));
101
106
  }
102
- function H(o) {
103
- const e = o.professionId;
104
- if (n.value = n.value.filter((s) => String(s.id) !== String(o.id)), !n.value.some((s) => String(s.professionId) === String(e))) {
105
- const s = g.value;
106
- if (s) {
107
- const t = f.value.find((l) => String(l.id) === String(e));
108
- t && s.toggleRowSelection(t, !1);
107
+ function H(s) {
108
+ const e = s.professionId;
109
+ if (l.value = l.value.filter((a) => String(a.id) !== String(s.id)), !l.value.some((a) => String(a.professionId) === String(e))) {
110
+ const a = g.value;
111
+ if (a) {
112
+ const t = f.value.find((n) => String(n.id) === String(e));
113
+ t && a.toggleRowSelection(t, !1);
109
114
  }
110
115
  }
111
116
  }
@@ -115,124 +120,124 @@ const se = (p, v) => {
115
120
  cancelButtonText: "\u53D6\u6D88",
116
121
  type: "warning"
117
122
  }).then(() => {
118
- n.value = [], g.value && g.value.clearSelection(), V.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A");
123
+ l.value = [], g.value && g.value.clearSelection(), V.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A");
119
124
  }).catch(() => {
120
125
  });
121
126
  }
122
127
  async function R() {
123
- const o = i.api.getUserPageList || i.api.getUserList;
124
- if (!!o) {
128
+ const s = i.api.getUserPageList || i.api.getUserList;
129
+ if (!!s) {
125
130
  y.value = !0;
126
131
  try {
127
132
  let e;
128
133
  try {
129
- e = await o();
134
+ e = await s();
130
135
  } catch {
131
- e = await o({ page: 1, pageSize: 99999 }, { page: 1, pageSize: 99999 });
136
+ e = await s({ page: 1, pageSize: 99999 }, { page: 1, pageSize: 99999 });
132
137
  }
133
- let a = Array.isArray(e) ? e : e || (e == null ? void 0 : e.data) || (e == null ? void 0 : e.content) || [];
134
- Array.isArray(a) || (a = []), f.value = a.map((s) => $(s));
138
+ let o = Array.isArray(e) ? e : e || (e == null ? void 0 : e.data) || (e == null ? void 0 : e.content) || [];
139
+ Array.isArray(o) || (o = []), f.value = o.map((a) => $(a));
135
140
  } catch (e) {
136
141
  console.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25:", e), V.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25");
137
142
  } finally {
138
- y.value = !1, L(() => {
143
+ y.value = !1, P(() => {
139
144
  U();
140
145
  });
141
146
  }
142
147
  }
143
148
  }
144
149
  function U() {
145
- const o = g.value;
146
- if (!o)
150
+ const s = g.value;
151
+ if (!s)
147
152
  return;
148
153
  const e = new Set(
149
- n.value.map((a) => String(a.professionId))
154
+ l.value.map((o) => String(o.professionId))
150
155
  );
151
- f.value.forEach((a) => {
152
- e.has(String(a.id)) && o.toggleRowSelection(a, !0);
156
+ f.value.forEach((o) => {
157
+ e.has(String(o.id)) && s.toggleRowSelection(o, !0);
153
158
  });
154
159
  }
155
160
  function O() {
156
- const o = new Set(i.disabledItems.map((t) => String(t.id))), e = new Set(n.value.map((t) => String(t.professionId))), a = f.value.filter((t) => {
157
- const l = String(t.id);
158
- return !e.has(l) && !o.has(l);
161
+ const s = new Set(i.disabledItems.map((t) => String(t.id))), e = new Set(l.value.map((t) => String(t.professionId))), o = f.value.filter((t) => {
162
+ const n = String(t.id);
163
+ return !e.has(n) && !s.has(n);
159
164
  });
160
- let s = [];
161
- if (a.forEach((t) => {
162
- s = s.concat(w(t));
165
+ let a = [];
166
+ if (o.forEach((t) => {
167
+ a = a.concat(N(t));
163
168
  }), i.multiple) {
164
169
  if (i.multipleLimit > 0) {
165
- const t = i.multipleLimit - n.value.length;
166
- s.slice(0, t).forEach((l) => {
167
- n.value.push(l);
170
+ const t = i.multipleLimit - l.value.length;
171
+ a.slice(0, t).forEach((n) => {
172
+ l.value.push(n);
168
173
  });
169
174
  } else
170
- s.forEach((t) => {
171
- n.value.push(t);
175
+ a.forEach((t) => {
176
+ l.value.push(t);
172
177
  });
173
- V.success(`\u5DF2\u9009\u4E2D ${a.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${s.length} \u6761\u8BB0\u5F55`);
178
+ V.success(`\u5DF2\u9009\u4E2D ${o.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${a.length} \u6761\u8BB0\u5F55`);
174
179
  }
175
- L(() => {
180
+ P(() => {
176
181
  const t = g.value;
177
- t && a.forEach((l) => {
178
- t.toggleRowSelection(l, !0);
182
+ t && o.forEach((n) => {
183
+ t.toggleRowSelection(n, !0);
179
184
  });
180
185
  });
181
186
  }
182
- function q(o) {
183
- if (o.length > 0) {
184
- const e = new Set(n.value.map((t) => String(t.professionId))), a = new Set(i.disabledItems.map((t) => String(t.id))), s = o.filter((t) => {
185
- const l = String(t.id);
186
- return !e.has(l) && !a.has(l);
187
+ function q(s) {
188
+ if (s.length > 0) {
189
+ const e = new Set(l.value.map((t) => String(t.professionId))), o = new Set(i.disabledItems.map((t) => String(t.id))), a = s.filter((t) => {
190
+ const n = String(t.id);
191
+ return !e.has(n) && !o.has(n);
187
192
  });
188
193
  if (i.multiple) {
189
194
  let t = [];
190
- if (s.forEach((l) => {
191
- t = t.concat(w(l));
195
+ if (a.forEach((n) => {
196
+ t = t.concat(N(n));
192
197
  }), i.multipleLimit > 0) {
193
- const l = i.multipleLimit - n.value.length;
194
- t.slice(0, l).forEach((r) => {
195
- n.value.push(r);
198
+ const n = i.multipleLimit - l.value.length;
199
+ t.slice(0, n).forEach((r) => {
200
+ l.value.push(r);
196
201
  });
197
202
  } else
198
- t.forEach((l) => {
199
- n.value.push(l);
203
+ t.forEach((n) => {
204
+ l.value.push(n);
200
205
  });
201
206
  }
202
207
  }
203
208
  }
204
- function F(o) {
205
- const e = new Set(o.map((t) => String(t.id))), a = new Set(i.disabledItems.map((t) => String(t.id)));
206
- o.forEach((t) => {
207
- const l = String(t.id);
208
- if (!C(t.id) && !a.has(l))
209
+ function F(s) {
210
+ const e = new Set(s.map((t) => String(t.id))), o = new Set(i.disabledItems.map((t) => String(t.id)));
211
+ s.forEach((t) => {
212
+ const n = String(t.id);
213
+ if (!k(t.id) && !o.has(n))
209
214
  if (i.multiple) {
210
- const r = w(t);
215
+ const r = N(t);
211
216
  if (i.multipleLimit > 0) {
212
- const d = i.multipleLimit - n.value.length;
217
+ const d = i.multipleLimit - l.value.length;
213
218
  if (d <= 0)
214
219
  return;
215
- r.slice(0, d).forEach((x) => {
216
- n.value.push(x);
220
+ r.slice(0, d).forEach((E) => {
221
+ l.value.push(E);
217
222
  });
218
223
  } else
219
224
  r.forEach((d) => {
220
- n.value.push(d);
225
+ l.value.push(d);
221
226
  });
222
227
  } else
223
- n.value = w(t);
228
+ l.value = N(t);
224
229
  });
225
- const s = new Set(f.value.map((t) => String(t.id)));
226
- n.value = n.value.filter((t) => {
227
- const l = String(t.professionId);
228
- return !(s.has(l) && !e.has(l));
230
+ const a = new Set(f.value.map((t) => String(t.id)));
231
+ l.value = l.value.filter((t) => {
232
+ const n = String(t.professionId);
233
+ return !(a.has(n) && !e.has(n));
229
234
  });
230
235
  }
231
- function G(o) {
232
- return !i.multiple && n.value.length >= 1 ? C(o.id) : C(o.id) ? !0 : !z(o.id);
236
+ function G(s) {
237
+ return !i.multiple && l.value.length >= 1 ? k(s.id) : k(s.id) ? !0 : !z(s.id);
233
238
  }
234
239
  function J() {
235
- let o = n.value.map((e) => ({
240
+ let s = l.value.map((e) => ({
236
241
  id: e.userId || e.id,
237
242
  professionId: e.professionId,
238
243
  profession: e.profession,
@@ -240,91 +245,97 @@ const se = (p, v) => {
240
245
  majorCode: e.majorCode,
241
246
  userType: e.userType,
242
247
  userId: e.userId,
243
- userName: e.userName
248
+ userName: e.userName,
249
+ username: e.userName,
250
+ nickName: e.nickName
244
251
  }));
245
- h("confirm", o), j();
252
+ h("confirm", s), C();
246
253
  }
247
- function j() {
254
+ function C() {
248
255
  f.value = [], h("update:modelValue", !1);
249
256
  }
250
257
  return K(
251
258
  () => i.modelValue,
252
- (o) => {
253
- o && (n.value = i.selectedItems.flatMap((e) => {
254
- var a;
255
- if (e.users && e.users.length > 0) {
256
- const s = e.id, t = e.profession || e.departmentName, l = e.majorName || t, r = e.majorCode || "";
259
+ (s) => {
260
+ s && (l.value = i.selectedItems.flatMap((e) => {
261
+ var o;
262
+ if (console.log("nickname", i.selectedItems), e.users && e.users.length > 0) {
263
+ const a = e.id, t = e.profession || e.departmentName, n = e.majorName || t, r = e.majorCode || "";
257
264
  return e.users.map((d) => ({
258
- id: `p_${s}_u_${d.id}`,
259
- professionId: s,
265
+ id: `p_${a}_u_${d.id}`,
266
+ professionId: a,
260
267
  profession: t,
261
- majorName: l,
268
+ majorName: n,
262
269
  majorCode: r,
263
270
  userType: d.userType || e.userType || "",
264
271
  userId: d.id,
265
- userName: d.name || "-"
272
+ userName: d.userName || d.username || "-",
273
+ username: d.userName || d.username || "-",
274
+ nickName: d.nickName || d.name || d.label || "-"
266
275
  }));
267
276
  }
268
277
  return [{
269
278
  id: e.id,
270
- professionId: (a = e.professionId) != null ? a : e.id,
279
+ professionId: (o = e.professionId) != null ? o : e.id,
271
280
  profession: e.profession || e.departmentName,
272
281
  majorName: e.majorName || e.profession || e.departmentName,
273
282
  majorCode: e.majorCode || "",
274
283
  userType: e.userType || "",
275
284
  userId: e.userId || "",
276
- userName: e.userName || e.userNames || "-"
285
+ userName: e.userName || e.username || "-",
286
+ username: e.userName || e.username || "-",
287
+ nickName: e.nickName || e.name || e.userNames || "-"
277
288
  }];
278
289
  }), R());
279
290
  },
280
291
  { immediate: !0 }
281
- ), (o, e) => {
282
- const a = I("el-button"), s = I("el-table-column"), t = I("el-table"), l = I("el-dialog"), r = Q("loading");
283
- return _(), T(l, {
292
+ ), (s, e) => {
293
+ const o = b("el-button"), a = b("el-table-column"), t = b("el-table"), n = b("el-dialog"), r = Q("loading");
294
+ return _(), j(n, {
284
295
  title: p.dialogTitle,
285
296
  modelValue: S.value,
286
297
  "onUpdate:modelValue": e[0] || (e[0] = (d) => S.value = d),
287
298
  width: "960px",
288
- "before-close": j,
299
+ "before-close": C,
289
300
  "append-to-body": "",
290
301
  class: "profession-select-dialog"
291
302
  }, {
292
- footer: u(() => [
293
- c(a, {
303
+ footer: m(() => [
304
+ c(o, {
294
305
  type: "primary",
295
306
  disabled: !D.value,
296
307
  onClick: J
297
308
  }, {
298
- default: u(() => [...e[3] || (e[3] = [
299
- N("\u786E\u5B9A", -1)
309
+ default: m(() => [...e[3] || (e[3] = [
310
+ I("\u786E\u5B9A", -1)
300
311
  ])]),
301
312
  _: 1
302
313
  }, 8, ["disabled"]),
303
- c(a, { onClick: j }, {
304
- default: u(() => [...e[4] || (e[4] = [
305
- N("\u53D6\u6D88", -1)
314
+ c(o, { onClick: C }, {
315
+ default: m(() => [...e[4] || (e[4] = [
316
+ I("\u53D6\u6D88", -1)
306
317
  ])]),
307
318
  _: 1
308
319
  })
309
320
  ]),
310
- default: u(() => [
311
- m("div", ae, [
312
- m("div", le, [
313
- m("div", ne, [
314
- c(a, {
321
+ default: m(() => [
322
+ u("div", oe, [
323
+ u("div", ne, [
324
+ u("div", le, [
325
+ c(o, {
315
326
  type: "primary",
316
327
  size: "default",
317
- icon: k(te),
328
+ icon: T(te),
318
329
  disabled: y.value,
319
330
  onClick: O
320
331
  }, {
321
- default: u(() => [...e[1] || (e[1] = [
322
- N("\u5168\u90E8\u9009\u4E2D", -1)
332
+ default: m(() => [...e[1] || (e[1] = [
333
+ I("\u5168\u90E8\u9009\u4E2D", -1)
323
334
  ])]),
324
335
  _: 1
325
336
  }, 8, ["icon", "disabled"])
326
337
  ]),
327
- W((_(), T(t, {
338
+ W((_(), j(t, {
328
339
  ref_key: "professionTable",
329
340
  ref: g,
330
341
  data: f.value,
@@ -334,14 +345,14 @@ const se = (p, v) => {
334
345
  onSelectAll: q,
335
346
  onSelectionChange: F
336
347
  }, {
337
- default: u(() => [
338
- c(s, {
348
+ default: m(() => [
349
+ c(a, {
339
350
  type: "selection",
340
351
  width: "50",
341
352
  align: "center",
342
353
  selectable: G
343
354
  }),
344
- c(s, {
355
+ c(a, {
345
356
  label: "\u4E13\u4E1A",
346
357
  prop: "majorName",
347
358
  "show-overflow-tooltip": !0
@@ -352,60 +363,60 @@ const se = (p, v) => {
352
363
  [r, y.value]
353
364
  ])
354
365
  ]),
355
- m("div", ie, [
356
- m("div", re, [
357
- m("div", null, "\u5DF2\u9009\u4E2D\u5217\u8868 (" + X(n.value.length) + ")", 1),
358
- n.value.length > 0 ? (_(), T(a, {
366
+ u("div", ie, [
367
+ u("div", re, [
368
+ u("div", null, "\u5DF2\u9009\u4E2D\u5217\u8868 (" + X(l.value.length) + ")", 1),
369
+ l.value.length > 0 ? (_(), j(o, {
359
370
  key: 0,
360
371
  type: "text",
361
372
  size: "default",
362
- icon: k(P),
373
+ icon: T(A),
363
374
  onClick: M,
364
375
  class: "clear-btn"
365
376
  }, {
366
- default: u(() => [...e[2] || (e[2] = [
367
- N("\u6E05\u7A7A", -1)
377
+ default: m(() => [...e[2] || (e[2] = [
378
+ I("\u6E05\u7A7A", -1)
368
379
  ])]),
369
380
  _: 1
370
381
  }, 8, ["icon"])) : Y("", !0)
371
382
  ]),
372
383
  c(t, {
373
- data: n.value,
384
+ data: l.value,
374
385
  height: "540",
375
386
  "row-key": "id",
376
387
  class: "selected-table"
377
388
  }, {
378
- default: u(() => [
379
- c(s, {
389
+ default: m(() => [
390
+ c(a, {
380
391
  align: "center",
381
392
  width: "60",
382
393
  label: "\u64CD\u4F5C"
383
394
  }, {
384
- default: u(({ row: d }) => [
385
- c(a, {
395
+ default: m(({ row: d }) => [
396
+ c(o, {
386
397
  type: "primary",
387
398
  link: "",
388
- icon: k(P),
389
- onClick: (x) => H(d)
399
+ icon: T(A),
400
+ onClick: (E) => H(d)
390
401
  }, null, 8, ["icon", "onClick"])
391
402
  ]),
392
403
  _: 1
393
404
  }),
394
- c(s, {
405
+ c(a, {
395
406
  label: "\u4E13\u4E1A",
396
407
  prop: "profession",
397
408
  "show-overflow-tooltip": !0,
398
409
  "min-width": "120"
399
410
  }),
400
- c(s, {
411
+ c(a, {
401
412
  label: "\u7528\u6237\u7C7B\u578B",
402
413
  prop: "userType",
403
414
  width: "100",
404
415
  "show-overflow-tooltip": !0
405
416
  }),
406
- c(s, {
417
+ c(a, {
407
418
  label: "\u7528\u6237\u540D\u79F0",
408
- prop: "userName",
419
+ prop: "nickName",
409
420
  "min-width": "140",
410
421
  "show-overflow-tooltip": !0
411
422
  })
@@ -419,8 +430,8 @@ const se = (p, v) => {
419
430
  }, 8, ["title", "modelValue"]);
420
431
  };
421
432
  }
422
- }, me = /* @__PURE__ */ se(de, [["__scopeId", "data-v-030101a8"]]);
433
+ }, ue = /* @__PURE__ */ ae(de, [["__scopeId", "data-v-144912f0"]]);
423
434
  export {
424
- me as ProfessionSelectDialog,
425
- me as default
435
+ ue as ProfessionSelectDialog,
436
+ ue as default
426
437
  };
@@ -1 +1 @@
1
- (function(m,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],t):(m=typeof globalThis<"u"?globalThis:m||self,t(m.ProfessionSelectVue3={},m.Vue,m.ElementPlus))})(this,function(m,t,_){"use strict";/*! Element Plus Icons Vue v2.3.2 */var v=t.defineComponent({name:"Check",__name:"check",setup(p){return(g,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),j=v,x=t.defineComponent({name:"Delete",__name:"delete",setup(p){return(g,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),C=x;const J="",K="",T=(p,g)=>{const r=p.__vccOpts||p;for(const[h,S]of g)r[h]=S;return r},k={class:"dialog-body"},E={class:"left-panel"},B={class:"select-all-btn-wrap"},L={class:"right-panel"},P={class:"selected-header"},I=T({__name:"ProfessionSelectDialog",props:{modelValue:{type:Boolean,default:!1},dialogTitle:{type:String,default:"\u9009\u62E9\u4E13\u4E1A"},selectedItems:{type:Array,default:()=>[]},api:{type:Object,required:!0},multiple:{type:Boolean,default:!0},multipleLimit:{type:Number,default:0},disabledItems:{type:Array,default:()=>[]}},emits:["update:modelValue","confirm"],setup(p,{emit:g}){const r=p,h=g,S=t.computed({get:()=>r.modelValue,set:s=>h("update:modelValue",s)}),y=t.ref(!1),f=t.ref([]),i=t.ref([]),u=t.ref(),A=t.computed(()=>r.multiple?r.multipleLimit>0&&i.value.length>r.multipleLimit?!1:i.value.length>0:i.value.length===1);function N(s){return i.value.some(e=>String(e.professionId)===String(s))}function D(s){return r.disabledItems.some(e=>String(e.id)===String(s))}function M(s){const e=s.users||s.userList||s.members||s.children||[],l=(Array.isArray(e)?e:[]).map(o=>{var n,d;return{id:(d=(n=o.id)!=null?n:o.userId)!=null?d:o.value,name:o.name||o.nickName||o.username||o.userName||o.label||"-",userType:o.userType||"",majorCode:o.majorCode||""}}),a=l.map(o=>o.name).filter(Boolean).join("\u3001");return{id:s.id,profession:s.profession||s.departmentName||s.name||"-",majorName:s.majorName||s.profession||s.name||"-",majorCode:s.majorCode||"",users:l,userNames:a}}function w(s){const e=s.id,l=s.profession,a=s.majorName||l,o=s.majorCode||"",n=s.users||[];return n.length===0?[{id:`p_${e}`,professionId:e,profession:l,majorName:a,majorCode:o,userType:"",userId:"",userName:"-"}]:n.map(d=>({id:`p_${e}_u_${d.id}`,professionId:e,profession:l,majorName:a,majorCode:d.majorCode||o,userType:d.userType||"",userId:d.id,userName:d.name||"-"}))}function z(s){const e=s.professionId;if(i.value=i.value.filter(a=>String(a.id)!==String(s.id)),!i.value.some(a=>String(a.professionId)===String(e))){const a=u.value;if(a){const o=f.value.find(n=>String(n.id)===String(e));o&&a.toggleRowSelection(o,!1)}}}function $(){_.ElMessageBox.confirm("\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u5DF2\u9009\u4E2D\u7684\u4E13\u4E1A\u5417\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(()=>{i.value=[],u.value&&u.value.clearSelection(),_.ElMessage.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A")}).catch(()=>{})}async function H(){const s=r.api.getUserPageList||r.api.getUserList;if(!!s){y.value=!0;try{let e;try{e=await s()}catch{e=await s({page:1,pageSize:99999},{page:1,pageSize:99999})}let l=Array.isArray(e)?e:e||(e==null?void 0:e.data)||(e==null?void 0:e.content)||[];Array.isArray(l)||(l=[]),f.value=l.map(a=>M(a))}catch(e){console.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25:",e),_.ElMessage.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25")}finally{y.value=!1,t.nextTick(()=>{R()})}}}function R(){const s=u.value;if(!s)return;const e=new Set(i.value.map(l=>String(l.professionId)));f.value.forEach(l=>{e.has(String(l.id))&&s.toggleRowSelection(l,!0)})}function U(){const s=new Set(r.disabledItems.map(o=>String(o.id))),e=new Set(i.value.map(o=>String(o.professionId))),l=f.value.filter(o=>{const n=String(o.id);return!e.has(n)&&!s.has(n)});let a=[];if(l.forEach(o=>{a=a.concat(w(o))}),r.multiple){if(r.multipleLimit>0){const o=r.multipleLimit-i.value.length;a.slice(0,o).forEach(n=>{i.value.push(n)})}else a.forEach(o=>{i.value.push(o)});_.ElMessage.success(`\u5DF2\u9009\u4E2D ${l.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${a.length} \u6761\u8BB0\u5F55`)}t.nextTick(()=>{const o=u.value;o&&l.forEach(n=>{o.toggleRowSelection(n,!0)})})}function q(s){if(s.length>0){const e=new Set(i.value.map(o=>String(o.professionId))),l=new Set(r.disabledItems.map(o=>String(o.id))),a=s.filter(o=>{const n=String(o.id);return!e.has(n)&&!l.has(n)});if(r.multiple){let o=[];if(a.forEach(n=>{o=o.concat(w(n))}),r.multipleLimit>0){const n=r.multipleLimit-i.value.length;o.slice(0,n).forEach(d=>{i.value.push(d)})}else o.forEach(n=>{i.value.push(n)})}}}function O(s){const e=new Set(s.map(o=>String(o.id))),l=new Set(r.disabledItems.map(o=>String(o.id)));s.forEach(o=>{const n=String(o.id);if(!N(o.id)&&!l.has(n))if(r.multiple){const d=w(o);if(r.multipleLimit>0){const c=r.multipleLimit-i.value.length;if(c<=0)return;d.slice(0,c).forEach(V=>{i.value.push(V)})}else d.forEach(c=>{i.value.push(c)})}else i.value=w(o)});const a=new Set(f.value.map(o=>String(o.id)));i.value=i.value.filter(o=>{const n=String(o.professionId);return!(a.has(n)&&!e.has(n))})}function F(s){return!r.multiple&&i.value.length>=1?N(s.id):N(s.id)?!0:!D(s.id)}function G(){let s=i.value.map(e=>({id:e.userId||e.id,professionId:e.professionId,profession:e.profession,majorName:e.majorName,majorCode:e.majorCode,userType:e.userType,userId:e.userId,userName:e.userName}));h("confirm",s),b()}function b(){f.value=[],h("update:modelValue",!1)}return t.watch(()=>r.modelValue,s=>{s&&(i.value=r.selectedItems.flatMap(e=>{var l;if(e.users&&e.users.length>0){const a=e.id,o=e.profession||e.departmentName,n=e.majorName||o,d=e.majorCode||"";return e.users.map(c=>({id:`p_${a}_u_${c.id}`,professionId:a,profession:o,majorName:n,majorCode:d,userType:c.userType||e.userType||"",userId:c.id,userName:c.name||"-"}))}return[{id:e.id,professionId:(l=e.professionId)!=null?l:e.id,profession:e.profession||e.departmentName,majorName:e.majorName||e.profession||e.departmentName,majorCode:e.majorCode||"",userType:e.userType||"",userId:e.userId||"",userName:e.userName||e.userNames||"-"}]}),H())},{immediate:!0}),(s,e)=>{const l=t.resolveComponent("el-button"),a=t.resolveComponent("el-table-column"),o=t.resolveComponent("el-table"),n=t.resolveComponent("el-dialog"),d=t.resolveDirective("loading");return t.openBlock(),t.createBlock(n,{title:p.dialogTitle,modelValue:S.value,"onUpdate:modelValue":e[0]||(e[0]=c=>S.value=c),width:"960px","before-close":b,"append-to-body":"",class:"profession-select-dialog"},{footer:t.withCtx(()=>[t.createVNode(l,{type:"primary",disabled:!A.value,onClick:G},{default:t.withCtx(()=>[...e[3]||(e[3]=[t.createTextVNode("\u786E\u5B9A",-1)])]),_:1},8,["disabled"]),t.createVNode(l,{onClick:b},{default:t.withCtx(()=>[...e[4]||(e[4]=[t.createTextVNode("\u53D6\u6D88",-1)])]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",k,[t.createElementVNode("div",E,[t.createElementVNode("div",B,[t.createVNode(l,{type:"primary",size:"default",icon:t.unref(j),disabled:y.value,onClick:U},{default:t.withCtx(()=>[...e[1]||(e[1]=[t.createTextVNode("\u5168\u90E8\u9009\u4E2D",-1)])]),_:1},8,["icon","disabled"])]),t.withDirectives((t.openBlock(),t.createBlock(o,{ref_key:"professionTable",ref:u,data:f.value,height:"540","row-key":"id",class:"profession-table",onSelectAll:q,onSelectionChange:O},{default:t.withCtx(()=>[t.createVNode(a,{type:"selection",width:"50",align:"center",selectable:F}),t.createVNode(a,{label:"\u4E13\u4E1A",prop:"majorName","show-overflow-tooltip":!0})]),_:1},8,["data"])),[[d,y.value]])]),t.createElementVNode("div",L,[t.createElementVNode("div",P,[t.createElementVNode("div",null,"\u5DF2\u9009\u4E2D\u5217\u8868 ("+t.toDisplayString(i.value.length)+")",1),i.value.length>0?(t.openBlock(),t.createBlock(l,{key:0,type:"text",size:"default",icon:t.unref(C),onClick:$,class:"clear-btn"},{default:t.withCtx(()=>[...e[2]||(e[2]=[t.createTextVNode("\u6E05\u7A7A",-1)])]),_:1},8,["icon"])):t.createCommentVNode("",!0)]),t.createVNode(o,{data:i.value,height:"540","row-key":"id",class:"selected-table"},{default:t.withCtx(()=>[t.createVNode(a,{align:"center",width:"60",label:"\u64CD\u4F5C"},{default:t.withCtx(({row:c})=>[t.createVNode(l,{type:"primary",link:"",icon:t.unref(C),onClick:V=>z(c)},null,8,["icon","onClick"])]),_:1}),t.createVNode(a,{label:"\u4E13\u4E1A",prop:"profession","show-overflow-tooltip":!0,"min-width":"120"}),t.createVNode(a,{label:"\u7528\u6237\u7C7B\u578B",prop:"userType",width:"100","show-overflow-tooltip":!0}),t.createVNode(a,{label:"\u7528\u6237\u540D\u79F0",prop:"userName","min-width":"140","show-overflow-tooltip":!0})]),_:1},8,["data"])])])]),_:1},8,["title","modelValue"])}}},[["__scopeId","data-v-030101a8"]]);m.ProfessionSelectDialog=I,m.default=I,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(m,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],t):(m=typeof globalThis<"u"?globalThis:m||self,t(m.ProfessionSelectVue3={},m.Vue,m.ElementPlus))})(this,function(m,t,_){"use strict";/*! Element Plus Icons Vue v2.3.2 */var V=t.defineComponent({name:"Check",__name:"check",setup(p){return(g,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),v=V,j=t.defineComponent({name:"Delete",__name:"delete",setup(p){return(g,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),C=j;const J="",K="",T=(p,g)=>{const r=p.__vccOpts||p;for(const[h,N]of g)r[h]=N;return r},E={class:"dialog-body"},x={class:"left-panel"},B={class:"select-all-btn-wrap"},L={class:"right-panel"},P={class:"selected-header"},I=T({__name:"ProfessionSelectDialog",props:{modelValue:{type:Boolean,default:!1},dialogTitle:{type:String,default:"\u9009\u62E9\u4E13\u4E1A"},selectedItems:{type:Array,default:()=>[]},api:{type:Object,required:!0},multiple:{type:Boolean,default:!0},multipleLimit:{type:Number,default:0},disabledItems:{type:Array,default:()=>[]}},emits:["update:modelValue","confirm"],setup(p,{emit:g}){const r=p,h=g,N=t.computed({get:()=>r.modelValue,set:a=>h("update:modelValue",a)}),S=t.ref(!1),f=t.ref([]),i=t.ref([]),u=t.ref(),A=t.computed(()=>r.multiple?r.multipleLimit>0&&i.value.length>r.multipleLimit?!1:i.value.length>0:i.value.length===1);function w(a){return i.value.some(e=>String(e.professionId)===String(a))}function D(a){return r.disabledItems.some(e=>String(e.id)===String(a))}function M(a){const e=a.users||a.userList||a.members||a.children||[],n=(Array.isArray(e)?e:[]).map(o=>{var l,d;return{id:(d=(l=o.id)!=null?l:o.userId)!=null?d:o.value,userName:o.userName||o.username||"-",nickName:o.nickName||o.name||o.label||"-",userType:o.userType||"",majorCode:o.majorCode||""}}),s=n.map(o=>o.nickName).filter(Boolean).join("\u3001");return{id:a.id,profession:a.profession||a.departmentName||a.name||"-",majorName:a.majorName||a.profession||a.name||"-",majorCode:a.majorCode||"",users:n,userNames:s}}function y(a){const e=a.id,n=a.profession,s=a.majorName||n,o=a.majorCode||"",l=a.users||[];return l.length===0?[{id:`p_${e}`,professionId:e,profession:n,majorName:s,majorCode:o,userType:"",userId:"",userName:"-",username:"-",nickName:"-"}]:l.map(d=>({id:`p_${e}_u_${d.id}`,professionId:e,profession:n,majorName:s,majorCode:d.majorCode||o,userType:d.userType||"",userId:d.id,userName:d.userName||"-",username:d.userName||"-",nickName:d.nickName||"-"}))}function z(a){const e=a.professionId;if(i.value=i.value.filter(s=>String(s.id)!==String(a.id)),!i.value.some(s=>String(s.professionId)===String(e))){const s=u.value;if(s){const o=f.value.find(l=>String(l.id)===String(e));o&&s.toggleRowSelection(o,!1)}}}function $(){_.ElMessageBox.confirm("\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u5DF2\u9009\u4E2D\u7684\u4E13\u4E1A\u5417\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(()=>{i.value=[],u.value&&u.value.clearSelection(),_.ElMessage.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A")}).catch(()=>{})}async function H(){const a=r.api.getUserPageList||r.api.getUserList;if(!!a){S.value=!0;try{let e;try{e=await a()}catch{e=await a({page:1,pageSize:99999},{page:1,pageSize:99999})}let n=Array.isArray(e)?e:e||(e==null?void 0:e.data)||(e==null?void 0:e.content)||[];Array.isArray(n)||(n=[]),f.value=n.map(s=>M(s))}catch(e){console.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25:",e),_.ElMessage.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25")}finally{S.value=!1,t.nextTick(()=>{R()})}}}function R(){const a=u.value;if(!a)return;const e=new Set(i.value.map(n=>String(n.professionId)));f.value.forEach(n=>{e.has(String(n.id))&&a.toggleRowSelection(n,!0)})}function U(){const a=new Set(r.disabledItems.map(o=>String(o.id))),e=new Set(i.value.map(o=>String(o.professionId))),n=f.value.filter(o=>{const l=String(o.id);return!e.has(l)&&!a.has(l)});let s=[];if(n.forEach(o=>{s=s.concat(y(o))}),r.multiple){if(r.multipleLimit>0){const o=r.multipleLimit-i.value.length;s.slice(0,o).forEach(l=>{i.value.push(l)})}else s.forEach(o=>{i.value.push(o)});_.ElMessage.success(`\u5DF2\u9009\u4E2D ${n.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${s.length} \u6761\u8BB0\u5F55`)}t.nextTick(()=>{const o=u.value;o&&n.forEach(l=>{o.toggleRowSelection(l,!0)})})}function q(a){if(a.length>0){const e=new Set(i.value.map(o=>String(o.professionId))),n=new Set(r.disabledItems.map(o=>String(o.id))),s=a.filter(o=>{const l=String(o.id);return!e.has(l)&&!n.has(l)});if(r.multiple){let o=[];if(s.forEach(l=>{o=o.concat(y(l))}),r.multipleLimit>0){const l=r.multipleLimit-i.value.length;o.slice(0,l).forEach(d=>{i.value.push(d)})}else o.forEach(l=>{i.value.push(l)})}}}function O(a){const e=new Set(a.map(o=>String(o.id))),n=new Set(r.disabledItems.map(o=>String(o.id)));a.forEach(o=>{const l=String(o.id);if(!w(o.id)&&!n.has(l))if(r.multiple){const d=y(o);if(r.multipleLimit>0){const c=r.multipleLimit-i.value.length;if(c<=0)return;d.slice(0,c).forEach(k=>{i.value.push(k)})}else d.forEach(c=>{i.value.push(c)})}else i.value=y(o)});const s=new Set(f.value.map(o=>String(o.id)));i.value=i.value.filter(o=>{const l=String(o.professionId);return!(s.has(l)&&!e.has(l))})}function F(a){return!r.multiple&&i.value.length>=1?w(a.id):w(a.id)?!0:!D(a.id)}function G(){let a=i.value.map(e=>({id:e.userId||e.id,professionId:e.professionId,profession:e.profession,majorName:e.majorName,majorCode:e.majorCode,userType:e.userType,userId:e.userId,userName:e.userName,username:e.userName,nickName:e.nickName}));h("confirm",a),b()}function b(){f.value=[],h("update:modelValue",!1)}return t.watch(()=>r.modelValue,a=>{a&&(i.value=r.selectedItems.flatMap(e=>{var n;if(console.log("nickname",r.selectedItems),e.users&&e.users.length>0){const s=e.id,o=e.profession||e.departmentName,l=e.majorName||o,d=e.majorCode||"";return e.users.map(c=>({id:`p_${s}_u_${c.id}`,professionId:s,profession:o,majorName:l,majorCode:d,userType:c.userType||e.userType||"",userId:c.id,userName:c.userName||c.username||"-",username:c.userName||c.username||"-",nickName:c.nickName||c.name||c.label||"-"}))}return[{id:e.id,professionId:(n=e.professionId)!=null?n:e.id,profession:e.profession||e.departmentName,majorName:e.majorName||e.profession||e.departmentName,majorCode:e.majorCode||"",userType:e.userType||"",userId:e.userId||"",userName:e.userName||e.username||"-",username:e.userName||e.username||"-",nickName:e.nickName||e.name||e.userNames||"-"}]}),H())},{immediate:!0}),(a,e)=>{const n=t.resolveComponent("el-button"),s=t.resolveComponent("el-table-column"),o=t.resolveComponent("el-table"),l=t.resolveComponent("el-dialog"),d=t.resolveDirective("loading");return t.openBlock(),t.createBlock(l,{title:p.dialogTitle,modelValue:N.value,"onUpdate:modelValue":e[0]||(e[0]=c=>N.value=c),width:"960px","before-close":b,"append-to-body":"",class:"profession-select-dialog"},{footer:t.withCtx(()=>[t.createVNode(n,{type:"primary",disabled:!A.value,onClick:G},{default:t.withCtx(()=>[...e[3]||(e[3]=[t.createTextVNode("\u786E\u5B9A",-1)])]),_:1},8,["disabled"]),t.createVNode(n,{onClick:b},{default:t.withCtx(()=>[...e[4]||(e[4]=[t.createTextVNode("\u53D6\u6D88",-1)])]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",E,[t.createElementVNode("div",x,[t.createElementVNode("div",B,[t.createVNode(n,{type:"primary",size:"default",icon:t.unref(v),disabled:S.value,onClick:U},{default:t.withCtx(()=>[...e[1]||(e[1]=[t.createTextVNode("\u5168\u90E8\u9009\u4E2D",-1)])]),_:1},8,["icon","disabled"])]),t.withDirectives((t.openBlock(),t.createBlock(o,{ref_key:"professionTable",ref:u,data:f.value,height:"540","row-key":"id",class:"profession-table",onSelectAll:q,onSelectionChange:O},{default:t.withCtx(()=>[t.createVNode(s,{type:"selection",width:"50",align:"center",selectable:F}),t.createVNode(s,{label:"\u4E13\u4E1A",prop:"majorName","show-overflow-tooltip":!0})]),_:1},8,["data"])),[[d,S.value]])]),t.createElementVNode("div",L,[t.createElementVNode("div",P,[t.createElementVNode("div",null,"\u5DF2\u9009\u4E2D\u5217\u8868 ("+t.toDisplayString(i.value.length)+")",1),i.value.length>0?(t.openBlock(),t.createBlock(n,{key:0,type:"text",size:"default",icon:t.unref(C),onClick:$,class:"clear-btn"},{default:t.withCtx(()=>[...e[2]||(e[2]=[t.createTextVNode("\u6E05\u7A7A",-1)])]),_:1},8,["icon"])):t.createCommentVNode("",!0)]),t.createVNode(o,{data:i.value,height:"540","row-key":"id",class:"selected-table"},{default:t.withCtx(()=>[t.createVNode(s,{align:"center",width:"60",label:"\u64CD\u4F5C"},{default:t.withCtx(({row:c})=>[t.createVNode(n,{type:"primary",link:"",icon:t.unref(C),onClick:k=>z(c)},null,8,["icon","onClick"])]),_:1}),t.createVNode(s,{label:"\u4E13\u4E1A",prop:"profession","show-overflow-tooltip":!0,"min-width":"120"}),t.createVNode(s,{label:"\u7528\u6237\u7C7B\u578B",prop:"userType",width:"100","show-overflow-tooltip":!0}),t.createVNode(s,{label:"\u7528\u6237\u540D\u79F0",prop:"nickName","min-width":"140","show-overflow-tooltip":!0})]),_:1},8,["data"])])])]),_:1},8,["title","modelValue"])}}},[["__scopeId","data-v-144912f0"]]);m.ProfessionSelectDialog=I,m.default=I,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .dialog-body[data-v-030101a8]{display:flex;gap:16px;min-height:580px}.left-panel[data-v-030101a8]{flex:1;min-width:0;display:flex;flex-direction:column}.select-all-btn-wrap[data-v-030101a8]{margin-bottom:10px}.right-panel[data-v-030101a8]{width:460px;flex-shrink:0;border:1px solid #ebeef5;border-radius:4px;overflow:hidden}.selected-header[data-v-030101a8]{padding:6px 12px;background:#ecf5ff;color:#409eff;font-size:14px;font-weight:500;display:flex;align-items:center;justify-content:space-between;height:40px;box-sizing:border-box;white-space:nowrap}.clear-btn[data-v-030101a8]{color:#f56c6c;padding:0;margin-left:10px}.clear-btn[data-v-030101a8]:hover{color:#ef4444}.profession-table[data-v-030101a8],.selected-table[data-v-030101a8]{flex:1}.selected-table[data-v-030101a8] .el-table__cell{padding:6px 0}.row-type-select[data-v-030101a8]{width:100%}.profession-select-dialog .el-dialog__body{padding:20px}
1
+ .dialog-body[data-v-144912f0]{display:flex;gap:16px;min-height:580px}.left-panel[data-v-144912f0]{flex:1;min-width:0;display:flex;flex-direction:column}.select-all-btn-wrap[data-v-144912f0]{margin-bottom:10px}.right-panel[data-v-144912f0]{width:460px;flex-shrink:0;border:1px solid #ebeef5;border-radius:4px;overflow:hidden}.selected-header[data-v-144912f0]{padding:6px 12px;background:#ecf5ff;color:#409eff;font-size:14px;font-weight:500;display:flex;align-items:center;justify-content:space-between;height:40px;box-sizing:border-box;white-space:nowrap}.clear-btn[data-v-144912f0]{color:#f56c6c;padding:0;margin-left:10px}.clear-btn[data-v-144912f0]:hover{color:#ef4444}.profession-table[data-v-144912f0],.selected-table[data-v-144912f0]{flex:1}.selected-table[data-v-144912f0] .el-table__cell{padding:6px 0}.row-type-select[data-v-144912f0]{width:100%}.profession-select-dialog .el-dialog__body{padding:20px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingminghahayu/profession-select-dialog-vue3",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Vue 3 Element Plus Profession Select Dialog Component",
5
5
  "main": "./dist/profession-select-vue3.umd.js",
6
6
  "module": "./dist/profession-select-vue3.es.js",
@@ -54,7 +54,7 @@
54
54
  </el-table-column>
55
55
  <el-table-column label="专业" prop="profession" :show-overflow-tooltip="true" min-width="120" />
56
56
  <el-table-column label="用户类型" prop="userType" width="100" :show-overflow-tooltip="true" />
57
- <el-table-column label="用户名称" prop="userName" min-width="140" :show-overflow-tooltip="true" />
57
+ <el-table-column label="用户名称" prop="nickName" min-width="140" :show-overflow-tooltip="true" />
58
58
  </el-table>
59
59
  </div>
60
60
  </div>
@@ -117,11 +117,13 @@ function formatProfessionItem(item) {
117
117
  const rawUsers = item.users || item.userList || item.members || item.children || []
118
118
  const users = (Array.isArray(rawUsers) ? rawUsers : []).map(u => ({
119
119
  id: u.id ?? u.userId ?? u.value,
120
- name: u.name || u.nickName || u.username || u.userName || u.label || '-',
120
+ // userName / username 都是工号,nickName 才是用户名称
121
+ userName: u.userName || u.username || '-',
122
+ nickName: u.nickName || u.name || u.label || '-',
121
123
  userType: u.userType || '',
122
124
  majorCode: u.majorCode || ''
123
125
  }))
124
- const userNames = users.map(u => u.name).filter(Boolean).join('、')
126
+ const userNames = users.map(u => u.nickName).filter(Boolean).join('、')
125
127
  return {
126
128
  id: item.id,
127
129
  profession: item.profession || item.departmentName || item.name || '-',
@@ -149,7 +151,9 @@ function expandProfessionToRows(prof) {
149
151
  majorCode,
150
152
  userType: '',
151
153
  userId: '',
152
- userName: '-'
154
+ userName: '-',
155
+ username: '-',
156
+ nickName: '-'
153
157
  }]
154
158
  }
155
159
  return users.map(u => ({
@@ -160,7 +164,9 @@ function expandProfessionToRows(prof) {
160
164
  majorCode: u.majorCode || majorCode,
161
165
  userType: u.userType || '',
162
166
  userId: u.id,
163
- userName: u.name || '-'
167
+ userName: u.userName || '-',
168
+ username: u.userName || '-',
169
+ nickName: u.nickName || '-'
164
170
  }))
165
171
  }
166
172
 
@@ -371,7 +377,9 @@ function saveDialog() {
371
377
  majorCode: u.majorCode,
372
378
  userType: u.userType,
373
379
  userId: u.userId,
374
- userName: u.userName
380
+ userName: u.userName,
381
+ username: u.userName,
382
+ nickName: u.nickName
375
383
  }))
376
384
  emit('confirm', list)
377
385
  handleClose()
@@ -388,6 +396,7 @@ watch(
388
396
  if (visible) {
389
397
  // 把外部传入的已选数据按用户展开为多条记录
390
398
  multiSelect.value = props.selectedItems.flatMap(u => {
399
+ console.log('nickname',props.selectedItems)
391
400
  // 兼容两种数据结构:
392
401
  // 1. 已经是按用户展开的记录(含 professionId 和 userName)
393
402
  // 2. 按专业展开的记录(含 users 数组)
@@ -404,7 +413,9 @@ watch(
404
413
  majorCode,
405
414
  userType: x.userType || u.userType || '',
406
415
  userId: x.id,
407
- userName: x.name || '-'
416
+ userName: x.userName || x.username || '-',
417
+ username: x.userName || x.username || '-',
418
+ nickName: x.nickName || x.name || x.label || '-'
408
419
  }))
409
420
  }
410
421
  // 已是单条用户记录
@@ -416,7 +427,9 @@ watch(
416
427
  majorCode: u.majorCode || '',
417
428
  userType: u.userType || '',
418
429
  userId: u.userId || '',
419
- userName: u.userName || u.userNames || '-'
430
+ userName: u.userName || u.username || '-',
431
+ username: u.userName || u.username || '-',
432
+ nickName: u.nickName || u.name || u.userNames || '-'
420
433
  }]
421
434
  })
422
435
  getPageList()