mgacn-commonsdk 1.0.2 → 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,8 +1,8 @@
1
- import { Plus as Ve, Delete as Oe, CircleCloseFilled as Ae } from "@element-plus/icons-vue";
2
- import { ElMessage as te, ElMessageBox as Re } from "element-plus";
3
- import Fe from "cropperjs";
4
- import He from "ali-oss";
5
- import { resolveComponent as N, openBlock as m, createElementBlock as b, createElementVNode as _, toDisplayString as D, createCommentVNode as F, createTextVNode as $, Fragment as P, renderList as Y, normalizeStyle as X, normalizeClass as V, createVNode as v, withCtx as S, withModifiers as Ee, withDirectives as j, vShow as z, ref as L, watch as W, onMounted as ie, createBlock as T, reactive as fe, computed as ve, nextTick as G, onBeforeUnmount as _e, withKeys as Pe, renderSlot as Q, resolveDynamicComponent as Ie, mergeProps as me, createSlots as Be } from "vue";
1
+ import { Plus as Oe, Delete as Ae, CircleCloseFilled as Re } from "@element-plus/icons-vue";
2
+ import { ElMessage as te, ElMessageBox as Fe } from "element-plus";
3
+ import He from "cropperjs";
4
+ import * as fe from "ali-oss";
5
+ import { resolveComponent as N, openBlock as m, createElementBlock as b, createElementVNode as _, toDisplayString as D, createCommentVNode as F, createTextVNode as $, Fragment as P, renderList as Y, normalizeStyle as X, normalizeClass as V, createVNode as v, withCtx as S, withModifiers as Ee, withDirectives as j, vShow as z, ref as L, watch as W, onMounted as ie, createBlock as T, reactive as me, computed as _e, nextTick as G, onBeforeUnmount as we, withKeys as Pe, renderSlot as Q, resolveDynamicComponent as Ie, mergeProps as ge, createSlots as Be } from "vue";
6
6
  import Ye from "axios";
7
7
  function je(e) {
8
8
  if (!e)
@@ -22,24 +22,25 @@ function je(e) {
22
22
  }
23
23
  };
24
24
  }
25
- const we = "__MGACN_COMMONSDK_API__";
25
+ const ke = "__MGACN_COMMONSDK_API__";
26
26
  function ze(e) {
27
- globalThis[we] = e;
27
+ globalThis[ke] = e;
28
28
  }
29
29
  function Ke() {
30
- const e = globalThis[we];
30
+ const e = globalThis[ke];
31
31
  if (!e)
32
32
  throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
33
33
  return e;
34
34
  }
