mgacn-commonsdk 1.0.3 → 1.0.4

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,10 +1,10 @@
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
- import Ye from "axios";
7
- function je(e) {
1
+ import { Plus as Pe, Delete as Fe, CircleCloseFilled as Ee, ArrowUp as He, ArrowDown as Be } from "@element-plus/icons-vue";
2
+ import { ElMessage as J, ElMessageBox as je } from "element-plus";
3
+ import Ye from "cropperjs";
4
+ import * as he from "ali-oss";
5
+ import { resolveComponent as x, openBlock as m, createElementBlock as v, createElementVNode as S, toDisplayString as D, createCommentVNode as A, createTextVNode as V, Fragment as K, renderList as q, normalizeStyle as ne, normalizeClass as I, createVNode as w, withCtx as C, withModifiers as ze, withDirectives as W, vShow as G, ref as R, watch as Z, onMounted as de, createBlock as O, reactive as ye, computed as Ce, nextTick as ee, onBeforeUnmount as Ue, withKeys as Ke, renderSlot as te, unref as ve, mergeProps as be, createSlots as qe } from "vue";
6
+ import We from "axios";
7
+ function Ge(e) {
8
8
  if (!e)
9
9
  throw new Error("[mgacn-commonsdk] createApi 需要传入 request 实例");
10
10
  return {
@@ -18,121 +18,209 @@ function je(e) {
18
18
  },
19
19
  // ---------- OSS ----------
20
20
  getOssSts(n) {
21
- return e.GET("/yhAdmin/oss/fileUploadSts", { params: { dir: n } });
21
+ return e.GET("/yhAdmin/oss/getStsToken", { params: { dir: n } });
22
22
  }
23
23
  };
24
24
  }
25
- const ke = "__MGACN_COMMONSDK_API__";
26
- function ze(e) {
27
- globalThis[ke] = e;
25
+ const xe = "__MGACN_COMMONSDK_API__";
26
+ function Qe(e) {
27
+ globalThis[xe] = e;
28
28
  }
29
- function Ke() {
30
- const e = globalThis[ke];
29
+ function Xe() {
30
+ const e = globalThis[xe];
31
31
  if (!e)
32
32
  throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
33
33
  return e;
34
34
  }
35
- const qe = fe.default ?? fe;
36
- function he(e) {
35
+ const Je = he.default ?? he, Ne = "__MGACN_COMMONSDK_OSS_URL__";
36
+ function Ze(e = "") {
37
+ globalThis[Ne] = String(e || "").replace(/\/$/, "");
38
+ }
39
+ function Me() {
40
+ return globalThis[Ne] || "";
41
+ }
42
+ function _e(e) {
37
43
  return String(e).padStart(2, "0");
38
44
  }
39
- function We() {
45
+ function et() {
40
46
  const e = /* @__PURE__ */ new Date();
41
- return `${e.getFullYear()}${he(e.getMonth() + 1)}${he(e.getDate())}`;
47
+ return `${e.getFullYear()}${_e(e.getMonth() + 1)}${_e(e.getDate())}`;
42
48
  }
43
- function Ce(e = 10) {
49
+ function De(e = 10) {
44
50
  const n = "0123456789abcdefghijklmnopqrstuvwxyz";
45
51
  let t = "";
46
- for (let r = 0; r < e; r++)
52
+ for (let a = 0; a < e; a++)
47
53
  t += n[Math.floor(Math.random() * n.length)];
48
54
  return t;
49
55
  }
50
- function ue(e = "portal_cms") {
51
- return `${e}/${We()}/`;
56
+ function pe(e = "portal_cms") {
57
+ return `${e}/${et()}/`;
52
58
  }
53
- function Se(e) {
54
- return Ke().getOssSts(e);
59
+ function $e(e) {
60
+ return Xe().getOssSts(e);
61
+ }
62
+ function tt(e = {}) {
63
+ const n = e.accessKeyId || e.AccessKeyId || e.accessKeyID || "", t = e.accessKeySecret || e.AccessKeySecret || "", a = e.securityToken || e.SecurityToken || e.stsToken || e.token || "", r = e.bucketName || e.bucket || e.BucketName || "";
64
+ let s = String(e.endPoint || e.endpoint || e.EndPoint || "").replace(/^https?:\/\//i, "").replace(/\/$/, "");
65
+ r && s.startsWith(`${r}.`) && (s = s.slice(r.length + 1));
66
+ const i = e.region || (s.startsWith("oss-") ? s.replace(/\.aliyuncs\.com.*$/i, "") : ""), c = String(e.ossUrl || e.domain || e.cdnDomain || "").replace(/\/$/, ""), b = r && s ? `https://${r}.${s}` : Me();
67
+ return {
68
+ accessKeyId: n,
69
+ accessKeySecret: t,
70
+ securityToken: a,
71
+ bucketName: r,
72
+ endPoint: s,
73
+ region: i,
74
+ ossUrl: c || b
75
+ };
55
76
  }
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));
58
- if (!i)
59
- throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败");
60
- const g = new qe({
61
- bucket: i.bucketName,
62
- accessKeyId: i.accessKeyId,
63
- accessKeySecret: i.accessKeySecret,
64
- success_action_status: "200",
65
- stsToken: i.securityToken,
66
- endpoint: i.endPoint
67
- });
68
- return g.options.ossUrl = i.ossUrl || i.domain || (i.bucketName && i.endPoint ? `https://${i.bucketName}.${i.endPoint}` : ""), g.options.uploadDir = o, g;
77
+ async function fe(e = {}) {
78
+ const { dir: n, foldName: t, getOss: a, ossinfo: r } = e, s = n || pe(t || "portal_cms"), i = r || (typeof a == "function" ? await a(s) : await $e(s)), c = tt(i || {});
79
+ if (!c.accessKeyId || !c.accessKeySecret || !c.bucketName)
80
+ throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:凭证字段不完整");
81
+ if (!c.securityToken)
82
+ throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:缺少 securityToken");
83
+ const b = {
84
+ bucket: c.bucketName,
85
+ accessKeyId: c.accessKeyId,
86
+ accessKeySecret: c.accessKeySecret,
87
+ stsToken: c.securityToken,
88
+ secure: !0,
89
+ success_action_status: "200"
90
+ };
91
+ c.region && (b.region = c.region), c.endPoint && (b.endpoint = c.endPoint);
92
+ const u = new Je(b);
93
+ return u.options.ossUrl = c.ossUrl || Me(), u.options.uploadDir = s, u;
69
94
  }
70
- async function Ge(e = {}) {
71
- const { client: n, file: t, dir: r, foldName: l, fileName: o, onProgress: i } = e;
95
+ async function nt(e = {}) {
96
+ var T, j;
97
+ const { client: n, file: t, dir: a, foldName: r, fileName: s, onProgress: i } = e;
72
98
  if (!t)
73
99
  throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
74
- const g = n || await xe({ dir: r, foldName: l }), k = r || g.options.uploadDir || ue(l);
75
- let u = o;
100
+ const c = n || await fe({ dir: a, foldName: r }), b = a || c.options.uploadDir || pe(r);
101
+ let u = s;
76
102
  if (!u) {
77
- const h = t.name || "file", c = h.indexOf("."), x = c > -1 ? h.slice(c) : "";
78
- u = `${k}${Ce(10)}${x}`;
103
+ const $ = t.name || "file", L = $.lastIndexOf("."), se = L > -1 ? $.slice(L) : "";
104
+ u = `${b}${De(10)}${se}`;
79
105
  }
80
- const p = await g.multipartUpload(u, t, {
81
- progress: (h) => {
82
- typeof i == "function" && i(Math.floor(h * 100));
106
+ const f = ($) => {
107
+ typeof i == "function" && i(Math.min(100, Math.max(0, Math.floor(Number($) * 100))));
108
+ }, k = t.size > 1 * 1024 * 1024, p = {
109
+ progress: async ($) => {
110
+ f($);
83
111
  }
84
- });
85
- if (p.res && p.res.statusCode !== 200)
112
+ };
113
+ let h;
114
+ const d = async ($) => {
115
+ const L = $ ? { "x-oss-object-acl": "public-read" } : void 0;
116
+ return k ? c.multipartUpload(u, t, {
117
+ ...p,
118
+ ...L ? { headers: L } : {}
119
+ }) : c.put(u, t, {
120
+ ...p,
121
+ ...L ? { headers: L } : {}
122
+ });
123
+ };
124
+ try {
125
+ f(0.01), h = await d(!0);
126
+ } catch {
127
+ f(0.01), h = await d(!1);
128
+ }
129
+ const U = ((T = h == null ? void 0 : h.res) == null ? void 0 : T.statusCode) ?? ((j = h == null ? void 0 : h.res) == null ? void 0 : j.status);
130
+ if (U && U !== 200)
86
131
  throw new Error("[mgacn-commonsdk] 上传失败");
87
- const w = (g.options.ossUrl || "").replace(/\/$/, ""), d = w ? `${w}/${u}` : u;
88
- return { name: u, url: d, raw: p, client: g };
132
+ f(1);
133
+ const N = (c.options.ossUrl || "").replace(/\/$/, ""), _ = N ? `${N}/${u}` : u;
134
+ let B = _;
135
+ try {
136
+ B = c.signatureUrl(u, { expires: 3600 * 24 });
137
+ } catch {
138
+ }
139
+ return {
140
+ name: u,
141
+ url: _,
142
+ previewUrl: B,
143
+ raw: h,
144
+ client: c
145
+ };
146
+ }
147
+ function rt(e = "", n = "") {
148
+ const t = String(e || "").trim();
149
+ if (!t) return "";
150
+ if (!/^https?:\/\//i.test(t)) return t.replace(/^\//, "");
151
+ try {
152
+ const a = new URL(t);
153
+ let r = decodeURIComponent(a.pathname.replace(/^\//, ""));
154
+ if (n) {
155
+ const s = String(n).replace(/\/$/, "");
156
+ t.startsWith(`${s}/`) && (r = decodeURIComponent(t.slice(s.length + 1).split("?")[0]));
157
+ }
158
+ return r.split("?")[0];
159
+ } catch {
160
+ return "";
161
+ }
162
+ }
163
+ async function at(e, n = {}) {
164
+ const t = n.client || await fe(n), a = rt(e, t.options.ossUrl);
165
+ if (!a) return e;
166
+ try {
167
+ return t.signatureUrl(a, { expires: n.expires || 3600 * 24 });
168
+ } catch {
169
+ return e;
170
+ }
89
171
  }
90
- const Qe = {
172
+ const lt = {
91
173
  methods: {
92
174
  getDir() {
93
- return ue(this.foldName || "portal_cms");
175
+ return pe(this.foldName || "portal_cms");
94
176
  },
95
- randomString: Ce,
177
+ randomString: De,
96
178
  getOss() {
97
- return Se(this.getDir());
179
+ return $e(this.getDir());
98
180
  },
99
181
  async createOssClient() {
100
- return xe({
182
+ return fe({
101
183
  dir: this.getDir(),
102
184
  getOss: () => this.getOss()
103
185
  });
104
186
  }
105
187
  }
106
- }, K = (e, n) => {
188
+ }, Q = (e, n) => {
107
189
  const t = e.__vccOpts || e;
108
- for (const [r, l] of n)
109
- t[r] = l;
190
+ for (const [a, r] of n)
191
+ t[a] = r;
110
192
  return t;
111
193
  };
112
- let ye = 0;
113
- function Ne() {
114
- return ye += 1, `mg-img-${Date.now()}-${ye}`;
194
+ let we = 0;
195
+ function Te() {
196
+ return we += 1, `mg-img-${Date.now()}-${we}`;
115
197
  }
116
- function Xe(e) {
198
+ function st(e) {
117
199
  return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
118
200
  }
119
- function be(e) {
201
+ function Se(e) {
120
202
  return e.map((n) => ({
121
- uid: Ne(),
203
+ uid: Te(),
122
204
  url: n,
123
205
  status: "success",
124
206
  percent: 100,
125
207
  previewUrl: ""
126
208
  }));
127
209
  }
128
- function Je(e = "") {
210
+ function le(e = "") {
211
+ return String(e).startsWith("blob:");
212
+ }
213
+ function ot(e = "") {
214
+ return /[?&](Expires|Signature|OSSAccessKeyId)=/i.test(String(e));
215
+ }
216
+ function it(e = "") {
129
217
  const n = e.lastIndexOf(".");
130
218
  return n > -1 ? e.slice(n + 1).toLowerCase() : "";
131
219
  }
132
- const Ze = {
220
+ const ct = {
133
221
  name: "MgImageUpload",
134
- mixins: [Qe],
135
- components: { CircleCloseFilled: Re, Delete: Ae, Plus: Oe },
222
+ mixins: [lt],
223
+ components: { CircleCloseFilled: Ee, Delete: Fe, Plus: Pe },
136
224
  props: {
137
225
  /** v-model 统一为 string[];入参兼容 string / string[] */
138
226
  modelValue: { type: [Array, String], default: () => [] },
@@ -154,13 +242,15 @@ const Ze = {
154
242
  uploading: { type: Boolean, default: !1 }
155
243
  },
156
244
  emits: ["update:modelValue", "update:uploading", "sendFile", "success", "error", "progress"],
157
- expose: ["hasPendingUpload", "isUploading"],
245
+ expose: ["hasPendingUpload", "isUploading", "openCropperDialog", "openCropUpload"],
158
246
  data() {
159
247
  return {
160
248
  fileList: [],
161
249
  cropImageUrl: "",
162
250
  dialogVisible: !1,
163
- cropper: null
251
+ cropper: null,
252
+ /** 进行中的上传任务数(与列表 status 解耦,保证 uploading 能正确回落) */
253
+ activeUploadCount: 0
164
254
  };
165
255
  },
166
256
  computed: {
@@ -169,10 +259,10 @@ const Ze = {
169
259
  },
170
260
  /** 是否存在未上传完的任务 */
171
261
  hasPendingUpload() {
172
- return this.fileList.some((e) => e.status === "uploading");
262
+ return this.activeUploadCount > 0;
173
263
  },
174
264
  uploadingCount() {
175
- return this.fileList.filter((e) => e.status === "uploading").length;
265
+ return this.activeUploadCount;
176
266
  },
177
267
  showUploadBtn() {
178
268
  return !this.disabled && this.fileList.length < this.fileNum;
@@ -188,23 +278,31 @@ const Ze = {
188
278
  hasPendingUpload: {
189
279
  immediate: !0,
190
280
  handler(e) {
191
- e !== this.uploading && this.$emit("update:uploading", e);
281
+ this.$emit("update:uploading", e);
192
282
  }
193
283
  },
194
284
  initFileList: {
195
285
  deep: !0,
196
286
  immediate: !0,
197
287
  handler(e) {
198
- e != null && e.length && this.replaceList(be(e));
288
+ e != null && e.length && (this.replaceList(Se(e)), this.ensureSignedPreviews());
199
289
  }
200
290
  },
201
291
  modelValue: {
202
292
  immediate: !0,
203
293
  handler(e) {
204
- var r;
205
- if ((r = this.initFileList) != null && r.length) return;
206
- const n = Xe(e), t = this.successUrls;
207
- n.length === t.length && n.every((l, o) => l === t[o]) || this.replaceList(be(n));
294
+ var s;
295
+ if ((s = this.initFileList) != null && s.length) return;
296
+ const n = st(e), t = this.successUrls;
297
+ if (n.length === t.length && n.every((i, c) => i === t[c]))
298
+ return;
299
+ const a = new Map(
300
+ this.fileList.map((i) => [i.url, i.previewUrl]).filter(([i]) => i)
301
+ ), r = Se(n).map((i) => ({
302
+ ...i,
303
+ previewUrl: a.get(i.url) || ""
304
+ }));
305
+ this.replaceList(r), this.ensureSignedPreviews();
208
306
  }
209
307
  },
210
308
  cropImageUrl(e) {
@@ -220,13 +318,36 @@ const Ze = {
220
318
  return this.hasPendingUpload;
221
319
  },
222
320
  replaceList(e) {
223
- this.revokeAllPreviews(), this.fileList = e;
321
+ const n = new Set(e.map((t) => t.previewUrl).filter(Boolean));
322
+ this.fileList.forEach((t) => {
323
+ le(t.previewUrl) && !n.has(t.previewUrl) && URL.revokeObjectURL(t.previewUrl);
324
+ }), this.fileList = e;
224
325
  },
225
326
  revokePreview(e) {
226
- e != null && e.previewUrl && (URL.revokeObjectURL(e.previewUrl), e.previewUrl = "");
327
+ le(e == null ? void 0 : e.previewUrl) && URL.revokeObjectURL(e.previewUrl);
227
328
  },
228
329
  revokeAllPreviews() {
229
- this.fileList.forEach((e) => this.revokePreview(e));
330
+ this.fileList.forEach((e) => {
331
+ le(e.previewUrl) && URL.revokeObjectURL(e.previewUrl);
332
+ });
333
+ },
334
+ /** 私有桶回显:给已有 url 补签名预览 */
335
+ async ensureSignedPreviews() {
336
+ const e = this.fileList.filter(
337
+ (n) => n.status === "success" && n.url && !le(n.previewUrl) && !ot(n.previewUrl || n.url)
338
+ );
339
+ if (e.length)
340
+ try {
341
+ const n = await this.createOssClient();
342
+ await Promise.all(
343
+ e.map(async (t) => {
344
+ const a = await at(t.url, { client: n });
345
+ a && (t.previewUrl = a);
346
+ })
347
+ );
348
+ } catch (n) {
349
+ console.warn("[MgImageUpload] 生成预览签名失败", n);
350
+ }
230
351
  },
231
352
  emitFile() {
232
353
  const e = [...this.successUrls];
@@ -236,10 +357,28 @@ const Ze = {
236
357
  const e = this.$refs.fileInput;
237
358
  e && (e.value = "", e.click());
238
359
  },
360
+ /**
361
+ * 外部触发:打开裁剪流程
362
+ * 默认先弹出系统选图,选完后进入裁剪弹窗(避免空弹窗无裁剪区)
363
+ */
364
+ openCropperDialog(e = {}) {
365
+ if (this.disabled) return;
366
+ if (e.pickFile !== !1) {
367
+ this.openFilePicker();
368
+ return;
369
+ }
370
+ this.dialogVisible = !0;
371
+ },
372
+ /**
373
+ * 外部触发:选图后进入裁剪弹窗(isCropper 模式下)
374
+ */
375
+ openCropUpload() {
376
+ this.disabled || this.openFilePicker();
377
+ },
239
378
  handleUpload() {
240
379
  if (!this.disabled) {
241
380
  if (this.fileList.length >= this.fileNum) {
242
- te.error(`文件数量不超过${this.fileNum}`);
381
+ J.error(`文件数量不超过${this.fileNum}`);
243
382
  return;
244
383
  }
245
384
  this.openFilePicker();
@@ -248,18 +387,18 @@ const Ze = {
248
387
  onFileChange(e) {
249
388
  const n = [...e.target.files || []];
250
389
  if (!n.length) return;
251
- const t = this.fileNum - this.fileList.length;
252
- if (n.length > t) {
253
- te.error(`文件数量不超过${this.fileNum}个`);
390
+ const t = this.dialogVisible || this.isCropper, a = this.fileNum - this.fileList.length;
391
+ if (!t && n.length > a) {
392
+ J.error(`文件数量不超过${this.fileNum}个`);
254
393
  return;
255
394
  }
256
- const r = [], l = [];
257
- if (n.forEach((o) => {
258
- this.acceptList.includes(Je(o.name)) ? r.push(o) : l.push(o);
259
- }), l.length) {
260
- const o = l.map((i) => i.name).join(",");
261
- Fe.confirm(
262
- `已过滤以下 ${l.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${o}</p><br/>只接受:${this.acceptList.join("/")}`,
395
+ const r = [], s = [];
396
+ if (n.forEach((i) => {
397
+ this.acceptList.includes(it(i.name)) ? r.push(i) : s.push(i);
398
+ }), s.length) {
399
+ const i = s.map((c) => c.name).join(",");
400
+ je.confirm(
401
+ `已过滤以下 ${s.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${i}</p><br/>只接受:${this.acceptList.join("/")}`,
263
402
  "提示",
264
403
  {
265
404
  confirmButtonText: "确认",
@@ -281,48 +420,59 @@ const Ze = {
281
420
  openCropper(e) {
282
421
  const n = new FileReader();
283
422
  n.onloadend = (t) => {
284
- this.cropImageUrl = t.target.result, this.dialogVisible = !0, this.cropper || this.$nextTick(() => this.initCropper());
423
+ const a = t.target.result;
424
+ this.cropImageUrl = a, this.dialogVisible = !0, this.$nextTick(() => {
425
+ requestAnimationFrame(() => {
426
+ if (this.cropper) {
427
+ this.cropper.replace(a);
428
+ return;
429
+ }
430
+ this.initCropper();
431
+ });
432
+ });
285
433
  }, n.readAsDataURL(e);
286
434
  },
287
435
  /** 先预览,再逐张上传;每张图独立进度蒙层 */
288
436
  startUpload(e) {
289
- this.resetFilelist && this.replaceList([]);
437
+ (this.resetFilelist || this.fileNum === 1) && this.replaceList([]);
290
438
  const n = this.maxFileSize * 1024 * 1024, t = [];
291
- return e.forEach((r) => {
292
- if (r.size > n) {
293
- te.error(`「${r.name}」超出 ${this.maxFileSize}MB 限制`);
439
+ return e.forEach((a) => {
440
+ if (a.size > n) {
441
+ J.error(`「${a.name}」超出 ${this.maxFileSize}MB 限制`);
294
442
  return;
295
443
  }
296
- const l = URL.createObjectURL(r), o = {
297
- uid: Ne(),
298
- url: l,
299
- previewUrl: l,
444
+ const r = URL.createObjectURL(a), s = {
445
+ uid: Te(),
446
+ url: r,
447
+ previewUrl: r,
300
448
  status: "uploading",
301
449
  percent: 0,
302
- raw: r
450
+ raw: a
303
451
  };
304
- this.fileList.push(o), t.push(this.uploadOne(o));
452
+ this.fileList.push(s), t.push(this.uploadOne(s));
305
453
  }), Promise.all(t);
306
454
  },
307
455
  async uploadOne(e) {
456
+ const n = e.previewUrl, t = (a) => {
457
+ const r = Math.min(100, Math.max(0, Number(a) || 0));
458
+ e.percent = r, this.$emit("progress", r, e.raw);
459
+ };
460
+ this.activeUploadCount += 1, this.$emit("update:uploading", !0);
308
461
  try {
309
- const n = await Ge({
462
+ t(0);
463
+ const a = await nt({
310
464
  file: e.raw,
311
465
  dir: this.getDir(),
312
- onProgress: (t) => {
313
- e.percent = t, this.$emit("progress", t, e.raw);
314
- }
466
+ onProgress: t
315
467
  });
316
- this.revokePreview(e), e.url = n.url, e.status = "success", e.percent = 100, e.raw = null, this.emitFile(), this.$emit("success", n, e);
317
- } catch (n) {
318
- e.status = "fail", e.percent = 0, this.$emit("error", n, e);
319
- } finally {
320
- this.dialogVisible && this.handleBack();
468
+ e.url = a.url, e.previewUrl = n || a.previewUrl || a.url, e.status = "success", t(100), e.raw = null, this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", a, e);
469
+ } catch (a) {
470
+ e.status = "fail", t(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), J.error((a == null ? void 0 : a.message) || "上传失败"), this.$emit("error", a, e);
321
471
  }
322
472
  },
323
473
  initCropper() {
324
474
  const e = this.$refs.cropImage;
325
- e && (this.cropper = new He(e, {
475
+ !e || !this.cropImageUrl || (this.destroyCropper(), this.cropper = new Ye(e, {
326
476
  aspectRatio: this.aspectRatio,
327
477
  autoCropArea: 0.8,
328
478
  viewMode: 1,
@@ -346,17 +496,17 @@ const Ze = {
346
496
  },
347
497
  confirmCrop() {
348
498
  if (this.uploadingCount) {
349
- te.error("上传中,请稍后!");
499
+ J.error("上传中,请稍后!");
350
500
  return;
351
501
  }
352
502
  if (!this.cropper) return;
353
- const e = this.cropper.getCroppedCanvas().toDataURL("image/jpeg");
354
- this.startUpload([this.base64ToFile(e)]);
503
+ const e = this.cropper.getCroppedCanvas().toDataURL("image/jpeg"), n = this.base64ToFile(e);
504
+ this.handleBack(), this.$nextTick(() => this.startUpload([n]));
355
505
  },
356
506
  base64ToFile(e) {
357
- const [n, t] = e.split(","), r = n.match(/:(.*?);/)[1], l = r.split("/")[1], o = atob(t), i = new Uint8Array(o.length);
358
- for (let g = 0; g < o.length; g++) i[g] = o.charCodeAt(g);
359
- return new File([i], `${Date.now()}.${l}`, { type: r });
507
+ const [n, t] = e.split(","), a = n.match(/:(.*?);/)[1], r = a.split("/")[1], s = atob(t), i = new Uint8Array(s.length);
508
+ for (let c = 0; c < s.length; c++) i[c] = s.charCodeAt(c);
509
+ return new File([i], `${Date.now()}.${r}`, { type: a });
360
510
  },
361
511
  handleBack() {
362
512
  this.cropImageUrl = "", this.dialogVisible = !1;
@@ -366,183 +516,185 @@ const Ze = {
366
516
  !n || n.status === "uploading" || (this.revokePreview(n), this.fileList.splice(e, 1), this.emitFile());
367
517
  }
368
518
  }
369
- }, et = { class: "upload-image-cropper" }, tt = ["multiple", "accept"], nt = {
519
+ }, ut = { class: "upload-image-cropper" }, dt = ["multiple", "accept"], pt = {
370
520
  key: 0,
371
521
  class: "grey-tips"
372
- }, lt = { key: 0 }, at = { class: "list-box" }, rt = {
522
+ }, ft = { key: 0 }, mt = { class: "list-box" }, gt = {
373
523
  key: 0,
374
524
  class: "status-mask is-uploading"
375
- }, ot = { class: "progress-wrap" }, st = { class: "percent-text" }, it = {
525
+ }, ht = { class: "progress-wrap" }, yt = { class: "percent-text" }, vt = {
376
526
  key: 1,
377
527
  class: "status-mask is-fail"
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) {
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");
381
- return m(), b("div", et, [
382
- _("input", {
528
+ }, bt = ["onClick"], _t = { class: "cropper-box" }, wt = ["src"], St = {
529
+ key: 0,
530
+ class: "cropper-placeholder"
531
+ }, kt = {
532
+ key: 0,
533
+ class: "btn-box btn-box--rotate"
534
+ }, Ct = { class: "btn-box" };
535
+ function Ut(e, n, t, a, r, s) {
536
+ const i = x("el-image"), c = x("el-progress"), b = x("CircleCloseFilled"), u = x("el-icon"), f = x("Delete"), k = x("Plus"), p = x("el-button"), h = x("el-dialog");
537
+ return m(), v("div", ut, [
538
+ S("input", {
383
539
  ref: "fileInput",
384
540
  type: "file",
385
541
  class: "file-input",
386
- multiple: o.multiple,
542
+ multiple: s.multiple,
387
543
  accept: t.accept,
388
- onChange: n[0] || (n[0] = (...c) => o.onFileChange && o.onFileChange(...c))
389
- }, null, 40, tt),
390
- t.greyTips ? (m(), b("div", nt, [
391
- t.otherTips ? (m(), b("div", lt, D(t.otherTips), 1)) : F("", !0),
392
- $(" " + D(t.greyTips), 1)
393
- ])) : F("", !0),
394
- _("div", at, [
395
- (m(!0), b(P, null, Y(l.fileList, (c, x) => (m(), b("div", {
396
- key: c.uid,
397
- class: V(["image-box", [`is-${c.status}`]]),
398
- style: X(t.imageStyle)
544
+ onChange: n[0] || (n[0] = (...d) => s.onFileChange && s.onFileChange(...d))
545
+ }, null, 40, dt),
546
+ t.greyTips ? (m(), v("div", pt, [
547
+ t.otherTips ? (m(), v("div", ft, D(t.otherTips), 1)) : A("", !0),
548
+ V(" " + D(t.greyTips), 1)
549
+ ])) : A("", !0),
550
+ S("div", mt, [
551
+ (m(!0), v(K, null, q(r.fileList, (d, U) => (m(), v("div", {
552
+ key: d.uid,
553
+ class: I(["image-box", [`is-${d.status}`]]),
554
+ style: ne(t.imageStyle)
399
555
  }, [
400
- v(i, {
401
- src: c.url,
556
+ w(i, {
557
+ src: d.previewUrl || d.url,
402
558
  fit: "cover",
403
559
  class: "img"
404
560
  }, null, 8, ["src"]),
405
- c.status === "uploading" ? (m(), b("div", rt, [
406
- _("div", ot, [
407
- v(g, {
561
+ d.status === "uploading" ? (m(), v("div", gt, [
562
+ S("div", ht, [
563
+ w(c, {
408
564
  type: "circle",
409
- percentage: c.percent,
565
+ percentage: d.percent,
410
566
  width: 30,
411
567
  "stroke-width": 3,
412
568
  "show-text": !1,
413
569
  color: "var(--mg-primary, #ff5722)"
414
570
  }, null, 8, ["percentage"]),
415
- _("span", st, D(c.percent) + "%", 1)
571
+ S("span", yt, D(d.percent) + "%", 1)
416
572
  ])
417
- ])) : c.status === "fail" ? (m(), b("div", it, [
418
- v(u, {
573
+ ])) : d.status === "fail" ? (m(), v("div", vt, [
574
+ w(u, {
419
575
  class: "fail-icon",
420
576
  size: 16
421
577
  }, {
422
- default: S(() => [
423
- v(k)
578
+ default: C(() => [
579
+ w(b)
424
580
  ]),
425
581
  _: 1
426
582
  }),
427
- n[5] || (n[5] = _("span", { class: "fail-text" }, "失败", -1)),
428
- v(u, {
583
+ n[5] || (n[5] = S("span", { class: "fail-text" }, "失败", -1)),
584
+ w(u, {
429
585
  class: "remove-icon",
430
586
  size: 14,
431
587
  title: "删除",
432
- onClick: Ee((M) => o.removeImg(x), ["stop"])
588
+ onClick: ze((N) => s.removeImg(U), ["stop"])
433
589
  }, {
434
- default: S(() => [
435
- v(p)
590
+ default: C(() => [
591
+ w(f)
436
592
  ]),
437
593
  _: 1
438
594
  }, 8, ["onClick"])
439
- ])) : (m(), b("div", {
595
+ ])) : (m(), v("div", {
440
596
  key: 2,
441
597
  class: "status-mask is-success",
442
- onClick: (M) => o.removeImg(x)
598
+ onClick: (N) => s.removeImg(U)
443
599
  }, [
444
- v(u, {
600
+ w(u, {
445
601
  class: "remove-icon",
446
602
  size: 16
447
603
  }, {
448
- default: S(() => [
449
- v(p)
604
+ default: C(() => [
605
+ w(f)
450
606
  ]),
451
607
  _: 1
452
608
  })
453
- ], 8, ut))
609
+ ], 8, bt))
454
610
  ], 6))), 128)),
455
- j(_("div", {
611
+ W(S("div", {
456
612
  class: "image-box upload-btn",
457
- style: X(t.imageStyle),
458
- onClick: n[1] || (n[1] = (...c) => o.handleUpload && o.handleUpload(...c))
613
+ style: ne(t.imageStyle),
614
+ onClick: n[1] || (n[1] = (...d) => s.handleUpload && s.handleUpload(...d))
459
615
  }, [
460
- v(u, {
616
+ w(u, {
461
617
  class: "icon",
462
618
  size: 14
463
619
  }, {
464
- default: S(() => [
465
- v(w)
620
+ default: C(() => [
621
+ w(k)
466
622
  ]),
467
623
  _: 1
468
624
  }),
469
- n[6] || (n[6] = _("div", null, "上传图片", -1))
625
+ n[6] || (n[6] = S("div", null, "上传图片", -1))
470
626
  ], 4), [
471
- [z, o.showUploadBtn]
627
+ [G, s.showUploadBtn]
472
628
  ])
473
629
  ]),
474
- v(h, {
475
- modelValue: l.dialogVisible,
476
- "onUpdate:modelValue": n[4] || (n[4] = (c) => l.dialogVisible = c),
630
+ w(h, {
631
+ modelValue: r.dialogVisible,
632
+ "onUpdate:modelValue": n[4] || (n[4] = (d) => r.dialogVisible = d),
477
633
  title: "裁剪图片",
478
- width: "600px",
634
+ width: "650px",
479
635
  top: "5vh",
480
636
  "append-to-body": "",
637
+ class: "mg-image-upload-dialog",
481
638
  "close-on-click-modal": !1,
482
- onClose: o.handleBack
639
+ onClose: s.handleBack
483
640
  }, {
484
- default: S(() => [
485
- _("div", ct, [
486
- j(_("img", {
487
- ref: "cropImage",
488
- src: l.cropImageUrl,
489
- class: "cropper-img"
490
- }, null, 8, dt), [
491
- [z, l.cropImageUrl]
492
- ])
493
- ]),
494
- _("div", pt, [
495
- t.isDegree ? (m(), b(P, { key: 0 }, [
496
- v(d, {
497
- onClick: n[2] || (n[2] = (c) => o.rotate(-t.degree))
498
- }, {
499
- default: S(() => [...n[7] || (n[7] = [
500
- $("向左旋转", -1)
501
- ])]),
502
- _: 1
503
- }),
504
- v(d, {
505
- onClick: n[3] || (n[3] = (c) => o.rotate(t.degree))
506
- }, {
507
- default: S(() => [...n[8] || (n[8] = [
508
- $("向右旋转", -1)
509
- ])]),
510
- _: 1
511
- })
512
- ], 64)) : F("", !0),
513
- v(d, {
514
- type: "primary",
515
- onClick: o.openFilePicker
641
+ footer: C(() => [
642
+ t.isDegree ? (m(), v("div", kt, [
643
+ w(p, {
644
+ onClick: n[2] || (n[2] = (d) => s.rotate(-t.degree))
516
645
  }, {
517
- default: S(() => [
518
- $(D(l.cropImageUrl ? "重新上传" : "点击上传"), 1)
519
- ]),
646
+ default: C(() => [...n[7] || (n[7] = [
647
+ V("向左旋转", -1)
648
+ ])]),
520
649
  _: 1
521
- }, 8, ["onClick"])
522
- ]),
523
- _("div", ft, [
524
- v(d, { onClick: o.handleBack }, {
525
- default: S(() => [...n[9] || (n[9] = [
526
- $("取 消", -1)
650
+ }),
651
+ w(p, {
652
+ onClick: n[3] || (n[3] = (d) => s.rotate(t.degree))
653
+ }, {
654
+ default: C(() => [...n[8] || (n[8] = [
655
+ V("向右旋转", -1)
527
656
  ])]),
528
657
  _: 1
658
+ })
659
+ ])) : A("", !0),
660
+ S("div", Ct, [
661
+ w(p, {
662
+ type: "primary",
663
+ onClick: s.openFilePicker
664
+ }, {
665
+ default: C(() => [
666
+ V(D(r.cropImageUrl ? "重新上传" : "点击上传"), 1)
667
+ ]),
668
+ _: 1
529
669
  }, 8, ["onClick"]),
530
- v(d, {
670
+ w(p, {
531
671
  type: "primary",
532
- onClick: o.confirmCrop
672
+ onClick: s.confirmCrop
533
673
  }, {
534
- default: S(() => [...n[10] || (n[10] = [
535
- $("确定", -1)
674
+ default: C(() => [...n[9] || (n[9] = [
675
+ V("确定", -1)
536
676
  ])]),
537
677
  _: 1
538
678
  }, 8, ["onClick"])
539
679
  ])
540
680
  ]),
681
+ default: C(() => [
682
+ S("div", _t, [
683
+ W(S("img", {
684
+ ref: "cropImage",
685
+ src: r.cropImageUrl,
686
+ class: "cropper-img"
687
+ }, null, 8, wt), [
688
+ [G, r.cropImageUrl]
689
+ ]),
690
+ r.cropImageUrl ? A("", !0) : (m(), v("div", St, "请选择图片后进行裁剪"))
691
+ ])
692
+ ]),
541
693
  _: 1
542
694
  }, 8, ["modelValue", "onClose"])
543
695
  ]);
544
696
  }
545
- const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986"]]), ht = {
697
+ const xt = /* @__PURE__ */ Q(ct, [["render", Ut], ["__scopeId", "data-v-68531340"]]), Nt = {
546
698
  __name: "DateRangePicker",
547
699
  props: {
548
700
  start: {
@@ -569,23 +721,23 @@ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986
569
721
  },
570
722
  emits: ["update:start", "update:end", "change"],
571
723
  setup(e, { emit: n }) {
572
- const t = n, r = e, l = L([]);
573
- W(
574
- () => r.start,
724
+ const t = n, a = e, r = R([]);
725
+ Z(
726
+ () => a.start,
575
727
  () => {
576
- l.value = [r.start, r.end];
728
+ r.value = [a.start, a.end];
577
729
  }
578
- ), ie(() => {
579
- l.value = [r.start, r.end];
730
+ ), de(() => {
731
+ r.value = [a.start, a.end];
580
732
  });
581
- function o(i) {
733
+ function s(i) {
582
734
  t("update:start", i ? i[0] : ""), t("update:end", i ? i[1] : ""), t("change");
583
735
  }
584
- return (i, g) => {
585
- const k = N("el-date-picker");
586
- return m(), T(k, {
587
- modelValue: l.value,
588
- "onUpdate:modelValue": g[0] || (g[0] = (u) => l.value = u),
736
+ return (i, c) => {
737
+ const b = x("el-date-picker");
738
+ return m(), O(b, {
739
+ modelValue: r.value,
740
+ "onUpdate:modelValue": c[0] || (c[0] = (u) => r.value = u),
589
741
  type: e.type,
590
742
  "range-separator": "至",
591
743
  "start-placeholder": `${e.title} 开始`,
@@ -593,27 +745,27 @@ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986
593
745
  "value-format": e.valueFormat,
594
746
  "default-time": e.defaultTime,
595
747
  class: "date-range-picker",
596
- onChange: o,
748
+ onChange: s,
597
749
  clearable: e.canClearable
598
750
  }, null, 8, ["modelValue", "type", "start-placeholder", "value-format", "default-time", "clearable"]);
599
751
  };
600
752
  }
601
- }, Ue = /* @__PURE__ */ K(ht, [["__scopeId", "data-v-47618fba"]]), yt = { class: "common-search__body" }, bt = { class: "common-search__fields-wrap" }, vt = {
753
+ }, Le = /* @__PURE__ */ Q(Nt, [["__scopeId", "data-v-47618fba"]]), Mt = { class: "common-search__body" }, Dt = { class: "common-search__fields-wrap" }, $t = {
602
754
  key: 0,
603
755
  class: "common-search__label"
604
- }, _t = {
756
+ }, Tt = {
605
757
  key: 4,
606
758
  class: "common-search__range"
607
- }, wt = { class: "common-search__range-sep" }, kt = {
759
+ }, Lt = { class: "common-search__range-sep" }, Ot = {
608
760
  key: 6,
609
761
  class: "common-search__range"
610
- }, Ct = {
762
+ }, Rt = {
611
763
  key: 0,
612
764
  class: "common-search__actions is-inline"
613
- }, St = {
765
+ }, Vt = {
614
766
  key: 0,
615
767
  class: "common-search__footer"
616
- }, xt = { class: "common-search__actions is-bottom" }, Nt = { class: "common-search__actions-main" }, Ut = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
768
+ }, It = { class: "common-search__actions is-bottom" }, At = { class: "common-search__actions-main" }, Pt = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
617
769
  __name: "SearchForm",
618
770
  props: {
619
771
  modelValue: { type: Object, default: () => ({}) },
@@ -622,347 +774,347 @@ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986
622
774
  },
623
775
  emits: ["change", "search", "reset", "update:modelValue"],
624
776
  setup(e, { emit: n }) {
625
- const t = e, r = n, l = L({}), o = me({}), i = me({});
626
- let g = !1;
627
- function k(s, f) {
628
- return JSON.stringify(s ?? {}) === JSON.stringify(f ?? {});
777
+ const t = e, a = n, r = R({}), s = ye({}), i = ye({});
778
+ let c = !1;
779
+ function b(o, g) {
780
+ return JSON.stringify(o ?? {}) === JSON.stringify(g ?? {});
629
781
  }
630
- const u = L(null), p = L(!1), w = L(!1), d = L(0), h = L(0), c = L(null);
631
- let x = null, M = !1, C = !1;
632
- const ne = _e(() => {
633
- if (!(!w.value || c.value == null))
782
+ const u = R(null), f = R(!1), k = R(!1), p = R(0), h = R(0), d = R(null);
783
+ let U = null, N = !1, _ = !1;
784
+ const B = Ce(() => {
785
+ if (!(!k.value || d.value == null))
634
786
  return {
635
- maxHeight: `${c.value}px`,
787
+ maxHeight: `${d.value}px`,
636
788
  overflow: "hidden"
637
789
  };
638
790
  });
639
- W(
791
+ Z(
640
792
  () => t.modelValue,
641
- (s) => {
642
- k(s, l.value) || (g = !0, l.value = { ...s || {} }, G(() => {
643
- g = !1;
793
+ (o) => {
794
+ b(o, r.value) || (c = !0, r.value = { ...o || {} }, ee(() => {
795
+ c = !1;
644
796
  }));
645
797
  },
646
798
  { deep: !0, immediate: !0 }
647
- ), W(
648
- l,
799
+ ), Z(
800
+ r,
649
801
  () => {
650
- g || r("update:modelValue", { ...l.value });
802
+ c || a("update:modelValue", { ...r.value });
651
803
  },
652
804
  { deep: !0 }
653
- ), W(
805
+ ), Z(
654
806
  () => t.itemList,
655
807
  () => {
656
- p.value = !1, G(() => q());
808
+ f.value = !1, ee(() => X());
657
809
  },
658
810
  { deep: !0 }
659
- ), ie(() => {
660
- G(() => q()), typeof ResizeObserver < "u" && (x = new ResizeObserver(() => {
661
- !M && !C && q();
662
- }), u.value && x.observe(u.value)), window.addEventListener("resize", O);
663
- }), we(() => {
664
- x == null || x.disconnect(), window.removeEventListener("resize", O);
811
+ ), de(() => {
812
+ ee(() => X()), typeof ResizeObserver < "u" && (U = new ResizeObserver(() => {
813
+ !N && !_ && X();
814
+ }), u.value && U.observe(u.value)), window.addEventListener("resize", T);
815
+ }), Ue(() => {
816
+ U == null || U.disconnect(), window.removeEventListener("resize", T);
665
817
  });
666
- function O() {
667
- !M && !C && q();
818
+ function T() {
819
+ !N && !_ && X();
668
820
  }
669
- function le(s) {
670
- if (!s.width) return;
671
- const f = typeof s.width == "number" ? `${s.width}px` : s.width;
672
- return { width: f, minWidth: f };
821
+ function j(o) {
822
+ if (!o.width) return;
823
+ const g = typeof o.width == "number" ? `${o.width}px` : o.width;
824
+ return { width: g, minWidth: g };
673
825
  }
674
- function ce(s, f) {
675
- if (s == null) return "";
676
- if (typeof s != "object") return String(s);
677
- const U = f.optionsLabel || "label";
678
- return typeof U == "string" ? s[U] : Array.isArray(U) ? `${s[U[0]]}(${s[U[1]]})` : s.label;
826
+ function $(o, g) {
827
+ if (o == null) return "";
828
+ if (typeof o != "object") return String(o);
829
+ const M = g.optionsLabel || "label";
830
+ return typeof M == "string" ? o[M] : Array.isArray(M) ? `${o[M[0]]}(${o[M[1]]})` : o.label;
679
831
  }
680
- function J(s, f) {
681
- return s == null || typeof s != "object" ? s : s[f.optionsValue || "value"];
832
+ function L(o, g) {
833
+ return o == null || typeof o != "object" ? o : o[g.optionsValue || "value"];
682
834
  }
683
- async function $e(s, f) {
684
- if (typeof s.remoteMethod == "function") {
685
- i[s.prop] = !0;
835
+ async function se(o, g) {
836
+ if (typeof o.remoteMethod == "function") {
837
+ i[o.prop] = !0;
686
838
  try {
687
- const U = await s.remoteMethod(f);
688
- o[s.prop] = Array.isArray(U) ? U : [];
839
+ const M = await o.remoteMethod(g);
840
+ s[o.prop] = Array.isArray(M) ? M : [];
689
841
  } finally {
690
- i[s.prop] = !1;
842
+ i[o.prop] = !1;
691
843
  }
692
844
  }
693
845
  }
694
- function de(s) {
695
- const f = s.style.maxHeight, U = s.style.overflow, I = s.style.transition;
696
- s.style.transition = "none", s.style.maxHeight = "none", s.style.overflow = "visible";
697
- const H = s.scrollHeight;
698
- return s.style.maxHeight = f, s.style.overflow = U, s.offsetHeight, s.style.transition = I, H;
846
+ function me(o) {
847
+ const g = o.style.maxHeight, M = o.style.overflow, Y = o.style.transition;
848
+ o.style.transition = "none", o.style.maxHeight = "none", o.style.overflow = "visible";
849
+ const E = o.scrollHeight;
850
+ return o.style.maxHeight = g, o.style.overflow = M, o.offsetHeight, o.style.transition = Y, E;
699
851
  }
700
- function q() {
701
- const s = u.value;
702
- if (!s || M || C) return;
703
- M = !0;
704
- const f = s.closest(".common-search"), U = s.querySelectorAll(".common-search__field");
705
- if (!U.length || !f) {
706
- w.value = !1, d.value = 0, h.value = 0, c.value = null, M = !1;
852
+ function X() {
853
+ const o = u.value;
854
+ if (!o || N || _) return;
855
+ N = !0;
856
+ const g = o.closest(".common-search"), M = o.querySelectorAll(".common-search__field");
857
+ if (!M.length || !g) {
858
+ k.value = !1, p.value = 0, h.value = 0, d.value = null, N = !1;
707
859
  return;
708
860
  }
709
- d.value = U[0].offsetHeight, h.value = de(s);
710
- const I = f.clientWidth, H = 20;
711
- let E = 0, ee = 1;
712
- Array.from(U).forEach((ae, a) => {
713
- const B = ae.offsetWidth;
714
- if (a === 0) {
715
- E = B;
861
+ p.value = M[0].offsetHeight, h.value = me(o);
862
+ const Y = g.clientWidth, E = 20;
863
+ let H = 0, ae = 1;
864
+ Array.from(M).forEach((oe, l) => {
865
+ const z = oe.offsetWidth;
866
+ if (l === 0) {
867
+ H = z;
716
868
  return;
717
869
  }
718
- E + H + B > I ? (ee += 1, E = B) : E += H + B;
870
+ H + E + z > Y ? (ae += 1, H = z) : H += E + z;
719
871
  });
720
- const R = ee > 1;
721
- w.value = R, R ? p.value ? c.value = h.value : c.value = d.value : (p.value = !1, c.value = null), M = !1;
872
+ const F = ae > 1;
873
+ k.value = F, F ? f.value ? d.value = h.value : d.value = p.value : (f.value = !1, d.value = null), N = !1;
722
874
  }
723
- function Te() {
724
- const s = u.value;
725
- if (!s || C) return;
726
- C = !0;
727
- const f = s.getBoundingClientRect().height || d.value;
728
- if (p.value)
729
- c.value = f, p.value = !1, requestAnimationFrame(() => {
875
+ function Ie() {
876
+ const o = u.value;
877
+ if (!o || _) return;
878
+ _ = !0;
879
+ const g = o.getBoundingClientRect().height || p.value;
880
+ if (f.value)
881
+ d.value = g, f.value = !1, requestAnimationFrame(() => {
730
882
  requestAnimationFrame(() => {
731
- c.value = d.value;
883
+ d.value = p.value;
732
884
  });
733
885
  });
734
886
  else {
735
- c.value = f;
736
- const U = de(s);
737
- h.value = U, p.value = !0, requestAnimationFrame(() => {
887
+ d.value = g;
888
+ const M = me(o);
889
+ h.value = M, f.value = !0, requestAnimationFrame(() => {
738
890
  requestAnimationFrame(() => {
739
- c.value = U;
891
+ d.value = M;
740
892
  });
741
893
  });
742
894
  }
743
895
  window.setTimeout(() => {
744
- C = !1, q();
896
+ _ = !1, X();
745
897
  }, 380);
746
898
  }
747
- function Ve() {
748
- const s = {};
749
- return t.itemList.forEach((f) => {
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);
751
- }), s;
899
+ function Ae() {
900
+ const o = {};
901
+ return t.itemList.forEach((g) => {
902
+ g.type === "daterange" || g.type === "dateRange" ? (o[g.start] = void 0, o[g.end] = void 0) : g.type === "number-range" || g.type === "numberRange" ? (o[g.start || `${g.prop}Min`] = void 0, o[g.end || `${g.prop}Max`] = void 0) : g.multiple ? o[g.prop] = [] : g.prop && (o[g.prop] = void 0);
903
+ }), o;
752
904
  }
753
- function pe() {
754
- r("update:modelValue", { ...l.value });
905
+ function ge() {
906
+ a("update:modelValue", { ...r.value });
755
907
  }
756
- function A() {
757
- pe(), r("change", { ...l.value }), r("search", { ...l.value });
908
+ function P() {
909
+ ge(), a("change", { ...r.value }), a("search", { ...r.value });
758
910
  }
759
- function Z() {
760
- l.value = Ve(), pe(), r("reset", { ...l.value }), r("change", { ...l.value });
911
+ function re() {
912
+ r.value = Ae(), ge(), a("reset", { ...r.value }), a("change", { ...r.value });
761
913
  }
762
- return (s, f) => {
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");
764
- return j((m(), b("div", {
765
- class: V(["common-search", {
766
- "is-single-row": !w.value,
767
- "is-multi-row": w.value,
768
- "is-expanded": w.value && p.value,
769
- "is-collapsed": w.value && !p.value
914
+ return (o, g) => {
915
+ const M = x("el-input"), Y = x("el-option"), E = x("el-select"), H = x("el-input-number"), ae = x("el-date-picker"), F = x("el-button"), oe = x("el-icon");
916
+ return W((m(), v("div", {
917
+ class: I(["common-search", {
918
+ "is-single-row": !k.value,
919
+ "is-multi-row": k.value,
920
+ "is-expanded": k.value && f.value,
921
+ "is-collapsed": k.value && !f.value
770
922
  }])
771
923
  }, [
772
- _("div", yt, [
773
- _("div", bt, [
774
- _("div", {
924
+ S("div", Mt, [
925
+ S("div", Dt, [
926
+ S("div", {
775
927
  ref_key: "fieldsRef",
776
928
  ref: u,
777
929
  class: "common-search__fields",
778
- style: X(ne.value)
930
+ style: ne(B.value)
779
931
  }, [
780
- (m(!0), b(P, null, Y(e.itemList, (a, B) => (m(), b("div", {
781
- key: a.prop || a.start || B,
782
- class: V(["common-search__field", [`is-${a.type}`, a.className]]),
783
- style: X(le(a))
932
+ (m(!0), v(K, null, q(e.itemList, (l, z) => (m(), v("div", {
933
+ key: l.prop || l.start || z,
934
+ class: I(["common-search__field", [`is-${l.type}`, l.className]]),
935
+ style: ne(j(l))
784
936
  }, [
785
- a.label ? (m(), b("label", vt, D(a.label), 1)) : F("", !0),
786
- a.type === "input" || a.type === "text" ? (m(), T(U, {
937
+ l.label ? (m(), v("label", $t, D(l.label), 1)) : A("", !0),
938
+ l.type === "input" || l.type === "text" ? (m(), O(M, {
787
939
  key: 1,
788
- modelValue: l.value[a.prop],
789
- "onUpdate:modelValue": (y) => l.value[a.prop] = y,
940
+ modelValue: r.value[l.prop],
941
+ "onUpdate:modelValue": (y) => r.value[l.prop] = y,
790
942
  modelModifiers: { trim: !0 },
791
943
  clearable: "",
792
- placeholder: a.placeholder || `请输入${a.label || ""}`,
793
- maxlength: a.maxlength || 200,
794
- disabled: a.disabled,
795
- onKeyup: Pe(A, ["enter"])
796
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) : a.type === "select" ? (m(), T(H, {
944
+ placeholder: l.placeholder || `请输入${l.label || ""}`,
945
+ maxlength: l.maxlength || 200,
946
+ disabled: l.disabled,
947
+ onKeyup: Ke(P, ["enter"])
948
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) : l.type === "select" ? (m(), O(E, {
797
949
  key: 2,
798
- modelValue: l.value[a.prop],
799
- "onUpdate:modelValue": (y) => l.value[a.prop] = y,
800
- placeholder: a.placeholder || `请选择${a.label || ""}`,
950
+ modelValue: r.value[l.prop],
951
+ "onUpdate:modelValue": (y) => r.value[l.prop] = y,
952
+ placeholder: l.placeholder || `请选择${l.label || ""}`,
801
953
  clearable: "",
802
- filterable: a.filterable !== !1,
803
- multiple: a.multiple,
804
- "collapse-tags": a.multiple,
805
- "collapse-tags-tooltip": a.multiple,
806
- disabled: a.disabled,
954
+ filterable: l.filterable !== !1,
955
+ multiple: l.multiple,
956
+ "collapse-tags": l.multiple,
957
+ "collapse-tags-tooltip": l.multiple,
958
+ disabled: l.disabled,
807
959
  class: "common-search__control",
808
- onChange: A
960
+ onChange: P
809
961
  }, {
810
- default: S(() => [
811
- (m(!0), b(P, null, Y(a.options || [], (y, re) => (m(), T(I, {
812
- key: `${J(y, a)}-${re}`,
813
- label: ce(y, a),
814
- value: J(y, a),
962
+ default: C(() => [
963
+ (m(!0), v(K, null, q(l.options || [], (y, ie) => (m(), O(Y, {
964
+ key: `${L(y, l)}-${ie}`,
965
+ label: $(y, l),
966
+ value: L(y, l),
815
967
  disabled: typeof y == "object" && (y == null ? void 0 : y.disabled)
816
968
  }, null, 8, ["label", "value", "disabled"]))), 128))
817
969
  ]),
818
970
  _: 2
819
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) : a.type === "remote-select" || a.type === "remoteSelect" ? (m(), T(H, {
971
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) : l.type === "remote-select" || l.type === "remoteSelect" ? (m(), O(E, {
820
972
  key: 3,
821
- modelValue: l.value[a.prop],
822
- "onUpdate:modelValue": (y) => l.value[a.prop] = y,
823
- placeholder: a.placeholder || "请输入关键词搜索",
973
+ modelValue: r.value[l.prop],
974
+ "onUpdate:modelValue": (y) => r.value[l.prop] = y,
975
+ placeholder: l.placeholder || "请输入关键词搜索",
824
976
  clearable: "",
825
977
  filterable: "",
826
978
  remote: "",
827
- multiple: a.multiple,
828
- "collapse-tags": a.multiple,
829
- "collapse-tags-tooltip": a.multiple,
979
+ multiple: l.multiple,
980
+ "collapse-tags": l.multiple,
981
+ "collapse-tags-tooltip": l.multiple,
830
982
  "reserve-keyword": !1,
831
- "remote-method": (y) => $e(a, y),
832
- loading: !!i[a.prop],
833
- disabled: a.disabled,
983
+ "remote-method": (y) => se(l, y),
984
+ loading: !!i[l.prop],
985
+ disabled: l.disabled,
834
986
  class: "common-search__control",
835
- onClear: (y) => o[a.prop] = [],
836
- onChange: A
987
+ onClear: (y) => s[l.prop] = [],
988
+ onChange: P
837
989
  }, {
838
- default: S(() => [
839
- (m(!0), b(P, null, Y(o[a.prop] || a.options || [], (y, re) => (m(), T(I, {
840
- key: `${J(y, a)}-${re}`,
841
- label: ce(y, a),
842
- value: J(y, a),
990
+ default: C(() => [
991
+ (m(!0), v(K, null, q(s[l.prop] || l.options || [], (y, ie) => (m(), O(Y, {
992
+ key: `${L(y, l)}-${ie}`,
993
+ label: $(y, l),
994
+ value: L(y, l),
843
995
  disabled: typeof y == "object" && (y == null ? void 0 : y.disabled)
844
996
  }, null, 8, ["label", "value", "disabled"]))), 128))
845
997
  ]),
846
998
  _: 2
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, [
848
- v(E, {
849
- modelValue: l.value[a.start || `${a.prop}Min`],
850
- "onUpdate:modelValue": (y) => l.value[a.start || `${a.prop}Min`] = y,
999
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : l.type === "number-range" || l.type === "numberRange" ? (m(), v("div", Tt, [
1000
+ w(H, {
1001
+ modelValue: r.value[l.start || `${l.prop}Min`],
1002
+ "onUpdate:modelValue": (y) => r.value[l.start || `${l.prop}Min`] = y,
851
1003
  controls: !1,
852
- min: a.min,
853
- max: a.max,
854
- precision: a.precision,
855
- placeholder: a.minPlaceholder || "最小值",
856
- disabled: a.disabled,
1004
+ min: l.min,
1005
+ max: l.max,
1006
+ precision: l.precision,
1007
+ placeholder: l.minPlaceholder || "最小值",
1008
+ disabled: l.disabled,
857
1009
  class: "common-search__range-input"
858
1010
  }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "precision", "placeholder", "disabled"]),
859
- _("span", wt, D(a.separator || "至"), 1),
860
- v(E, {
861
- modelValue: l.value[a.end || `${a.prop}Max`],
862
- "onUpdate:modelValue": (y) => l.value[a.end || `${a.prop}Max`] = y,
1011
+ S("span", Lt, D(l.separator || "至"), 1),
1012
+ w(H, {
1013
+ modelValue: r.value[l.end || `${l.prop}Max`],
1014
+ "onUpdate:modelValue": (y) => r.value[l.end || `${l.prop}Max`] = y,
863
1015
  controls: !1,
864
- min: a.min,
865
- max: a.max,
866
- precision: a.precision,
867
- placeholder: a.maxPlaceholder || "最大值",
868
- disabled: a.disabled,
1016
+ min: l.min,
1017
+ max: l.max,
1018
+ precision: l.precision,
1019
+ placeholder: l.maxPlaceholder || "最大值",
1020
+ disabled: l.disabled,
869
1021
  class: "common-search__range-input"
870
1022
  }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "precision", "placeholder", "disabled"])
871
- ])) : a.type === "date" ? (m(), T(ee, {
1023
+ ])) : l.type === "date" ? (m(), O(ae, {
872
1024
  key: 5,
873
- modelValue: l.value[a.prop],
874
- "onUpdate:modelValue": (y) => l.value[a.prop] = y,
875
- type: a.dateType || "date",
876
- placeholder: a.placeholder || "年/月/日",
877
- "value-format": a.valueFormat || "YYYY-MM-DD",
878
- format: a.format || "YYYY/MM/DD",
879
- clearable: a.clearable !== !1,
880
- disabled: a.disabled,
1025
+ modelValue: r.value[l.prop],
1026
+ "onUpdate:modelValue": (y) => r.value[l.prop] = y,
1027
+ type: l.dateType || "date",
1028
+ placeholder: l.placeholder || "年/月/日",
1029
+ "value-format": l.valueFormat || "YYYY-MM-DD",
1030
+ format: l.format || "YYYY/MM/DD",
1031
+ clearable: l.clearable !== !1,
1032
+ disabled: l.disabled,
881
1033
  class: "common-search__control"
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, {
884
- start: l.value[a.start],
885
- "onUpdate:start": (y) => l.value[a.start] = y,
886
- end: l.value[a.end],
887
- "onUpdate:end": (y) => l.value[a.end] = y,
888
- onChange: A
1034
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : l.type === "daterange" || l.type === "dateRange" ? (m(), v("div", Ot, [
1035
+ w(Le, {
1036
+ start: r.value[l.start],
1037
+ "onUpdate:start": (y) => r.value[l.start] = y,
1038
+ end: r.value[l.end],
1039
+ "onUpdate:end": (y) => r.value[l.end] = y,
1040
+ onChange: P
889
1041
  }, null, 8, ["start", "onUpdate:start", "end", "onUpdate:end"])
890
- ])) : Q(s.$slots, a.slotName || a.prop, {
891
- item: a,
892
- form: l.value
1042
+ ])) : te(o.$slots, l.slotName || l.prop, {
1043
+ item: l,
1044
+ form: r.value
893
1045
  }, void 0, !0, 7)
894
1046
  ], 6))), 128))
895
1047
  ], 4)
896
1048
  ]),
897
- w.value ? F("", !0) : (m(), b("div", Ct, [
898
- Q(s.$slots, "actions", {
899
- search: A,
900
- reset: Z,
901
- form: l.value
1049
+ k.value ? A("", !0) : (m(), v("div", Rt, [
1050
+ te(o.$slots, "actions", {
1051
+ search: P,
1052
+ reset: re,
1053
+ form: r.value
902
1054
  }, () => [
903
- v(R, {
1055
+ w(F, {
904
1056
  class: "common-search__reset",
905
- onClick: Z
1057
+ onClick: re
906
1058
  }, {
907
- default: S(() => [...f[0] || (f[0] = [
908
- $("重置", -1)
1059
+ default: C(() => [...g[0] || (g[0] = [
1060
+ V("重置", -1)
909
1061
  ])]),
910
1062
  _: 1
911
1063
  }),
912
- v(R, {
1064
+ w(F, {
913
1065
  type: "primary",
914
1066
  class: "common-search__submit",
915
1067
  loading: e.loading,
916
- onClick: A
1068
+ onClick: P
917
1069
  }, {
918
- default: S(() => [...f[1] || (f[1] = [
919
- $(" 搜索 ", -1)
1070
+ default: C(() => [...g[1] || (g[1] = [
1071
+ V(" 搜索 ", -1)
920
1072
  ])]),
921
1073
  _: 1
922
1074
  }, 8, ["loading"])
923
1075
  ], !0)
924
1076
  ]))
925
1077
  ]),
926
- w.value ? (m(), b("div", St, [
927
- _("div", xt, [
928
- _("div", Nt, [
929
- Q(s.$slots, "actions", {
930
- search: A,
931
- reset: Z,
932
- form: l.value
1078
+ k.value ? (m(), v("div", Vt, [
1079
+ S("div", It, [
1080
+ S("div", At, [
1081
+ te(o.$slots, "actions", {
1082
+ search: P,
1083
+ reset: re,
1084
+ form: r.value
933
1085
  }, () => [
934
- v(R, {
1086
+ w(F, {
935
1087
  class: "common-search__reset",
936
- onClick: Z
1088
+ onClick: re
937
1089
  }, {
938
- default: S(() => [...f[2] || (f[2] = [
939
- $("重置", -1)
1090
+ default: C(() => [...g[2] || (g[2] = [
1091
+ V("重置", -1)
940
1092
  ])]),
941
1093
  _: 1
942
1094
  }),
943
- v(R, {
1095
+ w(F, {
944
1096
  type: "primary",
945
1097
  class: "common-search__submit",
946
1098
  loading: e.loading,
947
- onClick: A
1099
+ onClick: P
948
1100
  }, {
949
- default: S(() => [...f[3] || (f[3] = [
950
- $(" 搜索 ", -1)
1101
+ default: C(() => [...g[3] || (g[3] = [
1102
+ V(" 搜索 ", -1)
951
1103
  ])]),
952
1104
  _: 1
953
1105
  }, 8, ["loading"])
954
1106
  ], !0)
955
1107
  ]),
956
- v(R, {
957
- onClick: Te,
1108
+ w(F, {
1109
+ onClick: Ie,
958
1110
  type: "primary",
959
1111
  plain: ""
960
1112
  }, {
961
- default: S(() => [
962
- $(D(p.value ? "收起" : "展开") + " ", 1),
963
- v(ae, { class: "el-icon--right" }, {
964
- default: S(() => [
965
- (m(), T(Ie(p.value ? "ArrowUp" : "ArrowDown")))
1113
+ default: C(() => [
1114
+ V(D(f.value ? "收起" : "展开") + " ", 1),
1115
+ w(oe, { class: "el-icon--right" }, {
1116
+ default: C(() => [
1117
+ f.value ? (m(), O(ve(He), { key: 0 })) : (m(), O(ve(Be), { key: 1 }))
966
1118
  ]),
967
1119
  _: 1
968
1120
  })
@@ -970,13 +1122,13 @@ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986
970
1122
  _: 1
971
1123
  })
972
1124
  ])
973
- ])) : F("", !0)
1125
+ ])) : A("", !0)
974
1126
  ], 2)), [
975
- [z, e.itemList.length]
1127
+ [G, e.itemList.length]
976
1128
  ]);
977
1129
  };
978
1130
  }
979
- }), Mt = /* @__PURE__ */ K(Ut, [["__scopeId", "data-v-08ffb41c"]]), Dt = {
1131
+ }), Ft = /* @__PURE__ */ Q(Pt, [["__scopeId", "data-v-abc90b18"]]), Et = {
980
1132
  name: "MgOverflowHid",
981
1133
  props: {
982
1134
  label: String,
@@ -999,59 +1151,59 @@ const gt = /* @__PURE__ */ K(Ze, [["render", mt], ["__scopeId", "data-v-27d5f986
999
1151
  return t && t.length > n && (t = t.slice(0, n) + "..."), t;
1000
1152
  }
1001
1153
  }
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) {
1004
- const i = N("el-popover");
1005
- return m(), b("div", Lt, [
1006
- t.value && t.value.length > t.maxLength ? (m(), T(i, {
1154
+ }, Ht = { class: "tableOverflowHid" }, Bt = ["innerHTML"], jt = { class: "name-wrapper" }, Yt = ["innerHTML"], zt = { key: 1 }, Kt = ["innerHTML"];
1155
+ function qt(e, n, t, a, r, s) {
1156
+ const i = x("el-popover");
1157
+ return m(), v("div", Ht, [
1158
+ t.value && t.value.length > t.maxLength ? (m(), O(i, {
1007
1159
  key: 0,
1008
1160
  trigger: "hover",
1009
1161
  placement: "bottom",
1010
1162
  width: "400"
1011
1163
  }, {
1012
- reference: S(() => [
1013
- _("div", Tt, [
1014
- j(_("span", {
1015
- class: V(t.labelClassName)
1164
+ reference: C(() => [
1165
+ S("div", jt, [
1166
+ W(S("span", {
1167
+ class: I(t.labelClassName)
1016
1168
  }, D(t.label) + ":", 3), [
1017
- [z, t.label]
1169
+ [G, t.label]
1018
1170
  ]),
1019
- _("span", {
1020
- class: V(t.valueClassName),
1021
- innerHTML: o.cutString(t.value, t.maxLength)
1022
- }, null, 10, Vt)
1171
+ S("span", {
1172
+ class: I(t.valueClassName),
1173
+ innerHTML: s.cutString(t.value, t.maxLength)
1174
+ }, null, 10, Yt)
1023
1175
  ])
1024
1176
  ]),
1025
- default: S(() => [
1026
- j(_("span", {
1027
- class: V(t.labelClassName)
1177
+ default: C(() => [
1178
+ W(S("span", {
1179
+ class: I(t.labelClassName)
1028
1180
  }, D(t.label) + ":", 3), [
1029
- [z, t.label]
1181
+ [G, t.label]
1030
1182
  ]),
1031
- _("span", { innerHTML: t.value }, null, 8, $t)
1183
+ S("span", { innerHTML: t.value }, null, 8, Bt)
1032
1184
  ]),
1033
1185
  _: 1
1034
- })) : (m(), b("div", Ot, [
1035
- j(_("span", {
1036
- class: V(t.labelClassName)
1186
+ })) : (m(), v("div", zt, [
1187
+ W(S("span", {
1188
+ class: I(t.labelClassName)
1037
1189
  }, D(t.label) + ":", 3), [
1038
- [z, t.label]
1190
+ [G, t.label]
1039
1191
  ]),
1040
- _("span", {
1041
- class: V([t.valueClassName, "value"])
1192
+ S("span", {
1193
+ class: I([t.valueClassName, "value"])
1042
1194
  }, [
1043
- _("span", { innerHTML: t.value }, null, 8, At)
1195
+ S("span", { innerHTML: t.value }, null, 8, Kt)
1044
1196
  ], 2)
1045
1197
  ]))
1046
1198
  ]);
1047
1199
  }
1048
- const Me = /* @__PURE__ */ K(Dt, [["render", Rt], ["__scopeId", "data-v-ef86ea54"]]), Ft = { class: "common-table__main" }, Ht = { key: 0 }, Et = { key: 1 }, Pt = {
1200
+ const Oe = /* @__PURE__ */ Q(Et, [["render", qt], ["__scopeId", "data-v-ef86ea54"]]), Wt = { class: "common-table__main" }, Gt = { key: 0 }, Qt = { key: 1 }, Xt = {
1049
1201
  key: 2,
1050
1202
  class: "bold-text"
1051
- }, It = {
1203
+ }, Jt = {
1052
1204
  key: 0,
1053
1205
  class: "common-table__pagination"
1054
- }, Bt = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1206
+ }, Zt = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
1055
1207
  __name: "DataTable",
1056
1208
  props: {
1057
1209
  /** 列配置:el-table-column 属性 + slotName */
@@ -1110,87 +1262,87 @@ const Me = /* @__PURE__ */ K(Dt, [["render", Rt], ["__scopeId", "data-v-ef86ea54
1110
1262
  },
1111
1263
  emits: ["pageChange", "cellClick", "edit", "delete"],
1112
1264
  setup(e, { emit: n }) {
1113
- const t = e, r = n, l = {
1265
+ const t = e, a = n, r = {
1114
1266
  background: "var(--brand-secondary-pale)",
1115
1267
  color: "var(--brand-text-primary)",
1116
1268
  fontWeight: 600,
1117
1269
  fontSize: "13px"
1118
- }, o = _e(() => ({
1119
- headerCellStyle: l,
1270
+ }, s = Ce(() => ({
1271
+ headerCellStyle: r,
1120
1272
  ...t.tableBind
1121
1273
  }));
1122
- function i(d) {
1123
- const { slotName: h, maxLength: c, ...x } = d || {};
1274
+ function i(p) {
1275
+ const { slotName: h, maxLength: d, ...U } = p || {};
1124
1276
  return {
1125
- ...x
1277
+ ...U
1126
1278
  };
1127
1279
  }
1128
- function g(d) {
1129
- return d == null || d === "" ? "-" : d;
1280
+ function c(p) {
1281
+ return p == null || p === "" ? "-" : p;
1130
1282
  }
1131
- function k(d) {
1132
- return t.pagination ? (t.pagination.page - 1) * t.pagination.limit + d + 1 : d + 1;
1283
+ function b(p) {
1284
+ return t.pagination ? (t.pagination.page - 1) * t.pagination.limit + p + 1 : p + 1;
1133
1285
  }
1134
- function u(d) {
1286
+ function u(p) {
1135
1287
  var h;
1136
- r("pageChange", { page: (h = t.pagination) == null ? void 0 : h.page, limit: d });
1288
+ a("pageChange", { page: (h = t.pagination) == null ? void 0 : h.page, limit: p });
1137
1289
  }
1138
- function p(d) {
1290
+ function f(p) {
1139
1291
  var h;
1140
- r("pageChange", { page: d, limit: (h = t.pagination) == null ? void 0 : h.limit });
1292
+ a("pageChange", { page: p, limit: (h = t.pagination) == null ? void 0 : h.limit });
1141
1293
  }
1142
- function w(d, h, c, x) {
1143
- r("cellClick", d, h, c, x), t.canCellClick && (h == null ? void 0 : h.label) !== "操作" && window.getSelection().toString();
1294
+ function k(p, h, d, U) {
1295
+ a("cellClick", p, h, d, U), t.canCellClick && (h == null ? void 0 : h.label) !== "操作" && window.getSelection().toString();
1144
1296
  }
1145
- return (d, h) => {
1146
- const c = N("el-table-column"), x = N("el-table"), M = N("el-pagination");
1147
- return m(), b("div", {
1148
- class: V(["common-table", { "is-fill-height": e.fillHeight }])
1297
+ return (p, h) => {
1298
+ const d = x("el-table-column"), U = x("el-table"), N = x("el-pagination");
1299
+ return m(), v("div", {
1300
+ class: I(["common-table", { "is-fill-height": e.fillHeight }])
1149
1301
  }, [
1150
- _("div", Ft, [
1151
- v(x, ge({
1302
+ S("div", Wt, [
1303
+ w(U, be({
1152
1304
  data: e.dataList,
1153
1305
  height: e.fillHeight ? "100%" : void 0,
1154
1306
  class: { "common-pointer-table": e.canCellClick }
1155
- }, o.value, { onCellClick: w }), {
1156
- default: S(() => [
1157
- e.showIndex ? (m(), T(c, {
1307
+ }, s.value, { onCellClick: k }), {
1308
+ default: C(() => [
1309
+ e.showIndex ? (m(), O(d, {
1158
1310
  key: 0,
1159
1311
  type: "index",
1160
1312
  label: e.indexLabel,
1161
1313
  width: e.indexWidth,
1162
- index: k,
1314
+ index: b,
1163
1315
  align: "center"
1164
- }, null, 8, ["label", "width"])) : F("", !0),
1165
- (m(!0), b(P, null, Y(e.propList, (C, ne) => (m(), T(c, ge({
1166
- key: C.prop || C.slotName || ne
1167
- }, { ref_for: !0 }, i(C)), Be({ _: 2 }, [
1168
- C.slotName ? {
1316
+ }, null, 8, ["label", "width"])) : A("", !0),
1317
+ (m(!0), v(K, null, q(e.propList, (_, B) => (m(), O(d, be({
1318
+ key: _.prop || _.slotName || B
1319
+ }, { ref_for: !0 }, i(_)), qe({ _: 2 }, [
1320
+ _.slotName ? {
1169
1321
  name: "default",
1170
- fn: S(({ row: O, $index: le }) => [
1171
- C.slotName === "overtext" ? (m(), b("div", Ht, [
1172
- v(Me, {
1173
- value: String(O[C.prop] ?? ""),
1174
- "max-length": C.maxLength || 18
1322
+ fn: C(({ row: T, $index: j }) => [
1323
+ _.slotName === "overtext" ? (m(), v("div", Gt, [
1324
+ w(Oe, {
1325
+ value: String(T[_.prop] ?? ""),
1326
+ "max-length": _.maxLength || 18
1175
1327
  }, null, 8, ["value", "max-length"])
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, {
1177
- row: O,
1178
- index: le,
1179
- column: C
1328
+ ])) : _.slotName === "whether" ? (m(), v("div", Qt, D(T[_.prop] == 0 ? "否" : T[_.prop] == 1 ? "是" : ""), 1)) : _.slotName === "boldtext" ? (m(), v("div", Xt, D(T[_.prop]), 1)) : te(p.$slots, _.slotName, {
1329
+ row: T,
1330
+ index: j,
1331
+ column: _
1180
1332
  }, () => [
1181
- $(D(g(O[C.prop])), 1)
1333
+ V(D(c(T[_.prop])), 1)
1182
1334
  ], !0, 3)
1183
1335
  ]),
1184
1336
  key: "0"
1185
1337
  } : void 0
1186
1338
  ]), 1040))), 128)),
1187
- Q(d.$slots, "default", {}, void 0, !0)
1339
+ te(p.$slots, "default", {}, void 0, !0)
1188
1340
  ]),
1189
1341
  _: 3
1190
1342
  }, 16, ["data", "height", "class"])
1191
1343
  ]),
1192
- e.pagination ? (m(), b("div", It, [
1193
- v(M, {
1344
+ e.pagination ? (m(), v("div", Jt, [
1345
+ w(N, {
1194
1346
  background: "",
1195
1347
  "current-page": e.pagination.page,
1196
1348
  "page-size": e.pagination.limit,
@@ -1198,13 +1350,13 @@ const Me = /* @__PURE__ */ K(Dt, [["render", Rt], ["__scopeId", "data-v-ef86ea54
1198
1350
  total: e.pagination.total,
1199
1351
  layout: e.paginationLayout,
1200
1352
  onSizeChange: u,
1201
- onCurrentChange: p
1353
+ onCurrentChange: f
1202
1354
  }, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
1203
- ])) : F("", !0)
1355
+ ])) : A("", !0)
1204
1356
  ], 2);
1205
1357
  };
1206
1358
  }
1207
- }), Yt = /* @__PURE__ */ K(Bt, [["__scopeId", "data-v-5f80313c"]]), jt = ["aria-checked", "disabled", "onClick"], zt = {
1359
+ }), en = /* @__PURE__ */ Q(Zt, [["__scopeId", "data-v-5f80313c"]]), tn = ["aria-checked", "disabled", "onClick"], nn = {
1208
1360
  __name: "SegmentedControl",
1209
1361
  props: {
1210
1362
  modelValue: { type: [String, Number, Boolean], default: void 0 },
@@ -1213,211 +1365,211 @@ const Me = /* @__PURE__ */ K(Dt, [["render", Rt], ["__scopeId", "data-v-ef86ea54
1213
1365
  },
1214
1366
  emits: ["update:modelValue", "change"],
1215
1367
  setup(e, { emit: n }) {
1216
- const t = e, r = n, l = L(null), o = L([]), i = L(!1), g = L({
1368
+ const t = e, a = n, r = R(null), s = R([]), i = R(!1), c = R({
1217
1369
  width: "0px",
1218
1370
  transform: "translateX(0px)"
1219
1371
  });
1220
- let k = null;
1221
- function u(d, h) {
1222
- d && (o.value[h] = d);
1372
+ let b = null;
1373
+ function u(p, h) {
1374
+ p && (s.value[h] = p);
1223
1375
  }
1224
- function p() {
1225
- const d = l.value;
1226
- if (!d) return;
1227
- const h = t.options.findIndex((C) => C.value === t.modelValue), c = o.value[h];
1228
- if (!c) {
1229
- g.value = { width: "0px", transform: "translateX(0px)" };
1376
+ function f() {
1377
+ const p = r.value;
1378
+ if (!p) return;
1379
+ const h = t.options.findIndex((_) => _.value === t.modelValue), d = s.value[h];
1380
+ if (!d) {
1381
+ c.value = { width: "0px", transform: "translateX(0px)" };
1230
1382
  return;
1231
1383
  }
1232
- const x = d.getBoundingClientRect(), M = c.getBoundingClientRect();
1233
- g.value = {
1234
- width: `${M.width}px`,
1235
- transform: `translateX(${M.left - x.left}px)`
1384
+ const U = p.getBoundingClientRect(), N = d.getBoundingClientRect();
1385
+ c.value = {
1386
+ width: `${N.width}px`,
1387
+ transform: `translateX(${N.left - U.left}px)`
1236
1388
  }, i.value = !0;
1237
1389
  }
1238
- function w(d) {
1239
- d.disabled || (r("update:modelValue", d.value), r("change", d.value));
1390
+ function k(p) {
1391
+ p.disabled || (a("update:modelValue", p.value), a("change", p.value));
1240
1392
  }
1241
- return W(
1393
+ return Z(
1242
1394
  () => [t.modelValue, t.options],
1243
1395
  async () => {
1244
- await G(), p();
1396
+ await ee(), f();
1245
1397
  },
1246
1398
  { deep: !0 }
1247
- ), ie(async () => {
1248
- await G(), p(), typeof ResizeObserver < "u" && l.value && (k = new ResizeObserver(() => p()), k.observe(l.value));
1249
- }), we(() => {
1250
- k == null || k.disconnect(), k = null;
1251
- }), (d, h) => (m(), b("div", {
1399
+ ), de(async () => {
1400
+ await ee(), f(), typeof ResizeObserver < "u" && r.value && (b = new ResizeObserver(() => f()), b.observe(r.value));
1401
+ }), Ue(() => {
1402
+ b == null || b.disconnect(), b = null;
1403
+ }), (p, h) => (m(), v("div", {
1252
1404
  ref_key: "rootRef",
1253
- ref: l,
1405
+ ref: r,
1254
1406
  class: "segmented",
1255
1407
  role: "radiogroup"
1256
1408
  }, [
1257
- _("div", {
1258
- class: V(["segmented__thumb", { "is-ready": i.value }]),
1259
- style: X(g.value)
1409
+ S("div", {
1410
+ class: I(["segmented__thumb", { "is-ready": i.value }]),
1411
+ style: ne(c.value)
1260
1412
  }, null, 6),
1261
- (m(!0), b(P, null, Y(e.options, (c, x) => (m(), b("button", {
1262
- key: String(c.value),
1413
+ (m(!0), v(K, null, q(e.options, (d, U) => (m(), v("button", {
1414
+ key: String(d.value),
1263
1415
  ref_for: !0,
1264
- ref: (M) => u(M, x),
1416
+ ref: (N) => u(N, U),
1265
1417
  type: "button",
1266
- class: V(["segmented__item", { "is-active": e.modelValue === c.value }]),
1418
+ class: I(["segmented__item", { "is-active": e.modelValue === d.value }]),
1267
1419
  role: "radio",
1268
- "aria-checked": e.modelValue === c.value,
1269
- disabled: c.disabled,
1270
- onClick: (M) => w(c)
1271
- }, D(c.label), 11, jt))), 128))
1420
+ "aria-checked": e.modelValue === d.value,
1421
+ disabled: d.disabled,
1422
+ onClick: (N) => k(d)
1423
+ }, D(d.label), 11, tn))), 128))
1272
1424
  ], 512));
1273
1425
  }
1274
- }, Kt = /* @__PURE__ */ K(zt, [["__scopeId", "data-v-8bff3e5b"]]);
1275
- function qt(e) {
1426
+ }, rn = /* @__PURE__ */ Q(nn, [["__scopeId", "data-v-8bff3e5b"]]);
1427
+ function an(e) {
1276
1428
  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);
1277
1429
  }
1278
- function oe(e) {
1430
+ function ce(e) {
1279
1431
  if (e === null || typeof e != "object") return e;
1280
1432
  if (e instanceof Date) return new Date(e.getTime());
1281
- if (Array.isArray(e)) return e.map((t) => oe(t));
1433
+ if (Array.isArray(e)) return e.map((t) => ce(t));
1282
1434
  const n = {};
1283
1435
  return Object.keys(e).forEach((t) => {
1284
- n[t] = oe(e[t]);
1436
+ n[t] = ce(e[t]);
1285
1437
  }), n;
1286
1438
  }
1287
- function Wt(e, n = 300) {
1439
+ function ln(e, n = 300) {
1288
1440
  let t = null;
1289
- return function(...l) {
1441
+ return function(...r) {
1290
1442
  t && clearTimeout(t), t = setTimeout(() => {
1291
- e.apply(this, l);
1443
+ e.apply(this, r);
1292
1444
  }, n);
1293
1445
  };
1294
1446
  }
1295
- function Gt(e, n = 300) {
1447
+ function sn(e, n = 300) {
1296
1448
  let t = 0;
1297
- return function(...l) {
1298
- const o = Date.now();
1299
- o - t >= n && (t = o, e.apply(this, l));
1449
+ return function(...r) {
1450
+ const s = Date.now();
1451
+ s - t >= n && (t = s, e.apply(this, r));
1300
1452
  };
1301
1453
  }
1302
- function De(e) {
1454
+ function Re(e) {
1303
1455
  if (e == null || e === "") return null;
1304
1456
  if (e instanceof Date)
1305
1457
  return Number.isNaN(e.getTime()) ? null : e;
1306
1458
  if (typeof e == "number") {
1307
- const l = new Date(e);
1308
- return Number.isNaN(l.getTime()) ? null : l;
1459
+ const r = new Date(e);
1460
+ return Number.isNaN(r.getTime()) ? null : r;
1309
1461
  }
1310
1462
  const n = String(e).trim();
1311
1463
  if (!n) return null;
1312
1464
  if (/^\d{10,13}$/.test(n)) {
1313
- const l = n.length === 10 ? Number(n) * 1e3 : Number(n), o = new Date(l);
1314
- return Number.isNaN(o.getTime()) ? null : o;
1465
+ const r = n.length === 10 ? Number(n) * 1e3 : Number(n), s = new Date(r);
1466
+ return Number.isNaN(s.getTime()) ? null : s;
1315
1467
  }
1316
1468
  if (/[Zz]$|[+-]\d{2}:?\d{2}$/.test(n)) {
1317
- const l = new Date(n);
1318
- return Number.isNaN(l.getTime()) ? null : l;
1469
+ const r = new Date(n);
1470
+ return Number.isNaN(r.getTime()) ? null : r;
1319
1471
  }
1320
1472
  const t = n.match(
1321
1473
  /^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:[\sT]+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,3}))?)?/
1322
1474
  );
1323
1475
  if (t) {
1324
- const [, l, o, i, g = "0", k = "0", u = "0", p = "0"] = t, w = new Date(
1325
- Number(l),
1326
- Number(o) - 1,
1476
+ const [, r, s, i, c = "0", b = "0", u = "0", f = "0"] = t, k = new Date(
1477
+ Number(r),
1478
+ Number(s) - 1,
1327
1479
  Number(i),
1328
- Number(g),
1329
- Number(k),
1480
+ Number(c),
1481
+ Number(b),
1330
1482
  Number(u),
1331
- Number(String(p).padEnd(3, "0"))
1483
+ Number(String(f).padEnd(3, "0"))
1332
1484
  );
1333
- return Number.isNaN(w.getTime()) ? null : w;
1485
+ return Number.isNaN(k.getTime()) ? null : k;
1334
1486
  }
1335
- const r = new Date(n);
1336
- return Number.isNaN(r.getTime()) ? null : r;
1487
+ const a = new Date(n);
1488
+ return Number.isNaN(a.getTime()) ? null : a;
1337
1489
  }
1338
- function se(e, n = "YYYY-MM-DD HH:mm:ss") {
1339
- const t = De(e);
1490
+ function ue(e, n = "YYYY-MM-DD HH:mm:ss") {
1491
+ const t = Re(e);
1340
1492
  if (!t) return "";
1341
- const r = t.getFullYear(), l = t.getMonth() + 1, o = t.getDate(), i = t.getHours(), g = t.getMinutes(), k = t.getSeconds(), u = {
1342
- YYYY: String(r),
1343
- MM: String(l).padStart(2, "0"),
1344
- DD: String(o).padStart(2, "0"),
1493
+ const a = t.getFullYear(), r = t.getMonth() + 1, s = t.getDate(), i = t.getHours(), c = t.getMinutes(), b = t.getSeconds(), u = {
1494
+ YYYY: String(a),
1495
+ MM: String(r).padStart(2, "0"),
1496
+ DD: String(s).padStart(2, "0"),
1345
1497
  HH: String(i).padStart(2, "0"),
1346
- mm: String(g).padStart(2, "0"),
1347
- ss: String(k).padStart(2, "0"),
1348
- M: String(l),
1349
- D: String(o),
1498
+ mm: String(c).padStart(2, "0"),
1499
+ ss: String(b).padStart(2, "0"),
1500
+ M: String(r),
1501
+ D: String(s),
1350
1502
  H: String(i),
1351
- m: String(g),
1352
- s: String(k)
1503
+ m: String(c),
1504
+ s: String(b)
1353
1505
  };
1354
- return n.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (p) => u[p]);
1506
+ return n.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (f) => u[f]);
1355
1507
  }
1356
- function Qt() {
1508
+ function on() {
1357
1509
  const e = /* @__PURE__ */ new Date();
1358
1510
  e.setHours(23, 59, 59, 0);
1359
1511
  const n = /* @__PURE__ */ new Date();
1360
1512
  return n.setDate(n.getDate() - 30), n.setHours(0, 0, 0, 0), {
1361
- start: se(n, "YYYY-MM-DD HH:mm:ss"),
1362
- end: se(e, "YYYY-MM-DD HH:mm:ss")
1513
+ start: ue(n, "YYYY-MM-DD HH:mm:ss"),
1514
+ end: ue(e, "YYYY-MM-DD HH:mm:ss")
1363
1515
  };
1364
1516
  }
1365
- function Xt(e) {
1517
+ function cn(e) {
1366
1518
  const n = {};
1367
1519
  return Object.keys(e || {}).forEach((t) => {
1368
- const r = e[t];
1369
- r == null || r === "" || Array.isArray(r) && r.length === 0 || (n[t] = r);
1520
+ const a = e[t];
1521
+ a == null || a === "" || Array.isArray(a) && a.length === 0 || (n[t] = a);
1370
1522
  }), n;
1371
1523
  }
1372
- function Jt(e, n = 2) {
1524
+ function un(e, n = 2) {
1373
1525
  if (e == null || e === "") return e;
1374
1526
  const t = Number(e);
1375
1527
  if (Number.isNaN(t)) return e;
1376
- const r = t.toFixed(n), [l, o] = r.split("."), i = l.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1377
- if (o == null) return i;
1378
- const g = o.replace(/0+$/, "");
1379
- return g ? `${i}.${g}` : i;
1528
+ const a = t.toFixed(n), [r, s] = a.split("."), i = r.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1529
+ if (s == null) return i;
1530
+ const c = s.replace(/0+$/, "");
1531
+ return c ? `${i}.${c}` : i;
1380
1532
  }
1381
- function Zt(e = "id") {
1533
+ function dn(e = "id") {
1382
1534
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
1383
1535
  }
1384
- const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1536
+ const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1385
1537
  __proto__: null,
1386
- cleanParams: Xt,
1387
- debounce: Wt,
1388
- deepClone: oe,
1389
- formatDate: se,
1390
- formatNum: Jt,
1391
- getRecentMonthRange: Qt,
1392
- isEmpty: qt,
1393
- parseDate: De,
1394
- throttle: Gt,
1395
- uniqueId: Zt
1538
+ cleanParams: cn,
1539
+ debounce: ln,
1540
+ deepClone: ce,
1541
+ formatDate: ue,
1542
+ formatNum: un,
1543
+ getRecentMonthRange: on,
1544
+ isEmpty: an,
1545
+ parseDate: Re,
1546
+ throttle: sn,
1547
+ uniqueId: dn
1396
1548
  }, Symbol.toStringTag, { value: "Module" }));
1397
- function en(e = {}) {
1549
+ function pn(e = {}) {
1398
1550
  const {
1399
1551
  baseURL: n = "",
1400
1552
  timeout: t = 6e4,
1401
- tokenKey: r,
1402
- systemIdKey: l,
1403
- loginUrl: o = "/login"
1404
- } = e, i = Ye.create({ baseURL: n, timeout: t });
1405
- let g = !1;
1406
- function k() {
1407
- typeof localStorage < "u" && localStorage.clear(), !g && (g = !0, setTimeout(() => {
1408
- typeof window < "u" && window.location.replace(o);
1553
+ tokenKey: a,
1554
+ systemIdKey: r,
1555
+ loginUrl: s = "/login"
1556
+ } = e, i = We.create({ baseURL: n, timeout: t });
1557
+ let c = !1;
1558
+ function b() {
1559
+ typeof localStorage < "u" && localStorage.clear(), !c && (c = !0, setTimeout(() => {
1560
+ typeof window < "u" && window.location.replace(s);
1409
1561
  }, 1500));
1410
1562
  }
1411
1563
  return i.interceptors.request.use(
1412
1564
  (u) => {
1413
1565
  if (u.headers["Content-Type"] = "application/json;charset=UTF-8", typeof localStorage < "u") {
1414
- if (r) {
1415
- const p = localStorage.getItem(r);
1416
- p && (u.headers.Authorization = p);
1566
+ if (a) {
1567
+ const f = localStorage.getItem(a);
1568
+ f && (u.headers.Authorization = f);
1417
1569
  }
1418
- if (l) {
1419
- const p = localStorage.getItem(l);
1420
- p && (u.headers.systemId = p);
1570
+ if (r) {
1571
+ const f = localStorage.getItem(r);
1572
+ f && (u.headers.systemId = f);
1421
1573
  }
1422
1574
  }
1423
1575
  return u;
@@ -1427,26 +1579,26 @@ function en(e = {}) {
1427
1579
  (u) => {
1428
1580
  if (u.status !== 200)
1429
1581
  return Promise.reject(new Error(`请求发生错误,状态码 ${u.status}`));
1430
- const { data: p, config: w } = u;
1431
- if (w.responseType === "arraybuffer") return p;
1432
- if (p && p.code === 0) return p.data;
1433
- const d = Number(p == null ? void 0 : p.code);
1434
- if (d === 401 || d === 403)
1435
- return k(), Promise.reject(new Error("登录失效,请重新登录"));
1436
- const h = ve(p) || "请求失败";
1582
+ const { data: f, config: k } = u;
1583
+ if (k.responseType === "arraybuffer") return f;
1584
+ if (f && f.code === 0) return f.data;
1585
+ const p = Number(f == null ? void 0 : f.code);
1586
+ if (p === 401 || p === 403)
1587
+ return b(), Promise.reject(new Error("登录失效,请重新登录"));
1588
+ const h = ke(f) || "请求失败";
1437
1589
  return Promise.reject(new Error(h));
1438
1590
  },
1439
1591
  (u) => {
1440
- var h, c;
1441
- const p = (h = u == null ? void 0 : u.response) == null ? void 0 : h.status;
1442
- if (p === 401 || p === 403)
1443
- return k(), Promise.reject(new Error("登录失效,请重新登录"));
1444
- const w = (c = u == null ? void 0 : u.response) == null ? void 0 : c.data, d = ve(w) || (u == null ? void 0 : u.message) || "请求失败";
1445
- return Promise.reject(new Error(String(d)));
1592
+ var h, d;
1593
+ const f = (h = u == null ? void 0 : u.response) == null ? void 0 : h.status;
1594
+ if (f === 401 || f === 403)
1595
+ return b(), Promise.reject(new Error("登录失效,请重新登录"));
1596
+ const k = (d = u == null ? void 0 : u.response) == null ? void 0 : d.data, p = ke(k) || (u == null ? void 0 : u.message) || "请求失败";
1597
+ return Promise.reject(new Error(String(p)));
1446
1598
  }
1447
1599
  ), i;
1448
1600
  }
1449
- function ve(e) {
1601
+ function ke(e) {
1450
1602
  if (e == null) return "";
1451
1603
  if (typeof e == "string") return e;
1452
1604
  if (typeof e != "object") return String(e);
@@ -1456,65 +1608,66 @@ function ve(e) {
1456
1608
  return String(t);
1457
1609
  return "";
1458
1610
  }
1459
- function tn(e = {}) {
1460
- const n = en(e);
1611
+ function fn(e = {}) {
1612
+ const n = pn(e);
1461
1613
  return {
1462
- GET(t, r = {}) {
1463
- return n({ method: "get", url: t, ...r });
1614
+ GET(t, a = {}) {
1615
+ return n({ method: "get", url: t, ...a });
1464
1616
  },
1465
- POST(t, r, l = {}) {
1466
- return n({ method: "post", url: t, data: r, ...l });
1617
+ POST(t, a, r = {}) {
1618
+ return n({ method: "post", url: t, data: a, ...r });
1467
1619
  },
1468
- DELETE(t, r = {}) {
1469
- return n({ method: "delete", url: t, ...r });
1620
+ DELETE(t, a = {}) {
1621
+ return n({ method: "delete", url: t, ...a });
1470
1622
  }
1471
1623
  };
1472
1624
  }
1473
- const Le = "__MGACN_COMMONSDK_REQUEST__";
1474
- function nn(e) {
1475
- globalThis[Le] = e;
1625
+ const Ve = "__MGACN_COMMONSDK_REQUEST__";
1626
+ function mn(e) {
1627
+ globalThis[Ve] = e;
1476
1628
  }
1477
- function pn() {
1478
- const e = globalThis[Le];
1629
+ function kn() {
1630
+ const e = globalThis[Ve];
1479
1631
  if (!e)
1480
1632
  throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
1481
1633
  return e;
1482
1634
  }
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]) => {
1492
- e.component(o.name || l, o);
1493
- });
1494
- const t = tn(n), r = je(t);
1495
- nn(t), ze(r), e.config.globalProperties.$request = t, e.config.globalProperties.$api = r;
1496
- }, fn = {
1497
- install: an,
1635
+ const gn = {
1636
+ MgImageUpload: xt,
1637
+ MgSearchForm: Ft,
1638
+ MgDataTable: en,
1639
+ MgDateRangePicker: Le,
1640
+ MgSegmentedControl: rn,
1641
+ MgOverflowHid: Oe
1642
+ }, hn = (e, n = {}) => {
1643
+ Object.entries(gn).forEach(([r, s]) => {
1644
+ e.component(s.name || r, s);
1645
+ }), n.ossUrl && Ze(n.ossUrl);
1646
+ const t = fn(n), a = Ge(t);
1647
+ mn(t), Qe(a), e.config.globalProperties.$request = t, e.config.globalProperties.$api = a;
1648
+ }, Cn = {
1649
+ install: hn,
1498
1650
  version: "1.0.0"
1499
1651
  };
1500
1652
  export {
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,
1508
- je as createApi,
1509
- xe as createOssClient,
1510
- tn as createRequest,
1511
- en as createService,
1512
- fn as default,
1513
- Ke as getApi,
1514
- Se as getOssSts,
1515
- pn as getRequest,
1516
- an as install,
1517
- ze as setApi,
1518
- Ge as uploadToOss,
1519
- dn as utils
1653
+ en as DataTable,
1654
+ Le as DateRangePicker,
1655
+ xt as ImageUpload,
1656
+ Ft as SearchForm,
1657
+ rn as SegmentedControl,
1658
+ Oe as TableOverflowHid,
1659
+ lt as aliOssMixin,
1660
+ Ge as createApi,
1661
+ fe as createOssClient,
1662
+ fn as createRequest,
1663
+ pn as createService,
1664
+ Cn as default,
1665
+ Xe as getApi,
1666
+ $e as getOssSts,
1667
+ kn as getRequest,
1668
+ hn as install,
1669
+ Qe as setApi,
1670
+ Ze as setDefaultOssUrl,
1671
+ nt as uploadToOss,
1672
+ Sn as utils
1520
1673
  };