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

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,41 +1,41 @@
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";
2
- import { ElMessageBox as Z, ElMessage as V } from "element-plus";
1
+ import { defineComponent as P, openBlock as _, createElementBlock as A, createElementVNode as u, computed as V, ref as w, watch as G, resolveComponent as b, resolveDirective as J, createBlock as j, withCtx as m, createVNode as c, createTextVNode as I, unref as E, withDirectives as K, toDisplayString as Q, createCommentVNode as W, nextTick as L } from "vue";
2
+ import { ElMessageBox as X, ElMessage as T } from "element-plus";
3
3
  /*! Element Plus Icons Vue v2.3.2 */
4
- var ee = /* @__PURE__ */ A({
4
+ var Y = /* @__PURE__ */ P({
5
5
  name: "Check",
6
6
  __name: "check",
7
7
  setup(p) {
8
- return (v, i) => (_(), B("svg", {
8
+ return (g, l) => (_(), A("svg", {
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
+ }), Z = Y, ee = /* @__PURE__ */ P({
19
19
  name: "Delete",
20
20
  __name: "delete",
21
21
  setup(p) {
22
- return (v, i) => (_(), B("svg", {
22
+ return (g, l) => (_(), A("svg", {
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) => {
34
- const i = p.__vccOpts || p;
35
- for (const [h, S] of v)
36
- i[h] = S;
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 = {
32
+ }), te = ee;
33
+ const se = (p, g) => {
34
+ const l = p.__vccOpts || p;
35
+ for (const [v, y] of g)
36
+ l[v] = y;
37
+ return l;
38
+ }, ae = { class: "dialog-body" }, oe = { class: "left-panel" }, le = { class: "select-all-btn-wrap" }, ne = { class: "right-panel" }, ie = { class: "selected-header" }, re = {
39
39
  __name: "ProfessionSelectDialog",
40
40
  props: {
41
41
  modelValue: { type: Boolean, default: !1 },
@@ -47,192 +47,187 @@ const se = (p, v) => {
47
47
  disabledItems: { type: Array, default: () => [] }
48
48
  },
49
49
  emits: ["update:modelValue", "confirm"],
50
- setup(p, { emit: v }) {
51
- const i = p, h = v, S = E({
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));
50
+ setup(p, { emit: g }) {
51
+ const l = p, v = g, y = V({
52
+ get: () => l.modelValue,
53
+ set: (s) => v("update:modelValue", s)
54
+ }), N = w(!1), f = w([]), n = w([]), h = w(), x = V(() => l.multiple ? l.multipleLimit > 0 && n.value.length > l.multipleLimit ? !1 : n.value.length > 0 : n.value.length === 1);
55
+ function k(s) {
56
+ return n.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 B(s) {
59
+ return l.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 D(s) {
62
+ const e = s.users || s.userList || s.members || s.children || [], a = (Array.isArray(e) ? e : []).map((t) => {
63
+ var o, 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 = (o = t.id) != null ? o : 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
+ }), i = a.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 || "",
73
+ id: s.id,
74
+ profession: s.profession || s.departmentName || s.name || "-",
75
+ majorName: s.majorName || s.profession || s.name || "-",
76
+ majorCode: s.majorCode || "",
76
77
  users: a,
77
- userNames: s
78
+ userNames: i
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 S(s) {
82
+ const e = s.id, a = s.profession, i = s.majorName || a, t = s.majorCode || "", o = s.users || [];
83
+ return o.length === 0 ? [{
83
84
  id: `p_${e}`,
84
85
  professionId: e,
85
86
  profession: a,
86
- majorName: s,
87
+ majorName: i,
87
88
  majorCode: t,
88
89
  userType: "",
89
90
  userId: "",
90
- userName: "-"
91
- }] : l.map((r) => ({
91
+ userName: "-",
92
+ username: "-",
93
+ nickName: "-"
94
+ }] : o.map((r) => ({
92
95
  id: `p_${e}_u_${r.id}`,
93
96
  professionId: e,
94
97
  profession: a,
95
- majorName: s,
98
+ majorName: i,
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);
109
- }
110
- }
111
- }
112
- function M() {
113
- Z.confirm("\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u5DF2\u9009\u4E2D\u7684\u4E13\u4E1A\u5417\uFF1F", "\u63D0\u793A", {
107
+ function z() {
108
+ X.confirm("\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u5DF2\u9009\u4E2D\u7684\u4E13\u4E1A\u5417\uFF1F", "\u63D0\u793A", {
114
109
  confirmButtonText: "\u786E\u5B9A",
115
110
  cancelButtonText: "\u53D6\u6D88",
116
111
  type: "warning"
117
112
  }).then(() => {
118
- n.value = [], g.value && g.value.clearSelection(), V.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A");
113
+ n.value = [], h.value && h.value.clearSelection(), T.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A");
119
114
  }).catch(() => {
120
115
  });
121
116
  }
122
- async function R() {
123
- const o = i.api.getUserPageList || i.api.getUserList;
124
- if (!!o) {
125
- y.value = !0;
117
+ async function $() {
118
+ const s = l.api.getUserPageList || l.api.getUserList;
119
+ if (!!s) {
120
+ N.value = !0;
126
121
  try {
127
122
  let e;
128
123
  try {
129
- e = await o();
124
+ e = await s();
130
125
  } catch {
131
- e = await o({ page: 1, pageSize: 99999 }, { page: 1, pageSize: 99999 });
126
+ e = await s({ page: 1, pageSize: 99999 }, { page: 1, pageSize: 99999 });
132
127
  }
133
128
  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));
129
+ Array.isArray(a) || (a = []), f.value = a.map((i) => D(i));
135
130
  } catch (e) {
136
- console.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25:", e), V.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25");
131
+ console.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25:", e), T.error("\u83B7\u53D6\u4E13\u4E1A\u5931\u8D25");
137
132
  } finally {
138
- y.value = !1, L(() => {
139
- U();
133
+ N.value = !1, L(() => {
134
+ M();
140
135
  });
141
136
  }
142
137
  }
143
138
  }
144
- function U() {
145
- const o = g.value;
146
- if (!o)
139
+ function M() {
140
+ const s = h.value;
141
+ if (!s)
147
142
  return;
148
143
  const e = new Set(
149
144
  n.value.map((a) => String(a.professionId))
150
145
  );
151
146
  f.value.forEach((a) => {
152
- e.has(String(a.id)) && o.toggleRowSelection(a, !0);
147
+ e.has(String(a.id)) && s.toggleRowSelection(a, !0);
153
148
  });
154
149
  }
155
- 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);
150
+ function R() {
151
+ const s = new Set(l.disabledItems.map((t) => String(t.id))), e = new Set(n.value.map((t) => String(t.professionId))), a = f.value.filter((t) => {
152
+ const o = String(t.id);
153
+ return !e.has(o) && !s.has(o);
159
154
  });
160
- let s = [];
155
+ let i = [];
161
156
  if (a.forEach((t) => {
162
- s = s.concat(w(t));
163
- }), i.multiple) {
164
- if (i.multipleLimit > 0) {
165
- const t = i.multipleLimit - n.value.length;
166
- s.slice(0, t).forEach((l) => {
167
- n.value.push(l);
157
+ i = i.concat(S(t));
158
+ }), l.multiple) {
159
+ if (l.multipleLimit > 0) {
160
+ const t = l.multipleLimit - n.value.length;
161
+ i.slice(0, t).forEach((o) => {
162
+ n.value.push(o);
168
163
  });
169
164
  } else
170
- s.forEach((t) => {
165
+ i.forEach((t) => {
171
166
  n.value.push(t);
172
167
  });
173
- V.success(`\u5DF2\u9009\u4E2D ${a.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${s.length} \u6761\u8BB0\u5F55`);
168
+ T.success(`\u5DF2\u9009\u4E2D ${a.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${i.length} \u6761\u8BB0\u5F55`);
174
169
  }
175
170
  L(() => {
176
- const t = g.value;
177
- t && a.forEach((l) => {
178
- t.toggleRowSelection(l, !0);
171
+ const t = h.value;
172
+ t && a.forEach((o) => {
173
+ t.toggleRowSelection(o, !0);
179
174
  });
180
175
  });
181
176
  }
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);
177
+ function U(s) {
178
+ if (s.length > 0) {
179
+ const e = new Set(n.value.map((t) => String(t.professionId))), a = new Set(l.disabledItems.map((t) => String(t.id))), i = s.filter((t) => {
180
+ const o = String(t.id);
181
+ return !e.has(o) && !a.has(o);
187
182
  });
188
- if (i.multiple) {
183
+ if (l.multiple) {
189
184
  let t = [];
190
- if (s.forEach((l) => {
191
- t = t.concat(w(l));
192
- }), i.multipleLimit > 0) {
193
- const l = i.multipleLimit - n.value.length;
194
- t.slice(0, l).forEach((r) => {
185
+ if (i.forEach((o) => {
186
+ t = t.concat(S(o));
187
+ }), l.multipleLimit > 0) {
188
+ const o = l.multipleLimit - n.value.length;
189
+ t.slice(0, o).forEach((r) => {
195
190
  n.value.push(r);
196
191
  });
197
192
  } else
198
- t.forEach((l) => {
199
- n.value.push(l);
193
+ t.forEach((o) => {
194
+ n.value.push(o);
200
195
  });
201
196
  }
202
197
  }
203
198
  }
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
- if (i.multiple) {
210
- const r = w(t);
211
- if (i.multipleLimit > 0) {
212
- const d = i.multipleLimit - n.value.length;
199
+ function H(s) {
200
+ const e = new Set(s.map((t) => String(t.id))), a = new Set(l.disabledItems.map((t) => String(t.id)));
201
+ s.forEach((t) => {
202
+ const o = String(t.id);
203
+ if (!k(t.id) && !a.has(o))
204
+ if (l.multiple) {
205
+ const r = S(t);
206
+ if (l.multipleLimit > 0) {
207
+ const d = l.multipleLimit - n.value.length;
213
208
  if (d <= 0)
214
209
  return;
215
- r.slice(0, d).forEach((x) => {
216
- n.value.push(x);
210
+ r.slice(0, d).forEach((F) => {
211
+ n.value.push(F);
217
212
  });
218
213
  } else
219
214
  r.forEach((d) => {
220
215
  n.value.push(d);
221
216
  });
222
217
  } else
223
- n.value = w(t);
218
+ n.value = S(t);
224
219
  });
225
- const s = new Set(f.value.map((t) => String(t.id)));
220
+ const i = new Set(f.value.map((t) => String(t.id)));
226
221
  n.value = n.value.filter((t) => {
227
- const l = String(t.professionId);
228
- return !(s.has(l) && !e.has(l));
222
+ const o = String(t.professionId);
223
+ return !(i.has(o) && !e.has(o));
229
224
  });
230
225
  }
231
- function G(o) {
232
- return !i.multiple && n.value.length >= 1 ? C(o.id) : C(o.id) ? !0 : !z(o.id);
226
+ function O(s) {
227
+ return !l.multiple && n.value.length >= 1 ? k(s.id) : k(s.id) ? !0 : !B(s.id);
233
228
  }
234
- function J() {
235
- let o = n.value.map((e) => ({
229
+ function q() {
230
+ let s = n.value.map((e) => ({
236
231
  id: e.userId || e.id,
237
232
  professionId: e.professionId,
238
233
  profession: e.profession,
@@ -240,29 +235,33 @@ const se = (p, v) => {
240
235
  majorCode: e.majorCode,
241
236
  userType: e.userType,
242
237
  userId: e.userId,
243
- userName: e.userName
238
+ userName: e.userName,
239
+ username: e.userName,
240
+ nickName: e.nickName
244
241
  }));
245
- h("confirm", o), j();
242
+ v("confirm", s), C();
246
243
  }
247
- function j() {
248
- f.value = [], h("update:modelValue", !1);
244
+ function C() {
245
+ f.value = [], v("update:modelValue", !1);
249
246
  }
250
- return K(
251
- () => i.modelValue,
252
- (o) => {
253
- o && (n.value = i.selectedItems.flatMap((e) => {
247
+ return G(
248
+ () => l.modelValue,
249
+ (s) => {
250
+ s && (n.value = l.selectedItems.flatMap((e) => {
254
251
  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 || "";
252
+ if (console.log("nickname", l.selectedItems), e.users && e.users.length > 0) {
253
+ const i = e.id, t = e.profession || e.departmentName, o = e.majorName || t, r = e.majorCode || "";
257
254
  return e.users.map((d) => ({
258
- id: `p_${s}_u_${d.id}`,
259
- professionId: s,
255
+ id: `p_${i}_u_${d.id}`,
256
+ professionId: i,
260
257
  profession: t,
261
- majorName: l,
258
+ majorName: o,
262
259
  majorCode: r,
263
260
  userType: d.userType || e.userType || "",
264
261
  userId: d.id,
265
- userName: d.name || "-"
262
+ userName: d.userName || d.username || "-",
263
+ username: d.userName || d.username || "-",
264
+ nickName: d.nickName || d.name || d.label || "-"
266
265
  }));
267
266
  }
268
267
  return [{
@@ -273,75 +272,77 @@ const se = (p, v) => {
273
272
  majorCode: e.majorCode || "",
274
273
  userType: e.userType || "",
275
274
  userId: e.userId || "",
276
- userName: e.userName || e.userNames || "-"
275
+ userName: e.userName || e.username || "-",
276
+ username: e.userName || e.username || "-",
277
+ nickName: e.nickName || e.name || e.userNames || "-"
277
278
  }];
278
- }), R());
279
+ }), $());
279
280
  },
280
281
  { 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, {
282
+ ), (s, e) => {
283
+ const a = b("el-button"), i = b("el-table-column"), t = b("el-table"), o = b("el-dialog"), r = J("loading");
284
+ return _(), j(o, {
284
285
  title: p.dialogTitle,
285
- modelValue: S.value,
286
- "onUpdate:modelValue": e[0] || (e[0] = (d) => S.value = d),
286
+ modelValue: y.value,
287
+ "onUpdate:modelValue": e[0] || (e[0] = (d) => y.value = d),
287
288
  width: "960px",
288
- "before-close": j,
289
+ "before-close": C,
289
290
  "append-to-body": "",
290
291
  class: "profession-select-dialog"
291
292
  }, {
292
- footer: u(() => [
293
+ footer: m(() => [
293
294
  c(a, {
294
295
  type: "primary",
295
- disabled: !D.value,
296
- onClick: J
296
+ disabled: !x.value,
297
+ onClick: q
297
298
  }, {
298
- default: u(() => [...e[3] || (e[3] = [
299
- N("\u786E\u5B9A", -1)
299
+ default: m(() => [...e[3] || (e[3] = [
300
+ I("\u786E\u5B9A", -1)
300
301
  ])]),
301
302
  _: 1
302
303
  }, 8, ["disabled"]),
303
- c(a, { onClick: j }, {
304
- default: u(() => [...e[4] || (e[4] = [
305
- N("\u53D6\u6D88", -1)
304
+ c(a, { onClick: C }, {
305
+ default: m(() => [...e[4] || (e[4] = [
306
+ I("\u53D6\u6D88", -1)
306
307
  ])]),
307
308
  _: 1
308
309
  })
309
310
  ]),
310
- default: u(() => [
311
- m("div", ae, [
312
- m("div", le, [
313
- m("div", ne, [
311
+ default: m(() => [
312
+ u("div", ae, [
313
+ u("div", oe, [
314
+ u("div", le, [
314
315
  c(a, {
315
316
  type: "primary",
316
317
  size: "default",
317
- icon: k(te),
318
- disabled: y.value,
319
- onClick: O
318
+ icon: E(Z),
319
+ disabled: N.value,
320
+ onClick: R
320
321
  }, {
321
- default: u(() => [...e[1] || (e[1] = [
322
- N("\u5168\u90E8\u9009\u4E2D", -1)
322
+ default: m(() => [...e[1] || (e[1] = [
323
+ I("\u5168\u90E8\u9009\u4E2D", -1)
323
324
  ])]),
324
325
  _: 1
325
326
  }, 8, ["icon", "disabled"])
326
327
  ]),
327
- W((_(), T(t, {
328
+ K((_(), j(t, {
328
329
  ref_key: "professionTable",
329
- ref: g,
330
+ ref: h,
330
331
  data: f.value,
331
332
  height: "540",
332
333
  "row-key": "id",
333
334
  class: "profession-table",
334
- onSelectAll: q,
335
- onSelectionChange: F
335
+ onSelectAll: U,
336
+ onSelectionChange: H
336
337
  }, {
337
- default: u(() => [
338
- c(s, {
338
+ default: m(() => [
339
+ c(i, {
339
340
  type: "selection",
340
341
  width: "50",
341
342
  align: "center",
342
- selectable: G
343
+ selectable: O
343
344
  }),
344
- c(s, {
345
+ c(i, {
345
346
  label: "\u4E13\u4E1A",
346
347
  prop: "majorName",
347
348
  "show-overflow-tooltip": !0
@@ -349,25 +350,25 @@ const se = (p, v) => {
349
350
  ]),
350
351
  _: 1
351
352
  }, 8, ["data"])), [
352
- [r, y.value]
353
+ [r, N.value]
353
354
  ])
354
355
  ]),
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, {
356
+ u("div", ne, [
357
+ u("div", ie, [
358
+ u("div", null, "\u5DF2\u9009\u4E2D\u5217\u8868 (" + Q(n.value.length) + ")", 1),
359
+ n.value.length > 0 ? (_(), j(a, {
359
360
  key: 0,
360
361
  type: "text",
361
362
  size: "default",
362
- icon: k(P),
363
- onClick: M,
363
+ icon: E(te),
364
+ onClick: z,
364
365
  class: "clear-btn"
365
366
  }, {
366
- default: u(() => [...e[2] || (e[2] = [
367
- N("\u6E05\u7A7A", -1)
367
+ default: m(() => [...e[2] || (e[2] = [
368
+ I("\u6E05\u7A7A", -1)
368
369
  ])]),
369
370
  _: 1
370
- }, 8, ["icon"])) : Y("", !0)
371
+ }, 8, ["icon"])) : W("", !0)
371
372
  ]),
372
373
  c(t, {
373
374
  data: n.value,
@@ -375,37 +376,22 @@ const se = (p, v) => {
375
376
  "row-key": "id",
376
377
  class: "selected-table"
377
378
  }, {
378
- default: u(() => [
379
- c(s, {
380
- align: "center",
381
- width: "60",
382
- label: "\u64CD\u4F5C"
383
- }, {
384
- default: u(({ row: d }) => [
385
- c(a, {
386
- type: "primary",
387
- link: "",
388
- icon: k(P),
389
- onClick: (x) => H(d)
390
- }, null, 8, ["icon", "onClick"])
391
- ]),
392
- _: 1
393
- }),
394
- c(s, {
379
+ default: m(() => [
380
+ c(i, {
395
381
  label: "\u4E13\u4E1A",
396
382
  prop: "profession",
397
383
  "show-overflow-tooltip": !0,
398
384
  "min-width": "120"
399
385
  }),
400
- c(s, {
386
+ c(i, {
401
387
  label: "\u7528\u6237\u7C7B\u578B",
402
388
  prop: "userType",
403
389
  width: "100",
404
390
  "show-overflow-tooltip": !0
405
391
  }),
406
- c(s, {
392
+ c(i, {
407
393
  label: "\u7528\u6237\u540D\u79F0",
408
- prop: "userName",
394
+ prop: "nickName",
409
395
  "min-width": "140",
410
396
  "show-overflow-tooltip": !0
411
397
  })
@@ -419,7 +405,7 @@ const se = (p, v) => {
419
405
  }, 8, ["title", "modelValue"]);
420
406
  };
421
407
  }
422
- }, me = /* @__PURE__ */ se(de, [["__scopeId", "data-v-030101a8"]]);
408
+ }, me = /* @__PURE__ */ se(re, [["__scopeId", "data-v-dc7b7eac"]]);
423
409
  export {
424
410
  me as ProfessionSelectDialog,
425
411
  me as default
@@ -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 I=t.defineComponent({name:"Check",__name:"check",setup(p){return(u,l)=>(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"})]))}}),k=I,V=t.defineComponent({name:"Delete",__name:"delete",setup(p){return(u,l)=>(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"})]))}}),j=V;const G="",J="",v=(p,u)=>{const l=p.__vccOpts||p;for(const[g,N]of u)l[g]=N;return l},T={class:"dialog-body"},E={class:"left-panel"},x={class:"select-all-btn-wrap"},B={class:"right-panel"},L={class:"selected-header"},C=v({__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:u}){const l=p,g=u,N=t.computed({get:()=>l.modelValue,set:a=>g("update:modelValue",a)}),y=t.ref(!1),f=t.ref([]),r=t.ref([]),h=t.ref(),P=t.computed(()=>l.multiple?l.multipleLimit>0&&r.value.length>l.multipleLimit?!1:r.value.length>0:r.value.length===1);function S(a){return r.value.some(e=>String(e.professionId)===String(a))}function A(a){return l.disabledItems.some(e=>String(e.id)===String(a))}function D(a){const e=a.users||a.userList||a.members||a.children||[],s=(Array.isArray(e)?e:[]).map(o=>{var n,d;return{id:(d=(n=o.id)!=null?n:o.userId)!=null?d:o.value,userName:o.userName||o.username||"-",nickName:o.nickName||o.name||o.label||"-",userType:o.userType||"",majorCode:o.majorCode||""}}),i=s.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:s,userNames:i}}function w(a){const e=a.id,s=a.profession,i=a.majorName||s,o=a.majorCode||"",n=a.users||[];return n.length===0?[{id:`p_${e}`,professionId:e,profession:s,majorName:i,majorCode:o,userType:"",userId:"",userName:"-",username:"-",nickName:"-"}]:n.map(d=>({id:`p_${e}_u_${d.id}`,professionId:e,profession:s,majorName:i,majorCode:d.majorCode||o,userType:d.userType||"",userId:d.id,userName:d.userName||"-",username:d.userName||"-",nickName:d.nickName||"-"}))}function M(){_.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(()=>{r.value=[],h.value&&h.value.clearSelection(),_.ElMessage.success("\u5DF2\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u4E13\u4E1A")}).catch(()=>{})}async function z(){const a=l.api.getUserPageList||l.api.getUserList;if(!!a){y.value=!0;try{let e;try{e=await a()}catch{e=await a({page:1,pageSize:99999},{page:1,pageSize:99999})}let s=Array.isArray(e)?e:e||(e==null?void 0:e.data)||(e==null?void 0:e.content)||[];Array.isArray(s)||(s=[]),f.value=s.map(i=>D(i))}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(()=>{$()})}}}function $(){const a=h.value;if(!a)return;const e=new Set(r.value.map(s=>String(s.professionId)));f.value.forEach(s=>{e.has(String(s.id))&&a.toggleRowSelection(s,!0)})}function R(){const a=new Set(l.disabledItems.map(o=>String(o.id))),e=new Set(r.value.map(o=>String(o.professionId))),s=f.value.filter(o=>{const n=String(o.id);return!e.has(n)&&!a.has(n)});let i=[];if(s.forEach(o=>{i=i.concat(w(o))}),l.multiple){if(l.multipleLimit>0){const o=l.multipleLimit-r.value.length;i.slice(0,o).forEach(n=>{r.value.push(n)})}else i.forEach(o=>{r.value.push(o)});_.ElMessage.success(`\u5DF2\u9009\u4E2D ${s.length} \u4E2A\u4E13\u4E1A\uFF0C\u5171 ${i.length} \u6761\u8BB0\u5F55`)}t.nextTick(()=>{const o=h.value;o&&s.forEach(n=>{o.toggleRowSelection(n,!0)})})}function U(a){if(a.length>0){const e=new Set(r.value.map(o=>String(o.professionId))),s=new Set(l.disabledItems.map(o=>String(o.id))),i=a.filter(o=>{const n=String(o.id);return!e.has(n)&&!s.has(n)});if(l.multiple){let o=[];if(i.forEach(n=>{o=o.concat(w(n))}),l.multipleLimit>0){const n=l.multipleLimit-r.value.length;o.slice(0,n).forEach(d=>{r.value.push(d)})}else o.forEach(n=>{r.value.push(n)})}}}function H(a){const e=new Set(a.map(o=>String(o.id))),s=new Set(l.disabledItems.map(o=>String(o.id)));a.forEach(o=>{const n=String(o.id);if(!S(o.id)&&!s.has(n))if(l.multiple){const d=w(o);if(l.multipleLimit>0){const c=l.multipleLimit-r.value.length;if(c<=0)return;d.slice(0,c).forEach(F=>{r.value.push(F)})}else d.forEach(c=>{r.value.push(c)})}else r.value=w(o)});const i=new Set(f.value.map(o=>String(o.id)));r.value=r.value.filter(o=>{const n=String(o.professionId);return!(i.has(n)&&!e.has(n))})}function q(a){return!l.multiple&&r.value.length>=1?S(a.id):S(a.id)?!0:!A(a.id)}function O(){let a=r.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}));g("confirm",a),b()}function b(){f.value=[],g("update:modelValue",!1)}return t.watch(()=>l.modelValue,a=>{a&&(r.value=l.selectedItems.flatMap(e=>{var s;if(console.log("nickname",l.selectedItems),e.users&&e.users.length>0){const i=e.id,o=e.profession||e.departmentName,n=e.majorName||o,d=e.majorCode||"";return e.users.map(c=>({id:`p_${i}_u_${c.id}`,professionId:i,profession:o,majorName:n,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:(s=e.professionId)!=null?s: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||"-"}]}),z())},{immediate:!0}),(a,e)=>{const s=t.resolveComponent("el-button"),i=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: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(s,{type:"primary",disabled:!P.value,onClick:O},{default:t.withCtx(()=>[...e[3]||(e[3]=[t.createTextVNode("\u786E\u5B9A",-1)])]),_:1},8,["disabled"]),t.createVNode(s,{onClick:b},{default:t.withCtx(()=>[...e[4]||(e[4]=[t.createTextVNode("\u53D6\u6D88",-1)])]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",T,[t.createElementVNode("div",E,[t.createElementVNode("div",x,[t.createVNode(s,{type:"primary",size:"default",icon:t.unref(k),disabled:y.value,onClick:R},{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:h,data:f.value,height:"540","row-key":"id",class:"profession-table",onSelectAll:U,onSelectionChange:H},{default:t.withCtx(()=>[t.createVNode(i,{type:"selection",width:"50",align:"center",selectable:q}),t.createVNode(i,{label:"\u4E13\u4E1A",prop:"majorName","show-overflow-tooltip":!0})]),_:1},8,["data"])),[[d,y.value]])]),t.createElementVNode("div",B,[t.createElementVNode("div",L,[t.createElementVNode("div",null,"\u5DF2\u9009\u4E2D\u5217\u8868 ("+t.toDisplayString(r.value.length)+")",1),r.value.length>0?(t.openBlock(),t.createBlock(s,{key:0,type:"text",size:"default",icon:t.unref(j),onClick:M,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:r.value,height:"540","row-key":"id",class:"selected-table"},{default:t.withCtx(()=>[t.createVNode(i,{label:"\u4E13\u4E1A",prop:"profession","show-overflow-tooltip":!0,"min-width":"120"}),t.createVNode(i,{label:"\u7528\u6237\u7C7B\u578B",prop:"userType",width:"100","show-overflow-tooltip":!0}),t.createVNode(i,{label:"\u7528\u6237\u540D\u79F0",prop:"nickName","min-width":"140","show-overflow-tooltip":!0})]),_:1},8,["data"])])])]),_:1},8,["title","modelValue"])}}},[["__scopeId","data-v-dc7b7eac"]]);m.ProfessionSelectDialog=C,m.default=C,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-dc7b7eac]{display:flex;gap:16px;min-height:580px}.left-panel[data-v-dc7b7eac]{flex:1;min-width:0;display:flex;flex-direction:column}.select-all-btn-wrap[data-v-dc7b7eac]{margin-bottom:10px}.right-panel[data-v-dc7b7eac]{width:460px;flex-shrink:0;border:1px solid #ebeef5;border-radius:4px;overflow:hidden}.selected-header[data-v-dc7b7eac]{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-dc7b7eac]{color:#f56c6c;padding:0;margin-left:10px}.clear-btn[data-v-dc7b7eac]:hover{color:#ef4444}.profession-table[data-v-dc7b7eac],.selected-table[data-v-dc7b7eac]{flex:1}.selected-table[data-v-dc7b7eac] .el-table__cell{padding:6px 0}.row-type-select[data-v-dc7b7eac]{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.3",
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",
@@ -47,14 +47,14 @@
47
47
  >清空</el-button>
48
48
  </div>
49
49
  <el-table :data="multiSelect" height="540" row-key="id" class="selected-table">
50
- <el-table-column align="center" width="60" label="操作">
50
+ <!-- <el-table-column align="center" width="60" label="操作">
51
51
  <template #default="{ row }">
52
52
  <el-button type="primary" link :icon="Delete" @click="removeFromSelected(row)" />
53
53
  </template>
54
- </el-table-column>
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()