35
- function ge(e) {
35
+ const qe = fe.default ?? fe;
36
+ function he(e) {
36
37
  return String(e).padStart(2, "0");
37
38
  }
38
- function qe() {
39
+ function We() {
39
40
  const e = /* @__PURE__ */ new Date();
40
- return `${e.getFullYear()}${ge(e.getMonth() + 1)}${ge(e.getDate())}`;
41
+ return `${e.getFullYear()}${he(e.getMonth() + 1)}${he(e.getDate())}`;
41
42
  }
42
- function ke(e = 10) {
43
+ function Ce(e = 10) {
43
44
  const n = "0123456789abcdefghijklmnopqrstuvwxyz";
44
45
  let t = "";
45
46
  for (let r = 0; r < e; r++)
@@ -47,16 +48,16 @@ function ke(e = 10) {
47
48
  return t;
48
49
  }
49
50
  function ue(e = "portal_cms") {
50
- return `${e}/${qe()}/`;
51
+ return `${e}/${We()}/`;
51
52
  }
52
- function Ce(e) {
53
+ function Se(e) {
53
54
  return Ke().getOssSts(e);
54
55
  }
55
- async function Se(e = {}) {
56
- const { dir: n, foldName: t, getOss: r, ossinfo: l } = e, o = n || ue(t || "portal_cms"), i = l || (typeof r == "function" ? await r(o) : await Ce(o));
56
+ async function xe(e = {}) {
57
+ const { dir: n, foldName: t, getOss: r, ossinfo: l } = e, o = n || ue(t || "portal_cms"), i = l || (typeof r == "function" ? await r(o) : await Se(o));
57
58
  if (!i)
58
59
  throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败");
59
- const g = new He({
60
+ const g = new qe({
60
61
  bucket: i.bucketName,
61
62
  accessKeyId: i.accessKeyId,
62
63
  accessKeySecret: i.accessKeySecret,
@@ -66,15 +67,15 @@ async function Se(e = {}) {
66
67
  });
67
68
  return g.options.ossUrl = i.ossUrl || i.domain || (i.bucketName && i.endPoint ? `https://${i.bucketName}.${i.endPoint}` : ""), g.options.uploadDir = o, g;
68
69
  }
69
- async function We(e = {}) {
70
+ async function Ge(e = {}) {
70
71
  const { client: n, file: t, dir: r, foldName: l, fileName: o, onProgress: i } = e;
71
72
  if (!t)
72
73
  throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
73
- const g = n || await Se({ dir: r, foldName: l }), k = r || g.options.uploadDir || ue(l);
74
+ const g = n || await xe({ dir: r, foldName: l }), k = r || g.options.uploadDir || ue(l);
74
75
  let u = o;
75
76
  if (!u) {
76
77
  const h = t.name || "file", c = h.indexOf("."), x = c > -1 ? h.slice(c) : "";
77
- u = `${k}${ke(10)}${x}`;
78
+ u = `${k}${Ce(10)}${x}`;
78
79
  }
79
80
  const p = await g.multipartUpload(u, t, {
80
81
  progress: (h) => {
@@ -86,17 +87,17 @@ async function We(e = {}) {
86
87
  const w = (g.options.ossUrl || "").replace(/\/$/, ""), d = w ? `${w}/${u}` : u;
87
88
  return { name: u, url: d, raw: p, client: g };
88
89
  }
89
- const Ge = {
90
+ const Qe = {
90
91
  methods: {
91
92
  getDir() {
92
93
  return ue(this.foldName || "portal_cms");
93
94
  },
94
- randomString: ke,
95
+ randomString: Ce,
95
96
  getOss() {
96
- return Ce(this.getDir());
97
+ return Se(this.getDir());
97
98
  },
98
99
  async createOssClient() {
99
- return Se({
100
+ return xe({
100
101
  dir: this.getDir(),
101
102
  getOss: () => this.getOss()
102
103
  });
@@ -108,30 +109,30 @@ const Ge = {
108
109
  t[r] = l;
109
110
  return t;
110
111
  };
111
- let he = 0;
112
- function xe() {
113
- return he += 1, `mg-img-${Date.now()}-${he}`;
112
+ let ye = 0;
113
+ function Ne() {
114
+ return ye += 1, `mg-img-${Date.now()}-${ye}`;
114
115
  }
115
- function Qe(e) {
116
+ function Xe(e) {
116
117
  return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
117
118
  }
118
- function ye(e) {
119
+ function be(e) {
119
120
  return e.map((n) => ({
120
- uid: xe(),
121
+ uid: Ne(),
121
122
  url: n,
122
123
  status: "success",
123
124
  percent: 100,
124
125
  previewUrl: ""
125
126
  }));
126
127
  }
127
- function Xe(e = "") {
128
+ function Je(e = "") {
128
129
  const n = e.lastIndexOf(".");
129
130
  return n > -1 ? e.slice(n + 1).toLowerCase() : "";
130
131
  }
131
- const Je = {
132
+ const Ze = {
132
133
  name: "MgImageUpload",
133
- mixins: [Ge],
134
- components: { CircleCloseFilled: Ae, Delete: Oe, Plus: Ve },
134
+ mixins: [Qe],
135
+ components: { CircleCloseFilled: Re, Delete: Ae, Plus: Oe },
135
136
  props: {
136
137
  /** v-model 统一为 string[];入参兼容 string / string[] */
137
138
  modelValue: { type: [Array, String], default: () => [] },
@@ -194,7 +195,7 @@ const Je = {
194
195
  deep: !0,
195
196
  immediate: !0,
196
197
  handler(e) {
197
- e != null && e.length && this.replaceList(ye(e));
198
+ e != null && e.length && this.replaceList(be(e));
198
199
  }
199
200
  },
200
201
  modelValue: {
@@ -202,8 +203,8 @@ const Je = {
202
203
  handler(e) {
203
204
  var r;
204
205
  if ((r = this.initFileList) != null && r.length) return;
205
- const n = Qe(e), t = this.successUrls;
206
- n.length === t.length && n.every((l, o) => l === t[o]) || this.replaceList(ye(n));
206
+ const n = Xe(e), t = this.successUrls;
207
+ n.length === t.length && n.every((l, o) => l === t[o]) || this.replaceList(be(n));
207
208
  }
208
209
  },
209
210
  cropImageUrl(e) {
@@ -254,10 +255,10 @@ const Je = {
254
255
  }
255
256
  const r = [], l = [];
256
257
  if (n.forEach((o) => {
257
- this.acceptList.includes(Xe(o.name)) ? r.push(o) : l.push(o);
258
+ this.acceptList.includes(Je(o.name)) ? r.push(o) : l.push(o);
258
259
  }), l.length) {
259
260
  const o = l.map((i) => i.name).join(",");
260
- Re.confirm(
261
+ Fe.confirm(
261
262
  `已过滤以下 ${l.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${o}</p><br/>只接受:${this.acceptList.join("/")}`,
262
263
  "提示",
263
264
  {
@@ -293,7 +294,7 @@ const Je = {
293
294
  return;
294
295
  }
295
296
  const l = URL.createObjectURL(r), o = {
296
- uid: xe(),
297
+ uid: Ne(),
297
298
  url: l,
298
299
  previewUrl: l,
299
300
  status: "uploading",
@@ -305,7 +306,7 @@ const Je = {
305
306
  },
306
307
  async uploadOne(e) {
307
308
  try {
308
- const n = await We({
309
+ const n = await Ge({
309
310
  file: e.raw,
310
311
  dir: this.getDir(),
311
312
  onProgress: (t) => {
@@ -321,7 +322,7 @@ const Je = {
321
322
  },
322
323
  initCropper() {
323
324
  const e = this.$refs.cropImage;
324
- e && (this.cropper = new Fe(e, {
325
+ e && (this.cropper = new He(e, {
325
326
  aspectRatio: this.aspectRatio,
326
327
  autoCropArea: 0.8,
327
328
  viewMode: 1,
@@ -365,19 +366,19 @@ const Je = {
365
366
  !n || n.status === "uploading" || (this.revokePreview(n), this.fileList.splice(e, 1), this.emitFile());
366
367
  }
367
368
  }
368
- }, Ze = { class: "upload-image-cropper" }, et = ["multiple", "accept"], tt = {
369
+ }, et = { class: "upload-image-cropper" }, tt = ["multiple", "accept"], nt = {
369
370
  key: 0,
370
371
  class: "grey-tips"
371
- }, nt = { key: 0 }, lt = { class: "list-box" }, at = {
372
+ }, lt = { key: 0 }, at = { class: "list-box" }, rt = {
372
373
  key: 0,
373
374
  class: "status-mask is-uploading"
374
- }, rt = { class: "progress-wrap" }, ot = { class: "percent-text" }, st = {
375
+ }, ot = { class: "progress-wrap" }, st = { class: "percent-text" }, it = {
375
376
  key: 1,
376
377
  class: "status-mask is-fail"
377
- }, it = ["onClick"], ut = { class: "cropper-box" }, ct = ["src"], dt = { class: "btn-box" }, pt = { class: "btn-box" };
378
- function ft(e, n, t, r, l, o) {
378
+ }, ut = ["onClick"], ct = { class: "cropper-box" }, dt = ["src"], pt = { class: "btn-box" }, ft = { class: "btn-box" };
379
+ function mt(e, n, t, r, l, o) {
379
380
  const i = N("el-image"), g = N("el-progress"), k = N("CircleCloseFilled"), u = N("el-icon"), p = N("Delete"), w = N("Plus"), d = N("el-button"), h = N("el-dialog");
380
- return m(), b("div", Ze, [
381
+ return m(), b("div", et, [
381
382
  _("input", {
382
383
  ref: "fileInput",
383
384
  type: "file",
@@ -385,12 +386,12 @@ function ft(e, n, t, r, l, o) {
385
386
  multiple: o.multiple,
386
387
  accept: t.accept,
387
388
  onChange: n[0] || (n[0] = (...c) => o.onFileChange && o.onFileChange(...c))
388
- }, null, 40, et),
389
- t.greyTips ? (m(), b("div", tt, [
390
- t.otherTips ? (m(), b("div", nt, D(t.otherTips), 1)) : F("", !0),
389
+ }, null, 40, tt),
390
+ t.greyTips ? (m(), b("div", nt, [
391
+ t.otherTips ? (m(), b("div", lt, D(t.otherTips), 1)) : F("", !0),
391
392
  $(" " + D(t.greyTips), 1)
392
393
  ])) : F("", !0),
393
- _("div", lt, [
394
+ _("div", at, [
394
395
  (m(!0), b(P, null, Y(l.fileList, (c, x) => (m(), b("div", {
395
396
  key: c.uid,
396
397
  class: V(["image-box", [`is-${c.status}`]]),
@@ -401,8 +402,8 @@ function ft(e, n, t, r, l, o) {
401
402
  fit: "cover",
402
403
  class: "img"
403
404
  }, null, 8, ["src"]),
404
- c.status === "uploading" ? (m(), b("div", at, [
405
- _("div", rt, [
405
+ c.status === "uploading" ? (m(), b("div", rt, [
406
+ _("div", ot, [
406
407
  v(g, {
407
408
  type: "circle",
408
409
  percentage: c.percent,
@@ -411,9 +412,9 @@ function ft(e, n, t, r, l, o) {
411
412
  "show-text": !1,
412
413
  color: "var(--mg-primary, #ff5722)"
413
414
  }, null, 8, ["percentage"]),
414
- _("span", ot, D(c.percent) + "%", 1)
415
+ _("span", st, D(c.percent) + "%", 1)
415
416
  ])
416
- ])) : c.status === "fail" ? (m(), b("div", st, [
417
+ ])) : c.status === "fail" ? (m(), b("div", it, [
417
418
  v(u, {
418
419
  class: "fail-icon",
419
420
  size: 16
@@ -449,7 +450,7 @@ function ft(e, n, t, r, l, o) {
449
450
  ]),
450
451
  _: 1
451
452
  })
452
- ], 8, it))
453
+ ], 8, ut))
453
454
  ], 6))), 128)),
454
455
  j(_("div", {
455
456
  class: "image-box upload-btn",
@@ -481,16 +482,16 @@ function ft(e, n, t, r, l, o) {
481
482
  onClose: o.handleBack
482
483
  }, {
483
484
  default: S(() => [
484
- _("div", ut, [
485
+ _("div", ct, [
485
486
  j(_("img", {
486
487
  ref: "cropImage",
487
488
  src: l.cropImageUrl,
488
489
  class: "cropper-img"
489
- }, null, 8, ct), [
490
+ }, null, 8, dt), [
490
491
  [z, l.cropImageUrl]
491
492
  ])
492
493
  ]),
493
- _("div", dt, [
494
+ _("div", pt, [
494
495
  t.isDegree ? (m(), b(P, { key: 0 }, [
495
496
  v(d, {
496
497
  onClick: n[2] || (n[2] = (c) => o.rotate(-t.degree))
@@ -519,7 +520,7 @@ function ft(e, n, t, r, l, o) {
519
520
  _: 1
520
521
  }, 8, ["onClick"])
521
522
  ]),
522
- _("div", pt, [
523
+ _("div", ft, [
523
524
  v(d, { onClick: o.handleBack }, {
524
525
  default: S(() => [...n[9] || (n[9] = [
525
526
  $("取 消", -1)
@@ -541,7 +542,7 @@ function ft(e, n, t, r, l, o) {
541
542
  }, 8, ["modelValue", "onClose"])
542
543
  ]);
543
544
  }
544
- const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986"]]), gt = {
545
+ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986"]]), ht = {
545
546
  __name: "DateRangePicker",
546
547
  props: {
547
548
  start: {
@@ -597,22 +598,22 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
597
598
  }, null, 8, ["modelValue", "type", "start-placeholder", "value-format", "default-time", "clearable"]);
598
599
  };
599
600
  }
600
- }, Ne = /* @__PURE__ */ K(gt, [["__scopeId", "data-v-47618fba"]]), ht = { class: "common-search__body" }, yt = { class: "common-search__fields-wrap" }, bt = {
601
+ }, Ue = /* @__PURE__ */ K(ht, [["__scopeId", "data-v-47618fba"]]), yt = { class: "common-search__body" }, bt = { class: "common-search__fields-wrap" }, vt = {
601
602
  key: 0,
602
603
  class: "common-search__label"
603
- }, vt = {
604
+ }, _t = {
604
605
  key: 4,
605
606
  class: "common-search__range"
606
- }, _t = { class: "common-search__range-sep" }, wt = {
607
+ }, wt = { class: "common-search__range-sep" }, kt = {
607
608
  key: 6,
608
609
  class: "common-search__range"
609
- }, kt = {
610
+ }, Ct = {
610
611
  key: 0,
611
612
  class: "common-search__actions is-inline"
612
- }, Ct = {
613
+ }, St = {
613
614
  key: 0,
614
615
  class: "common-search__footer"
615
- }, St = { class: "common-search__actions is-bottom" }, xt = { class: "common-search__actions-main" }, Nt = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
616
+ }, xt = { class: "common-search__actions is-bottom" }, Nt = { class: "common-search__actions-main" }, Ut = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
616
617
  __name: "SearchForm",
617
618
  props: {
618
619
  modelValue: { type: Object, default: () => ({}) },
@@ -621,14 +622,14 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
621
622
  },
622
623
  emits: ["change", "search", "reset", "update:modelValue"],
623
624
  setup(e, { emit: n }) {
624
- const t = e, r = n, l = L({}), o = fe({}), i = fe({});
625
+ const t = e, r = n, l = L({}), o = me({}), i = me({});
625
626
  let g = !1;
626
627
  function k(s, f) {
627
628
  return JSON.stringify(s ?? {}) === JSON.stringify(f ?? {});
628
629
  }
629
630
  const u = L(null), p = L(!1), w = L(!1), d = L(0), h = L(0), c = L(null);
630
631
  let x = null, M = !1, C = !1;
631
- const ne = ve(() => {
632
+ const ne = _e(() => {
632
633
  if (!(!w.value || c.value == null))
633
634
  return {
634
635
  maxHeight: `${c.value}px`,
@@ -659,7 +660,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
659
660
  G(() => q()), typeof ResizeObserver < "u" && (x = new ResizeObserver(() => {
660
661
  !M && !C && q();
661
662
  }), u.value && x.observe(u.value)), window.addEventListener("resize", O);
662
- }), _e(() => {
663
+ }), we(() => {
663
664
  x == null || x.disconnect(), window.removeEventListener("resize", O);
664
665
  });
665
666
  function O() {
@@ -679,7 +680,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
679
680
  function J(s, f) {
680
681
  return s == null || typeof s != "object" ? s : s[f.optionsValue || "value"];
681
682
  }
682
- async function Le(s, f) {
683
+ async function $e(s, f) {
683
684
  if (typeof s.remoteMethod == "function") {
684
685
  i[s.prop] = !0;
685
686
  try {
@@ -719,7 +720,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
719
720
  const R = ee > 1;
720
721
  w.value = R, R ? p.value ? c.value = h.value : c.value = d.value : (p.value = !1, c.value = null), M = !1;
721
722
  }
722
- function $e() {
723
+ function Te() {
723
724
  const s = u.value;
724
725
  if (!s || C) return;
725
726
  C = !0;
@@ -743,7 +744,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
743
744
  C = !1, q();
744
745
  }, 380);
745
746
  }
746
- function Te() {
747
+ function Ve() {
747
748
  const s = {};
748
749
  return t.itemList.forEach((f) => {
749
750
  f.type === "daterange" || f.type === "dateRange" ? (s[f.start] = void 0, s[f.end] = void 0) : f.type === "number-range" || f.type === "numberRange" ? (s[f.start || `${f.prop}Min`] = void 0, s[f.end || `${f.prop}Max`] = void 0) : f.multiple ? s[f.prop] = [] : f.prop && (s[f.prop] = void 0);
@@ -756,7 +757,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
756
757
  pe(), r("change", { ...l.value }), r("search", { ...l.value });
757
758
  }
758
759
  function Z() {
759
- l.value = Te(), pe(), r("reset", { ...l.value }), r("change", { ...l.value });
760
+ l.value = Ve(), pe(), r("reset", { ...l.value }), r("change", { ...l.value });
760
761
  }
761
762
  return (s, f) => {
762
763
  const U = N("el-input"), I = N("el-option"), H = N("el-select"), E = N("el-input-number"), ee = N("el-date-picker"), R = N("el-button"), ae = N("el-icon");
@@ -768,8 +769,8 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
768
769
  "is-collapsed": w.value && !p.value
769
770
  }])
770
771
  }, [
771
- _("div", ht, [
772
- _("div", yt, [
772
+ _("div", yt, [
773
+ _("div", bt, [
773
774
  _("div", {
774
775
  ref_key: "fieldsRef",
775
776
  ref: u,
@@ -781,7 +782,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
781
782
  class: V(["common-search__field", [`is-${a.type}`, a.className]]),
782
783
  style: X(le(a))
783
784
  }, [
784
- a.label ? (m(), b("label", bt, D(a.label), 1)) : F("", !0),
785
+ a.label ? (m(), b("label", vt, D(a.label), 1)) : F("", !0),
785
786
  a.type === "input" || a.type === "text" ? (m(), T(U, {
786
787
  key: 1,
787
788
  modelValue: l.value[a.prop],
@@ -827,7 +828,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
827
828
  "collapse-tags": a.multiple,
828
829
  "collapse-tags-tooltip": a.multiple,
829
830
  "reserve-keyword": !1,
830
- "remote-method": (y) => Le(a, y),
831
+ "remote-method": (y) => $e(a, y),
831
832
  loading: !!i[a.prop],
832
833
  disabled: a.disabled,
833
834
  class: "common-search__control",
@@ -843,7 +844,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
843
844
  }, null, 8, ["label", "value", "disabled"]))), 128))
844
845
  ]),
845
846
  _: 2
846
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : a.type === "number-range" || a.type === "numberRange" ? (m(), b("div", vt, [
847
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : a.type === "number-range" || a.type === "numberRange" ? (m(), b("div", _t, [
847
848
  v(E, {
848
849
  modelValue: l.value[a.start || `${a.prop}Min`],
849
850
  "onUpdate:modelValue": (y) => l.value[a.start || `${a.prop}Min`] = y,
@@ -855,7 +856,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
855
856
  disabled: a.disabled,
856
857
  class: "common-search__range-input"
857
858
  }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "precision", "placeholder", "disabled"]),
858
- _("span", _t, D(a.separator || "至"), 1),
859
+ _("span", wt, D(a.separator || "至"), 1),
859
860
  v(E, {
860
861
  modelValue: l.value[a.end || `${a.prop}Max`],
861
862
  "onUpdate:modelValue": (y) => l.value[a.end || `${a.prop}Max`] = y,
@@ -878,8 +879,8 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
878
879
  clearable: a.clearable !== !1,
879
880
  disabled: a.disabled,
880
881
  class: "common-search__control"
881
- }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : a.type === "daterange" || a.type === "dateRange" ? (m(), b("div", wt, [
882
- v(Ne, {
882
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : a.type === "daterange" || a.type === "dateRange" ? (m(), b("div", kt, [
883
+ v(Ue, {
883
884
  start: l.value[a.start],
884
885
  "onUpdate:start": (y) => l.value[a.start] = y,
885
886
  end: l.value[a.end],
@@ -893,7 +894,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
893
894
  ], 6))), 128))
894
895
  ], 4)
895
896
  ]),
896
- w.value ? F("", !0) : (m(), b("div", kt, [
897
+ w.value ? F("", !0) : (m(), b("div", Ct, [
897
898
  Q(s.$slots, "actions", {
898
899
  search: A,
899
900
  reset: Z,
@@ -922,9 +923,9 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
922
923
  ], !0)
923
924
  ]))
924
925
  ]),
925
- w.value ? (m(), b("div", Ct, [
926
- _("div", St, [
927
- _("div", xt, [
926
+ w.value ? (m(), b("div", St, [
927
+ _("div", xt, [
928
+ _("div", Nt, [
928
929
  Q(s.$slots, "actions", {
929
930
  search: A,
930
931
  reset: Z,
@@ -953,7 +954,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
953
954
  ], !0)
954
955
  ]),
955
956
  v(R, {
956
- onClick: $e,
957
+ onClick: Te,
957
958
  type: "primary",
958
959
  plain: ""
959
960
  }, {
@@ -975,7 +976,7 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
975
976
  ]);
976
977
  };
977
978
  }
978
- }), Ut = /* @__PURE__ */ K(Nt, [["__scopeId", "data-v-08ffb41c"]]), Mt = {
979
+ }), Mt = /* @__PURE__ */ K(Ut, [["__scopeId", "data-v-08ffb41c"]]), Dt = {
979
980
  name: "MgOverflowHid",
980
981
  props: {
981
982
  label: String,
@@ -998,10 +999,10 @@ const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986
998
999
  return t && t.length > n && (t = t.slice(0, n) + "..."), t;
999
1000
  }
1000
1001
  }
1001
- }, Dt = { class: "tableOverflowHid" }, Lt = ["innerHTML"], $t = { class: "name-wrapper" }, Tt = ["innerHTML"], Vt = { key: 1 }, Ot = ["innerHTML"];
1002
- function At(e, n, t, r, l, o) {
1002
+ }, Lt = { class: "tableOverflowHid" }, $t = ["innerHTML"], Tt = { class: "name-wrapper" }, Vt = ["innerHTML"], Ot = { key: 1 }, At = ["innerHTML"];
1003
+ function Rt(e, n, t, r, l, o) {
1003
1004
  const i = N("el-popover");
1004
- return m(), b("div", Dt, [
1005
+ return m(), b("div", Lt, [
1005
1006
  t.value && t.value.length > t.maxLength ? (m(), T(i, {
1006
1007
  key: 0,
1007
1008
  trigger: "hover",
@@ -1009,7 +1010,7 @@ function At(e, n, t, r, l, o) {
1009
1010
  width: "400"
1010
1011
  }, {
1011
1012
  reference: S(() => [
1012
- _("div", $t, [
1013
+ _("div", Tt, [
1013
1014
  j(_("span", {
1014
1015
  class: V(t.labelClassName)
1015
1016
  }, D(t.label) + ":", 3), [
@@ -1018,7 +1019,7 @@ function At(e, n, t, r, l, o) {
1018
1019
  _("span", {
1019
1020
  class: V(t.valueClassName),
1020
1021
  innerHTML: o.cutString(t.value, t.maxLength)
1021
- }, null, 10, Tt)
1022
+ }, null, 10, Vt)
1022
1023
  ])
1023
1024
  ]),
1024
1025
  default: S(() => [
@@ -1027,10 +1028,10 @@ function At(e, n, t, r, l, o) {
1027
1028
  }, D(t.label) + ":", 3), [
1028
1029
  [z, t.label]
1029
1030
  ]),
1030
- _("span", { innerHTML: t.value }, null, 8, Lt)
1031
+ _("span", { innerHTML: t.value }, null, 8, $t)
1031
1032
  ]),
1032
1033
  _: 1
1033
- })) : (m(), b("div", Vt, [
1034
+ })) : (m(), b("div", Ot, [
1034
1035
  j(_("span", {
1035
1036
  class: V(t.labelClassName)
1036
1037
  }, D(t.label) + ":", 3), [
@@ -1039,18 +1040,18 @@ function At(e, n, t, r, l, o) {
1039
1040
  _("span", {
1040
1041
  class: V([t.valueClassName, "value"])
1041
1042
  }, [
1042
- _("span", { innerHTML: t.value }, null, 8, Ot)
1043
+ _("span", { innerHTML: t.value }, null, 8, At)
1043
1044
  ], 2)
1044
1045
  ]))
1045
1046
  ]);
1046
1047
  }
1047
- const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54"]]), Rt = { class: "common-table__main" }, Ft = { key: 0 }, Ht = { key: 1 }, Et = {
1048
+ const Me = /* @__PURE__ */ K(Dt, [["render", Rt], ["__scopeId", "data-v-ef86ea54"]]), Ft = { class: "common-table__main" }, Ht = { key: 0 }, Et = { key: 1 }, Pt = {
1048
1049
  key: 2,
1049
1050
  class: "bold-text"
1050
- }, Pt = {
1051
+ }, It = {
1051
1052
  key: 0,
1052
1053
  class: "common-table__pagination"
1053
- }, It = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1054
+ }, Bt = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1054
1055
  __name: "DataTable",
1055
1056
  props: {
1056
1057
  /** 列配置:el-table-column 属性 + slotName */
@@ -1114,7 +1115,7 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1114
1115
  color: "var(--brand-text-primary)",
1115
1116
  fontWeight: 600,
1116
1117
  fontSize: "13px"
1117
- }, o = ve(() => ({
1118
+ }, o = _e(() => ({
1118
1119
  headerCellStyle: l,
1119
1120
  ...t.tableBind
1120
1121
  }));
@@ -1146,8 +1147,8 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1146
1147
  return m(), b("div", {
1147
1148
  class: V(["common-table", { "is-fill-height": e.fillHeight }])
1148
1149
  }, [
1149
- _("div", Rt, [
1150
- v(x, me({
1150
+ _("div", Ft, [
1151
+ v(x, ge({
1151
1152
  data: e.dataList,
1152
1153
  height: e.fillHeight ? "100%" : void 0,
1153
1154
  class: { "common-pointer-table": e.canCellClick }
@@ -1161,18 +1162,18 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1161
1162
  index: k,
1162
1163
  align: "center"
1163
1164
  }, null, 8, ["label", "width"])) : F("", !0),
1164
- (m(!0), b(P, null, Y(e.propList, (C, ne) => (m(), T(c, me({
1165
+ (m(!0), b(P, null, Y(e.propList, (C, ne) => (m(), T(c, ge({
1165
1166
  key: C.prop || C.slotName || ne
1166
1167
  }, { ref_for: !0 }, i(C)), Be({ _: 2 }, [
1167
1168
  C.slotName ? {
1168
1169
  name: "default",
1169
1170
  fn: S(({ row: O, $index: le }) => [
1170
- C.slotName === "overtext" ? (m(), b("div", Ft, [
1171
- v(Ue, {
1171
+ C.slotName === "overtext" ? (m(), b("div", Ht, [
1172
+ v(Me, {
1172
1173
  value: String(O[C.prop] ?? ""),
1173
1174
  "max-length": C.maxLength || 18
1174
1175
  }, null, 8, ["value", "max-length"])
1175
- ])) : C.slotName === "whether" ? (m(), b("div", Ht, D(O[C.prop] == 0 ? "否" : O[C.prop] == 1 ? "是" : ""), 1)) : C.slotName === "boldtext" ? (m(), b("div", Et, D(O[C.prop]), 1)) : Q(d.$slots, C.slotName, {
1176
+ ])) : C.slotName === "whether" ? (m(), b("div", Et, D(O[C.prop] == 0 ? "否" : O[C.prop] == 1 ? "是" : ""), 1)) : C.slotName === "boldtext" ? (m(), b("div", Pt, D(O[C.prop]), 1)) : Q(d.$slots, C.slotName, {
1176
1177
  row: O,
1177
1178
  index: le,
1178
1179
  column: C
@@ -1188,7 +1189,7 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1188
1189
  _: 3
1189
1190
  }, 16, ["data", "height", "class"])
1190
1191
  ]),
1191
- e.pagination ? (m(), b("div", Pt, [
1192
+ e.pagination ? (m(), b("div", It, [
1192
1193
  v(M, {
1193
1194
  background: "",
1194
1195
  "current-page": e.pagination.page,
@@ -1203,7 +1204,7 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1203
1204
  ], 2);
1204
1205
  };
1205
1206
  }
1206
- }), Bt = /* @__PURE__ */ K(It, [["__scopeId", "data-v-5f80313c"]]), Yt = ["aria-checked", "disabled", "onClick"], jt = {
1207
+ }), Yt = /* @__PURE__ */ K(Bt, [["__scopeId", "data-v-5f80313c"]]), jt = ["aria-checked", "disabled", "onClick"], zt = {
1207
1208
  __name: "SegmentedControl",
1208
1209
  props: {
1209
1210
  modelValue: { type: [String, Number, Boolean], default: void 0 },
@@ -1245,7 +1246,7 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1245
1246
  { deep: !0 }
1246
1247
  ), ie(async () => {
1247
1248
  await G(), p(), typeof ResizeObserver < "u" && l.value && (k = new ResizeObserver(() => p()), k.observe(l.value));
1248
- }), _e(() => {
1249
+ }), we(() => {
1249
1250
  k == null || k.disconnect(), k = null;
1250
1251
  }), (d, h) => (m(), b("div", {
1251
1252
  ref_key: "rootRef",
@@ -1267,11 +1268,11 @@ const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54
1267
1268
  "aria-checked": e.modelValue === c.value,
1268
1269
  disabled: c.disabled,
1269
1270
  onClick: (M) => w(c)
1270
- }, D(c.label), 11, Yt))), 128))
1271
+ }, D(c.label), 11, jt))), 128))
1271
1272
  ], 512));
1272
1273
  }
1273
- }, zt = /* @__PURE__ */ K(jt, [["__scopeId", "data-v-8bff3e5b"]]);
1274
- function Kt(e) {
1274
+ }, Kt = /* @__PURE__ */ K(zt, [["__scopeId", "data-v-8bff3e5b"]]);
1275
+ function qt(e) {
1275
1276
  return !!(e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0);
1276
1277
  }
1277
1278
  function oe(e) {
@@ -1283,7 +1284,7 @@ function oe(e) {
1283
1284
  n[t] = oe(e[t]);
1284
1285
  }), n;
1285
1286
  }
1286
- function qt(e, n = 300) {
1287
+ function Wt(e, n = 300) {
1287
1288
  let t = null;
1288
1289
  return function(...l) {
1289
1290
  t && clearTimeout(t), t = setTimeout(() => {
@@ -1291,14 +1292,14 @@ function qt(e, n = 300) {
1291
1292
  }, n);
1292
1293
  };
1293
1294
  }
1294
- function Wt(e, n = 300) {
1295
+ function Gt(e, n = 300) {
1295
1296
  let t = 0;
1296
1297
  return function(...l) {
1297
1298
  const o = Date.now();
1298
1299
  o - t >= n && (t = o, e.apply(this, l));
1299
1300
  };
1300
1301
  }
1301
- function Me(e) {
1302
+ function De(e) {
1302
1303
  if (e == null || e === "") return null;
1303
1304
  if (e instanceof Date)
1304
1305
  return Number.isNaN(e.getTime()) ? null : e;
@@ -1335,7 +1336,7 @@ function Me(e) {
1335
1336
  return Number.isNaN(r.getTime()) ? null : r;
1336
1337
  }
1337
1338
  function se(e, n = "YYYY-MM-DD HH:mm:ss") {
1338
- const t = Me(e);
1339
+ const t = De(e);
1339
1340
  if (!t) return "";
1340
1341
  const r = t.getFullYear(), l = t.getMonth() + 1, o = t.getDate(), i = t.getHours(), g = t.getMinutes(), k = t.getSeconds(), u = {
1341
1342
  YYYY: String(r),
@@ -1352,7 +1353,7 @@ function se(e, n = "YYYY-MM-DD HH:mm:ss") {
1352
1353
  };
1353
1354
  return n.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (p) => u[p]);
1354
1355
  }
1355
- function Gt() {
1356
+ function Qt() {
1356
1357
  const e = /* @__PURE__ */ new Date();
1357
1358
  e.setHours(23, 59, 59, 0);
1358
1359
  const n = /* @__PURE__ */ new Date();
@@ -1361,14 +1362,14 @@ function Gt() {
1361
1362
  end: se(e, "YYYY-MM-DD HH:mm:ss")
1362
1363
  };
1363
1364
  }
1364
- function Qt(e) {
1365
+ function Xt(e) {
1365
1366
  const n = {};
1366
1367
  return Object.keys(e || {}).forEach((t) => {
1367
1368
  const r = e[t];
1368
1369
  r == null || r === "" || Array.isArray(r) && r.length === 0 || (n[t] = r);
1369
1370
  }), n;
1370
1371
  }
1371
- function Xt(e, n = 2) {
1372
+ function Jt(e, n = 2) {
1372
1373
  if (e == null || e === "") return e;
1373
1374
  const t = Number(e);
1374
1375
  if (Number.isNaN(t)) return e;
@@ -1377,23 +1378,23 @@ function Xt(e, n = 2) {
1377
1378
  const g = o.replace(/0+$/, "");
1378
1379
  return g ? `${i}.${g}` : i;
1379
1380
  }
1380
- function Jt(e = "id") {
1381
+ function Zt(e = "id") {
1381
1382
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
1382
1383
  }
1383
1384
  const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1384
1385
  __proto__: null,
1385
- cleanParams: Qt,
1386
- debounce: qt,
1386
+ cleanParams: Xt,
1387
+ debounce: Wt,
1387
1388
  deepClone: oe,
1388
1389
  formatDate: se,
1389
- formatNum: Xt,
1390
- getRecentMonthRange: Gt,
1391
- isEmpty: Kt,
1392
- parseDate: Me,
1393
- throttle: Wt,
1394
- uniqueId: Jt
1390
+ formatNum: Jt,
1391
+ getRecentMonthRange: Qt,
1392
+ isEmpty: qt,
1393
+ parseDate: De,
1394
+ throttle: Gt,
1395
+ uniqueId: Zt
1395
1396
  }, Symbol.toStringTag, { value: "Module" }));
1396
- function Zt(e = {}) {
1397
+ function en(e = {}) {
1397
1398
  const {
1398
1399
  baseURL: n = "",
1399
1400
  timeout: t = 6e4,
@@ -1432,7 +1433,7 @@ function Zt(e = {}) {
1432
1433
  const d = Number(p == null ? void 0 : p.code);
1433
1434
  if (d === 401 || d === 403)
1434
1435
  return k(), Promise.reject(new Error("登录失效,请重新登录"));
1435
- const h = be(p) || "请求失败";
1436
+ const h = ve(p) || "请求失败";
1436
1437
  return Promise.reject(new Error(h));
1437
1438
  },
1438
1439
  (u) => {
@@ -1440,12 +1441,12 @@ function Zt(e = {}) {
1440
1441
  const p = (h = u == null ? void 0 : u.response) == null ? void 0 : h.status;
1441
1442
  if (p === 401 || p === 403)
1442
1443
  return k(), Promise.reject(new Error("登录失效,请重新登录"));
1443
- const w = (c = u == null ? void 0 : u.response) == null ? void 0 : c.data, d = be(w) || (u == null ? void 0 : u.message) || "请求失败";
1444
+ const w = (c = u == null ? void 0 : u.response) == null ? void 0 : c.data, d = ve(w) || (u == null ? void 0 : u.message) || "请求失败";
1444
1445
  return Promise.reject(new Error(String(d)));
1445
1446
  }
1446
1447
  ), i;
1447
1448
  }
1448
- function be(e) {
1449
+ function ve(e) {
1449
1450
  if (e == null) return "";
1450
1451
  if (typeof e == "string") return e;
1451
1452
  if (typeof e != "object") return String(e);
@@ -1455,8 +1456,8 @@ function be(e) {
1455
1456
  return String(t);
1456
1457
  return "";
1457
1458
  }
1458
- function en(e = {}) {
1459
- const n = Zt(e);
1459
+ function tn(e = {}) {
1460
+ const n = en(e);
1460
1461
  return {
1461
1462
  GET(t, r = {}) {
1462
1463
  return n({ method: "get", url: t, ...r });
@@ -1469,51 +1470,51 @@ function en(e = {}) {
1469
1470
  }
1470
1471
  };
1471
1472
  }
1472
- const De = "__MGACN_COMMONSDK_REQUEST__";
1473
- function tn(e) {
1474
- globalThis[De] = e;
1473
+ const Le = "__MGACN_COMMONSDK_REQUEST__";
1474
+ function nn(e) {
1475
+ globalThis[Le] = e;
1475
1476
  }
1476
1477
  function pn() {
1477
- const e = globalThis[De];
1478
+ const e = globalThis[Le];
1478
1479
  if (!e)
1479
1480
  throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
1480
1481
  return e;
1481
1482
  }
1482
- const nn = {
1483
- MgImageUpload: mt,
1484
- MgSearchForm: Ut,
1485
- MgDataTable: Bt,
1486
- MgDateRangePicker: Ne,
1487
- MgSegmentedControl: zt,
1488
- MgOverflowHid: Ue
1489
- }, ln = (e, n = {}) => {
1490
- Object.entries(nn).forEach(([l, o]) => {
1483
+ const ln = {
1484
+ MgImageUpload: gt,
1485
+ MgSearchForm: Mt,
1486
+ MgDataTable: Yt,
1487
+ MgDateRangePicker: Ue,
1488
+ MgSegmentedControl: Kt,
1489
+ MgOverflowHid: Me
1490
+ }, an = (e, n = {}) => {
1491
+ Object.entries(ln).forEach(([l, o]) => {
1491
1492
  e.component(o.name || l, o);
1492
1493
  });
1493
- const t = en(n), r = je(t);
1494
- tn(t), ze(r), e.config.globalProperties.$request = t, e.config.globalProperties.$api = r;
1494
+ const t = tn(n), r = je(t);
1495
+ nn(t), ze(r), e.config.globalProperties.$request = t, e.config.globalProperties.$api = r;
1495
1496
  }, fn = {
1496
- install: ln,
1497
+ install: an,
1497
1498
  version: "1.0.0"
1498
1499
  };
1499
1500
  export {
1500
- Bt as DataTable,
1501
- Ne as DateRangePicker,
1502
- mt as ImageUpload,
1503
- Ut as SearchForm,
1504
- zt as SegmentedControl,
1505
- Ue as TableOverflowHid,
1506
- Ge as aliOssMixin,
1501
+ Yt as DataTable,
1502
+ Ue as DateRangePicker,
1503
+ gt as ImageUpload,
1504
+ Mt as SearchForm,
1505
+ Kt as SegmentedControl,
1506
+ Me as TableOverflowHid,
1507
+ Qe as aliOssMixin,
1507
1508
  je as createApi,
1508
- Se as createOssClient,
1509
- en as createRequest,
1510
- Zt as createService,
1509
+ xe as createOssClient,
1510
+ tn as createRequest,
1511
+ en as createService,
1511
1512
  fn as default,
1512
1513
  Ke as getApi,
1513
- Ce as getOssSts,
1514
+ Se as getOssSts,
1514
1515
  pn as getRequest,
1515
- ln as install,
1516
+ an as install,
1516
1517
  ze as setApi,
1517
- We as uploadToOss,
1518
+ Ge as uploadToOss,
1518
1519
  dn as utils
1519
1520
  };
@@ -1 +1 @@
1
- (function(b,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("@element-plus/icons-vue"),require("element-plus"),require("cropperjs"),require("ali-oss"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","@element-plus/icons-vue","element-plus","cropperjs","ali-oss","vue","axios"],E):(b=typeof globalThis<"u"?globalThis:b||self,E(b.MgacnCommonSdk={},b.ElementPlusIconsVue,b.ElementPlus,b.Cropper,b.OSS,b.Vue,b.axios))})(this,(function(b,E,$,ke,Ce,e,we){"use strict";function X(t){if(!t)throw new Error("[mgacn-commonsdk] createApi 需要传入 request 实例");return{logout(o){return t.GET(`/yhAdmin/login/exit/${o}`)},getUserInfo(o){return t.GET(`/yhAdmin/user/queryUser/${o}`)},getOssSts(o){return t.GET("/yhAdmin/oss/fileUploadSts",{params:{dir:o}})}}}const J="__MGACN_COMMONSDK_API__";function Z(t){globalThis[J]=t}function v(){const t=globalThis[J];if(!t)throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");return t}function ee(t){return String(t).padStart(2,"0")}function Ne(){const t=new Date;return`${t.getFullYear()}${ee(t.getMonth()+1)}${ee(t.getDate())}`}function te(t=10){const o="0123456789abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<t;r++)n+=o[Math.floor(Math.random()*o.length)];return n}function z(t="portal_cms"){return`${t}/${Ne()}/`}function H(t){return v().getOssSts(t)}async function P(t={}){const{dir:o,foldName:n,getOss:r,ossinfo:l}=t,s=o||z(n||"portal_cms"),c=l||(typeof r=="function"?await r(s):await H(s));if(!c)throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败");const g=new Ce({bucket:c.bucketName,accessKeyId:c.accessKeyId,accessKeySecret:c.accessKeySecret,success_action_status:"200",stsToken:c.securityToken,endpoint:c.endPoint});return g.options.ossUrl=c.ossUrl||c.domain||(c.bucketName&&c.endPoint?`https://${c.bucketName}.${c.endPoint}`:""),g.options.uploadDir=s,g}async function ne(t={}){const{client:o,file:n,dir:r,foldName:l,fileName:s,onProgress:c}=t;if(!n)throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");const g=o||await P({dir:r,foldName:l}),k=r||g.options.uploadDir||z(l);let d=s;if(!d){const h=n.name||"file",p=h.indexOf("."),w=p>-1?h.slice(p):"";d=`${k}${te(10)}${w}`}const u=await g.multipartUpload(d,n,{progress:h=>{typeof c=="function"&&c(Math.floor(h*100))}});if(u.res&&u.res.statusCode!==200)throw new Error("[mgacn-commonsdk] 上传失败");const _=(g.options.ossUrl||"").replace(/\/$/,""),m=_?`${_}/${d}`:d;return{name:d,url:m,raw:u,client:g}}const oe={methods:{getDir(){return z(this.foldName||"portal_cms")},randomString:te,getOss(){return H(this.getDir())},async createOssClient(){return P({dir:this.getDir(),getOss:()=>this.getOss()})}}},T=(t,o)=>{const n=t.__vccOpts||t;for(const[r,l]of o)n[r]=l;return n};let le=0;function ae(){return le+=1,`mg-img-${Date.now()}-${le}`}function Se(t){return Array.isArray(t)?t.filter(Boolean):t?[t]:[]}function re(t){return t.map(o=>({uid:ae(),url:o,status:"success",percent:100,previewUrl:""}))}function Ve(t=""){const o=t.lastIndexOf(".");return o>-1?t.slice(o+1).toLowerCase():""}const xe={name:"MgImageUpload",mixins:[oe],components:{CircleCloseFilled:E.CircleCloseFilled,Delete:E.Delete,Plus:E.Plus},props:{modelValue:{type:[Array,String],default:()=>[]},greyTips:String,otherTips:String,maxFileSize:{type:Number,default:100},fileNum:{type:Number,default:1},initFileList:{type:Array,default:()=>[]},isCropper:Boolean,isDegree:Boolean,degree:{type:Number,default:3},aspectRatio:{type:Number,default:1},imageStyle:Object,resetFilelist:Boolean,accept:{type:String,default:".jpg,.jpeg,.png,.gif,.svg"},foldName:{type:String,default:"portal_cms"},disabled:Boolean,uploading:{type:Boolean,default:!1}},emits:["update:modelValue","update:uploading","sendFile","success","error","progress"],expose:["hasPendingUpload","isUploading"],data(){return{fileList:[],cropImageUrl:"",dialogVisible:!1,cropper:null}},computed:{multiple(){return this.fileNum>1&&!this.isCropper},hasPendingUpload(){return this.fileList.some(t=>t.status==="uploading")},uploadingCount(){return this.fileList.filter(t=>t.status==="uploading").length},showUploadBtn(){return!this.disabled&&this.fileList.length<this.fileNum},acceptList(){return this.accept.split(",").map(t=>t.replace(".","").trim().toLowerCase()).filter(Boolean)},successUrls(){return this.fileList.filter(t=>t.status==="success").map(t=>t.url)}},watch:{hasPendingUpload:{immediate:!0,handler(t){t!==this.uploading&&this.$emit("update:uploading",t)}},initFileList:{deep:!0,immediate:!0,handler(t){t!=null&&t.length&&this.replaceList(re(t))}},modelValue:{immediate:!0,handler(t){var r;if((r=this.initFileList)!=null&&r.length)return;const o=Se(t),n=this.successUrls;o.length===n.length&&o.every((l,s)=>l===n[s])||this.replaceList(re(o))}},cropImageUrl(t){this.cropper&&(t?this.cropper.replace(t):this.destroyCropper())}},beforeUnmount(){this.destroyCropper(),this.revokeAllPreviews()},methods:{isUploading(){return this.hasPendingUpload},replaceList(t){this.revokeAllPreviews(),this.fileList=t},revokePreview(t){t!=null&&t.previewUrl&&(URL.revokeObjectURL(t.previewUrl),t.previewUrl="")},revokeAllPreviews(){this.fileList.forEach(t=>this.revokePreview(t))},emitFile(){const t=[...this.successUrls];this.$emit("update:modelValue",t),this.$emit("sendFile",t)},openFilePicker(){const t=this.$refs.fileInput;t&&(t.value="",t.click())},handleUpload(){if(!this.disabled){if(this.fileList.length>=this.fileNum){$.ElMessage.error(`文件数量不超过${this.fileNum}`);return}this.openFilePicker()}},onFileChange(t){const o=[...t.target.files||[]];if(!o.length)return;const n=this.fileNum-this.fileList.length;if(o.length>n){$.ElMessage.error(`文件数量不超过${this.fileNum}个`);return}const r=[],l=[];if(o.forEach(s=>{this.acceptList.includes(Ve(s.name))?r.push(s):l.push(s)}),l.length){const s=l.map(c=>c.name).join(",");$.ElMessageBox.confirm(`已过滤以下 ${l.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${s}</p><br/>只接受:${this.acceptList.join("/")}`,"提示",{confirmButtonText:"确认",showCancelButton:!1,dangerouslyUseHTMLString:!0,type:"warning"}).catch(()=>{})}if(r.length){if(this.isCropper){this.openCropper(r[0]);return}this.startUpload(r)}},openCropper(t){const o=new FileReader;o.onloadend=n=>{this.cropImageUrl=n.target.result,this.dialogVisible=!0,this.cropper||this.$nextTick(()=>this.initCropper())},o.readAsDataURL(t)},startUpload(t){this.resetFilelist&&this.replaceList([]);const o=this.maxFileSize*1024*1024,n=[];return t.forEach(r=>{if(r.size>o){$.ElMessage.error(`「${r.name}」超出 ${this.maxFileSize}MB 限制`);return}const l=URL.createObjectURL(r),s={uid:ae(),url:l,previewUrl:l,status:"uploading",percent:0,raw:r};this.fileList.push(s),n.push(this.uploadOne(s))}),Promise.all(n)},async uploadOne(t){try{const o=await ne({file:t.raw,dir:this.getDir(),onProgress:n=>{t.percent=n,this.$emit("progress",n,t.raw)}});this.revokePreview(t),t.url=o.url,t.status="success",t.percent=100,t.raw=null,this.emitFile(),this.$emit("success",o,t)}catch(o){t.status="fail",t.percent=0,this.$emit("error",o,t)}finally{this.dialogVisible&&this.handleBack()}},initCropper(){const t=this.$refs.cropImage;t&&(this.cropper=new ke(t,{aspectRatio:this.aspectRatio,autoCropArea:.8,viewMode:1,movable:!0,zoomable:!0,rotatable:!0,guides:!0,background:!0,cropBoxMovable:!0,cropBoxResizable:!0,minCropBoxWidth:100,minCropBoxHeight:100}))},destroyCropper(){this.cropper&&(this.cropper.destroy(),this.cropper=null)},rotate(t){var o;(o=this.cropper)==null||o.rotate(t)},confirmCrop(){if(this.uploadingCount){$.ElMessage.error("上传中,请稍后!");return}if(!this.cropper)return;const t=this.cropper.getCroppedCanvas().toDataURL("image/jpeg");this.startUpload([this.base64ToFile(t)])},base64ToFile(t){const[o,n]=t.split(","),r=o.match(/:(.*?);/)[1],l=r.split("/")[1],s=atob(n),c=new Uint8Array(s.length);for(let g=0;g<s.length;g++)c[g]=s.charCodeAt(g);return new File([c],`${Date.now()}.${l}`,{type:r})},handleBack(){this.cropImageUrl="",this.dialogVisible=!1},removeImg(t){const o=this.fileList[t];!o||o.status==="uploading"||(this.revokePreview(o),this.fileList.splice(t,1),this.emitFile())}}},Be={class:"upload-image-cropper"},Ee=["multiple","accept"],De={key:0,class:"grey-tips"},Me={key:0},Te={class:"list-box"},Ue={key:0,class:"status-mask is-uploading"},Le={class:"progress-wrap"},$e={class:"percent-text"},Oe={key:1,class:"status-mask is-fail"},Fe=["onClick"],Ae={class:"cropper-box"},Re=["src"],ze={class:"btn-box"},He={class:"btn-box"};function Pe(t,o,n,r,l,s){const c=e.resolveComponent("el-image"),g=e.resolveComponent("el-progress"),k=e.resolveComponent("CircleCloseFilled"),d=e.resolveComponent("el-icon"),u=e.resolveComponent("Delete"),_=e.resolveComponent("Plus"),m=e.resolveComponent("el-button"),h=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("input",{ref:"fileInput",type:"file",class:"file-input",multiple:s.multiple,accept:n.accept,onChange:o[0]||(o[0]=(...p)=>s.onFileChange&&s.onFileChange(...p))},null,40,Ee),n.greyTips?(e.openBlock(),e.createElementBlock("div",De,[n.otherTips?(e.openBlock(),e.createElementBlock("div",Me,e.toDisplayString(n.otherTips),1)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.greyTips),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.fileList,(p,w)=>(e.openBlock(),e.createElementBlock("div",{key:p.uid,class:e.normalizeClass(["image-box",[`is-${p.status}`]]),style:e.normalizeStyle(n.imageStyle)},[e.createVNode(c,{src:p.url,fit:"cover",class:"img"},null,8,["src"]),p.status==="uploading"?(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",Le,[e.createVNode(g,{type:"circle",percentage:p.percent,width:30,"stroke-width":3,"show-text":!1,color:"var(--mg-primary, #ff5722)"},null,8,["percentage"]),e.createElementVNode("span",$e,e.toDisplayString(p.percent)+"%",1)])])):p.status==="fail"?(e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(d,{class:"fail-icon",size:16},{default:e.withCtx(()=>[e.createVNode(k)]),_:1}),o[5]||(o[5]=e.createElementVNode("span",{class:"fail-text"},"失败",-1)),e.createVNode(d,{class:"remove-icon",size:14,title:"删除",onClick:e.withModifiers(S=>s.removeImg(w),["stop"])},{default:e.withCtx(()=>[e.createVNode(u)]),_:1},8,["onClick"])])):(e.openBlock(),e.createElementBlock("div",{key:2,class:"status-mask is-success",onClick:S=>s.removeImg(w)},[e.createVNode(d,{class:"remove-icon",size:16},{default:e.withCtx(()=>[e.createVNode(u)]),_:1})],8,Fe))],6))),128)),e.withDirectives(e.createElementVNode("div",{class:"image-box upload-btn",style:e.normalizeStyle(n.imageStyle),onClick:o[1]||(o[1]=(...p)=>s.handleUpload&&s.handleUpload(...p))},[e.createVNode(d,{class:"icon",size:14},{default:e.withCtx(()=>[e.createVNode(_)]),_:1}),o[6]||(o[6]=e.createElementVNode("div",null,"上传图片",-1))],4),[[e.vShow,s.showUploadBtn]])]),e.createVNode(h,{modelValue:l.dialogVisible,"onUpdate:modelValue":o[4]||(o[4]=p=>l.dialogVisible=p),title:"裁剪图片",width:"600px",top:"5vh","append-to-body":"","close-on-click-modal":!1,onClose:s.handleBack},{default:e.withCtx(()=>[e.createElementVNode("div",Ae,[e.withDirectives(e.createElementVNode("img",{ref:"cropImage",src:l.cropImageUrl,class:"cropper-img"},null,8,Re),[[e.vShow,l.cropImageUrl]])]),e.createElementVNode("div",ze,[n.isDegree?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(m,{onClick:o[2]||(o[2]=p=>s.rotate(-n.degree))},{default:e.withCtx(()=>[...o[7]||(o[7]=[e.createTextVNode("向左旋转",-1)])]),_:1}),e.createVNode(m,{onClick:o[3]||(o[3]=p=>s.rotate(n.degree))},{default:e.withCtx(()=>[...o[8]||(o[8]=[e.createTextVNode("向右旋转",-1)])]),_:1})],64)):e.createCommentVNode("",!0),e.createVNode(m,{type:"primary",onClick:s.openFilePicker},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cropImageUrl?"重新上传":"点击上传"),1)]),_:1},8,["onClick"])]),e.createElementVNode("div",He,[e.createVNode(m,{onClick:s.handleBack},{default:e.withCtx(()=>[...o[9]||(o[9]=[e.createTextVNode("取 消",-1)])]),_:1},8,["onClick"]),e.createVNode(m,{type:"primary",onClick:s.confirmCrop},{default:e.withCtx(()=>[...o[10]||(o[10]=[e.createTextVNode("确定",-1)])]),_:1},8,["onClick"])])]),_:1},8,["modelValue","onClose"])])}const se=T(xe,[["render",Pe],["__scopeId","data-v-27d5f986"]]),Ie={__name:"DateRangePicker",props:{start:{type:String},end:{type:String},type:{default:"daterange"},format:{default:"YYYY-MM-DD"},valueFormat:{default:"YYYY-MM-DD HH:mm:ss"},defaultTime:{default:[new Date(2024,1,1,0,0,0),new Date(2024,1,1,23,59,59)]},title:{type:String,default:""},canClearable:{type:Boolean,default:!0}},emits:["update:start","update:end","change"],setup(t,{emit:o}){const n=o,r=t,l=e.ref([]);e.watch(()=>r.start,()=>{l.value=[r.start,r.end]}),e.onMounted(()=>{l.value=[r.start,r.end]});function s(c){n("update:start",c?c[0]:""),n("update:end",c?c[1]:""),n("change")}return(c,g)=>{const k=e.resolveComponent("el-date-picker");return e.openBlock(),e.createBlock(k,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=d=>l.value=d),type:t.type,"range-separator":"至","start-placeholder":`${t.title} 开始`,"end-placeholder":"结束","value-format":t.valueFormat,"default-time":t.defaultTime,class:"date-range-picker",onChange:s,clearable:t.canClearable},null,8,["modelValue","type","start-placeholder","value-format","default-time","clearable"])}}},I=T(Ie,[["__scopeId","data-v-47618fba"]]),je={class:"common-search__body"},Ye={class:"common-search__fields-wrap"},qe={key:0,class:"common-search__label"},Ke={key:4,class:"common-search__range"},We={class:"common-search__range-sep"},Ge={key:6,class:"common-search__range"},Qe={key:0,class:"common-search__actions is-inline"},Xe={key:0,class:"common-search__footer"},Je={class:"common-search__actions is-bottom"},Ze={class:"common-search__actions-main"},ie=T(Object.assign({name:"MgSearchForm"},{__name:"SearchForm",props:{modelValue:{type:Object,default:()=>({})},itemList:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["change","search","reset","update:modelValue"],setup(t,{emit:o}){const n=t,r=o,l=e.ref({}),s=e.reactive({}),c=e.reactive({});let g=!1;function k(i,f){return JSON.stringify(i??{})===JSON.stringify(f??{})}const d=e.ref(null),u=e.ref(!1),_=e.ref(!1),m=e.ref(0),h=e.ref(0),p=e.ref(null);let w=null,S=!1,C=!1;const K=e.computed(()=>{if(!(!_.value||p.value==null))return{maxHeight:`${p.value}px`,overflow:"hidden"}});e.watch(()=>n.modelValue,i=>{k(i,l.value)||(g=!0,l.value={...i||{}},e.nextTick(()=>{g=!1}))},{deep:!0,immediate:!0}),e.watch(l,()=>{g||r("update:modelValue",{...l.value})},{deep:!0}),e.watch(()=>n.itemList,()=>{u.value=!1,e.nextTick(()=>O())},{deep:!0}),e.onMounted(()=>{e.nextTick(()=>O()),typeof ResizeObserver<"u"&&(w=new ResizeObserver(()=>{!S&&!C&&O()}),d.value&&w.observe(d.value)),window.addEventListener("resize",V)}),e.onBeforeUnmount(()=>{w==null||w.disconnect(),window.removeEventListener("resize",V)});function V(){!S&&!C&&O()}function W(i){if(!i.width)return;const f=typeof i.width=="number"?`${i.width}px`:i.width;return{width:f,minWidth:f}}function ye(i,f){if(i==null)return"";if(typeof i!="object")return String(i);const N=f.optionsLabel||"label";return typeof N=="string"?i[N]:Array.isArray(N)?`${i[N[0]]}(${i[N[1]]})`:i.label}function F(i,f){return i==null||typeof i!="object"?i:i[f.optionsValue||"value"]}async function Vt(i,f){if(typeof i.remoteMethod=="function"){c[i.prop]=!0;try{const N=await i.remoteMethod(f);s[i.prop]=Array.isArray(N)?N:[]}finally{c[i.prop]=!1}}}function be(i){const f=i.style.maxHeight,N=i.style.overflow,U=i.style.transition;i.style.transition="none",i.style.maxHeight="none",i.style.overflow="visible";const D=i.scrollHeight;return i.style.maxHeight=f,i.style.overflow=N,i.offsetHeight,i.style.transition=U,D}function O(){const i=d.value;if(!i||S||C)return;S=!0;const f=i.closest(".common-search"),N=i.querySelectorAll(".common-search__field");if(!N.length||!f){_.value=!1,m.value=0,h.value=0,p.value=null,S=!1;return}m.value=N[0].offsetHeight,h.value=be(i);const U=f.clientWidth,D=20;let M=0,R=1;Array.from(N).forEach((G,a)=>{const L=G.offsetWidth;if(a===0){M=L;return}M+D+L>U?(R+=1,M=L):M+=D+L});const B=R>1;_.value=B,B?u.value?p.value=h.value:p.value=m.value:(u.value=!1,p.value=null),S=!1}function xt(){const i=d.value;if(!i||C)return;C=!0;const f=i.getBoundingClientRect().height||m.value;if(u.value)p.value=f,u.value=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=m.value})});else{p.value=f;const N=be(i);h.value=N,u.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=N})})}window.setTimeout(()=>{C=!1,O()},380)}function Bt(){const i={};return n.itemList.forEach(f=>{f.type==="daterange"||f.type==="dateRange"?(i[f.start]=void 0,i[f.end]=void 0):f.type==="number-range"||f.type==="numberRange"?(i[f.start||`${f.prop}Min`]=void 0,i[f.end||`${f.prop}Max`]=void 0):f.multiple?i[f.prop]=[]:f.prop&&(i[f.prop]=void 0)}),i}function _e(){r("update:modelValue",{...l.value})}function x(){_e(),r("change",{...l.value}),r("search",{...l.value})}function A(){l.value=Bt(),_e(),r("reset",{...l.value}),r("change",{...l.value})}return(i,f)=>{const N=e.resolveComponent("el-input"),U=e.resolveComponent("el-option"),D=e.resolveComponent("el-select"),M=e.resolveComponent("el-input-number"),R=e.resolveComponent("el-date-picker"),B=e.resolveComponent("el-button"),G=e.resolveComponent("el-icon");return e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["common-search",{"is-single-row":!_.value,"is-multi-row":_.value,"is-expanded":_.value&&u.value,"is-collapsed":_.value&&!u.value}])},[e.createElementVNode("div",je,[e.createElementVNode("div",Ye,[e.createElementVNode("div",{ref_key:"fieldsRef",ref:d,class:"common-search__fields",style:e.normalizeStyle(K.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemList,(a,L)=>(e.openBlock(),e.createElementBlock("div",{key:a.prop||a.start||L,class:e.normalizeClass(["common-search__field",[`is-${a.type}`,a.className]]),style:e.normalizeStyle(W(a))},[a.label?(e.openBlock(),e.createElementBlock("label",qe,e.toDisplayString(a.label),1)):e.createCommentVNode("",!0),a.type==="input"||a.type==="text"?(e.openBlock(),e.createBlock(N,{key:1,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,modelModifiers:{trim:!0},clearable:"",placeholder:a.placeholder||`请输入${a.label||""}`,maxlength:a.maxlength||200,disabled:a.disabled,onKeyup:e.withKeys(x,["enter"])},null,8,["modelValue","onUpdate:modelValue","placeholder","maxlength","disabled"])):a.type==="select"?(e.openBlock(),e.createBlock(D,{key:2,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,placeholder:a.placeholder||`请选择${a.label||""}`,clearable:"",filterable:a.filterable!==!1,multiple:a.multiple,"collapse-tags":a.multiple,"collapse-tags-tooltip":a.multiple,disabled:a.disabled,class:"common-search__control",onChange:x},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options||[],(y,Q)=>(e.openBlock(),e.createBlock(U,{key:`${F(y,a)}-${Q}`,label:ye(y,a),value:F(y,a),disabled:typeof y=="object"&&(y==null?void 0:y.disabled)},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable","multiple","collapse-tags","collapse-tags-tooltip","disabled"])):a.type==="remote-select"||a.type==="remoteSelect"?(e.openBlock(),e.createBlock(D,{key:3,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,placeholder:a.placeholder||"请输入关键词搜索",clearable:"",filterable:"",remote:"",multiple:a.multiple,"collapse-tags":a.multiple,"collapse-tags-tooltip":a.multiple,"reserve-keyword":!1,"remote-method":y=>Vt(a,y),loading:!!c[a.prop],disabled:a.disabled,class:"common-search__control",onClear:y=>s[a.prop]=[],onChange:x},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s[a.prop]||a.options||[],(y,Q)=>(e.openBlock(),e.createBlock(U,{key:`${F(y,a)}-${Q}`,label:ye(y,a),value:F(y,a),disabled:typeof y=="object"&&(y==null?void 0:y.disabled)},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","multiple","collapse-tags","collapse-tags-tooltip","remote-method","loading","disabled","onClear"])):a.type==="number-range"||a.type==="numberRange"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(M,{modelValue:l.value[a.start||`${a.prop}Min`],"onUpdate:modelValue":y=>l.value[a.start||`${a.prop}Min`]=y,controls:!1,min:a.min,max:a.max,precision:a.precision,placeholder:a.minPlaceholder||"最小值",disabled:a.disabled,class:"common-search__range-input"},null,8,["modelValue","onUpdate:modelValue","min","max","precision","placeholder","disabled"]),e.createElementVNode("span",We,e.toDisplayString(a.separator||"至"),1),e.createVNode(M,{modelValue:l.value[a.end||`${a.prop}Max`],"onUpdate:modelValue":y=>l.value[a.end||`${a.prop}Max`]=y,controls:!1,min:a.min,max:a.max,precision:a.precision,placeholder:a.maxPlaceholder||"最大值",disabled:a.disabled,class:"common-search__range-input"},null,8,["modelValue","onUpdate:modelValue","min","max","precision","placeholder","disabled"])])):a.type==="date"?(e.openBlock(),e.createBlock(R,{key:5,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,type:a.dateType||"date",placeholder:a.placeholder||"年/月/日","value-format":a.valueFormat||"YYYY-MM-DD",format:a.format||"YYYY/MM/DD",clearable:a.clearable!==!1,disabled:a.disabled,class:"common-search__control"},null,8,["modelValue","onUpdate:modelValue","type","placeholder","value-format","format","clearable","disabled"])):a.type==="daterange"||a.type==="dateRange"?(e.openBlock(),e.createElementBlock("div",Ge,[e.createVNode(I,{start:l.value[a.start],"onUpdate:start":y=>l.value[a.start]=y,end:l.value[a.end],"onUpdate:end":y=>l.value[a.end]=y,onChange:x},null,8,["start","onUpdate:start","end","onUpdate:end"])])):e.renderSlot(i.$slots,a.slotName||a.prop,{item:a,form:l.value},void 0,!0,7)],6))),128))],4)]),_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Qe,[e.renderSlot(i.$slots,"actions",{search:x,reset:A,form:l.value},()=>[e.createVNode(B,{class:"common-search__reset",onClick:A},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode("重置",-1)])]),_:1}),e.createVNode(B,{type:"primary",class:"common-search__submit",loading:t.loading,onClick:x},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["loading"])],!0)]))]),_.value?(e.openBlock(),e.createElementBlock("div",Xe,[e.createElementVNode("div",Je,[e.createElementVNode("div",Ze,[e.renderSlot(i.$slots,"actions",{search:x,reset:A,form:l.value},()=>[e.createVNode(B,{class:"common-search__reset",onClick:A},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("重置",-1)])]),_:1}),e.createVNode(B,{type:"primary",class:"common-search__submit",loading:t.loading,onClick:x},{default:e.withCtx(()=>[...f[3]||(f[3]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["loading"])],!0)]),e.createVNode(B,{onClick:xt,type:"primary",plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value?"收起":"展开")+" ",1),e.createVNode(G,{class:"el-icon--right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value?"ArrowUp":"ArrowDown")))]),_:1})]),_:1})])])):e.createCommentVNode("",!0)],2)),[[e.vShow,t.itemList.length]])}}}),[["__scopeId","data-v-08ffb41c"]]),ve={name:"MgOverflowHid",props:{label:String,value:String,maxLength:{type:Number,default:40},labelClassName:{type:String,default:()=>"text_nomal"},valueClassName:{type:String,default:()=>"text_nomal"}},data(){return{}},methods:{cutString(t,o){let n=t||"";return n&&n.length>o&&(n=n.slice(0,o)+"..."),n}}},et={class:"tableOverflowHid"},tt=["innerHTML"],nt={class:"name-wrapper"},ot=["innerHTML"],lt={key:1},at=["innerHTML"];function rt(t,o,n,r,l,s){const c=e.resolveComponent("el-popover");return e.openBlock(),e.createElementBlock("div",et,[n.value&&n.value.length>n.maxLength?(e.openBlock(),e.createBlock(c,{key:0,trigger:"hover",placement:"bottom",width:"400"},{reference:e.withCtx(()=>[e.createElementVNode("div",nt,[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{class:e.normalizeClass(n.valueClassName),innerHTML:s.cutString(n.value,n.maxLength)},null,10,ot)])]),default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{innerHTML:n.value},null,8,tt)]),_:1})):(e.openBlock(),e.createElementBlock("div",lt,[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{class:e.normalizeClass([n.valueClassName,"value"])},[e.createElementVNode("span",{innerHTML:n.value},null,8,at)],2)]))])}const j=T(ve,[["render",rt],["__scopeId","data-v-ef86ea54"]]),st={class:"common-table__main"},it={key:0},ct={key:1},dt={key:2,class:"bold-text"},pt={key:0,class:"common-table__pagination"},ce=T(Object.assign({name:"MgDataTable"},{__name:"DataTable",props:{propList:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},tableBind:{type:Object,default:()=>({})},canCellClick:{type:Boolean,default:!1},pagination:{type:Object,default:void 0},pageSizes:{type:Array,default:()=>[10,20,50,100]},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},showIndex:{type:Boolean,default:!1},indexLabel:{type:String,default:"序号"},indexWidth:{type:[String,Number],default:64},fillHeight:{type:Boolean,default:!1}},emits:["pageChange","cellClick","edit","delete"],setup(t,{emit:o}){const n=t,r=o,l={background:"var(--brand-secondary-pale)",color:"var(--brand-text-primary)",fontWeight:600,fontSize:"13px"},s=e.computed(()=>({headerCellStyle:l,...n.tableBind}));function c(m){const{slotName:h,maxLength:p,...w}=m||{};return{...w}}function g(m){return m==null||m===""?"-":m}function k(m){return n.pagination?(n.pagination.page-1)*n.pagination.limit+m+1:m+1}function d(m){var h;r("pageChange",{page:(h=n.pagination)==null?void 0:h.page,limit:m})}function u(m){var h;r("pageChange",{page:m,limit:(h=n.pagination)==null?void 0:h.limit})}function _(m,h,p,w){r("cellClick",m,h,p,w),n.canCellClick&&(h==null?void 0:h.label)!=="操作"&&window.getSelection().toString()}return(m,h)=>{const p=e.resolveComponent("el-table-column"),w=e.resolveComponent("el-table"),S=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["common-table",{"is-fill-height":t.fillHeight}])},[e.createElementVNode("div",st,[e.createVNode(w,e.mergeProps({data:t.dataList,height:t.fillHeight?"100%":void 0,class:{"common-pointer-table":t.canCellClick}},s.value,{onCellClick:_}),{default:e.withCtx(()=>[t.showIndex?(e.openBlock(),e.createBlock(p,{key:0,type:"index",label:t.indexLabel,width:t.indexWidth,index:k,align:"center"},null,8,["label","width"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.propList,(C,K)=>(e.openBlock(),e.createBlock(p,e.mergeProps({key:C.prop||C.slotName||K},{ref_for:!0},c(C)),e.createSlots({_:2},[C.slotName?{name:"default",fn:e.withCtx(({row:V,$index:W})=>[C.slotName==="overtext"?(e.openBlock(),e.createElementBlock("div",it,[e.createVNode(j,{value:String(V[C.prop]??""),"max-length":C.maxLength||18},null,8,["value","max-length"])])):C.slotName==="whether"?(e.openBlock(),e.createElementBlock("div",ct,e.toDisplayString(V[C.prop]==0?"否":V[C.prop]==1?"是":""),1)):C.slotName==="boldtext"?(e.openBlock(),e.createElementBlock("div",dt,e.toDisplayString(V[C.prop]),1)):e.renderSlot(m.$slots,C.slotName,{row:V,index:W,column:C},()=>[e.createTextVNode(e.toDisplayString(g(V[C.prop])),1)],!0,3)]),key:"0"}:void 0]),1040))),128)),e.renderSlot(m.$slots,"default",{},void 0,!0)]),_:3},16,["data","height","class"])]),t.pagination?(e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(S,{background:"","current-page":t.pagination.page,"page-size":t.pagination.limit,"page-sizes":t.pageSizes,total:t.pagination.total,layout:t.paginationLayout,onSizeChange:d,onCurrentChange:u},null,8,["current-page","page-size","page-sizes","total","layout"])])):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-5f80313c"]]),mt=["aria-checked","disabled","onClick"],de=T({__name:"SegmentedControl",props:{modelValue:{type:[String,Number,Boolean],default:void 0},options:{type:Array,default:()=>[]}},emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,r=o,l=e.ref(null),s=e.ref([]),c=e.ref(!1),g=e.ref({width:"0px",transform:"translateX(0px)"});let k=null;function d(m,h){m&&(s.value[h]=m)}function u(){const m=l.value;if(!m)return;const h=n.options.findIndex(C=>C.value===n.modelValue),p=s.value[h];if(!p){g.value={width:"0px",transform:"translateX(0px)"};return}const w=m.getBoundingClientRect(),S=p.getBoundingClientRect();g.value={width:`${S.width}px`,transform:`translateX(${S.left-w.left}px)`},c.value=!0}function _(m){m.disabled||(r("update:modelValue",m.value),r("change",m.value))}return e.watch(()=>[n.modelValue,n.options],async()=>{await e.nextTick(),u()},{deep:!0}),e.onMounted(async()=>{await e.nextTick(),u(),typeof ResizeObserver<"u"&&l.value&&(k=new ResizeObserver(()=>u()),k.observe(l.value))}),e.onBeforeUnmount(()=>{k==null||k.disconnect(),k=null}),(m,h)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"segmented",role:"radiogroup"},[e.createElementVNode("div",{class:e.normalizeClass(["segmented__thumb",{"is-ready":c.value}]),style:e.normalizeStyle(g.value)},null,6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(p,w)=>(e.openBlock(),e.createElementBlock("button",{key:String(p.value),ref_for:!0,ref:S=>d(S,w),type:"button",class:e.normalizeClass(["segmented__item",{"is-active":t.modelValue===p.value}]),role:"radio","aria-checked":t.modelValue===p.value,disabled:p.disabled,onClick:S=>_(p)},e.toDisplayString(p.label),11,mt))),128))],512))}},[["__scopeId","data-v-8bff3e5b"]]);function ut(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0)}function Y(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t))return t.map(n=>Y(n));const o={};return Object.keys(t).forEach(n=>{o[n]=Y(t[n])}),o}function ft(t,o=300){let n=null;return function(...l){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,l)},o)}}function gt(t,o=300){let n=0;return function(...l){const s=Date.now();s-n>=o&&(n=s,t.apply(this,l))}}function pe(t){if(t==null||t==="")return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"){const l=new Date(t);return Number.isNaN(l.getTime())?null:l}const o=String(t).trim();if(!o)return null;if(/^\d{10,13}$/.test(o)){const l=o.length===10?Number(o)*1e3:Number(o),s=new Date(l);return Number.isNaN(s.getTime())?null:s}if(/[Zz]$|[+-]\d{2}:?\d{2}$/.test(o)){const l=new Date(o);return Number.isNaN(l.getTime())?null:l}const n=o.match(/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:[\sT]+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,3}))?)?/);if(n){const[,l,s,c,g="0",k="0",d="0",u="0"]=n,_=new Date(Number(l),Number(s)-1,Number(c),Number(g),Number(k),Number(d),Number(String(u).padEnd(3,"0")));return Number.isNaN(_.getTime())?null:_}const r=new Date(o);return Number.isNaN(r.getTime())?null:r}function q(t,o="YYYY-MM-DD HH:mm:ss"){const n=pe(t);if(!n)return"";const r=n.getFullYear(),l=n.getMonth()+1,s=n.getDate(),c=n.getHours(),g=n.getMinutes(),k=n.getSeconds(),d={YYYY:String(r),MM:String(l).padStart(2,"0"),DD:String(s).padStart(2,"0"),HH:String(c).padStart(2,"0"),mm:String(g).padStart(2,"0"),ss:String(k).padStart(2,"0"),M:String(l),D:String(s),H:String(c),m:String(g),s:String(k)};return o.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g,u=>d[u])}function ht(){const t=new Date;t.setHours(23,59,59,0);const o=new Date;return o.setDate(o.getDate()-30),o.setHours(0,0,0,0),{start:q(o,"YYYY-MM-DD HH:mm:ss"),end:q(t,"YYYY-MM-DD HH:mm:ss")}}function yt(t){const o={};return Object.keys(t||{}).forEach(n=>{const r=t[n];r==null||r===""||Array.isArray(r)&&r.length===0||(o[n]=r)}),o}function bt(t,o=2){if(t==null||t==="")return t;const n=Number(t);if(Number.isNaN(n))return t;const r=n.toFixed(o),[l,s]=r.split("."),c=l.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(s==null)return c;const g=s.replace(/0+$/,"");return g?`${c}.${g}`:c}function _t(t="id"){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}const kt=Object.freeze(Object.defineProperty({__proto__:null,cleanParams:yt,debounce:ft,deepClone:Y,formatDate:q,formatNum:bt,getRecentMonthRange:ht,isEmpty:ut,parseDate:pe,throttle:gt,uniqueId:_t},Symbol.toStringTag,{value:"Module"}));function me(t={}){const{baseURL:o="",timeout:n=6e4,tokenKey:r,systemIdKey:l,loginUrl:s="/login"}=t,c=we.create({baseURL:o,timeout:n});let g=!1;function k(){typeof localStorage<"u"&&localStorage.clear(),!g&&(g=!0,setTimeout(()=>{typeof window<"u"&&window.location.replace(s)},1500))}return c.interceptors.request.use(d=>{if(d.headers["Content-Type"]="application/json;charset=UTF-8",typeof localStorage<"u"){if(r){const u=localStorage.getItem(r);u&&(d.headers.Authorization=u)}if(l){const u=localStorage.getItem(l);u&&(d.headers.systemId=u)}}return d},d=>Promise.reject(d)),c.interceptors.response.use(d=>{if(d.status!==200)return Promise.reject(new Error(`请求发生错误,状态码 ${d.status}`));const{data:u,config:_}=d;if(_.responseType==="arraybuffer")return u;if(u&&u.code===0)return u.data;const m=Number(u==null?void 0:u.code);if(m===401||m===403)return k(),Promise.reject(new Error("登录失效,请重新登录"));const h=ue(u)||"请求失败";return Promise.reject(new Error(h))},d=>{var h,p;const u=(h=d==null?void 0:d.response)==null?void 0:h.status;if(u===401||u===403)return k(),Promise.reject(new Error("登录失效,请重新登录"));const _=(p=d==null?void 0:d.response)==null?void 0:p.data,m=ue(_)||(d==null?void 0:d.message)||"请求失败";return Promise.reject(new Error(String(m)))}),c}function ue(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t!="object")return String(t);const o=[t.message,t.msg,t.data,t.error];for(const n of o)if(!(n==null||n==="")&&(typeof n=="string"||typeof n=="number"))return String(n);return""}function fe(t={}){const o=me(t);return{GET(n,r={}){return o({method:"get",url:n,...r})},POST(n,r,l={}){return o({method:"post",url:n,data:r,...l})},DELETE(n,r={}){return o({method:"delete",url:n,...r})}}}const ge="__MGACN_COMMONSDK_REQUEST__";function Ct(t){globalThis[ge]=t}function wt(){const t=globalThis[ge];if(!t)throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");return t}const Nt={MgImageUpload:se,MgSearchForm:ie,MgDataTable:ce,MgDateRangePicker:I,MgSegmentedControl:de,MgOverflowHid:j},he=(t,o={})=>{Object.entries(Nt).forEach(([l,s])=>{t.component(s.name||l,s)});const n=fe(o),r=X(n);Ct(n),Z(r),t.config.globalProperties.$request=n,t.config.globalProperties.$api=r},St={install:he,version:"1.0.0"};b.DataTable=ce,b.DateRangePicker=I,b.ImageUpload=se,b.SearchForm=ie,b.SegmentedControl=de,b.TableOverflowHid=j,b.aliOssMixin=oe,b.createApi=X,b.createOssClient=P,b.createRequest=fe,b.createService=me,b.default=St,b.getApi=v,b.getOssSts=H,b.getRequest=wt,b.install=he,b.setApi=Z,b.uploadToOss=ne,b.utils=kt,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(b,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("@element-plus/icons-vue"),require("element-plus"),require("cropperjs"),require("ali-oss"),require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","@element-plus/icons-vue","element-plus","cropperjs","ali-oss","vue","axios"],E):(b=typeof globalThis<"u"?globalThis:b||self,E(b.MgacnCommonSdk={},b.ElementPlusIconsVue,b.ElementPlus,b.Cropper,b.OSS,b.Vue,b.axios))})(this,(function(b,E,$,Ce,we,e,Ne){"use strict";function Se(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return o.default=t,Object.freeze(o)}const X=Se(we);function J(t){if(!t)throw new Error("[mgacn-commonsdk] createApi 需要传入 request 实例");return{logout(o){return t.GET(`/yhAdmin/login/exit/${o}`)},getUserInfo(o){return t.GET(`/yhAdmin/user/queryUser/${o}`)},getOssSts(o){return t.GET("/yhAdmin/oss/fileUploadSts",{params:{dir:o}})}}}const Z="__MGACN_COMMONSDK_API__";function v(t){globalThis[Z]=t}function ee(){const t=globalThis[Z];if(!t)throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");return t}const Ve=X.default??X;function te(t){return String(t).padStart(2,"0")}function xe(){const t=new Date;return`${t.getFullYear()}${te(t.getMonth()+1)}${te(t.getDate())}`}function ne(t=10){const o="0123456789abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<t;r++)n+=o[Math.floor(Math.random()*o.length)];return n}function P(t="portal_cms"){return`${t}/${xe()}/`}function z(t){return ee().getOssSts(t)}async function H(t={}){const{dir:o,foldName:n,getOss:r,ossinfo:l}=t,s=o||P(n||"portal_cms"),c=l||(typeof r=="function"?await r(s):await z(s));if(!c)throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败");const g=new Ve({bucket:c.bucketName,accessKeyId:c.accessKeyId,accessKeySecret:c.accessKeySecret,success_action_status:"200",stsToken:c.securityToken,endpoint:c.endPoint});return g.options.ossUrl=c.ossUrl||c.domain||(c.bucketName&&c.endPoint?`https://${c.bucketName}.${c.endPoint}`:""),g.options.uploadDir=s,g}async function oe(t={}){const{client:o,file:n,dir:r,foldName:l,fileName:s,onProgress:c}=t;if(!n)throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");const g=o||await H({dir:r,foldName:l}),k=r||g.options.uploadDir||P(l);let d=s;if(!d){const h=n.name||"file",p=h.indexOf("."),w=p>-1?h.slice(p):"";d=`${k}${ne(10)}${w}`}const u=await g.multipartUpload(d,n,{progress:h=>{typeof c=="function"&&c(Math.floor(h*100))}});if(u.res&&u.res.statusCode!==200)throw new Error("[mgacn-commonsdk] 上传失败");const _=(g.options.ossUrl||"").replace(/\/$/,""),m=_?`${_}/${d}`:d;return{name:d,url:m,raw:u,client:g}}const le={methods:{getDir(){return P(this.foldName||"portal_cms")},randomString:ne,getOss(){return z(this.getDir())},async createOssClient(){return H({dir:this.getDir(),getOss:()=>this.getOss()})}}},T=(t,o)=>{const n=t.__vccOpts||t;for(const[r,l]of o)n[r]=l;return n};let ae=0;function re(){return ae+=1,`mg-img-${Date.now()}-${ae}`}function Be(t){return Array.isArray(t)?t.filter(Boolean):t?[t]:[]}function se(t){return t.map(o=>({uid:re(),url:o,status:"success",percent:100,previewUrl:""}))}function Ee(t=""){const o=t.lastIndexOf(".");return o>-1?t.slice(o+1).toLowerCase():""}const De={name:"MgImageUpload",mixins:[le],components:{CircleCloseFilled:E.CircleCloseFilled,Delete:E.Delete,Plus:E.Plus},props:{modelValue:{type:[Array,String],default:()=>[]},greyTips:String,otherTips:String,maxFileSize:{type:Number,default:100},fileNum:{type:Number,default:1},initFileList:{type:Array,default:()=>[]},isCropper:Boolean,isDegree:Boolean,degree:{type:Number,default:3},aspectRatio:{type:Number,default:1},imageStyle:Object,resetFilelist:Boolean,accept:{type:String,default:".jpg,.jpeg,.png,.gif,.svg"},foldName:{type:String,default:"portal_cms"},disabled:Boolean,uploading:{type:Boolean,default:!1}},emits:["update:modelValue","update:uploading","sendFile","success","error","progress"],expose:["hasPendingUpload","isUploading"],data(){return{fileList:[],cropImageUrl:"",dialogVisible:!1,cropper:null}},computed:{multiple(){return this.fileNum>1&&!this.isCropper},hasPendingUpload(){return this.fileList.some(t=>t.status==="uploading")},uploadingCount(){return this.fileList.filter(t=>t.status==="uploading").length},showUploadBtn(){return!this.disabled&&this.fileList.length<this.fileNum},acceptList(){return this.accept.split(",").map(t=>t.replace(".","").trim().toLowerCase()).filter(Boolean)},successUrls(){return this.fileList.filter(t=>t.status==="success").map(t=>t.url)}},watch:{hasPendingUpload:{immediate:!0,handler(t){t!==this.uploading&&this.$emit("update:uploading",t)}},initFileList:{deep:!0,immediate:!0,handler(t){t!=null&&t.length&&this.replaceList(se(t))}},modelValue:{immediate:!0,handler(t){var r;if((r=this.initFileList)!=null&&r.length)return;const o=Be(t),n=this.successUrls;o.length===n.length&&o.every((l,s)=>l===n[s])||this.replaceList(se(o))}},cropImageUrl(t){this.cropper&&(t?this.cropper.replace(t):this.destroyCropper())}},beforeUnmount(){this.destroyCropper(),this.revokeAllPreviews()},methods:{isUploading(){return this.hasPendingUpload},replaceList(t){this.revokeAllPreviews(),this.fileList=t},revokePreview(t){t!=null&&t.previewUrl&&(URL.revokeObjectURL(t.previewUrl),t.previewUrl="")},revokeAllPreviews(){this.fileList.forEach(t=>this.revokePreview(t))},emitFile(){const t=[...this.successUrls];this.$emit("update:modelValue",t),this.$emit("sendFile",t)},openFilePicker(){const t=this.$refs.fileInput;t&&(t.value="",t.click())},handleUpload(){if(!this.disabled){if(this.fileList.length>=this.fileNum){$.ElMessage.error(`文件数量不超过${this.fileNum}`);return}this.openFilePicker()}},onFileChange(t){const o=[...t.target.files||[]];if(!o.length)return;const n=this.fileNum-this.fileList.length;if(o.length>n){$.ElMessage.error(`文件数量不超过${this.fileNum}个`);return}const r=[],l=[];if(o.forEach(s=>{this.acceptList.includes(Ee(s.name))?r.push(s):l.push(s)}),l.length){const s=l.map(c=>c.name).join(",");$.ElMessageBox.confirm(`已过滤以下 ${l.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${s}</p><br/>只接受:${this.acceptList.join("/")}`,"提示",{confirmButtonText:"确认",showCancelButton:!1,dangerouslyUseHTMLString:!0,type:"warning"}).catch(()=>{})}if(r.length){if(this.isCropper){this.openCropper(r[0]);return}this.startUpload(r)}},openCropper(t){const o=new FileReader;o.onloadend=n=>{this.cropImageUrl=n.target.result,this.dialogVisible=!0,this.cropper||this.$nextTick(()=>this.initCropper())},o.readAsDataURL(t)},startUpload(t){this.resetFilelist&&this.replaceList([]);const o=this.maxFileSize*1024*1024,n=[];return t.forEach(r=>{if(r.size>o){$.ElMessage.error(`「${r.name}」超出 ${this.maxFileSize}MB 限制`);return}const l=URL.createObjectURL(r),s={uid:re(),url:l,previewUrl:l,status:"uploading",percent:0,raw:r};this.fileList.push(s),n.push(this.uploadOne(s))}),Promise.all(n)},async uploadOne(t){try{const o=await oe({file:t.raw,dir:this.getDir(),onProgress:n=>{t.percent=n,this.$emit("progress",n,t.raw)}});this.revokePreview(t),t.url=o.url,t.status="success",t.percent=100,t.raw=null,this.emitFile(),this.$emit("success",o,t)}catch(o){t.status="fail",t.percent=0,this.$emit("error",o,t)}finally{this.dialogVisible&&this.handleBack()}},initCropper(){const t=this.$refs.cropImage;t&&(this.cropper=new Ce(t,{aspectRatio:this.aspectRatio,autoCropArea:.8,viewMode:1,movable:!0,zoomable:!0,rotatable:!0,guides:!0,background:!0,cropBoxMovable:!0,cropBoxResizable:!0,minCropBoxWidth:100,minCropBoxHeight:100}))},destroyCropper(){this.cropper&&(this.cropper.destroy(),this.cropper=null)},rotate(t){var o;(o=this.cropper)==null||o.rotate(t)},confirmCrop(){if(this.uploadingCount){$.ElMessage.error("上传中,请稍后!");return}if(!this.cropper)return;const t=this.cropper.getCroppedCanvas().toDataURL("image/jpeg");this.startUpload([this.base64ToFile(t)])},base64ToFile(t){const[o,n]=t.split(","),r=o.match(/:(.*?);/)[1],l=r.split("/")[1],s=atob(n),c=new Uint8Array(s.length);for(let g=0;g<s.length;g++)c[g]=s.charCodeAt(g);return new File([c],`${Date.now()}.${l}`,{type:r})},handleBack(){this.cropImageUrl="",this.dialogVisible=!1},removeImg(t){const o=this.fileList[t];!o||o.status==="uploading"||(this.revokePreview(o),this.fileList.splice(t,1),this.emitFile())}}},Me={class:"upload-image-cropper"},Te=["multiple","accept"],Ue={key:0,class:"grey-tips"},Le={key:0},$e={class:"list-box"},Oe={key:0,class:"status-mask is-uploading"},Fe={class:"progress-wrap"},Ae={class:"percent-text"},Re={key:1,class:"status-mask is-fail"},Pe=["onClick"],ze={class:"cropper-box"},He=["src"],je={class:"btn-box"},Ie={class:"btn-box"};function Ye(t,o,n,r,l,s){const c=e.resolveComponent("el-image"),g=e.resolveComponent("el-progress"),k=e.resolveComponent("CircleCloseFilled"),d=e.resolveComponent("el-icon"),u=e.resolveComponent("Delete"),_=e.resolveComponent("Plus"),m=e.resolveComponent("el-button"),h=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("input",{ref:"fileInput",type:"file",class:"file-input",multiple:s.multiple,accept:n.accept,onChange:o[0]||(o[0]=(...p)=>s.onFileChange&&s.onFileChange(...p))},null,40,Te),n.greyTips?(e.openBlock(),e.createElementBlock("div",Ue,[n.otherTips?(e.openBlock(),e.createElementBlock("div",Le,e.toDisplayString(n.otherTips),1)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.greyTips),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.fileList,(p,w)=>(e.openBlock(),e.createElementBlock("div",{key:p.uid,class:e.normalizeClass(["image-box",[`is-${p.status}`]]),style:e.normalizeStyle(n.imageStyle)},[e.createVNode(c,{src:p.url,fit:"cover",class:"img"},null,8,["src"]),p.status==="uploading"?(e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Fe,[e.createVNode(g,{type:"circle",percentage:p.percent,width:30,"stroke-width":3,"show-text":!1,color:"var(--mg-primary, #ff5722)"},null,8,["percentage"]),e.createElementVNode("span",Ae,e.toDisplayString(p.percent)+"%",1)])])):p.status==="fail"?(e.openBlock(),e.createElementBlock("div",Re,[e.createVNode(d,{class:"fail-icon",size:16},{default:e.withCtx(()=>[e.createVNode(k)]),_:1}),o[5]||(o[5]=e.createElementVNode("span",{class:"fail-text"},"失败",-1)),e.createVNode(d,{class:"remove-icon",size:14,title:"删除",onClick:e.withModifiers(S=>s.removeImg(w),["stop"])},{default:e.withCtx(()=>[e.createVNode(u)]),_:1},8,["onClick"])])):(e.openBlock(),e.createElementBlock("div",{key:2,class:"status-mask is-success",onClick:S=>s.removeImg(w)},[e.createVNode(d,{class:"remove-icon",size:16},{default:e.withCtx(()=>[e.createVNode(u)]),_:1})],8,Pe))],6))),128)),e.withDirectives(e.createElementVNode("div",{class:"image-box upload-btn",style:e.normalizeStyle(n.imageStyle),onClick:o[1]||(o[1]=(...p)=>s.handleUpload&&s.handleUpload(...p))},[e.createVNode(d,{class:"icon",size:14},{default:e.withCtx(()=>[e.createVNode(_)]),_:1}),o[6]||(o[6]=e.createElementVNode("div",null,"上传图片",-1))],4),[[e.vShow,s.showUploadBtn]])]),e.createVNode(h,{modelValue:l.dialogVisible,"onUpdate:modelValue":o[4]||(o[4]=p=>l.dialogVisible=p),title:"裁剪图片",width:"600px",top:"5vh","append-to-body":"","close-on-click-modal":!1,onClose:s.handleBack},{default:e.withCtx(()=>[e.createElementVNode("div",ze,[e.withDirectives(e.createElementVNode("img",{ref:"cropImage",src:l.cropImageUrl,class:"cropper-img"},null,8,He),[[e.vShow,l.cropImageUrl]])]),e.createElementVNode("div",je,[n.isDegree?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(m,{onClick:o[2]||(o[2]=p=>s.rotate(-n.degree))},{default:e.withCtx(()=>[...o[7]||(o[7]=[e.createTextVNode("向左旋转",-1)])]),_:1}),e.createVNode(m,{onClick:o[3]||(o[3]=p=>s.rotate(n.degree))},{default:e.withCtx(()=>[...o[8]||(o[8]=[e.createTextVNode("向右旋转",-1)])]),_:1})],64)):e.createCommentVNode("",!0),e.createVNode(m,{type:"primary",onClick:s.openFilePicker},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cropImageUrl?"重新上传":"点击上传"),1)]),_:1},8,["onClick"])]),e.createElementVNode("div",Ie,[e.createVNode(m,{onClick:s.handleBack},{default:e.withCtx(()=>[...o[9]||(o[9]=[e.createTextVNode("取 消",-1)])]),_:1},8,["onClick"]),e.createVNode(m,{type:"primary",onClick:s.confirmCrop},{default:e.withCtx(()=>[...o[10]||(o[10]=[e.createTextVNode("确定",-1)])]),_:1},8,["onClick"])])]),_:1},8,["modelValue","onClose"])])}const ie=T(De,[["render",Ye],["__scopeId","data-v-27d5f986"]]),qe={__name:"DateRangePicker",props:{start:{type:String},end:{type:String},type:{default:"daterange"},format:{default:"YYYY-MM-DD"},valueFormat:{default:"YYYY-MM-DD HH:mm:ss"},defaultTime:{default:[new Date(2024,1,1,0,0,0),new Date(2024,1,1,23,59,59)]},title:{type:String,default:""},canClearable:{type:Boolean,default:!0}},emits:["update:start","update:end","change"],setup(t,{emit:o}){const n=o,r=t,l=e.ref([]);e.watch(()=>r.start,()=>{l.value=[r.start,r.end]}),e.onMounted(()=>{l.value=[r.start,r.end]});function s(c){n("update:start",c?c[0]:""),n("update:end",c?c[1]:""),n("change")}return(c,g)=>{const k=e.resolveComponent("el-date-picker");return e.openBlock(),e.createBlock(k,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=d=>l.value=d),type:t.type,"range-separator":"至","start-placeholder":`${t.title} 开始`,"end-placeholder":"结束","value-format":t.valueFormat,"default-time":t.defaultTime,class:"date-range-picker",onChange:s,clearable:t.canClearable},null,8,["modelValue","type","start-placeholder","value-format","default-time","clearable"])}}},j=T(qe,[["__scopeId","data-v-47618fba"]]),Ke={class:"common-search__body"},We={class:"common-search__fields-wrap"},Ge={key:0,class:"common-search__label"},Qe={key:4,class:"common-search__range"},Xe={class:"common-search__range-sep"},Je={key:6,class:"common-search__range"},Ze={key:0,class:"common-search__actions is-inline"},ve={key:0,class:"common-search__footer"},et={class:"common-search__actions is-bottom"},tt={class:"common-search__actions-main"},ce=T(Object.assign({name:"MgSearchForm"},{__name:"SearchForm",props:{modelValue:{type:Object,default:()=>({})},itemList:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["change","search","reset","update:modelValue"],setup(t,{emit:o}){const n=t,r=o,l=e.ref({}),s=e.reactive({}),c=e.reactive({});let g=!1;function k(i,f){return JSON.stringify(i??{})===JSON.stringify(f??{})}const d=e.ref(null),u=e.ref(!1),_=e.ref(!1),m=e.ref(0),h=e.ref(0),p=e.ref(null);let w=null,S=!1,C=!1;const K=e.computed(()=>{if(!(!_.value||p.value==null))return{maxHeight:`${p.value}px`,overflow:"hidden"}});e.watch(()=>n.modelValue,i=>{k(i,l.value)||(g=!0,l.value={...i||{}},e.nextTick(()=>{g=!1}))},{deep:!0,immediate:!0}),e.watch(l,()=>{g||r("update:modelValue",{...l.value})},{deep:!0}),e.watch(()=>n.itemList,()=>{u.value=!1,e.nextTick(()=>O())},{deep:!0}),e.onMounted(()=>{e.nextTick(()=>O()),typeof ResizeObserver<"u"&&(w=new ResizeObserver(()=>{!S&&!C&&O()}),d.value&&w.observe(d.value)),window.addEventListener("resize",V)}),e.onBeforeUnmount(()=>{w==null||w.disconnect(),window.removeEventListener("resize",V)});function V(){!S&&!C&&O()}function W(i){if(!i.width)return;const f=typeof i.width=="number"?`${i.width}px`:i.width;return{width:f,minWidth:f}}function be(i,f){if(i==null)return"";if(typeof i!="object")return String(i);const N=f.optionsLabel||"label";return typeof N=="string"?i[N]:Array.isArray(N)?`${i[N[0]]}(${i[N[1]]})`:i.label}function F(i,f){return i==null||typeof i!="object"?i:i[f.optionsValue||"value"]}async function Et(i,f){if(typeof i.remoteMethod=="function"){c[i.prop]=!0;try{const N=await i.remoteMethod(f);s[i.prop]=Array.isArray(N)?N:[]}finally{c[i.prop]=!1}}}function _e(i){const f=i.style.maxHeight,N=i.style.overflow,U=i.style.transition;i.style.transition="none",i.style.maxHeight="none",i.style.overflow="visible";const D=i.scrollHeight;return i.style.maxHeight=f,i.style.overflow=N,i.offsetHeight,i.style.transition=U,D}function O(){const i=d.value;if(!i||S||C)return;S=!0;const f=i.closest(".common-search"),N=i.querySelectorAll(".common-search__field");if(!N.length||!f){_.value=!1,m.value=0,h.value=0,p.value=null,S=!1;return}m.value=N[0].offsetHeight,h.value=_e(i);const U=f.clientWidth,D=20;let M=0,R=1;Array.from(N).forEach((G,a)=>{const L=G.offsetWidth;if(a===0){M=L;return}M+D+L>U?(R+=1,M=L):M+=D+L});const B=R>1;_.value=B,B?u.value?p.value=h.value:p.value=m.value:(u.value=!1,p.value=null),S=!1}function Dt(){const i=d.value;if(!i||C)return;C=!0;const f=i.getBoundingClientRect().height||m.value;if(u.value)p.value=f,u.value=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=m.value})});else{p.value=f;const N=_e(i);h.value=N,u.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{p.value=N})})}window.setTimeout(()=>{C=!1,O()},380)}function Mt(){const i={};return n.itemList.forEach(f=>{f.type==="daterange"||f.type==="dateRange"?(i[f.start]=void 0,i[f.end]=void 0):f.type==="number-range"||f.type==="numberRange"?(i[f.start||`${f.prop}Min`]=void 0,i[f.end||`${f.prop}Max`]=void 0):f.multiple?i[f.prop]=[]:f.prop&&(i[f.prop]=void 0)}),i}function ke(){r("update:modelValue",{...l.value})}function x(){ke(),r("change",{...l.value}),r("search",{...l.value})}function A(){l.value=Mt(),ke(),r("reset",{...l.value}),r("change",{...l.value})}return(i,f)=>{const N=e.resolveComponent("el-input"),U=e.resolveComponent("el-option"),D=e.resolveComponent("el-select"),M=e.resolveComponent("el-input-number"),R=e.resolveComponent("el-date-picker"),B=e.resolveComponent("el-button"),G=e.resolveComponent("el-icon");return e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["common-search",{"is-single-row":!_.value,"is-multi-row":_.value,"is-expanded":_.value&&u.value,"is-collapsed":_.value&&!u.value}])},[e.createElementVNode("div",Ke,[e.createElementVNode("div",We,[e.createElementVNode("div",{ref_key:"fieldsRef",ref:d,class:"common-search__fields",style:e.normalizeStyle(K.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemList,(a,L)=>(e.openBlock(),e.createElementBlock("div",{key:a.prop||a.start||L,class:e.normalizeClass(["common-search__field",[`is-${a.type}`,a.className]]),style:e.normalizeStyle(W(a))},[a.label?(e.openBlock(),e.createElementBlock("label",Ge,e.toDisplayString(a.label),1)):e.createCommentVNode("",!0),a.type==="input"||a.type==="text"?(e.openBlock(),e.createBlock(N,{key:1,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,modelModifiers:{trim:!0},clearable:"",placeholder:a.placeholder||`请输入${a.label||""}`,maxlength:a.maxlength||200,disabled:a.disabled,onKeyup:e.withKeys(x,["enter"])},null,8,["modelValue","onUpdate:modelValue","placeholder","maxlength","disabled"])):a.type==="select"?(e.openBlock(),e.createBlock(D,{key:2,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,placeholder:a.placeholder||`请选择${a.label||""}`,clearable:"",filterable:a.filterable!==!1,multiple:a.multiple,"collapse-tags":a.multiple,"collapse-tags-tooltip":a.multiple,disabled:a.disabled,class:"common-search__control",onChange:x},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options||[],(y,Q)=>(e.openBlock(),e.createBlock(U,{key:`${F(y,a)}-${Q}`,label:be(y,a),value:F(y,a),disabled:typeof y=="object"&&(y==null?void 0:y.disabled)},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable","multiple","collapse-tags","collapse-tags-tooltip","disabled"])):a.type==="remote-select"||a.type==="remoteSelect"?(e.openBlock(),e.createBlock(D,{key:3,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,placeholder:a.placeholder||"请输入关键词搜索",clearable:"",filterable:"",remote:"",multiple:a.multiple,"collapse-tags":a.multiple,"collapse-tags-tooltip":a.multiple,"reserve-keyword":!1,"remote-method":y=>Et(a,y),loading:!!c[a.prop],disabled:a.disabled,class:"common-search__control",onClear:y=>s[a.prop]=[],onChange:x},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s[a.prop]||a.options||[],(y,Q)=>(e.openBlock(),e.createBlock(U,{key:`${F(y,a)}-${Q}`,label:be(y,a),value:F(y,a),disabled:typeof y=="object"&&(y==null?void 0:y.disabled)},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","multiple","collapse-tags","collapse-tags-tooltip","remote-method","loading","disabled","onClear"])):a.type==="number-range"||a.type==="numberRange"?(e.openBlock(),e.createElementBlock("div",Qe,[e.createVNode(M,{modelValue:l.value[a.start||`${a.prop}Min`],"onUpdate:modelValue":y=>l.value[a.start||`${a.prop}Min`]=y,controls:!1,min:a.min,max:a.max,precision:a.precision,placeholder:a.minPlaceholder||"最小值",disabled:a.disabled,class:"common-search__range-input"},null,8,["modelValue","onUpdate:modelValue","min","max","precision","placeholder","disabled"]),e.createElementVNode("span",Xe,e.toDisplayString(a.separator||"至"),1),e.createVNode(M,{modelValue:l.value[a.end||`${a.prop}Max`],"onUpdate:modelValue":y=>l.value[a.end||`${a.prop}Max`]=y,controls:!1,min:a.min,max:a.max,precision:a.precision,placeholder:a.maxPlaceholder||"最大值",disabled:a.disabled,class:"common-search__range-input"},null,8,["modelValue","onUpdate:modelValue","min","max","precision","placeholder","disabled"])])):a.type==="date"?(e.openBlock(),e.createBlock(R,{key:5,modelValue:l.value[a.prop],"onUpdate:modelValue":y=>l.value[a.prop]=y,type:a.dateType||"date",placeholder:a.placeholder||"年/月/日","value-format":a.valueFormat||"YYYY-MM-DD",format:a.format||"YYYY/MM/DD",clearable:a.clearable!==!1,disabled:a.disabled,class:"common-search__control"},null,8,["modelValue","onUpdate:modelValue","type","placeholder","value-format","format","clearable","disabled"])):a.type==="daterange"||a.type==="dateRange"?(e.openBlock(),e.createElementBlock("div",Je,[e.createVNode(j,{start:l.value[a.start],"onUpdate:start":y=>l.value[a.start]=y,end:l.value[a.end],"onUpdate:end":y=>l.value[a.end]=y,onChange:x},null,8,["start","onUpdate:start","end","onUpdate:end"])])):e.renderSlot(i.$slots,a.slotName||a.prop,{item:a,form:l.value},void 0,!0,7)],6))),128))],4)]),_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ze,[e.renderSlot(i.$slots,"actions",{search:x,reset:A,form:l.value},()=>[e.createVNode(B,{class:"common-search__reset",onClick:A},{default:e.withCtx(()=>[...f[0]||(f[0]=[e.createTextVNode("重置",-1)])]),_:1}),e.createVNode(B,{type:"primary",class:"common-search__submit",loading:t.loading,onClick:x},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["loading"])],!0)]))]),_.value?(e.openBlock(),e.createElementBlock("div",ve,[e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.renderSlot(i.$slots,"actions",{search:x,reset:A,form:l.value},()=>[e.createVNode(B,{class:"common-search__reset",onClick:A},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode("重置",-1)])]),_:1}),e.createVNode(B,{type:"primary",class:"common-search__submit",loading:t.loading,onClick:x},{default:e.withCtx(()=>[...f[3]||(f[3]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["loading"])],!0)]),e.createVNode(B,{onClick:Dt,type:"primary",plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value?"收起":"展开")+" ",1),e.createVNode(G,{class:"el-icon--right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value?"ArrowUp":"ArrowDown")))]),_:1})]),_:1})])])):e.createCommentVNode("",!0)],2)),[[e.vShow,t.itemList.length]])}}}),[["__scopeId","data-v-08ffb41c"]]),nt={name:"MgOverflowHid",props:{label:String,value:String,maxLength:{type:Number,default:40},labelClassName:{type:String,default:()=>"text_nomal"},valueClassName:{type:String,default:()=>"text_nomal"}},data(){return{}},methods:{cutString(t,o){let n=t||"";return n&&n.length>o&&(n=n.slice(0,o)+"..."),n}}},ot={class:"tableOverflowHid"},lt=["innerHTML"],at={class:"name-wrapper"},rt=["innerHTML"],st={key:1},it=["innerHTML"];function ct(t,o,n,r,l,s){const c=e.resolveComponent("el-popover");return e.openBlock(),e.createElementBlock("div",ot,[n.value&&n.value.length>n.maxLength?(e.openBlock(),e.createBlock(c,{key:0,trigger:"hover",placement:"bottom",width:"400"},{reference:e.withCtx(()=>[e.createElementVNode("div",at,[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{class:e.normalizeClass(n.valueClassName),innerHTML:s.cutString(n.value,n.maxLength)},null,10,rt)])]),default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{innerHTML:n.value},null,8,lt)]),_:1})):(e.openBlock(),e.createElementBlock("div",st,[e.withDirectives(e.createElementVNode("span",{class:e.normalizeClass(n.labelClassName)},e.toDisplayString(n.label)+":",3),[[e.vShow,n.label]]),e.createElementVNode("span",{class:e.normalizeClass([n.valueClassName,"value"])},[e.createElementVNode("span",{innerHTML:n.value},null,8,it)],2)]))])}const I=T(nt,[["render",ct],["__scopeId","data-v-ef86ea54"]]),dt={class:"common-table__main"},pt={key:0},mt={key:1},ut={key:2,class:"bold-text"},ft={key:0,class:"common-table__pagination"},de=T(Object.assign({name:"MgDataTable"},{__name:"DataTable",props:{propList:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},tableBind:{type:Object,default:()=>({})},canCellClick:{type:Boolean,default:!1},pagination:{type:Object,default:void 0},pageSizes:{type:Array,default:()=>[10,20,50,100]},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},showIndex:{type:Boolean,default:!1},indexLabel:{type:String,default:"序号"},indexWidth:{type:[String,Number],default:64},fillHeight:{type:Boolean,default:!1}},emits:["pageChange","cellClick","edit","delete"],setup(t,{emit:o}){const n=t,r=o,l={background:"var(--brand-secondary-pale)",color:"var(--brand-text-primary)",fontWeight:600,fontSize:"13px"},s=e.computed(()=>({headerCellStyle:l,...n.tableBind}));function c(m){const{slotName:h,maxLength:p,...w}=m||{};return{...w}}function g(m){return m==null||m===""?"-":m}function k(m){return n.pagination?(n.pagination.page-1)*n.pagination.limit+m+1:m+1}function d(m){var h;r("pageChange",{page:(h=n.pagination)==null?void 0:h.page,limit:m})}function u(m){var h;r("pageChange",{page:m,limit:(h=n.pagination)==null?void 0:h.limit})}function _(m,h,p,w){r("cellClick",m,h,p,w),n.canCellClick&&(h==null?void 0:h.label)!=="操作"&&window.getSelection().toString()}return(m,h)=>{const p=e.resolveComponent("el-table-column"),w=e.resolveComponent("el-table"),S=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["common-table",{"is-fill-height":t.fillHeight}])},[e.createElementVNode("div",dt,[e.createVNode(w,e.mergeProps({data:t.dataList,height:t.fillHeight?"100%":void 0,class:{"common-pointer-table":t.canCellClick}},s.value,{onCellClick:_}),{default:e.withCtx(()=>[t.showIndex?(e.openBlock(),e.createBlock(p,{key:0,type:"index",label:t.indexLabel,width:t.indexWidth,index:k,align:"center"},null,8,["label","width"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.propList,(C,K)=>(e.openBlock(),e.createBlock(p,e.mergeProps({key:C.prop||C.slotName||K},{ref_for:!0},c(C)),e.createSlots({_:2},[C.slotName?{name:"default",fn:e.withCtx(({row:V,$index:W})=>[C.slotName==="overtext"?(e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(I,{value:String(V[C.prop]??""),"max-length":C.maxLength||18},null,8,["value","max-length"])])):C.slotName==="whether"?(e.openBlock(),e.createElementBlock("div",mt,e.toDisplayString(V[C.prop]==0?"否":V[C.prop]==1?"是":""),1)):C.slotName==="boldtext"?(e.openBlock(),e.createElementBlock("div",ut,e.toDisplayString(V[C.prop]),1)):e.renderSlot(m.$slots,C.slotName,{row:V,index:W,column:C},()=>[e.createTextVNode(e.toDisplayString(g(V[C.prop])),1)],!0,3)]),key:"0"}:void 0]),1040))),128)),e.renderSlot(m.$slots,"default",{},void 0,!0)]),_:3},16,["data","height","class"])]),t.pagination?(e.openBlock(),e.createElementBlock("div",ft,[e.createVNode(S,{background:"","current-page":t.pagination.page,"page-size":t.pagination.limit,"page-sizes":t.pageSizes,total:t.pagination.total,layout:t.paginationLayout,onSizeChange:d,onCurrentChange:u},null,8,["current-page","page-size","page-sizes","total","layout"])])):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-5f80313c"]]),gt=["aria-checked","disabled","onClick"],pe=T({__name:"SegmentedControl",props:{modelValue:{type:[String,Number,Boolean],default:void 0},options:{type:Array,default:()=>[]}},emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,r=o,l=e.ref(null),s=e.ref([]),c=e.ref(!1),g=e.ref({width:"0px",transform:"translateX(0px)"});let k=null;function d(m,h){m&&(s.value[h]=m)}function u(){const m=l.value;if(!m)return;const h=n.options.findIndex(C=>C.value===n.modelValue),p=s.value[h];if(!p){g.value={width:"0px",transform:"translateX(0px)"};return}const w=m.getBoundingClientRect(),S=p.getBoundingClientRect();g.value={width:`${S.width}px`,transform:`translateX(${S.left-w.left}px)`},c.value=!0}function _(m){m.disabled||(r("update:modelValue",m.value),r("change",m.value))}return e.watch(()=>[n.modelValue,n.options],async()=>{await e.nextTick(),u()},{deep:!0}),e.onMounted(async()=>{await e.nextTick(),u(),typeof ResizeObserver<"u"&&l.value&&(k=new ResizeObserver(()=>u()),k.observe(l.value))}),e.onBeforeUnmount(()=>{k==null||k.disconnect(),k=null}),(m,h)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:l,class:"segmented",role:"radiogroup"},[e.createElementVNode("div",{class:e.normalizeClass(["segmented__thumb",{"is-ready":c.value}]),style:e.normalizeStyle(g.value)},null,6),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(p,w)=>(e.openBlock(),e.createElementBlock("button",{key:String(p.value),ref_for:!0,ref:S=>d(S,w),type:"button",class:e.normalizeClass(["segmented__item",{"is-active":t.modelValue===p.value}]),role:"radio","aria-checked":t.modelValue===p.value,disabled:p.disabled,onClick:S=>_(p)},e.toDisplayString(p.label),11,gt))),128))],512))}},[["__scopeId","data-v-8bff3e5b"]]);function ht(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0)}function Y(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t))return t.map(n=>Y(n));const o={};return Object.keys(t).forEach(n=>{o[n]=Y(t[n])}),o}function yt(t,o=300){let n=null;return function(...l){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,l)},o)}}function bt(t,o=300){let n=0;return function(...l){const s=Date.now();s-n>=o&&(n=s,t.apply(this,l))}}function me(t){if(t==null||t==="")return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"){const l=new Date(t);return Number.isNaN(l.getTime())?null:l}const o=String(t).trim();if(!o)return null;if(/^\d{10,13}$/.test(o)){const l=o.length===10?Number(o)*1e3:Number(o),s=new Date(l);return Number.isNaN(s.getTime())?null:s}if(/[Zz]$|[+-]\d{2}:?\d{2}$/.test(o)){const l=new Date(o);return Number.isNaN(l.getTime())?null:l}const n=o.match(/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:[\sT]+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,3}))?)?/);if(n){const[,l,s,c,g="0",k="0",d="0",u="0"]=n,_=new Date(Number(l),Number(s)-1,Number(c),Number(g),Number(k),Number(d),Number(String(u).padEnd(3,"0")));return Number.isNaN(_.getTime())?null:_}const r=new Date(o);return Number.isNaN(r.getTime())?null:r}function q(t,o="YYYY-MM-DD HH:mm:ss"){const n=me(t);if(!n)return"";const r=n.getFullYear(),l=n.getMonth()+1,s=n.getDate(),c=n.getHours(),g=n.getMinutes(),k=n.getSeconds(),d={YYYY:String(r),MM:String(l).padStart(2,"0"),DD:String(s).padStart(2,"0"),HH:String(c).padStart(2,"0"),mm:String(g).padStart(2,"0"),ss:String(k).padStart(2,"0"),M:String(l),D:String(s),H:String(c),m:String(g),s:String(k)};return o.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g,u=>d[u])}function _t(){const t=new Date;t.setHours(23,59,59,0);const o=new Date;return o.setDate(o.getDate()-30),o.setHours(0,0,0,0),{start:q(o,"YYYY-MM-DD HH:mm:ss"),end:q(t,"YYYY-MM-DD HH:mm:ss")}}function kt(t){const o={};return Object.keys(t||{}).forEach(n=>{const r=t[n];r==null||r===""||Array.isArray(r)&&r.length===0||(o[n]=r)}),o}function Ct(t,o=2){if(t==null||t==="")return t;const n=Number(t);if(Number.isNaN(n))return t;const r=n.toFixed(o),[l,s]=r.split("."),c=l.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(s==null)return c;const g=s.replace(/0+$/,"");return g?`${c}.${g}`:c}function wt(t="id"){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}const Nt=Object.freeze(Object.defineProperty({__proto__:null,cleanParams:kt,debounce:yt,deepClone:Y,formatDate:q,formatNum:Ct,getRecentMonthRange:_t,isEmpty:ht,parseDate:me,throttle:bt,uniqueId:wt},Symbol.toStringTag,{value:"Module"}));function ue(t={}){const{baseURL:o="",timeout:n=6e4,tokenKey:r,systemIdKey:l,loginUrl:s="/login"}=t,c=Ne.create({baseURL:o,timeout:n});let g=!1;function k(){typeof localStorage<"u"&&localStorage.clear(),!g&&(g=!0,setTimeout(()=>{typeof window<"u"&&window.location.replace(s)},1500))}return c.interceptors.request.use(d=>{if(d.headers["Content-Type"]="application/json;charset=UTF-8",typeof localStorage<"u"){if(r){const u=localStorage.getItem(r);u&&(d.headers.Authorization=u)}if(l){const u=localStorage.getItem(l);u&&(d.headers.systemId=u)}}return d},d=>Promise.reject(d)),c.interceptors.response.use(d=>{if(d.status!==200)return Promise.reject(new Error(`请求发生错误,状态码 ${d.status}`));const{data:u,config:_}=d;if(_.responseType==="arraybuffer")return u;if(u&&u.code===0)return u.data;const m=Number(u==null?void 0:u.code);if(m===401||m===403)return k(),Promise.reject(new Error("登录失效,请重新登录"));const h=fe(u)||"请求失败";return Promise.reject(new Error(h))},d=>{var h,p;const u=(h=d==null?void 0:d.response)==null?void 0:h.status;if(u===401||u===403)return k(),Promise.reject(new Error("登录失效,请重新登录"));const _=(p=d==null?void 0:d.response)==null?void 0:p.data,m=fe(_)||(d==null?void 0:d.message)||"请求失败";return Promise.reject(new Error(String(m)))}),c}function fe(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t!="object")return String(t);const o=[t.message,t.msg,t.data,t.error];for(const n of o)if(!(n==null||n==="")&&(typeof n=="string"||typeof n=="number"))return String(n);return""}function ge(t={}){const o=ue(t);return{GET(n,r={}){return o({method:"get",url:n,...r})},POST(n,r,l={}){return o({method:"post",url:n,data:r,...l})},DELETE(n,r={}){return o({method:"delete",url:n,...r})}}}const he="__MGACN_COMMONSDK_REQUEST__";function St(t){globalThis[he]=t}function Vt(){const t=globalThis[he];if(!t)throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");return t}const xt={MgImageUpload:ie,MgSearchForm:ce,MgDataTable:de,MgDateRangePicker:j,MgSegmentedControl:pe,MgOverflowHid:I},ye=(t,o={})=>{Object.entries(xt).forEach(([l,s])=>{t.component(s.name||l,s)});const n=ge(o),r=J(n);St(n),v(r),t.config.globalProperties.$request=n,t.config.globalProperties.$api=r},Bt={install:ye,version:"1.0.0"};b.DataTable=de,b.DateRangePicker=j,b.ImageUpload=ie,b.SearchForm=ce,b.SegmentedControl=pe,b.TableOverflowHid=I,b.aliOssMixin=le,b.createApi=J,b.createOssClient=H,b.createRequest=ge,b.createService=ue,b.default=Bt,b.getApi=ee,b.getOssSts=z,b.getRequest=Vt,b.install=ye,b.setApi=v,b.uploadToOss=oe,b.utils=Nt,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mgacn-commonsdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "芒果ACN公共组件库:公共组件、工具方法与网络请求封装",
5
5
  "type": "module",
6
6
  "main": "./dist/mgacn-commonsdk.umd.cjs",
@@ -45,7 +45,8 @@
45
45
  "dependencies": {
46
46
  "ali-oss": "^6.23.0",
47
47
  "axios": "^1.19.0",
48
- "cropperjs": "^1.6.2"
48
+ "cropperjs": "^1.6.2",
49
+ "mgacn-commonsdk": "^1.0.2"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@element-plus/icons-vue": "^2.3.2",