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