@pangu-backend-ui/user-core 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineComponent as B, ref as g, inject as A, resolveComponent as o, openBlock as f, createElementBlock as U, Fragment as N, createTextVNode as c, toDisplayString as w, createBlock as V, withCtx as l, createVNode as e, createCommentVNode as x, watch as q, computed as W, renderSlot as H, renderList as O, resolveDirective as Q, withDirectives as X, KeepAlive as Z, resolveDynamicComponent as ee, createElementVNode as F, unref as le, pushScopeId as te, popScopeId as oe } from "vue";
2
- import { defineStore as ae } from "pinia";
3
- import { PgTable as ne } from "@pangu-backend-ui/common";
4
- const ie = {
1
+ import { defineComponent as B, ref as g, inject as A, resolveComponent as o, openBlock as v, createElementBlock as U, Fragment as N, createTextVNode as c, toDisplayString as w, createBlock as V, withCtx as l, createVNode as e, createCommentVNode as x, watch as q, computed as Q, renderSlot as H, renderList as O, resolveDirective as X, withDirectives as Z, KeepAlive as ee, resolveDynamicComponent as le, createElementVNode as F, unref as te, pushScopeId as oe, popScopeId as ae } from "vue";
2
+ import { defineStore as ne } from "pinia";
3
+ import { PgTable as ie } from "@pangu-backend-ui/common";
4
+ const ue = {
5
5
  key: 0,
6
6
  class: "container"
7
- }, ue = /* @__PURE__ */ B({
7
+ }, se = /* @__PURE__ */ B({
8
8
  __name: "UserMobileComponent",
9
9
  props: {
10
10
  userId: {
@@ -16,12 +16,12 @@ const ie = {
16
16
  default: null
17
17
  }
18
18
  },
19
- setup(v) {
20
- const s = v, a = g({
19
+ setup(m) {
20
+ const s = m, a = g({
21
21
  plainMobile: null,
22
22
  loading: !1
23
23
  }), r = A("http");
24
- function m() {
24
+ function _() {
25
25
  a.value.plainMobile == null && (a.value.loading = !0, r == null || r.get(`/api/user/${s.userId}/plainmobile`).then((i) => {
26
26
  a.value.plainMobile = i.data, a.value.loading = !1;
27
27
  }).finally(() => {
@@ -30,23 +30,23 @@ const ie = {
30
30
  }
31
31
  return (i, b) => {
32
32
  const u = o("View"), h = o("el-icon"), d = o("Loading");
33
- return s.maskMobile != null ? (f(), U("div", ie, [
34
- a.value.plainMobile == null ? (f(), U(N, { key: 0 }, [
33
+ return s.maskMobile != null ? (v(), U("div", ue, [
34
+ a.value.plainMobile == null ? (v(), U(N, { key: 0 }, [
35
35
  c(w(s.maskMobile), 1)
36
- ], 64)) : (f(), U(N, { key: 1 }, [
36
+ ], 64)) : (v(), U(N, { key: 1 }, [
37
37
  c(w(a.value.plainMobile), 1)
38
38
  ], 64)),
39
- a.value.plainMobile == null && !a.value.loading && s.userId != null ? (f(), V(h, {
39
+ a.value.plainMobile == null && !a.value.loading && s.userId != null ? (v(), V(h, {
40
40
  key: 2,
41
41
  class: "view-icon",
42
- onClick: m
42
+ onClick: _
43
43
  }, {
44
44
  default: l(() => [
45
45
  e(u)
46
46
  ]),
47
47
  _: 1
48
48
  })) : x("", !0),
49
- a.value.loading ? (f(), V(h, {
49
+ a.value.loading ? (v(), V(h, {
50
50
  key: 3,
51
51
  class: "is-loading view-icon"
52
52
  }, {
@@ -59,34 +59,34 @@ const ie = {
59
59
  };
60
60
  }
61
61
  });
62
- const j = (v, s) => {
63
- const a = v.__vccOpts || v;
64
- for (const [r, m] of s)
65
- a[r] = m;
62
+ const j = (m, s) => {
63
+ const a = m.__vccOpts || m;
64
+ for (const [r, _] of s)
65
+ a[r] = _;
66
66
  return a;
67
- }, R = /* @__PURE__ */ j(ue, [["__scopeId", "data-v-76c9c9ae"]]), se = {
68
- install: (v) => {
69
- v.component("PgUserMobile", R);
67
+ }, R = /* @__PURE__ */ j(se, [["__scopeId", "data-v-76c9c9ae"]]), re = {
68
+ install: (m) => {
69
+ m.component("PgUserMobile", R);
70
70
  }
71
- }, re = /* @__PURE__ */ B({
71
+ }, de = /* @__PURE__ */ B({
72
72
  __name: "LoginHistory",
73
73
  props: ["userId"],
74
- setup(v) {
74
+ setup(m) {
75
75
  const a = g({
76
- userId: v.userId,
76
+ userId: m.userId,
77
77
  loginTimeStart: null,
78
78
  loginTimeEnd: null
79
79
  }), r = g([]);
80
80
  q(r, (b) => {
81
81
  b ? (a.value.loginTimeStart = b[0], a.value.loginTimeEnd = b[1]) : (a.value.loginTimeStart = null, a.value.loginTimeEnd = null);
82
82
  });
83
- const m = g();
83
+ const _ = g();
84
84
  function i() {
85
- m.value.search();
85
+ _.value.search();
86
86
  }
87
87
  return (b, u) => {
88
- const h = o("el-date-picker"), d = o("el-button"), I = o("el-space"), C = o("el-table-column"), _ = o("el-tag"), y = o("pg-table");
89
- return f(), U(N, null, [
88
+ const h = o("el-date-picker"), d = o("el-button"), I = o("el-space"), C = o("el-table-column"), f = o("el-tag"), y = o("pg-table");
89
+ return v(), U(N, null, [
90
90
  e(I, null, {
91
91
  default: l(() => [
92
92
  e(h, {
@@ -113,7 +113,7 @@ const j = (v, s) => {
113
113
  }),
114
114
  e(y, {
115
115
  ref_key: "historiesTable",
116
- ref: m,
116
+ ref: _,
117
117
  style: { "margin-top": "10px" },
118
118
  "data-url": "/api/user/login-history",
119
119
  condition: a.value
@@ -143,7 +143,7 @@ const j = (v, s) => {
143
143
  "show-overflow-tooltip": ""
144
144
  }, {
145
145
  default: l(({ row: p }) => [
146
- p.method === "SMS" ? (f(), V(_, {
146
+ p.method === "SMS" ? (v(), V(f, {
147
147
  key: 0,
148
148
  type: "primary",
149
149
  size: "small"
@@ -153,7 +153,7 @@ const j = (v, s) => {
153
153
  ]),
154
154
  _: 1
155
155
  })) : x("", !0),
156
- p.method === "THIRD_PLATFORM" ? (f(), V(_, {
156
+ p.method === "THIRD_PLATFORM" ? (v(), V(f, {
157
157
  key: 1,
158
158
  type: "primary",
159
159
  size: "small"
@@ -163,7 +163,7 @@ const j = (v, s) => {
163
163
  ]),
164
164
  _: 1
165
165
  })) : x("", !0),
166
- p.method === "UNIVERIFY" ? (f(), V(_, {
166
+ p.method === "UNIVERIFY" ? (v(), V(f, {
167
167
  key: 2,
168
168
  type: "primary",
169
169
  size: "small"
@@ -173,7 +173,7 @@ const j = (v, s) => {
173
173
  ]),
174
174
  _: 1
175
175
  })) : x("", !0),
176
- p.method === "PASSWORD" ? (f(), V(_, {
176
+ p.method === "PASSWORD" ? (v(), V(f, {
177
177
  key: 3,
178
178
  type: "primary",
179
179
  size: "small"
@@ -210,14 +210,14 @@ const j = (v, s) => {
210
210
  ], 64);
211
211
  };
212
212
  }
213
- }), J = ae("pg-user-core-config-store", () => {
214
- const v = [];
215
- return v.push({
213
+ }), J = ne("pg-user-core-config-store", () => {
214
+ const m = [];
215
+ return m.push({
216
216
  name: "登录历史",
217
217
  code: "LOGIN_HISTORY",
218
- component: re
218
+ component: de
219
219
  }), {
220
- userDetailDialogTabs: W(() => v)
220
+ userDetailDialogTabs: Q(() => m)
221
221
  };
222
222
  }), G = /* @__PURE__ */ B({
223
223
  __name: "AddBlacklistComp",
@@ -232,8 +232,8 @@ const j = (v, s) => {
232
232
  }
233
233
  },
234
234
  emits: ["success"],
235
- setup(v, { expose: s, emit: a }) {
236
- const r = v, m = A("http"), i = g(!1);
235
+ setup(m, { expose: s, emit: a }) {
236
+ const r = m, _ = A("http"), i = g(!1);
237
237
  let b = g(null);
238
238
  function u(t) {
239
239
  i.value = !0, b.value = t ?? r.userId, t && C(b.value);
@@ -250,20 +250,20 @@ const j = (v, s) => {
250
250
  description: null
251
251
  }), I = g();
252
252
  function C(t) {
253
- m == null || m.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then((n) => {
253
+ _ == null || _.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then((n) => {
254
254
  var $, M, k, L, P;
255
255
  ($ = n.data) != null && $.info && ((M = n.data) != null && M.info.allowPermissionCodes && (d.value.permissions = JSON.parse((k = n.data) == null ? void 0 : k.info.allowPermissionCodes)), d.value.userId = (L = n.data) == null ? void 0 : L.info.userId, d.value.unlockTime = n.data.info.unlockTime, d.value.description = n.data.info.description), I.value = (P = n.data) == null ? void 0 : P.permissionCodes;
256
256
  });
257
257
  }
258
- const _ = g();
258
+ const f = g();
259
259
  function y() {
260
260
  var t;
261
- (t = _.value) == null || t.resetFields();
261
+ (t = f.value) == null || t.resetFields();
262
262
  }
263
263
  function p() {
264
264
  var t;
265
- (t = _.value) == null || t.validate((n, $) => {
266
- n && (m == null || m.post(`/api/user/${b.value}/blacklist`, d.value).then((M) => {
265
+ (t = f.value) == null || t.validate((n, $) => {
266
+ n && (_ == null || _.post(`/api/user/${b.value}/blacklist`, d.value).then((M) => {
267
267
  i.value = !1, a("success");
268
268
  }));
269
269
  });
@@ -323,7 +323,7 @@ const j = (v, s) => {
323
323
  show: u
324
324
  }), (t, n) => {
325
325
  const $ = o("el-button"), M = o("el-date-picker"), k = o("el-form-item"), L = o("el-checkbox"), P = o("el-checkbox-group"), E = o("el-input"), z = o("el-form"), T = o("el-dialog");
326
- return f(), U(N, null, [
326
+ return v(), U(N, null, [
327
327
  r.hiddenEntranceSlot ? x("", !0) : H(t.$slots, "default", { key: 0 }, () => [
328
328
  e($, {
329
329
  icon: "lock",
@@ -357,7 +357,7 @@ const j = (v, s) => {
357
357
  default: l(() => [
358
358
  e(z, {
359
359
  ref_key: "form",
360
- ref: _,
360
+ ref: f,
361
361
  "label-position": "top",
362
362
  rules: h.value,
363
363
  model: d.value
@@ -387,7 +387,7 @@ const j = (v, s) => {
387
387
  "onUpdate:modelValue": n[2] || (n[2] = (S) => d.value.permissions = S)
388
388
  }, {
389
389
  default: l(() => [
390
- (f(!0), U(N, null, O(I.value, (S, Y) => (f(), V(L, {
390
+ (v(!0), U(N, null, O(I.value, (S, Y) => (v(), V(L, {
391
391
  label: Y,
392
392
  key: Y
393
393
  }, {
@@ -426,8 +426,8 @@ const j = (v, s) => {
426
426
  }
427
427
  }), K = /* @__PURE__ */ B({
428
428
  __name: "UserDetailDialog",
429
- setup(v, { expose: s }) {
430
- const a = J(), r = A("http"), m = g(!1), i = g(), b = g(), u = g({
429
+ setup(m, { expose: s }) {
430
+ const a = J(), r = A("http"), _ = g(!1), i = g(), b = g(), u = g({
431
431
  activeName: a.userDetailDialogTabs[0].code,
432
432
  tabs: []
433
433
  }), h = g(!1);
@@ -436,7 +436,7 @@ const j = (v, s) => {
436
436
  }
437
437
  function I(D) {
438
438
  r == null || r.get(`/api/user/${D}`).then((t) => {
439
- i.value = t.data, h.value = !1, m.value = !0, i.value.inBlacklist && C(D);
439
+ i.value = t.data, h.value = !1, _.value = !0, i.value.inBlacklist && C(D);
440
440
  });
441
441
  }
442
442
  function C(D) {
@@ -444,9 +444,9 @@ const j = (v, s) => {
444
444
  b.value = t.data;
445
445
  });
446
446
  }
447
- const _ = g();
447
+ const f = g();
448
448
  function y() {
449
- _.value.show(i.value.id);
449
+ f.value.show(i.value.id);
450
450
  }
451
451
  function p() {
452
452
  i.value = null, b.value = null;
@@ -454,11 +454,11 @@ const j = (v, s) => {
454
454
  return s({
455
455
  show: d
456
456
  }), (D, t) => {
457
- const n = o("el-descriptions-item"), $ = o("el-tag"), M = o("el-descriptions"), k = o("el-tab-pane"), L = o("el-tabs"), P = o("el-button"), E = o("el-dialog"), z = Q("loading");
458
- return f(), U(N, null, [
459
- X((f(), V(E, {
460
- modelValue: m.value,
461
- "onUpdate:modelValue": t[1] || (t[1] = (T) => m.value = T),
457
+ const n = o("el-descriptions-item"), $ = o("el-tag"), M = o("el-descriptions"), k = o("el-tab-pane"), L = o("el-tabs"), P = o("el-button"), E = o("el-dialog"), z = X("loading");
458
+ return v(), U(N, null, [
459
+ Z((v(), V(E, {
460
+ modelValue: _.value,
461
+ "onUpdate:modelValue": t[1] || (t[1] = (T) => _.value = T),
462
462
  title: "用户详情",
463
463
  width: "1300",
464
464
  onClosed: p
@@ -492,7 +492,7 @@ const j = (v, s) => {
492
492
  }),
493
493
  e(n, { label: "手机号码" }, {
494
494
  default: l(() => [
495
- (f(), V(R, {
495
+ (v(), V(R, {
496
496
  "mask-mobile": i.value.mobile,
497
497
  "user-id": i.value.id,
498
498
  key: i.value.id
@@ -558,7 +558,7 @@ const j = (v, s) => {
558
558
  ]),
559
559
  _: 1
560
560
  }),
561
- b.value ? (f(), V(M, {
561
+ b.value ? (v(), V(M, {
562
562
  key: 0,
563
563
  style: { "margin-top": "10px" },
564
564
  border: "",
@@ -592,7 +592,7 @@ const j = (v, s) => {
592
592
  ]),
593
593
  _: 1
594
594
  })) : x("", !0),
595
- (f(), V(L, {
595
+ (v(), V(L, {
596
596
  modelValue: u.value.activeName,
597
597
  "onUpdate:modelValue": t[0] || (t[0] = (T) => u.value.activeName = T),
598
598
  key: `usr_tab_${i.value.id}`,
@@ -600,14 +600,14 @@ const j = (v, s) => {
600
600
  type: "border-card"
601
601
  }, {
602
602
  default: l(() => [
603
- (f(!0), U(N, null, O(u.value.tabs, (T, S) => (f(), V(k, {
603
+ (v(!0), U(N, null, O(u.value.tabs, (T, S) => (v(), V(k, {
604
604
  label: T.name,
605
605
  name: T.code,
606
606
  key: `user_detail_dialog_${T.code}`
607
607
  }, {
608
608
  default: l(() => [
609
- (f(), V(Z, null, [
610
- u.value.activeName == T.code ? (f(), V(ee(T.component), {
609
+ (v(), V(ee, null, [
610
+ u.value.activeName == T.code ? (v(), V(le(T.component), {
611
611
  key: `ud_tab_${T.code}`,
612
612
  userId: i.value.id
613
613
  }, null, 8, ["userId"])) : x("", !0)
@@ -625,23 +625,88 @@ const j = (v, s) => {
625
625
  ]),
626
626
  e(G, {
627
627
  ref_key: "addBlacklistComp",
628
- ref: _,
628
+ ref: f,
629
629
  onSuccess: t[2] || (t[2] = (T) => I(i.value.id)),
630
630
  "hidden-entrance-slot": ""
631
631
  }, null, 512)
632
632
  ], 64);
633
633
  };
634
634
  }
635
- }), de = {
636
- install: (v) => {
637
- v.component("PgUserDetailDialog", K);
635
+ }), ce = {
636
+ install: (m) => {
637
+ m.component("PgUserDetailDialog", K);
638
+ }
639
+ }, W = /* @__PURE__ */ B({
640
+ __name: "UserSelectorComp",
641
+ props: {
642
+ modelValue: {
643
+ required: !0,
644
+ type: Number
645
+ },
646
+ pageSize: {
647
+ type: Number,
648
+ default: 20
649
+ }
650
+ },
651
+ emits: ["update:modelValue"],
652
+ setup(m, { emit: s }) {
653
+ const a = m, r = A("http"), _ = g(a.modelValue);
654
+ q(_, (d) => {
655
+ s("update:modelValue", d);
656
+ });
657
+ const i = g(!1), b = g([]);
658
+ let u = null;
659
+ function h(d) {
660
+ d && (i.value = !0, u && clearTimeout(u), u = setTimeout(() => {
661
+ r == null || r.get("/api/user/keyword-search", {
662
+ keyword: d,
663
+ pageSize: a.pageSize
664
+ }).then((I) => {
665
+ b.value = I.data;
666
+ }).finally(() => {
667
+ i.value = !1;
668
+ });
669
+ }, 200));
670
+ }
671
+ return (d, I) => {
672
+ const C = o("el-option"), f = o("el-select");
673
+ return v(), V(f, {
674
+ modelValue: _.value,
675
+ "onUpdate:modelValue": I[0] || (I[0] = (y) => _.value = y),
676
+ filterable: "",
677
+ remote: "",
678
+ loading: i.value,
679
+ "remote-method": h
680
+ }, {
681
+ default: l(() => [
682
+ (v(!0), U(N, null, O(b.value, (y) => (v(), V(C, {
683
+ key: y.id,
684
+ value: y.id,
685
+ label: `${y.id} / ${y.nickname} / ${y.mobile} / ${y.inviteCode}`
686
+ }, {
687
+ default: l(() => [
688
+ H(d.$slots, "default", { user: y }, () => [
689
+ c(w(y.id) + " / " + w(y.nickname) + " / " + w(y.mobile) + " / " + w(y.inviteCode), 1)
690
+ ])
691
+ ]),
692
+ _: 2
693
+ }, 1032, ["value", "label"]))), 128))
694
+ ]),
695
+ _: 3
696
+ }, 8, ["modelValue", "loading"]);
697
+ };
638
698
  }
639
- }, ce = [
640
- se,
641
- de
642
- ], pe = (v) => (te("data-v-391c43be"), v = v(), oe(), v), me = { class: "page-layout" }, _e = { style: { "margin-top": "10px" } }, fe = /* @__PURE__ */ pe(() => /* @__PURE__ */ F("template", { "slot-scope": "{row}" }, null, -1)), ve = /* @__PURE__ */ B({
699
+ }), pe = {
700
+ install: (m) => {
701
+ m.component("PgUserSelector", W);
702
+ }
703
+ }, me = [
704
+ re,
705
+ ce,
706
+ pe
707
+ ], _e = (m) => (oe("data-v-391c43be"), m = m(), ae(), m), fe = { class: "page-layout" }, ve = { style: { "margin-top": "10px" } }, be = /* @__PURE__ */ _e(() => /* @__PURE__ */ F("template", { "slot-scope": "{row}" }, null, -1)), ge = /* @__PURE__ */ B({
643
708
  __name: "list",
644
- setup(v) {
709
+ setup(m) {
645
710
  const s = g({
646
711
  id: null,
647
712
  parentId: null,
@@ -652,14 +717,14 @@ const j = (v, s) => {
652
717
  function r() {
653
718
  a.value.search();
654
719
  }
655
- const m = g();
720
+ const _ = g();
656
721
  function i(b) {
657
- m.value.show(b.id);
722
+ _.value.show(b.id);
658
723
  }
659
724
  return (b, u) => {
660
- const h = o("el-input"), d = o("el-button"), I = o("el-space"), C = o("el-card"), _ = o("el-table-column"), y = o("el-image");
661
- return f(), U(N, null, [
662
- F("div", me, [
725
+ const h = o("el-input"), d = o("el-button"), I = o("el-space"), C = o("el-card"), f = o("el-table-column"), y = o("el-image");
726
+ return v(), U(N, null, [
727
+ F("div", fe, [
663
728
  e(C, null, {
664
729
  default: l(() => [
665
730
  e(I, null, {
@@ -715,8 +780,8 @@ const j = (v, s) => {
715
780
  ]),
716
781
  _: 1
717
782
  }),
718
- F("div", _e, [
719
- e(le(ne), {
783
+ F("div", ve, [
784
+ e(te(ie), {
720
785
  ref_key: "userTable",
721
786
  ref: a,
722
787
  "data-url": "/api/user/page",
@@ -724,13 +789,13 @@ const j = (v, s) => {
724
789
  onRowDbClick: u[5] || (u[5] = (p) => i(p))
725
790
  }, {
726
791
  columns: l(() => [
727
- e(_, {
792
+ e(f, {
728
793
  prop: "id",
729
794
  label: "UID",
730
795
  width: "80",
731
796
  align: "center"
732
797
  }),
733
- e(_, {
798
+ e(f, {
734
799
  prop: "mobile",
735
800
  label: "手机",
736
801
  width: "115",
@@ -738,7 +803,7 @@ const j = (v, s) => {
738
803
  "show-overflow-tooltip": ""
739
804
  }, {
740
805
  default: l((p) => [
741
- (f(), V(R, {
806
+ (v(), V(R, {
742
807
  "mask-mobile": p.row.mobile,
743
808
  "user-id": p.row.id,
744
809
  key: p.row.id
@@ -746,28 +811,28 @@ const j = (v, s) => {
746
811
  ]),
747
812
  _: 1
748
813
  }),
749
- e(_, {
814
+ e(f, {
750
815
  prop: "username",
751
816
  label: "用户名",
752
817
  width: "110",
753
818
  align: "left",
754
819
  "show-overflow-tooltip": ""
755
820
  }),
756
- e(_, {
821
+ e(f, {
757
822
  prop: "nickname",
758
823
  label: "昵称",
759
824
  width: "110",
760
825
  align: "left",
761
826
  "show-overflow-tooltip": ""
762
827
  }),
763
- e(_, {
828
+ e(f, {
764
829
  prop: "inviteCode",
765
830
  label: "邀请码",
766
831
  width: "90",
767
832
  align: "center",
768
833
  "show-overflow-tooltip": ""
769
834
  }),
770
- e(_, {
835
+ e(f, {
771
836
  prop: "avatar",
772
837
  label: "头像",
773
838
  width: "60",
@@ -785,48 +850,48 @@ const j = (v, s) => {
785
850
  ]),
786
851
  _: 1
787
852
  }),
788
- e(_, {
853
+ e(f, {
789
854
  prop: "parentId",
790
855
  label: "上级ID",
791
856
  width: "80",
792
857
  align: "left",
793
858
  "show-overflow-tooltip": ""
794
859
  }),
795
- e(_, {
860
+ e(f, {
796
861
  prop: "relationPath",
797
862
  label: "邀请关系",
798
863
  "min-width": "150",
799
864
  align: "left",
800
865
  "show-overflow-tooltip": ""
801
866
  }),
802
- e(_, {
867
+ e(f, {
803
868
  prop: "blackUnlockTime",
804
869
  label: "黑名单解锁",
805
870
  width: "145",
806
871
  align: "left",
807
872
  "show-overflow-tooltip": ""
808
873
  }),
809
- e(_, {
874
+ e(f, {
810
875
  prop: "lastLoginTime",
811
876
  label: "最后登录时间",
812
877
  width: "145",
813
878
  align: "center",
814
879
  "show-overflow-tooltip": ""
815
880
  }),
816
- e(_, {
881
+ e(f, {
817
882
  prop: "createdTime",
818
883
  label: "创建时间",
819
884
  width: "145",
820
885
  align: "center",
821
886
  "show-overflow-tooltip": ""
822
887
  }),
823
- e(_, {
888
+ e(f, {
824
889
  label: "操作",
825
890
  width: "220",
826
891
  fixed: "right"
827
892
  }, {
828
893
  default: l(() => [
829
- fe
894
+ be
830
895
  ]),
831
896
  _: 1
832
897
  })
@@ -837,85 +902,25 @@ const j = (v, s) => {
837
902
  ]),
838
903
  e(K, {
839
904
  ref_key: "userDetailDialog",
840
- ref: m
905
+ ref: _
841
906
  }, null, 512)
842
907
  ], 64);
843
908
  };
844
909
  }
845
910
  });
846
- const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @__PURE__ */ B({
847
- __name: "UserSelectorComp",
848
- props: {
849
- modelValue: {
850
- required: !0,
851
- type: Number
852
- },
853
- pageSize: {
854
- type: Number,
855
- default: 20
856
- }
857
- },
858
- emits: ["update:modelValue"],
859
- setup(v, { emit: s }) {
860
- const a = v, r = A("http"), m = g(a.modelValue);
861
- q(m, (d) => {
862
- s("update:modelValue", d);
863
- });
864
- const i = g(!1), b = g([]);
865
- let u = null;
866
- function h(d) {
867
- d && (i.value = !0, u && clearTimeout(u), u = setTimeout(() => {
868
- r == null || r.get("/api/user/keyword-search", {
869
- keyword: d,
870
- pageSize: a.pageSize
871
- }).then((I) => {
872
- b.value = I.data;
873
- }).finally(() => {
874
- i.value = !1;
875
- });
876
- }, 200));
877
- }
878
- return (d, I) => {
879
- const C = o("el-option"), _ = o("el-select");
880
- return f(), V(_, {
881
- modelValue: m.value,
882
- "onUpdate:modelValue": I[0] || (I[0] = (y) => m.value = y),
883
- filterable: "",
884
- remote: "",
885
- loading: i.value,
886
- "remote-method": h
887
- }, {
888
- default: l(() => [
889
- (f(!0), U(N, null, O(b.value, (y) => (f(), V(C, {
890
- key: y.id,
891
- value: y.id,
892
- label: `${y.id} / ${y.nickname} / ${y.mobile} / ${y.inviteCode}`
893
- }, {
894
- default: l(() => [
895
- H(d.$slots, "default", { user: y }, () => [
896
- c(w(y.id) + " / " + w(y.nickname) + " / " + w(y.mobile) + " / " + w(y.inviteCode), 1)
897
- ])
898
- ]),
899
- _: 2
900
- }, 1032, ["value", "label"]))), 128))
901
- ]),
902
- _: 3
903
- }, 8, ["modelValue", "loading"]);
904
- };
905
- }
906
- }), ke = /* @__PURE__ */ B({
911
+ const ke = /* @__PURE__ */ j(ge, [["__scopeId", "data-v-391c43be"]]), we = /* @__PURE__ */ B({
907
912
  __name: "BlackListView",
908
- setup(v) {
913
+ setup(m) {
909
914
  const s = A("http"), a = g({
910
915
  userId: null,
911
916
  status: "VALID"
912
917
  }), r = g();
913
- function m() {
918
+ function _() {
914
919
  r.value.search();
915
920
  }
916
921
  function i(h) {
917
922
  s == null || s.post(`/api/user/blacklist/${h}/unlock`).then((d) => {
918
- m();
923
+ _();
919
924
  });
920
925
  }
921
926
  const b = g();
@@ -923,13 +928,13 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
923
928
  b.value.show(h);
924
929
  }
925
930
  return (h, d) => {
926
- const I = o("el-option"), C = o("el-select"), _ = o("el-button"), y = o("el-space"), p = o("el-card"), D = o("el-table-column"), t = o("el-link"), n = o("el-tag"), $ = o("el-popconfirm"), M = o("pg-table");
927
- return f(), U(N, null, [
931
+ const I = o("el-option"), C = o("el-select"), f = o("el-button"), y = o("el-space"), p = o("el-card"), D = o("el-table-column"), t = o("el-link"), n = o("el-tag"), $ = o("el-popconfirm"), M = o("pg-table");
932
+ return v(), U(N, null, [
928
933
  e(p, null, {
929
934
  default: l(() => [
930
935
  e(y, null, {
931
936
  default: l(() => [
932
- e(ge, {
937
+ e(W, {
933
938
  modelValue: a.value.userId,
934
939
  "onUpdate:modelValue": d[0] || (d[0] = (k) => a.value.userId = k),
935
940
  clearable: "",
@@ -954,10 +959,10 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
954
959
  ]),
955
960
  _: 1
956
961
  }, 8, ["modelValue"]),
957
- e(_, {
962
+ e(f, {
958
963
  icon: "search",
959
964
  type: "primary",
960
- onClick: m
965
+ onClick: _
961
966
  }, {
962
967
  default: l(() => [
963
968
  c("搜索")
@@ -1062,13 +1067,13 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
1062
1067
  }),
1063
1068
  e(D, null, {
1064
1069
  default: l(({ row: k }) => [
1065
- k.status == "VALID" ? (f(), V($, {
1070
+ k.status == "VALID" ? (v(), V($, {
1066
1071
  key: 0,
1067
1072
  title: "确定要解锁吗?",
1068
1073
  onConfirm: i
1069
1074
  }, {
1070
1075
  reference: l(() => [
1071
- e(_, {
1076
+ e(f, {
1072
1077
  type: "warning",
1073
1078
  icon: "unlock"
1074
1079
  }, {
@@ -1080,7 +1085,7 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
1080
1085
  ]),
1081
1086
  _: 1
1082
1087
  })) : x("", !0),
1083
- k.status == "VALID" ? (f(), V(_, {
1088
+ k.status == "VALID" ? (v(), V(f, {
1084
1089
  key: 1,
1085
1090
  icon: "edit",
1086
1091
  onClick: (L) => u(k.userId)
@@ -1099,15 +1104,15 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
1099
1104
  e(G, {
1100
1105
  ref_key: "addBlacklistComp",
1101
1106
  ref: b,
1102
- onSuccess: m,
1107
+ onSuccess: _,
1103
1108
  "hidden-entrance-slot": ""
1104
1109
  }, null, 512)
1105
1110
  ], 64);
1106
1111
  };
1107
1112
  }
1108
- }), we = {
1109
- install: (v, s) => {
1110
- let a = s.router, r = a.getRoutes().find((m) => m.path == "/");
1113
+ }), he = {
1114
+ install: (m, s) => {
1115
+ let a = s.router, r = a.getRoutes().find((_) => _.path == "/");
1111
1116
  r && r.meta && a.addRoute({
1112
1117
  path: "/user",
1113
1118
  name: "User",
@@ -1116,27 +1121,28 @@ const be = /* @__PURE__ */ j(ve, [["__scopeId", "data-v-391c43be"]]), ge = /* @_
1116
1121
  children: [{
1117
1122
  path: "list",
1118
1123
  name: "UserList",
1119
- component: be
1124
+ component: ke
1120
1125
  }, {
1121
1126
  path: "blacklist",
1122
1127
  name: "BlackListView",
1123
- component: ke
1128
+ component: we
1124
1129
  }]
1125
1130
  });
1126
1131
  }
1127
- }, he = (v, s) => {
1132
+ }, ye = (m, s) => {
1128
1133
  const a = J();
1129
1134
  if (s.userDetailDialogTabs && s.userDetailDialogTabs.length)
1130
1135
  for (let r of s.userDetailDialogTabs)
1131
1136
  a.userDetailDialogTabs.push(r);
1132
- ce.forEach((r) => v.use(r)), v.use(we, s);
1133
- }, Ie = {
1134
- install: he
1137
+ me.forEach((r) => m.use(r)), m.use(he, s);
1138
+ }, Ce = {
1139
+ install: ye
1135
1140
  };
1136
1141
  export {
1137
- de as UserDetailDialog,
1138
- se as UserMobileComp,
1139
- Ie as default,
1140
- he as install,
1142
+ ce as UserDetailDialog,
1143
+ re as UserMobileComp,
1144
+ pe as UserSelectComp,
1145
+ Ce as default,
1146
+ ye as install,
1141
1147
  J as useUserCoreConfigStore
1142
1148
  };
package/index.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k["pg-user-core"]={},k.Vue,k.pinia,k.common))})(this,function(k,e,A,R){"use strict";const j={key:0,class:"container"},z=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(m){const n=m,o=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function d(){o.value.plainMobile==null&&(o.value.loading=!0,i==null||i.get(`/api/user/${n.userId}/plainmobile`).then(a=>{o.value.plainMobile=a.data,o.value.loading=!1}).finally(()=>{o.value.loading=!1}))}return(a,_)=>{const r=e.resolveComponent("View"),V=e.resolveComponent("el-icon"),c=e.resolveComponent("Loading");return n.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",j,[o.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(n.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.value.plainMobile),1)],64)),o.value.plainMobile==null&&!o.value.loading&&n.userId!=null?(e.openBlock(),e.createBlock(V,{key:2,class:"view-icon",onClick:d},{default:e.withCtx(()=>[e.createVNode(r)]),_:1})):e.createCommentVNode("",!0),o.value.loading?(e.openBlock(),e.createBlock(V,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(c)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),ee="",U=(m,n)=>{const o=m.__vccOpts||m;for(const[i,d]of n)o[i]=d;return o},T=U(z,[["__scopeId","data-v-76c9c9ae"]]),M={install:m=>{m.component("PgUserMobile",T)}},O=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(m){const n=m,o=e.ref({userId:n.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,_=>{_?(o.value.loginTimeStart=_[0],o.value.loginTimeEnd=_[1]):(o.value.loginTimeStart=null,o.value.loginTimeEnd=null)});const d=e.ref();function a(){d.value.search()}return(_,r)=>{const V=e.resolveComponent("el-date-picker"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-table-column"),p=e.resolveComponent("el-tag"),C=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:a},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(C,{ref_key:"historiesTable",ref:d,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:o.value},{columns:e.withCtx(()=>[e.createVNode(h,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:s})=>[s.method==="SMS"?(e.openBlock(),e.createBlock(p,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),s.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(p,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),s.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(p,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),s.method==="PASSWORD"?(e.openBlock(),e.createBlock(p,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(h,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),B=A.defineStore("pg-user-core-config-store",()=>{const m=[];return m.push({name:"登录历史",code:"LOGIN_HISTORY",component:O}),{userDetailDialogTabs:e.computed(()=>m)}}),$=e.defineComponent({__name:"AddBlacklistComp",props:{hiddenEntranceSlot:{type:Boolean,default:!1},userId:{type:Number,required:!0}},emits:["success"],setup(m,{expose:n,emit:o}){const i=m,d=e.inject("http"),a=e.ref(!1);let _=e.ref(null);function r(t){a.value=!0,_.value=t??i.userId,t&&h(_.value)}const V=e.ref({description:[{required:!0,message:"请输入加入黑名单的说明"}],unlockTime:[{required:!0,message:"解锁时间不能为空"}]}),c=e.ref({userId:null,unlockTime:null,permissions:[],description:null}),b=e.ref();function h(t){d==null||d.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then(l=>{var N,x,f,y,D;(N=l.data)!=null&&N.info&&((x=l.data)!=null&&x.info.allowPermissionCodes&&(c.value.permissions=JSON.parse((f=l.data)==null?void 0:f.info.allowPermissionCodes)),c.value.userId=(y=l.data)==null?void 0:y.info.userId,c.value.unlockTime=l.data.info.unlockTime,c.value.description=l.data.info.description),b.value=(D=l.data)==null?void 0:D.permissionCodes})}const p=e.ref();function C(){var t;(t=p.value)==null||t.resetFields()}function s(){var t;(t=p.value)==null||t.validate((l,N)=>{l&&(d==null||d.post(`/api/user/${_.value}/blacklist`,c.value).then(x=>{a.value=!1,o("success")}))})}const w=[{text:"三天",value:()=>{const t=new Date;return t.setDate(t.getDate()+3),t}},{text:"七天",value:()=>{const t=new Date;return t.setDate(t.getDate()+7),t}},{text:"十五天",value:()=>{const t=new Date;return t.setDate(t.getDate()+15),t}},{text:"一个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+1),t}},{text:"三个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+3),t}},{text:"六个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+6),t}},{text:"永久",value:()=>{const t=new Date;return t.setFullYear(t.getFullYear()+100),t}}];return n({show:r}),(t,l)=>{const N=e.resolveComponent("el-button"),x=e.resolveComponent("el-date-picker"),f=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-checkbox"),D=e.resolveComponent("el-checkbox-group"),S=e.resolveComponent("el-input"),I=e.resolveComponent("el-form"),u=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[i.hiddenEntranceSlot?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[e.createVNode(N,{icon:"lock",type:"warning",onClick:l[0]||(l[0]=g=>r())},{default:e.withCtx(()=>[e.createTextVNode("加入黑名单")]),_:1})]),e.createVNode(u,{modelValue:a.value,"onUpdate:modelValue":l[4]||(l[4]=g=>a.value=g),onClosed:C,title:"黑名单管理",width:"500"},{footer:e.withCtx(()=>[e.createVNode(N,{type:"primary",onClick:s},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(I,{ref_key:"form",ref:p,"label-position":"top",rules:V.value,model:c.value},{default:e.withCtx(()=>[e.createVNode(f,{label:"解锁时间",prop:"unlockTime"},{default:e.withCtx(()=>[e.createVNode(x,{type:"datetime",shortcuts:w,modelValue:c.value.unlockTime,"onUpdate:modelValue":l[1]||(l[1]=g=>c.value.unlockTime=g)},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"允许权限",prop:"allowPermissionCodes"},{default:e.withCtx(()=>[e.createVNode(D,{modelValue:c.value.permissions,"onUpdate:modelValue":l[2]||(l[2]=g=>c.value.permissions=g)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(g,F)=>(e.openBlock(),e.createBlock(y,{label:F,key:F},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"描述",prop:"description"},{default:e.withCtx(()=>[e.createVNode(S,{type:"textarea",modelValue:c.value.description,"onUpdate:modelValue":l[3]||(l[3]=g=>c.value.description=g)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])],64)}}}),L=e.defineComponent({__name:"UserDetailDialog",setup(m,{expose:n}){const o=B(),i=e.inject("http"),d=e.ref(!1),a=e.ref(),_=e.ref(),r=e.ref({activeName:o.userDetailDialogTabs[0].code,tabs:[]}),V=e.ref(!1);function c(w,t,l){V.value=!0,b(w),t&&(r.value.activeName=t),r.value.tabs.length=0,r.value.tabs=r.value.tabs.concat(o.userDetailDialogTabs),l&&(r.value.tabs=r.value.tabs.concat(l))}function b(w){i==null||i.get(`/api/user/${w}`).then(t=>{a.value=t.data,V.value=!1,d.value=!0,a.value.inBlacklist&&h(w)})}function h(w){i==null||i.get(`/api/user/${w}/blacklist`).then(t=>{_.value=t.data})}const p=e.ref();function C(){p.value.show(a.value.id)}function s(){a.value=null,_.value=null}return n({show:c}),(w,t)=>{const l=e.resolveComponent("el-descriptions-item"),N=e.resolveComponent("el-tag"),x=e.resolveComponent("el-descriptions"),f=e.resolveComponent("el-tab-pane"),y=e.resolveComponent("el-tabs"),D=e.resolveComponent("el-button"),S=e.resolveComponent("el-dialog"),I=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives((e.openBlock(),e.createBlock(S,{modelValue:d.value,"onUpdate:modelValue":t[1]||(t[1]=u=>d.value=u),title:"用户详情",width:"1300",onClosed:s},{footer:e.withCtx(()=>[e.createVNode(D,{icon:"lock",type:"warning",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"修改":"加入")+"黑名单",1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(x,{border:""},{default:e.withCtx(()=>[e.createVNode(l,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.id),1)]),_:1}),e.createVNode(l,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.nickname),1)]),_:1}),e.createVNode(l,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":a.value.mobile,"user-id":a.value.id,key:a.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(l,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inviteCode),1)]),_:1}),e.createVNode(l,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.touchTime),1)]),_:1}),e.createVNode(l,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.lastLoginTime),1)]),_:1}),e.createVNode(l,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.updatedTime),1)]),_:1}),e.createVNode(l,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.parentId),1)]),_:1}),e.createVNode(l,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(N,{type:a.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(l,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.relationPath),1)]),_:1})]),_:1}),_.value?(e.openBlock(),e.createBlock(x,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(l,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.unlockTime),1)]),_:1}),e.createVNode(l,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.allowPermissionCodes?JSON.parse(_.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(l,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(y,{modelValue:r.value.activeName,"onUpdate:modelValue":t[0]||(t[0]=u=>r.value.activeName=u),key:`usr_tab_${a.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value.tabs,(u,g)=>(e.openBlock(),e.createBlock(f,{label:u.name,name:u.code,key:`user_detail_dialog_${u.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[r.value.activeName==u.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.component),{key:`ud_tab_${u.code}`,userId:a.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))]),_:1},8,["modelValue"])),[[I,V.value]]),e.createVNode($,{ref_key:"addBlacklistComp",ref:p,onSuccess:t[2]||(t[2]=u=>b(a.value.id)),"hidden-entrance-slot":""},null,512)],64)}}}),E={install:m=>{m.component("PgUserDetailDialog",L)}},q=[M,E],Y=m=>(e.pushScopeId("data-v-391c43be"),m=m(),e.popScopeId(),m),H={class:"page-layout"},J={style:{"margin-top":"10px"}},G=Y(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),K=e.defineComponent({__name:"list",setup(m){const n=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),o=e.ref(null);function i(){o.value.search()}const d=e.ref();function a(_){d.value.show(_.id)}return(_,r)=>{const V=e.resolveComponent("el-input"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-card"),p=e.resolveComponent("el-table-column"),C=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",H,[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:n.value.id,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value.id=s),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.parentId,"onUpdate:modelValue":r[1]||(r[1]=s=>n.value.parentId=s),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.phone,"onUpdate:modelValue":r[2]||(r[2]=s=>n.value.phone=s),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.nicekname,"onUpdate:modelValue":r[3]||(r[3]=s=>n.value.nicekname=s),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.inviteCode,"onUpdate:modelValue":r[4]||(r[4]=s=>n.value.inviteCode=s),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",J,[e.createVNode(e.unref(R.PgTable),{ref_key:"userTable",ref:o,"data-url":"/api/user/page",condition:n.value,onRowDbClick:r[5]||(r[5]=s=>a(s))},{columns:e.withCtx(()=>[e.createVNode(p,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(p,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(s=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":s.row.mobile,"user-id":s.row.id,key:s.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(p,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(p,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(p,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(p,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(s=>[e.createVNode(C,{fit:"cover",size:30,src:s.row.avatar,"preview-teleported":"","preview-src-list":[s.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(p,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(p,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(p,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(p,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(p,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(p,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[G]),_:1})]),_:1},8,["condition"])])]),e.createVNode(L,{ref_key:"userDetailDialog",ref:d},null,512)],64)}}}),te="",W=U(K,[["__scopeId","data-v-391c43be"]]),Q=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(m,{emit:n}){const o=m,i=e.inject("http"),d=e.ref(o.modelValue);e.watch(d,c=>{n("update:modelValue",c)});const a=e.ref(!1),_=e.ref([]);let r=null;function V(c){c&&(a.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{i==null||i.get("/api/user/keyword-search",{keyword:c,pageSize:o.pageSize}).then(b=>{_.value=b.data}).finally(()=>{a.value=!1})},200))}return(c,b)=>{const h=e.resolveComponent("el-option"),p=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(p,{modelValue:d.value,"onUpdate:modelValue":b[0]||(b[0]=C=>d.value=C),filterable:"",remote:"",loading:a.value,"remote-method":V},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,C=>(e.openBlock(),e.createBlock(h,{key:C.id,value:C.id,label:`${C.id} / ${C.nickname} / ${C.mobile} / ${C.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default",{user:C},()=>[e.createTextVNode(e.toDisplayString(C.id)+" / "+e.toDisplayString(C.nickname)+" / "+e.toDisplayString(C.mobile)+" / "+e.toDisplayString(C.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),X=e.defineComponent({__name:"BlackListView",setup(m){const n=e.inject("http"),o=e.ref({userId:null,status:"VALID"}),i=e.ref();function d(){i.value.search()}function a(V){n==null||n.post(`/api/user/blacklist/${V}/unlock`).then(c=>{d()})}const _=e.ref();function r(V){_.value.show(V)}return(V,c)=>{const b=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),p=e.resolveComponent("el-button"),C=e.resolveComponent("el-space"),s=e.resolveComponent("el-card"),w=e.resolveComponent("el-table-column"),t=e.resolveComponent("el-link"),l=e.resolveComponent("el-tag"),N=e.resolveComponent("el-popconfirm"),x=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(s,null,{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(Q,{modelValue:o.value.userId,"onUpdate:modelValue":c[0]||(c[0]=f=>o.value.userId=f),clearable:"",style:{width:"300px"}},null,8,["modelValue"]),e.createVNode(h,{placeholder:"状态",modelValue:o.value.status,"onUpdate:modelValue":c[1]||(c[1]=f=>o.value.status=f),clearable:"",style:{width:"100px"}},{default:e.withCtx(()=>[e.createVNode(b,{value:"VALID",label:"有效"}),e.createVNode(b,{value:"INVALID",label:"失效"})]),_:1},8,["modelValue"]),e.createVNode(p,{icon:"search",type:"primary",onClick:d},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createVNode(x,{ref_key:"table",ref:i,"data-url":"/api/user/blacklist",condition:o.value,style:{"margin-top":"10px"}},{columns:e.withCtx(()=>[e.createVNode(w,{label:"ID",prop:"id",width:"100"}),e.createVNode(w,{label:"用户信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"用户ID",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(t,{type:"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.userId),1)]),_:2},1024)]),_:1}),e.createVNode(w,{label:"手机号",width:"150"},{default:e.withCtx(({row:f})=>[e.createVNode(T,{"user-id":f.userId,"mask-mobile":f.userMobile},null,8,["user-id","mask-mobile"])]),_:1}),e.createVNode(w,{label:"用户昵称",prop:"userNickname"})]),_:1}),e.createVNode(w,{label:"限制信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"描述",prop:"description"}),e.createVNode(w,{label:"允许权限",prop:"allowPermissionCodes","show-overflow-tooltip":""}),e.createVNode(w,{label:"状态",prop:"status",align:"center",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(l,{type:f.status=="VALID"?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.status=="VALID"?"有效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(w,{label:"加入时间",prop:"createdTime",width:"170"}),e.createVNode(w,{label:"解锁时间",prop:"unlockTime",width:"170"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(({row:f})=>[f.status=="VALID"?(e.openBlock(),e.createBlock(N,{key:0,title:"确定要解锁吗?",onConfirm:a},{reference:e.withCtx(()=>[e.createVNode(p,{type:"warning",icon:"unlock"},{default:e.withCtx(()=>[e.createTextVNode("解锁")]),_:1})]),_:1})):e.createCommentVNode("",!0),f.status=="VALID"?(e.openBlock(),e.createBlock(p,{key:1,icon:"edit",onClick:y=>r(f.userId)},{default:e.withCtx(()=>[e.createTextVNode("编辑")]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"]),e.createVNode($,{ref_key:"addBlacklistComp",ref:_,onSuccess:d,"hidden-entrance-slot":""},null,512)],64)}}}),Z={install:(m,n)=>{let o=n.router,i=o.getRoutes().find(d=>d.path=="/");i&&i.meta&&o.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:W},{path:"blacklist",name:"BlackListView",component:X}]})}},P=(m,n)=>{const o=B();if(n.userDetailDialogTabs&&n.userDetailDialogTabs.length)for(let i of n.userDetailDialogTabs)o.userDetailDialogTabs.push(i);q.forEach(i=>m.use(i)),m.use(Z,n)},v={install:P};k.UserDetailDialog=E,k.UserMobileComp=M,k.default=v,k.install=P,k.useUserCoreConfigStore=B,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia"),require("@pangu-backend-ui/common")):typeof define=="function"&&define.amd?define(["exports","vue","pinia","@pangu-backend-ui/common"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k["pg-user-core"]={},k.Vue,k.pinia,k.common))})(this,function(k,e,j,z){"use strict";const O={key:0,class:"container"},q=e.defineComponent({__name:"UserMobileComponent",props:{userId:{type:Number,default:null},maskMobile:{type:String,default:null}},setup(d){const n=d,o=e.ref({plainMobile:null,loading:!1}),i=e.inject("http");function p(){o.value.plainMobile==null&&(o.value.loading=!0,i==null||i.get(`/api/user/${n.userId}/plainmobile`).then(a=>{o.value.plainMobile=a.data,o.value.loading=!1}).finally(()=>{o.value.loading=!1}))}return(a,_)=>{const r=e.resolveComponent("View"),V=e.resolveComponent("el-icon"),c=e.resolveComponent("Loading");return n.maskMobile!=null?(e.openBlock(),e.createElementBlock("div",O,[o.value.plainMobile==null?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(n.maskMobile),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.value.plainMobile),1)],64)),o.value.plainMobile==null&&!o.value.loading&&n.userId!=null?(e.openBlock(),e.createBlock(V,{key:2,class:"view-icon",onClick:p},{default:e.withCtx(()=>[e.createVNode(r)]),_:1})):e.createCommentVNode("",!0),o.value.loading?(e.openBlock(),e.createBlock(V,{key:3,class:"is-loading view-icon"},{default:e.withCtx(()=>[e.createVNode(c)]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}}),te="",U=(d,n)=>{const o=d.__vccOpts||d;for(const[i,p]of n)o[i]=p;return o},T=U(q,[["__scopeId","data-v-76c9c9ae"]]),M={install:d=>{d.component("PgUserMobile",T)}},Y=e.defineComponent({__name:"LoginHistory",props:["userId"],setup(d){const n=d,o=e.ref({userId:n.userId,loginTimeStart:null,loginTimeEnd:null}),i=e.ref([]);e.watch(i,_=>{_?(o.value.loginTimeStart=_[0],o.value.loginTimeEnd=_[1]):(o.value.loginTimeStart=null,o.value.loginTimeEnd=null)});const p=e.ref();function a(){p.value.search()}return(_,r)=>{const V=e.resolveComponent("el-date-picker"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-table-column"),m=e.resolveComponent("el-tag"),C=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),type:"datetimerange","range-separator":"-","start-placeholder":"登录开始时间","end-placeholder":"登录结束时间",clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:a},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1}),e.createVNode(C,{ref_key:"historiesTable",ref:p,style:{"margin-top":"10px"},"data-url":"/api/user/login-history",condition:o.value},{columns:e.withCtx(()=>[e.createVNode(h,{prop:"createdTime",label:"登录时间",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"ip",label:"登录IP",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"runtimeName",label:"运行容器",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{label:"登录方式",align:"center","show-overflow-tooltip":""},{default:e.withCtx(({row:s})=>[s.method==="SMS"?(e.openBlock(),e.createBlock(m,{key:0,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("短信登录")]),_:1})):e.createCommentVNode("",!0),s.method==="THIRD_PLATFORM"?(e.openBlock(),e.createBlock(m,{key:1,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("第三方平台")]),_:1})):e.createCommentVNode("",!0),s.method==="UNIVERIFY"?(e.openBlock(),e.createBlock(m,{key:2,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("一键登录")]),_:1})):e.createCommentVNode("",!0),s.method==="PASSWORD"?(e.openBlock(),e.createBlock(m,{key:3,type:"primary",size:"small"},{default:e.withCtx(()=>[e.createTextVNode("帐号密码")]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(h,{prop:"thirdPlatformName",label:"第三方登录",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionCode",label:"版本代码",align:"center","show-overflow-tooltip":""}),e.createVNode(h,{prop:"versionName",label:"版本名称",align:"center","show-overflow-tooltip":""})]),_:1},8,["condition"])],64)}}}),B=j.defineStore("pg-user-core-config-store",()=>{const d=[];return d.push({name:"登录历史",code:"LOGIN_HISTORY",component:Y}),{userDetailDialogTabs:e.computed(()=>d)}}),$=e.defineComponent({__name:"AddBlacklistComp",props:{hiddenEntranceSlot:{type:Boolean,default:!1},userId:{type:Number,required:!0}},emits:["success"],setup(d,{expose:n,emit:o}){const i=d,p=e.inject("http"),a=e.ref(!1);let _=e.ref(null);function r(t){a.value=!0,_.value=t??i.userId,t&&h(_.value)}const V=e.ref({description:[{required:!0,message:"请输入加入黑名单的说明"}],unlockTime:[{required:!0,message:"解锁时间不能为空"}]}),c=e.ref({userId:null,unlockTime:null,permissions:[],description:null}),b=e.ref();function h(t){p==null||p.get(`/api/user/${t}/blacklist-and-all-permission-codes`).then(l=>{var N,x,f,y,D;(N=l.data)!=null&&N.info&&((x=l.data)!=null&&x.info.allowPermissionCodes&&(c.value.permissions=JSON.parse((f=l.data)==null?void 0:f.info.allowPermissionCodes)),c.value.userId=(y=l.data)==null?void 0:y.info.userId,c.value.unlockTime=l.data.info.unlockTime,c.value.description=l.data.info.description),b.value=(D=l.data)==null?void 0:D.permissionCodes})}const m=e.ref();function C(){var t;(t=m.value)==null||t.resetFields()}function s(){var t;(t=m.value)==null||t.validate((l,N)=>{l&&(p==null||p.post(`/api/user/${_.value}/blacklist`,c.value).then(x=>{a.value=!1,o("success")}))})}const w=[{text:"三天",value:()=>{const t=new Date;return t.setDate(t.getDate()+3),t}},{text:"七天",value:()=>{const t=new Date;return t.setDate(t.getDate()+7),t}},{text:"十五天",value:()=>{const t=new Date;return t.setDate(t.getDate()+15),t}},{text:"一个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+1),t}},{text:"三个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+3),t}},{text:"六个月",value:()=>{const t=new Date;return t.setMonth(t.getMonth()+6),t}},{text:"永久",value:()=>{const t=new Date;return t.setFullYear(t.getFullYear()+100),t}}];return n({show:r}),(t,l)=>{const N=e.resolveComponent("el-button"),x=e.resolveComponent("el-date-picker"),f=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-checkbox"),D=e.resolveComponent("el-checkbox-group"),S=e.resolveComponent("el-input"),I=e.resolveComponent("el-form"),u=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock(e.Fragment,null,[i.hiddenEntranceSlot?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[e.createVNode(N,{icon:"lock",type:"warning",onClick:l[0]||(l[0]=g=>r())},{default:e.withCtx(()=>[e.createTextVNode("加入黑名单")]),_:1})]),e.createVNode(u,{modelValue:a.value,"onUpdate:modelValue":l[4]||(l[4]=g=>a.value=g),onClosed:C,title:"黑名单管理",width:"500"},{footer:e.withCtx(()=>[e.createVNode(N,{type:"primary",onClick:s},{default:e.withCtx(()=>[e.createTextVNode("提交")]),_:1})]),default:e.withCtx(()=>[e.createVNode(I,{ref_key:"form",ref:m,"label-position":"top",rules:V.value,model:c.value},{default:e.withCtx(()=>[e.createVNode(f,{label:"解锁时间",prop:"unlockTime"},{default:e.withCtx(()=>[e.createVNode(x,{type:"datetime",shortcuts:w,modelValue:c.value.unlockTime,"onUpdate:modelValue":l[1]||(l[1]=g=>c.value.unlockTime=g)},null,8,["modelValue"])]),_:1}),e.createVNode(f,{label:"允许权限",prop:"allowPermissionCodes"},{default:e.withCtx(()=>[e.createVNode(D,{modelValue:c.value.permissions,"onUpdate:modelValue":l[2]||(l[2]=g=>c.value.permissions=g)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(g,R)=>(e.openBlock(),e.createBlock(y,{label:R,key:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e.createVNode(f,{label:"描述",prop:"description"},{default:e.withCtx(()=>[e.createVNode(S,{type:"textarea",modelValue:c.value.description,"onUpdate:modelValue":l[3]||(l[3]=g=>c.value.description=g)},null,8,["modelValue"])]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["modelValue"])],64)}}}),L=e.defineComponent({__name:"UserDetailDialog",setup(d,{expose:n}){const o=B(),i=e.inject("http"),p=e.ref(!1),a=e.ref(),_=e.ref(),r=e.ref({activeName:o.userDetailDialogTabs[0].code,tabs:[]}),V=e.ref(!1);function c(w,t,l){V.value=!0,b(w),t&&(r.value.activeName=t),r.value.tabs.length=0,r.value.tabs=r.value.tabs.concat(o.userDetailDialogTabs),l&&(r.value.tabs=r.value.tabs.concat(l))}function b(w){i==null||i.get(`/api/user/${w}`).then(t=>{a.value=t.data,V.value=!1,p.value=!0,a.value.inBlacklist&&h(w)})}function h(w){i==null||i.get(`/api/user/${w}/blacklist`).then(t=>{_.value=t.data})}const m=e.ref();function C(){m.value.show(a.value.id)}function s(){a.value=null,_.value=null}return n({show:c}),(w,t)=>{const l=e.resolveComponent("el-descriptions-item"),N=e.resolveComponent("el-tag"),x=e.resolveComponent("el-descriptions"),f=e.resolveComponent("el-tab-pane"),y=e.resolveComponent("el-tabs"),D=e.resolveComponent("el-button"),S=e.resolveComponent("el-dialog"),I=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives((e.openBlock(),e.createBlock(S,{modelValue:p.value,"onUpdate:modelValue":t[1]||(t[1]=u=>p.value=u),title:"用户详情",width:"1300",onClosed:s},{footer:e.withCtx(()=>[e.createVNode(D,{icon:"lock",type:"warning",onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"修改":"加入")+"黑名单",1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(x,{border:""},{default:e.withCtx(()=>[e.createVNode(l,{label:"用户编号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.id),1)]),_:1}),e.createVNode(l,{label:"用户昵称"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.nickname),1)]),_:1}),e.createVNode(l,{label:"手机号码"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":a.value.mobile,"user-id":a.value.id,key:a.value.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(l,{label:"邀请编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inviteCode),1)]),_:1}),e.createVNode(l,{label:"活动时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.touchTime),1)]),_:1}),e.createVNode(l,{label:"注册时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"最后登陆"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.lastLoginTime),1)]),_:1}),e.createVNode(l,{label:"最后更新"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.updatedTime),1)]),_:1}),e.createVNode(l,{label:"上级用户"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.parentId),1)]),_:1}),e.createVNode(l,{label:"黑名单"},{default:e.withCtx(()=>[e.createVNode(N,{type:a.value.inBlacklist?"danger":"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.inBlacklist?"是":"否"),1)]),_:1},8,["type"])]),_:1}),e.createVNode(l,{label:"邀请关系"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.relationPath),1)]),_:1})]),_:1}),_.value?(e.openBlock(),e.createBlock(x,{key:0,style:{"margin-top":"10px"},border:"",column:"2"},{default:e.withCtx(()=>[e.createVNode(l,{label:"黑名单解锁时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.unlockTime),1)]),_:1}),e.createVNode(l,{label:"加入时间"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.createdTime),1)]),_:1}),e.createVNode(l,{label:"允许权限"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.allowPermissionCodes?JSON.parse(_.value.allowPermissionCodes).join(", "):""),1)]),_:1}),e.createVNode(l,{label:"描述"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.value.description),1)]),_:1})]),_:1})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(y,{modelValue:r.value.activeName,"onUpdate:modelValue":t[0]||(t[0]=u=>r.value.activeName=u),key:`usr_tab_${a.value.id}`,style:{"margin-top":"10px"},type:"border-card"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value.tabs,(u,g)=>(e.openBlock(),e.createBlock(f,{label:u.name,name:u.code,key:`user_detail_dialog_${u.code}`},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[r.value.activeName==u.code?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.component),{key:`ud_tab_${u.code}`,userId:a.value.id},null,8,["userId"])):e.createCommentVNode("",!0)],1024))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"]))]),_:1},8,["modelValue"])),[[I,V.value]]),e.createVNode($,{ref_key:"addBlacklistComp",ref:m,onSuccess:t[2]||(t[2]=u=>b(a.value.id)),"hidden-entrance-slot":""},null,512)],64)}}}),E={install:d=>{d.component("PgUserDetailDialog",L)}},P=e.defineComponent({__name:"UserSelectorComp",props:{modelValue:{required:!0,type:Number},pageSize:{type:Number,default:20}},emits:["update:modelValue"],setup(d,{emit:n}){const o=d,i=e.inject("http"),p=e.ref(o.modelValue);e.watch(p,c=>{n("update:modelValue",c)});const a=e.ref(!1),_=e.ref([]);let r=null;function V(c){c&&(a.value=!0,r&&clearTimeout(r),r=setTimeout(()=>{i==null||i.get("/api/user/keyword-search",{keyword:c,pageSize:o.pageSize}).then(b=>{_.value=b.data}).finally(()=>{a.value=!1})},200))}return(c,b)=>{const h=e.resolveComponent("el-option"),m=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(m,{modelValue:p.value,"onUpdate:modelValue":b[0]||(b[0]=C=>p.value=C),filterable:"",remote:"",loading:a.value,"remote-method":V},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,C=>(e.openBlock(),e.createBlock(h,{key:C.id,value:C.id,label:`${C.id} / ${C.nickname} / ${C.mobile} / ${C.inviteCode}`},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default",{user:C},()=>[e.createTextVNode(e.toDisplayString(C.id)+" / "+e.toDisplayString(C.nickname)+" / "+e.toDisplayString(C.mobile)+" / "+e.toDisplayString(C.inviteCode),1)])]),_:2},1032,["value","label"]))),128))]),_:3},8,["modelValue","loading"])}}}),F={install:d=>{d.component("PgUserSelector",P)}},H=[M,E,F],J=d=>(e.pushScopeId("data-v-391c43be"),d=d(),e.popScopeId(),d),G={class:"page-layout"},K={style:{"margin-top":"10px"}},W=J(()=>e.createElementVNode("template",{"slot-scope":"{row}"},null,-1)),Q=e.defineComponent({__name:"list",setup(d){const n=e.ref({id:null,parentId:null,phone:null,nicekname:null,inviteCode:null}),o=e.ref(null);function i(){o.value.search()}const p=e.ref();function a(_){p.value.show(_.id)}return(_,r)=>{const V=e.resolveComponent("el-input"),c=e.resolveComponent("el-button"),b=e.resolveComponent("el-space"),h=e.resolveComponent("el-card"),m=e.resolveComponent("el-table-column"),C=e.resolveComponent("el-image");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",G,[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,{modelValue:n.value.id,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value.id=s),placeholder:"ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.parentId,"onUpdate:modelValue":r[1]||(r[1]=s=>n.value.parentId=s),placeholder:"父用户ID",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.phone,"onUpdate:modelValue":r[2]||(r[2]=s=>n.value.phone=s),placeholder:"手机号",style:{width:"120px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.nicekname,"onUpdate:modelValue":r[3]||(r[3]=s=>n.value.nicekname=s),placeholder:"昵称",style:{width:"150px"},clearable:""},null,8,["modelValue"]),e.createVNode(V,{modelValue:n.value.inviteCode,"onUpdate:modelValue":r[4]||(r[4]=s=>n.value.inviteCode=s),placeholder:"邀请码",style:{width:"100px"},clearable:""},null,8,["modelValue"]),e.createVNode(c,{type:"primary",icon:"search",onClick:i},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createElementVNode("div",K,[e.createVNode(e.unref(z.PgTable),{ref_key:"userTable",ref:o,"data-url":"/api/user/page",condition:n.value,onRowDbClick:r[5]||(r[5]=s=>a(s))},{columns:e.withCtx(()=>[e.createVNode(m,{prop:"id",label:"UID",width:"80",align:"center"}),e.createVNode(m,{prop:"mobile",label:"手机",width:"115",align:"left","show-overflow-tooltip":""},{default:e.withCtx(s=>[(e.openBlock(),e.createBlock(T,{"mask-mobile":s.row.mobile,"user-id":s.row.id,key:s.row.id},null,8,["mask-mobile","user-id"]))]),_:1}),e.createVNode(m,{prop:"username",label:"用户名",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"nickname",label:"昵称",width:"110",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"inviteCode",label:"邀请码",width:"90",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"avatar",label:"头像",width:"60",align:"center","show-overflow-tooltip":""},{default:e.withCtx(s=>[e.createVNode(C,{fit:"cover",size:30,src:s.row.avatar,"preview-teleported":"","preview-src-list":[s.row.avatar]},null,8,["src","preview-src-list"])]),_:1}),e.createVNode(m,{prop:"parentId",label:"上级ID",width:"80",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"relationPath",label:"邀请关系","min-width":"150",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"blackUnlockTime",label:"黑名单解锁",width:"145",align:"left","show-overflow-tooltip":""}),e.createVNode(m,{prop:"lastLoginTime",label:"最后登录时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{prop:"createdTime",label:"创建时间",width:"145",align:"center","show-overflow-tooltip":""}),e.createVNode(m,{label:"操作",width:"220",fixed:"right"},{default:e.withCtx(()=>[W]),_:1})]),_:1},8,["condition"])])]),e.createVNode(L,{ref_key:"userDetailDialog",ref:p},null,512)],64)}}}),oe="",X=U(Q,[["__scopeId","data-v-391c43be"]]),Z=e.defineComponent({__name:"BlackListView",setup(d){const n=e.inject("http"),o=e.ref({userId:null,status:"VALID"}),i=e.ref();function p(){i.value.search()}function a(V){n==null||n.post(`/api/user/blacklist/${V}/unlock`).then(c=>{p()})}const _=e.ref();function r(V){_.value.show(V)}return(V,c)=>{const b=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),m=e.resolveComponent("el-button"),C=e.resolveComponent("el-space"),s=e.resolveComponent("el-card"),w=e.resolveComponent("el-table-column"),t=e.resolveComponent("el-link"),l=e.resolveComponent("el-tag"),N=e.resolveComponent("el-popconfirm"),x=e.resolveComponent("pg-table");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(s,null,{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(P,{modelValue:o.value.userId,"onUpdate:modelValue":c[0]||(c[0]=f=>o.value.userId=f),clearable:"",style:{width:"300px"}},null,8,["modelValue"]),e.createVNode(h,{placeholder:"状态",modelValue:o.value.status,"onUpdate:modelValue":c[1]||(c[1]=f=>o.value.status=f),clearable:"",style:{width:"100px"}},{default:e.withCtx(()=>[e.createVNode(b,{value:"VALID",label:"有效"}),e.createVNode(b,{value:"INVALID",label:"失效"})]),_:1},8,["modelValue"]),e.createVNode(m,{icon:"search",type:"primary",onClick:p},{default:e.withCtx(()=>[e.createTextVNode("搜索")]),_:1})]),_:1})]),_:1}),e.createVNode(x,{ref_key:"table",ref:i,"data-url":"/api/user/blacklist",condition:o.value,style:{"margin-top":"10px"}},{columns:e.withCtx(()=>[e.createVNode(w,{label:"ID",prop:"id",width:"100"}),e.createVNode(w,{label:"用户信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"用户ID",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(t,{type:"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.userId),1)]),_:2},1024)]),_:1}),e.createVNode(w,{label:"手机号",width:"150"},{default:e.withCtx(({row:f})=>[e.createVNode(T,{"user-id":f.userId,"mask-mobile":f.userMobile},null,8,["user-id","mask-mobile"])]),_:1}),e.createVNode(w,{label:"用户昵称",prop:"userNickname"})]),_:1}),e.createVNode(w,{label:"限制信息"},{default:e.withCtx(()=>[e.createVNode(w,{label:"描述",prop:"description"}),e.createVNode(w,{label:"允许权限",prop:"allowPermissionCodes","show-overflow-tooltip":""}),e.createVNode(w,{label:"状态",prop:"status",align:"center",width:"100"},{default:e.withCtx(({row:f})=>[e.createVNode(l,{type:f.status=="VALID"?"success":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.status=="VALID"?"有效":"失效"),1)]),_:2},1032,["type"])]),_:1}),e.createVNode(w,{label:"加入时间",prop:"createdTime",width:"170"}),e.createVNode(w,{label:"解锁时间",prop:"unlockTime",width:"170"})]),_:1}),e.createVNode(w,null,{default:e.withCtx(({row:f})=>[f.status=="VALID"?(e.openBlock(),e.createBlock(N,{key:0,title:"确定要解锁吗?",onConfirm:a},{reference:e.withCtx(()=>[e.createVNode(m,{type:"warning",icon:"unlock"},{default:e.withCtx(()=>[e.createTextVNode("解锁")]),_:1})]),_:1})):e.createCommentVNode("",!0),f.status=="VALID"?(e.openBlock(),e.createBlock(m,{key:1,icon:"edit",onClick:y=>r(f.userId)},{default:e.withCtx(()=>[e.createTextVNode("编辑")]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["condition"]),e.createVNode($,{ref_key:"addBlacklistComp",ref:_,onSuccess:p,"hidden-entrance-slot":""},null,512)],64)}}}),v={install:(d,n)=>{let o=n.router,i=o.getRoutes().find(p=>p.path=="/");i&&i.meta&&o.addRoute({path:"/user",name:"User",redirect:"/user/list",component:i.meta.commonLayout,children:[{path:"list",name:"UserList",component:X},{path:"blacklist",name:"BlackListView",component:Z}]})}},A=(d,n)=>{const o=B();if(n.userDetailDialogTabs&&n.userDetailDialogTabs.length)for(let i of n.userDetailDialogTabs)o.userDetailDialogTabs.push(i);H.forEach(i=>d.use(i)),d.use(v,n)},ee={install:A};k.UserDetailDialog=E,k.UserMobileComp=M,k.UserSelectComp=F,k.default=ee,k.install=A,k.useUserCoreConfigStore=B,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pangu-backend-ui/user-core",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "unpkg": "index.umd.cjs",
@@ -0,0 +1,6 @@
1
+ import { App } from "vue";
2
+ export * from './UserSelectorComp.vue';
3
+ declare const _default: {
4
+ install: (app: App) => void;
5
+ };
6
+ export default _default;
@@ -1,7 +1,8 @@
1
1
  import UserMobileComp from './UserMobile';
2
2
  import UserDetailDialog from './UserDetail';
3
+ import UserSelectComp from './UserSelector';
3
4
  declare const _default: {
4
5
  install: (app: import("vue").App<any>) => void;
5
6
  }[];
6
7
  export default _default;
7
- export { UserMobileComp, UserDetailDialog };
8
+ export { UserMobileComp, UserDetailDialog, UserSelectComp };