mgacn-commonsdk 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -20
- package/dist/mgacn-commonsdk.js +1161 -330
- package/dist/mgacn-commonsdk.umd.cjs +1 -1
- package/dist/style.css +9 -9
- package/package.json +1 -1
package/dist/mgacn-commonsdk.js
CHANGED
|
@@ -1,130 +1,137 @@
|
|
|
1
|
-
import { Plus as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { resolveComponent as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
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) {
|
|
8
8
|
if (!e)
|
|
9
9
|
throw new Error("[mgacn-commonsdk] createApi 需要传入 request 实例");
|
|
10
10
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// ---------- 注销登录 ----------
|
|
12
|
+
logout(n) {
|
|
13
|
+
return e.GET(`/yhAdmin/login/exit/${n}`);
|
|
13
14
|
},
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// ---------- 用户 ----------
|
|
16
|
+
getUserInfo(n) {
|
|
17
|
+
return e.GET(`/yhAdmin/user/queryUser/${n}`);
|
|
18
|
+
},
|
|
19
|
+
// ---------- OSS ----------
|
|
20
|
+
getOssSts(n) {
|
|
21
|
+
return e.GET("/yhAdmin/oss/fileUploadSts", { params: { dir: n } });
|
|
16
22
|
}
|
|
17
23
|
};
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
25
|
+
const we = "__MGACN_COMMONSDK_API__";
|
|
26
|
+
function ze(e) {
|
|
27
|
+
globalThis[we] = e;
|
|
22
28
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
29
|
+
function Ke() {
|
|
30
|
+
const e = globalThis[we];
|
|
31
|
+
if (!e)
|
|
25
32
|
throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
|
|
26
|
-
return
|
|
33
|
+
return e;
|
|
27
34
|
}
|
|
28
|
-
function
|
|
35
|
+
function ge(e) {
|
|
29
36
|
return String(e).padStart(2, "0");
|
|
30
37
|
}
|
|
31
|
-
function
|
|
38
|
+
function qe() {
|
|
32
39
|
const e = /* @__PURE__ */ new Date();
|
|
33
|
-
return `${e.getFullYear()}${
|
|
40
|
+
return `${e.getFullYear()}${ge(e.getMonth() + 1)}${ge(e.getDate())}`;
|
|
34
41
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
for (let
|
|
39
|
-
|
|
40
|
-
return
|
|
42
|
+
function ke(e = 10) {
|
|
43
|
+
const n = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
44
|
+
let t = "";
|
|
45
|
+
for (let r = 0; r < e; r++)
|
|
46
|
+
t += n[Math.floor(Math.random() * n.length)];
|
|
47
|
+
return t;
|
|
41
48
|
}
|
|
42
|
-
function
|
|
43
|
-
return `${e}/${
|
|
49
|
+
function ue(e = "portal_cms") {
|
|
50
|
+
return `${e}/${qe()}/`;
|
|
44
51
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
52
|
+
function Ce(e) {
|
|
53
|
+
return Ke().getOssSts(e);
|
|
47
54
|
}
|
|
48
|
-
async function
|
|
49
|
-
const { dir:
|
|
50
|
-
if (!
|
|
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)
|
|
51
58
|
throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败");
|
|
52
|
-
const
|
|
53
|
-
bucket:
|
|
54
|
-
accessKeyId:
|
|
55
|
-
accessKeySecret:
|
|
59
|
+
const g = new He({
|
|
60
|
+
bucket: i.bucketName,
|
|
61
|
+
accessKeyId: i.accessKeyId,
|
|
62
|
+
accessKeySecret: i.accessKeySecret,
|
|
56
63
|
success_action_status: "200",
|
|
57
|
-
stsToken:
|
|
58
|
-
endpoint:
|
|
64
|
+
stsToken: i.securityToken,
|
|
65
|
+
endpoint: i.endPoint
|
|
59
66
|
});
|
|
60
|
-
return
|
|
67
|
+
return g.options.ossUrl = i.ossUrl || i.domain || (i.bucketName && i.endPoint ? `https://${i.bucketName}.${i.endPoint}` : ""), g.options.uploadDir = o, g;
|
|
61
68
|
}
|
|
62
|
-
async function
|
|
63
|
-
const { client:
|
|
64
|
-
if (!
|
|
69
|
+
async function We(e = {}) {
|
|
70
|
+
const { client: n, file: t, dir: r, foldName: l, fileName: o, onProgress: i } = e;
|
|
71
|
+
if (!t)
|
|
65
72
|
throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
if (!
|
|
69
|
-
const
|
|
70
|
-
|
|
73
|
+
const g = n || await Se({ dir: r, foldName: l }), k = r || g.options.uploadDir || ue(l);
|
|
74
|
+
let u = o;
|
|
75
|
+
if (!u) {
|
|
76
|
+
const h = t.name || "file", c = h.indexOf("."), x = c > -1 ? h.slice(c) : "";
|
|
77
|
+
u = `${k}${ke(10)}${x}`;
|
|
71
78
|
}
|
|
72
|
-
const
|
|
73
|
-
progress: (
|
|
74
|
-
typeof
|
|
79
|
+
const p = await g.multipartUpload(u, t, {
|
|
80
|
+
progress: (h) => {
|
|
81
|
+
typeof i == "function" && i(Math.floor(h * 100));
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
|
-
if (
|
|
84
|
+
if (p.res && p.res.statusCode !== 200)
|
|
78
85
|
throw new Error("[mgacn-commonsdk] 上传失败");
|
|
79
|
-
const w = (
|
|
80
|
-
return { name:
|
|
86
|
+
const w = (g.options.ossUrl || "").replace(/\/$/, ""), d = w ? `${w}/${u}` : u;
|
|
87
|
+
return { name: u, url: d, raw: p, client: g };
|
|
81
88
|
}
|
|
82
|
-
const
|
|
89
|
+
const Ge = {
|
|
83
90
|
methods: {
|
|
84
91
|
getDir() {
|
|
85
|
-
return
|
|
92
|
+
return ue(this.foldName || "portal_cms");
|
|
86
93
|
},
|
|
87
|
-
randomString:
|
|
94
|
+
randomString: ke,
|
|
88
95
|
getOss() {
|
|
89
|
-
return
|
|
96
|
+
return Ce(this.getDir());
|
|
90
97
|
},
|
|
91
98
|
async createOssClient() {
|
|
92
|
-
return
|
|
99
|
+
return Se({
|
|
93
100
|
dir: this.getDir(),
|
|
94
101
|
getOss: () => this.getOss()
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
|
-
},
|
|
99
|
-
const
|
|
100
|
-
for (const [
|
|
101
|
-
r
|
|
102
|
-
return
|
|
105
|
+
}, K = (e, n) => {
|
|
106
|
+
const t = e.__vccOpts || e;
|
|
107
|
+
for (const [r, l] of n)
|
|
108
|
+
t[r] = l;
|
|
109
|
+
return t;
|
|
103
110
|
};
|
|
104
|
-
let
|
|
105
|
-
function
|
|
106
|
-
return
|
|
111
|
+
let he = 0;
|
|
112
|
+
function xe() {
|
|
113
|
+
return he += 1, `mg-img-${Date.now()}-${he}`;
|
|
107
114
|
}
|
|
108
|
-
function
|
|
115
|
+
function Qe(e) {
|
|
109
116
|
return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
|
|
110
117
|
}
|
|
111
|
-
function
|
|
112
|
-
return e.map((
|
|
113
|
-
uid:
|
|
114
|
-
url:
|
|
118
|
+
function ye(e) {
|
|
119
|
+
return e.map((n) => ({
|
|
120
|
+
uid: xe(),
|
|
121
|
+
url: n,
|
|
115
122
|
status: "success",
|
|
116
123
|
percent: 100,
|
|
117
124
|
previewUrl: ""
|
|
118
125
|
}));
|
|
119
126
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
return
|
|
127
|
+
function Xe(e = "") {
|
|
128
|
+
const n = e.lastIndexOf(".");
|
|
129
|
+
return n > -1 ? e.slice(n + 1).toLowerCase() : "";
|
|
123
130
|
}
|
|
124
|
-
const
|
|
131
|
+
const Je = {
|
|
125
132
|
name: "MgImageUpload",
|
|
126
|
-
mixins: [
|
|
127
|
-
components: { CircleCloseFilled:
|
|
133
|
+
mixins: [Ge],
|
|
134
|
+
components: { CircleCloseFilled: Ae, Delete: Oe, Plus: Ve },
|
|
128
135
|
props: {
|
|
129
136
|
/** v-model 统一为 string[];入参兼容 string / string[] */
|
|
130
137
|
modelValue: { type: [Array, String], default: () => [] },
|
|
@@ -145,14 +152,7 @@ const le = {
|
|
|
145
152
|
/** 是否有未完成上传(支持 v-model:uploading) */
|
|
146
153
|
uploading: { type: Boolean, default: !1 }
|
|
147
154
|
},
|
|
148
|
-
emits: [
|
|
149
|
-
"update:modelValue",
|
|
150
|
-
"update:uploading",
|
|
151
|
-
"sendFile",
|
|
152
|
-
"success",
|
|
153
|
-
"error",
|
|
154
|
-
"progress"
|
|
155
|
-
],
|
|
155
|
+
emits: ["update:modelValue", "update:uploading", "sendFile", "success", "error", "progress"],
|
|
156
156
|
expose: ["hasPendingUpload", "isUploading"],
|
|
157
157
|
data() {
|
|
158
158
|
return {
|
|
@@ -194,16 +194,16 @@ const le = {
|
|
|
194
194
|
deep: !0,
|
|
195
195
|
immediate: !0,
|
|
196
196
|
handler(e) {
|
|
197
|
-
e != null && e.length && this.replaceList(
|
|
197
|
+
e != null && e.length && this.replaceList(ye(e));
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
modelValue: {
|
|
201
201
|
immediate: !0,
|
|
202
202
|
handler(e) {
|
|
203
|
-
var
|
|
204
|
-
if ((
|
|
205
|
-
const
|
|
206
|
-
|
|
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));
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
209
|
cropImageUrl(e) {
|
|
@@ -238,27 +238,27 @@ const le = {
|
|
|
238
238
|
handleUpload() {
|
|
239
239
|
if (!this.disabled) {
|
|
240
240
|
if (this.fileList.length >= this.fileNum) {
|
|
241
|
-
|
|
241
|
+
te.error(`文件数量不超过${this.fileNum}`);
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
this.openFilePicker();
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
onFileChange(e) {
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
252
|
-
|
|
248
|
+
const n = [...e.target.files || []];
|
|
249
|
+
if (!n.length) return;
|
|
250
|
+
const t = this.fileNum - this.fileList.length;
|
|
251
|
+
if (n.length > t) {
|
|
252
|
+
te.error(`文件数量不超过${this.fileNum}个`);
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
257
|
-
this.acceptList.includes(
|
|
258
|
-
}),
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
`已过滤以下 ${
|
|
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("/")}`,
|
|
262
262
|
"提示",
|
|
263
263
|
{
|
|
264
264
|
confirmButtonText: "确认",
|
|
@@ -269,59 +269,59 @@ const le = {
|
|
|
269
269
|
).catch(() => {
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
if (
|
|
272
|
+
if (r.length) {
|
|
273
273
|
if (this.isCropper) {
|
|
274
|
-
this.openCropper(
|
|
274
|
+
this.openCropper(r[0]);
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
-
this.startUpload(
|
|
277
|
+
this.startUpload(r);
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
280
|
openCropper(e) {
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
this.cropImageUrl =
|
|
284
|
-
},
|
|
281
|
+
const n = new FileReader();
|
|
282
|
+
n.onloadend = (t) => {
|
|
283
|
+
this.cropImageUrl = t.target.result, this.dialogVisible = !0, this.cropper || this.$nextTick(() => this.initCropper());
|
|
284
|
+
}, n.readAsDataURL(e);
|
|
285
285
|
},
|
|
286
286
|
/** 先预览,再逐张上传;每张图独立进度蒙层 */
|
|
287
287
|
startUpload(e) {
|
|
288
288
|
this.resetFilelist && this.replaceList([]);
|
|
289
|
-
const
|
|
290
|
-
return e.forEach((
|
|
291
|
-
if (
|
|
292
|
-
|
|
289
|
+
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 限制`);
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
|
-
const
|
|
296
|
-
uid:
|
|
297
|
-
url:
|
|
298
|
-
previewUrl:
|
|
295
|
+
const l = URL.createObjectURL(r), o = {
|
|
296
|
+
uid: xe(),
|
|
297
|
+
url: l,
|
|
298
|
+
previewUrl: l,
|
|
299
299
|
status: "uploading",
|
|
300
300
|
percent: 0,
|
|
301
|
-
raw:
|
|
301
|
+
raw: r
|
|
302
302
|
};
|
|
303
|
-
this.fileList.push(
|
|
304
|
-
}), Promise.all(
|
|
303
|
+
this.fileList.push(o), t.push(this.uploadOne(o));
|
|
304
|
+
}), Promise.all(t);
|
|
305
305
|
},
|
|
306
306
|
async uploadOne(e) {
|
|
307
307
|
try {
|
|
308
|
-
const
|
|
308
|
+
const n = await We({
|
|
309
309
|
file: e.raw,
|
|
310
310
|
dir: this.getDir(),
|
|
311
|
-
onProgress: (
|
|
312
|
-
e.percent =
|
|
311
|
+
onProgress: (t) => {
|
|
312
|
+
e.percent = t, this.$emit("progress", t, e.raw);
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
|
-
this.revokePreview(e), e.url =
|
|
316
|
-
} catch (
|
|
317
|
-
e.status = "fail", e.percent = 0, this.$emit("error",
|
|
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
318
|
} finally {
|
|
319
319
|
this.dialogVisible && this.handleBack();
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
initCropper() {
|
|
323
323
|
const e = this.$refs.cropImage;
|
|
324
|
-
e && (this.cropper = new
|
|
324
|
+
e && (this.cropper = new Fe(e, {
|
|
325
325
|
aspectRatio: this.aspectRatio,
|
|
326
326
|
autoCropArea: 0.8,
|
|
327
327
|
viewMode: 1,
|
|
@@ -340,12 +340,12 @@ const le = {
|
|
|
340
340
|
this.cropper && (this.cropper.destroy(), this.cropper = null);
|
|
341
341
|
},
|
|
342
342
|
rotate(e) {
|
|
343
|
-
var
|
|
344
|
-
(
|
|
343
|
+
var n;
|
|
344
|
+
(n = this.cropper) == null || n.rotate(e);
|
|
345
345
|
},
|
|
346
346
|
confirmCrop() {
|
|
347
347
|
if (this.uploadingCount) {
|
|
348
|
-
|
|
348
|
+
te.error("上传中,请稍后!");
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
if (!this.cropper) return;
|
|
@@ -353,185 +353,185 @@ const le = {
|
|
|
353
353
|
this.startUpload([this.base64ToFile(e)]);
|
|
354
354
|
},
|
|
355
355
|
base64ToFile(e) {
|
|
356
|
-
const [
|
|
357
|
-
for (let
|
|
358
|
-
return new File([
|
|
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 });
|
|
359
359
|
},
|
|
360
360
|
handleBack() {
|
|
361
361
|
this.cropImageUrl = "", this.dialogVisible = !1;
|
|
362
362
|
},
|
|
363
363
|
removeImg(e) {
|
|
364
|
-
const
|
|
365
|
-
!
|
|
364
|
+
const n = this.fileList[e];
|
|
365
|
+
!n || n.status === "uploading" || (this.revokePreview(n), this.fileList.splice(e, 1), this.emitFile());
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
},
|
|
368
|
+
}, Ze = { class: "upload-image-cropper" }, et = ["multiple", "accept"], tt = {
|
|
369
369
|
key: 0,
|
|
370
370
|
class: "grey-tips"
|
|
371
|
-
},
|
|
371
|
+
}, nt = { key: 0 }, lt = { class: "list-box" }, at = {
|
|
372
372
|
key: 0,
|
|
373
373
|
class: "status-mask is-uploading"
|
|
374
|
-
},
|
|
374
|
+
}, rt = { class: "progress-wrap" }, ot = { class: "percent-text" }, st = {
|
|
375
375
|
key: 1,
|
|
376
376
|
class: "status-mask is-fail"
|
|
377
|
-
},
|
|
378
|
-
function
|
|
379
|
-
const
|
|
380
|
-
return
|
|
381
|
-
|
|
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", {
|
|
382
382
|
ref: "fileInput",
|
|
383
383
|
type: "file",
|
|
384
384
|
class: "file-input",
|
|
385
|
-
multiple:
|
|
386
|
-
accept:
|
|
387
|
-
onChange:
|
|
388
|
-
}, null, 40,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
])) :
|
|
393
|
-
|
|
394
|
-
(
|
|
395
|
-
key:
|
|
396
|
-
class:
|
|
397
|
-
style:
|
|
385
|
+
multiple: o.multiple,
|
|
386
|
+
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)
|
|
398
398
|
}, [
|
|
399
|
-
|
|
400
|
-
src:
|
|
399
|
+
v(i, {
|
|
400
|
+
src: c.url,
|
|
401
401
|
fit: "cover",
|
|
402
402
|
class: "img"
|
|
403
403
|
}, null, 8, ["src"]),
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
c.status === "uploading" ? (m(), b("div", at, [
|
|
405
|
+
_("div", rt, [
|
|
406
|
+
v(g, {
|
|
407
407
|
type: "circle",
|
|
408
|
-
percentage:
|
|
408
|
+
percentage: c.percent,
|
|
409
409
|
width: 30,
|
|
410
410
|
"stroke-width": 3,
|
|
411
411
|
"show-text": !1,
|
|
412
412
|
color: "var(--mg-primary, #ff5722)"
|
|
413
413
|
}, null, 8, ["percentage"]),
|
|
414
|
-
|
|
414
|
+
_("span", ot, D(c.percent) + "%", 1)
|
|
415
415
|
])
|
|
416
|
-
])) :
|
|
417
|
-
|
|
416
|
+
])) : c.status === "fail" ? (m(), b("div", st, [
|
|
417
|
+
v(u, {
|
|
418
418
|
class: "fail-icon",
|
|
419
419
|
size: 16
|
|
420
420
|
}, {
|
|
421
|
-
default:
|
|
422
|
-
|
|
421
|
+
default: S(() => [
|
|
422
|
+
v(k)
|
|
423
423
|
]),
|
|
424
424
|
_: 1
|
|
425
425
|
}),
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
n[5] || (n[5] = _("span", { class: "fail-text" }, "失败", -1)),
|
|
427
|
+
v(u, {
|
|
428
428
|
class: "remove-icon",
|
|
429
429
|
size: 14,
|
|
430
430
|
title: "删除",
|
|
431
|
-
onClick:
|
|
431
|
+
onClick: Ee((M) => o.removeImg(x), ["stop"])
|
|
432
432
|
}, {
|
|
433
|
-
default:
|
|
434
|
-
p
|
|
433
|
+
default: S(() => [
|
|
434
|
+
v(p)
|
|
435
435
|
]),
|
|
436
436
|
_: 1
|
|
437
437
|
}, 8, ["onClick"])
|
|
438
|
-
])) : (
|
|
438
|
+
])) : (m(), b("div", {
|
|
439
439
|
key: 2,
|
|
440
440
|
class: "status-mask is-success",
|
|
441
|
-
onClick: (
|
|
441
|
+
onClick: (M) => o.removeImg(x)
|
|
442
442
|
}, [
|
|
443
|
-
|
|
443
|
+
v(u, {
|
|
444
444
|
class: "remove-icon",
|
|
445
445
|
size: 16
|
|
446
446
|
}, {
|
|
447
|
-
default:
|
|
448
|
-
p
|
|
447
|
+
default: S(() => [
|
|
448
|
+
v(p)
|
|
449
449
|
]),
|
|
450
450
|
_: 1
|
|
451
451
|
})
|
|
452
|
-
], 8,
|
|
452
|
+
], 8, it))
|
|
453
453
|
], 6))), 128)),
|
|
454
|
-
|
|
454
|
+
j(_("div", {
|
|
455
455
|
class: "image-box upload-btn",
|
|
456
|
-
style:
|
|
457
|
-
onClick:
|
|
456
|
+
style: X(t.imageStyle),
|
|
457
|
+
onClick: n[1] || (n[1] = (...c) => o.handleUpload && o.handleUpload(...c))
|
|
458
458
|
}, [
|
|
459
|
-
|
|
459
|
+
v(u, {
|
|
460
460
|
class: "icon",
|
|
461
461
|
size: 14
|
|
462
462
|
}, {
|
|
463
|
-
default:
|
|
464
|
-
|
|
463
|
+
default: S(() => [
|
|
464
|
+
v(w)
|
|
465
465
|
]),
|
|
466
466
|
_: 1
|
|
467
467
|
}),
|
|
468
|
-
|
|
468
|
+
n[6] || (n[6] = _("div", null, "上传图片", -1))
|
|
469
469
|
], 4), [
|
|
470
|
-
[
|
|
470
|
+
[z, o.showUploadBtn]
|
|
471
471
|
])
|
|
472
472
|
]),
|
|
473
|
-
|
|
474
|
-
modelValue:
|
|
475
|
-
"onUpdate:modelValue":
|
|
473
|
+
v(h, {
|
|
474
|
+
modelValue: l.dialogVisible,
|
|
475
|
+
"onUpdate:modelValue": n[4] || (n[4] = (c) => l.dialogVisible = c),
|
|
476
476
|
title: "裁剪图片",
|
|
477
477
|
width: "600px",
|
|
478
478
|
top: "5vh",
|
|
479
479
|
"append-to-body": "",
|
|
480
480
|
"close-on-click-modal": !1,
|
|
481
|
-
onClose:
|
|
481
|
+
onClose: o.handleBack
|
|
482
482
|
}, {
|
|
483
|
-
default:
|
|
484
|
-
|
|
485
|
-
|
|
483
|
+
default: S(() => [
|
|
484
|
+
_("div", ut, [
|
|
485
|
+
j(_("img", {
|
|
486
486
|
ref: "cropImage",
|
|
487
|
-
src:
|
|
487
|
+
src: l.cropImageUrl,
|
|
488
488
|
class: "cropper-img"
|
|
489
|
-
}, null, 8,
|
|
490
|
-
[
|
|
489
|
+
}, null, 8, ct), [
|
|
490
|
+
[z, l.cropImageUrl]
|
|
491
491
|
])
|
|
492
492
|
]),
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
onClick:
|
|
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
497
|
}, {
|
|
498
|
-
default:
|
|
499
|
-
|
|
498
|
+
default: S(() => [...n[7] || (n[7] = [
|
|
499
|
+
$("向左旋转", -1)
|
|
500
500
|
])]),
|
|
501
501
|
_: 1
|
|
502
502
|
}),
|
|
503
|
-
|
|
504
|
-
onClick:
|
|
503
|
+
v(d, {
|
|
504
|
+
onClick: n[3] || (n[3] = (c) => o.rotate(t.degree))
|
|
505
505
|
}, {
|
|
506
|
-
default:
|
|
507
|
-
|
|
506
|
+
default: S(() => [...n[8] || (n[8] = [
|
|
507
|
+
$("向右旋转", -1)
|
|
508
508
|
])]),
|
|
509
509
|
_: 1
|
|
510
510
|
})
|
|
511
|
-
], 64)) :
|
|
512
|
-
|
|
511
|
+
], 64)) : F("", !0),
|
|
512
|
+
v(d, {
|
|
513
513
|
type: "primary",
|
|
514
|
-
onClick:
|
|
514
|
+
onClick: o.openFilePicker
|
|
515
515
|
}, {
|
|
516
|
-
default:
|
|
517
|
-
|
|
516
|
+
default: S(() => [
|
|
517
|
+
$(D(l.cropImageUrl ? "重新上传" : "点击上传"), 1)
|
|
518
518
|
]),
|
|
519
519
|
_: 1
|
|
520
520
|
}, 8, ["onClick"])
|
|
521
521
|
]),
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
default:
|
|
525
|
-
|
|
522
|
+
_("div", pt, [
|
|
523
|
+
v(d, { onClick: o.handleBack }, {
|
|
524
|
+
default: S(() => [...n[9] || (n[9] = [
|
|
525
|
+
$("取 消", -1)
|
|
526
526
|
])]),
|
|
527
527
|
_: 1
|
|
528
528
|
}, 8, ["onClick"]),
|
|
529
|
-
|
|
529
|
+
v(d, {
|
|
530
530
|
type: "primary",
|
|
531
|
-
onClick:
|
|
531
|
+
onClick: o.confirmCrop
|
|
532
532
|
}, {
|
|
533
|
-
default:
|
|
534
|
-
|
|
533
|
+
default: S(() => [...n[10] || (n[10] = [
|
|
534
|
+
$("确定", -1)
|
|
535
535
|
])]),
|
|
536
536
|
_: 1
|
|
537
537
|
}, 8, ["onClick"])
|
|
@@ -541,148 +541,979 @@ function _e(e, t, r, s, o, i) {
|
|
|
541
541
|
}, 8, ["modelValue", "onClose"])
|
|
542
542
|
]);
|
|
543
543
|
}
|
|
544
|
-
const
|
|
545
|
-
|
|
544
|
+
const mt = /* @__PURE__ */ K(Je, [["render", ft], ["__scopeId", "data-v-27d5f986"]]), gt = {
|
|
545
|
+
__name: "DateRangePicker",
|
|
546
|
+
props: {
|
|
547
|
+
start: {
|
|
548
|
+
type: String
|
|
549
|
+
},
|
|
550
|
+
end: {
|
|
551
|
+
type: String
|
|
552
|
+
},
|
|
553
|
+
type: {
|
|
554
|
+
default: "daterange"
|
|
555
|
+
// daterange、datetimerange、monthrange
|
|
556
|
+
},
|
|
557
|
+
format: {
|
|
558
|
+
default: "YYYY-MM-DD"
|
|
559
|
+
},
|
|
560
|
+
valueFormat: {
|
|
561
|
+
default: "YYYY-MM-DD HH:mm:ss"
|
|
562
|
+
},
|
|
563
|
+
defaultTime: {
|
|
564
|
+
default: [new Date(2024, 1, 1, 0, 0, 0), new Date(2024, 1, 1, 23, 59, 59)]
|
|
565
|
+
},
|
|
566
|
+
title: { type: String, default: "" },
|
|
567
|
+
canClearable: { type: Boolean, default: !0 }
|
|
568
|
+
},
|
|
569
|
+
emits: ["update:start", "update:end", "change"],
|
|
570
|
+
setup(e, { emit: n }) {
|
|
571
|
+
const t = n, r = e, l = L([]);
|
|
572
|
+
W(
|
|
573
|
+
() => r.start,
|
|
574
|
+
() => {
|
|
575
|
+
l.value = [r.start, r.end];
|
|
576
|
+
}
|
|
577
|
+
), ie(() => {
|
|
578
|
+
l.value = [r.start, r.end];
|
|
579
|
+
});
|
|
580
|
+
function o(i) {
|
|
581
|
+
t("update:start", i ? i[0] : ""), t("update:end", i ? i[1] : ""), t("change");
|
|
582
|
+
}
|
|
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),
|
|
588
|
+
type: e.type,
|
|
589
|
+
"range-separator": "至",
|
|
590
|
+
"start-placeholder": `${e.title} 开始`,
|
|
591
|
+
"end-placeholder": "结束",
|
|
592
|
+
"value-format": e.valueFormat,
|
|
593
|
+
"default-time": e.defaultTime,
|
|
594
|
+
class: "date-range-picker",
|
|
595
|
+
onChange: o,
|
|
596
|
+
clearable: e.canClearable
|
|
597
|
+
}, null, 8, ["modelValue", "type", "start-placeholder", "value-format", "default-time", "clearable"]);
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
}, Ne = /* @__PURE__ */ K(gt, [["__scopeId", "data-v-47618fba"]]), ht = { class: "common-search__body" }, yt = { class: "common-search__fields-wrap" }, bt = {
|
|
601
|
+
key: 0,
|
|
602
|
+
class: "common-search__label"
|
|
603
|
+
}, vt = {
|
|
604
|
+
key: 4,
|
|
605
|
+
class: "common-search__range"
|
|
606
|
+
}, _t = { class: "common-search__range-sep" }, wt = {
|
|
607
|
+
key: 6,
|
|
608
|
+
class: "common-search__range"
|
|
609
|
+
}, kt = {
|
|
610
|
+
key: 0,
|
|
611
|
+
class: "common-search__actions is-inline"
|
|
612
|
+
}, Ct = {
|
|
613
|
+
key: 0,
|
|
614
|
+
class: "common-search__footer"
|
|
615
|
+
}, St = { class: "common-search__actions is-bottom" }, xt = { class: "common-search__actions-main" }, Nt = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
|
|
616
|
+
__name: "SearchForm",
|
|
617
|
+
props: {
|
|
618
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
619
|
+
itemList: { type: Array, default: () => [] },
|
|
620
|
+
loading: { type: Boolean, default: !1 }
|
|
621
|
+
},
|
|
622
|
+
emits: ["change", "search", "reset", "update:modelValue"],
|
|
623
|
+
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 ?? {});
|
|
628
|
+
}
|
|
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))
|
|
633
|
+
return {
|
|
634
|
+
maxHeight: `${c.value}px`,
|
|
635
|
+
overflow: "hidden"
|
|
636
|
+
};
|
|
637
|
+
});
|
|
638
|
+
W(
|
|
639
|
+
() => t.modelValue,
|
|
640
|
+
(s) => {
|
|
641
|
+
k(s, l.value) || (g = !0, l.value = { ...s || {} }, G(() => {
|
|
642
|
+
g = !1;
|
|
643
|
+
}));
|
|
644
|
+
},
|
|
645
|
+
{ deep: !0, immediate: !0 }
|
|
646
|
+
), W(
|
|
647
|
+
l,
|
|
648
|
+
() => {
|
|
649
|
+
g || r("update:modelValue", { ...l.value });
|
|
650
|
+
},
|
|
651
|
+
{ deep: !0 }
|
|
652
|
+
), W(
|
|
653
|
+
() => t.itemList,
|
|
654
|
+
() => {
|
|
655
|
+
p.value = !1, G(() => q());
|
|
656
|
+
},
|
|
657
|
+
{ 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);
|
|
664
|
+
});
|
|
665
|
+
function O() {
|
|
666
|
+
!M && !C && q();
|
|
667
|
+
}
|
|
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 };
|
|
672
|
+
}
|
|
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;
|
|
678
|
+
}
|
|
679
|
+
function J(s, f) {
|
|
680
|
+
return s == null || typeof s != "object" ? s : s[f.optionsValue || "value"];
|
|
681
|
+
}
|
|
682
|
+
async function Le(s, f) {
|
|
683
|
+
if (typeof s.remoteMethod == "function") {
|
|
684
|
+
i[s.prop] = !0;
|
|
685
|
+
try {
|
|
686
|
+
const U = await s.remoteMethod(f);
|
|
687
|
+
o[s.prop] = Array.isArray(U) ? U : [];
|
|
688
|
+
} finally {
|
|
689
|
+
i[s.prop] = !1;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
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;
|
|
698
|
+
}
|
|
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;
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
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;
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
E + H + B > I ? (ee += 1, E = B) : E += H + B;
|
|
718
|
+
});
|
|
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;
|
|
721
|
+
}
|
|
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(() => {
|
|
729
|
+
requestAnimationFrame(() => {
|
|
730
|
+
c.value = d.value;
|
|
731
|
+
});
|
|
732
|
+
});
|
|
733
|
+
else {
|
|
734
|
+
c.value = f;
|
|
735
|
+
const U = de(s);
|
|
736
|
+
h.value = U, p.value = !0, requestAnimationFrame(() => {
|
|
737
|
+
requestAnimationFrame(() => {
|
|
738
|
+
c.value = U;
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
window.setTimeout(() => {
|
|
743
|
+
C = !1, q();
|
|
744
|
+
}, 380);
|
|
745
|
+
}
|
|
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;
|
|
751
|
+
}
|
|
752
|
+
function pe() {
|
|
753
|
+
r("update:modelValue", { ...l.value });
|
|
754
|
+
}
|
|
755
|
+
function A() {
|
|
756
|
+
pe(), r("change", { ...l.value }), r("search", { ...l.value });
|
|
757
|
+
}
|
|
758
|
+
function Z() {
|
|
759
|
+
l.value = Te(), pe(), r("reset", { ...l.value }), r("change", { ...l.value });
|
|
760
|
+
}
|
|
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
|
|
769
|
+
}])
|
|
770
|
+
}, [
|
|
771
|
+
_("div", ht, [
|
|
772
|
+
_("div", yt, [
|
|
773
|
+
_("div", {
|
|
774
|
+
ref_key: "fieldsRef",
|
|
775
|
+
ref: u,
|
|
776
|
+
class: "common-search__fields",
|
|
777
|
+
style: X(ne.value)
|
|
778
|
+
}, [
|
|
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))
|
|
783
|
+
}, [
|
|
784
|
+
a.label ? (m(), b("label", bt, D(a.label), 1)) : F("", !0),
|
|
785
|
+
a.type === "input" || a.type === "text" ? (m(), T(U, {
|
|
786
|
+
key: 1,
|
|
787
|
+
modelValue: l.value[a.prop],
|
|
788
|
+
"onUpdate:modelValue": (y) => l.value[a.prop] = y,
|
|
789
|
+
modelModifiers: { trim: !0 },
|
|
790
|
+
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, {
|
|
796
|
+
key: 2,
|
|
797
|
+
modelValue: l.value[a.prop],
|
|
798
|
+
"onUpdate:modelValue": (y) => l.value[a.prop] = y,
|
|
799
|
+
placeholder: a.placeholder || `请选择${a.label || ""}`,
|
|
800
|
+
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,
|
|
806
|
+
class: "common-search__control",
|
|
807
|
+
onChange: A
|
|
808
|
+
}, {
|
|
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),
|
|
814
|
+
disabled: typeof y == "object" && (y == null ? void 0 : y.disabled)
|
|
815
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
816
|
+
]),
|
|
817
|
+
_: 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, {
|
|
819
|
+
key: 3,
|
|
820
|
+
modelValue: l.value[a.prop],
|
|
821
|
+
"onUpdate:modelValue": (y) => l.value[a.prop] = y,
|
|
822
|
+
placeholder: a.placeholder || "请输入关键词搜索",
|
|
823
|
+
clearable: "",
|
|
824
|
+
filterable: "",
|
|
825
|
+
remote: "",
|
|
826
|
+
multiple: a.multiple,
|
|
827
|
+
"collapse-tags": a.multiple,
|
|
828
|
+
"collapse-tags-tooltip": a.multiple,
|
|
829
|
+
"reserve-keyword": !1,
|
|
830
|
+
"remote-method": (y) => Le(a, y),
|
|
831
|
+
loading: !!i[a.prop],
|
|
832
|
+
disabled: a.disabled,
|
|
833
|
+
class: "common-search__control",
|
|
834
|
+
onClear: (y) => o[a.prop] = [],
|
|
835
|
+
onChange: A
|
|
836
|
+
}, {
|
|
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),
|
|
842
|
+
disabled: typeof y == "object" && (y == null ? void 0 : y.disabled)
|
|
843
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
844
|
+
]),
|
|
845
|
+
_: 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,
|
|
850
|
+
controls: !1,
|
|
851
|
+
min: a.min,
|
|
852
|
+
max: a.max,
|
|
853
|
+
precision: a.precision,
|
|
854
|
+
placeholder: a.minPlaceholder || "最小值",
|
|
855
|
+
disabled: a.disabled,
|
|
856
|
+
class: "common-search__range-input"
|
|
857
|
+
}, 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,
|
|
862
|
+
controls: !1,
|
|
863
|
+
min: a.min,
|
|
864
|
+
max: a.max,
|
|
865
|
+
precision: a.precision,
|
|
866
|
+
placeholder: a.maxPlaceholder || "最大值",
|
|
867
|
+
disabled: a.disabled,
|
|
868
|
+
class: "common-search__range-input"
|
|
869
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "precision", "placeholder", "disabled"])
|
|
870
|
+
])) : a.type === "date" ? (m(), T(ee, {
|
|
871
|
+
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,
|
|
880
|
+
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
|
|
888
|
+
}, null, 8, ["start", "onUpdate:start", "end", "onUpdate:end"])
|
|
889
|
+
])) : Q(s.$slots, a.slotName || a.prop, {
|
|
890
|
+
item: a,
|
|
891
|
+
form: l.value
|
|
892
|
+
}, void 0, !0, 7)
|
|
893
|
+
], 6))), 128))
|
|
894
|
+
], 4)
|
|
895
|
+
]),
|
|
896
|
+
w.value ? F("", !0) : (m(), b("div", kt, [
|
|
897
|
+
Q(s.$slots, "actions", {
|
|
898
|
+
search: A,
|
|
899
|
+
reset: Z,
|
|
900
|
+
form: l.value
|
|
901
|
+
}, () => [
|
|
902
|
+
v(R, {
|
|
903
|
+
class: "common-search__reset",
|
|
904
|
+
onClick: Z
|
|
905
|
+
}, {
|
|
906
|
+
default: S(() => [...f[0] || (f[0] = [
|
|
907
|
+
$("重置", -1)
|
|
908
|
+
])]),
|
|
909
|
+
_: 1
|
|
910
|
+
}),
|
|
911
|
+
v(R, {
|
|
912
|
+
type: "primary",
|
|
913
|
+
class: "common-search__submit",
|
|
914
|
+
loading: e.loading,
|
|
915
|
+
onClick: A
|
|
916
|
+
}, {
|
|
917
|
+
default: S(() => [...f[1] || (f[1] = [
|
|
918
|
+
$(" 搜索 ", -1)
|
|
919
|
+
])]),
|
|
920
|
+
_: 1
|
|
921
|
+
}, 8, ["loading"])
|
|
922
|
+
], !0)
|
|
923
|
+
]))
|
|
924
|
+
]),
|
|
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
|
|
932
|
+
}, () => [
|
|
933
|
+
v(R, {
|
|
934
|
+
class: "common-search__reset",
|
|
935
|
+
onClick: Z
|
|
936
|
+
}, {
|
|
937
|
+
default: S(() => [...f[2] || (f[2] = [
|
|
938
|
+
$("重置", -1)
|
|
939
|
+
])]),
|
|
940
|
+
_: 1
|
|
941
|
+
}),
|
|
942
|
+
v(R, {
|
|
943
|
+
type: "primary",
|
|
944
|
+
class: "common-search__submit",
|
|
945
|
+
loading: e.loading,
|
|
946
|
+
onClick: A
|
|
947
|
+
}, {
|
|
948
|
+
default: S(() => [...f[3] || (f[3] = [
|
|
949
|
+
$(" 搜索 ", -1)
|
|
950
|
+
])]),
|
|
951
|
+
_: 1
|
|
952
|
+
}, 8, ["loading"])
|
|
953
|
+
], !0)
|
|
954
|
+
]),
|
|
955
|
+
v(R, {
|
|
956
|
+
onClick: $e,
|
|
957
|
+
type: "primary",
|
|
958
|
+
plain: ""
|
|
959
|
+
}, {
|
|
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")))
|
|
965
|
+
]),
|
|
966
|
+
_: 1
|
|
967
|
+
})
|
|
968
|
+
]),
|
|
969
|
+
_: 1
|
|
970
|
+
})
|
|
971
|
+
])
|
|
972
|
+
])) : F("", !0)
|
|
973
|
+
], 2)), [
|
|
974
|
+
[z, e.itemList.length]
|
|
975
|
+
]);
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
}), Ut = /* @__PURE__ */ K(Nt, [["__scopeId", "data-v-08ffb41c"]]), Mt = {
|
|
979
|
+
name: "MgOverflowHid",
|
|
980
|
+
props: {
|
|
981
|
+
label: String,
|
|
982
|
+
//属性名
|
|
983
|
+
value: String,
|
|
984
|
+
//属性值
|
|
985
|
+
maxLength: { type: Number, default: 40 },
|
|
986
|
+
//溢出隐藏字数最大值
|
|
987
|
+
labelClassName: { type: String, default: () => "text_nomal" },
|
|
988
|
+
//属性名样式名
|
|
989
|
+
valueClassName: { type: String, default: () => "text_nomal" }
|
|
990
|
+
//属性值字体样式名
|
|
991
|
+
},
|
|
992
|
+
data() {
|
|
993
|
+
return {};
|
|
994
|
+
},
|
|
995
|
+
methods: {
|
|
996
|
+
cutString(e, n) {
|
|
997
|
+
let t = e || "";
|
|
998
|
+
return t && t.length > n && (t = t.slice(0, n) + "..."), t;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
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, {
|
|
1006
|
+
key: 0,
|
|
1007
|
+
trigger: "hover",
|
|
1008
|
+
placement: "bottom",
|
|
1009
|
+
width: "400"
|
|
1010
|
+
}, {
|
|
1011
|
+
reference: S(() => [
|
|
1012
|
+
_("div", $t, [
|
|
1013
|
+
j(_("span", {
|
|
1014
|
+
class: V(t.labelClassName)
|
|
1015
|
+
}, D(t.label) + ":", 3), [
|
|
1016
|
+
[z, t.label]
|
|
1017
|
+
]),
|
|
1018
|
+
_("span", {
|
|
1019
|
+
class: V(t.valueClassName),
|
|
1020
|
+
innerHTML: o.cutString(t.value, t.maxLength)
|
|
1021
|
+
}, null, 10, Tt)
|
|
1022
|
+
])
|
|
1023
|
+
]),
|
|
1024
|
+
default: S(() => [
|
|
1025
|
+
j(_("span", {
|
|
1026
|
+
class: V(t.labelClassName)
|
|
1027
|
+
}, D(t.label) + ":", 3), [
|
|
1028
|
+
[z, t.label]
|
|
1029
|
+
]),
|
|
1030
|
+
_("span", { innerHTML: t.value }, null, 8, Lt)
|
|
1031
|
+
]),
|
|
1032
|
+
_: 1
|
|
1033
|
+
})) : (m(), b("div", Vt, [
|
|
1034
|
+
j(_("span", {
|
|
1035
|
+
class: V(t.labelClassName)
|
|
1036
|
+
}, D(t.label) + ":", 3), [
|
|
1037
|
+
[z, t.label]
|
|
1038
|
+
]),
|
|
1039
|
+
_("span", {
|
|
1040
|
+
class: V([t.valueClassName, "value"])
|
|
1041
|
+
}, [
|
|
1042
|
+
_("span", { innerHTML: t.value }, null, 8, Ot)
|
|
1043
|
+
], 2)
|
|
1044
|
+
]))
|
|
1045
|
+
]);
|
|
1046
|
+
}
|
|
1047
|
+
const Ue = /* @__PURE__ */ K(Mt, [["render", At], ["__scopeId", "data-v-ef86ea54"]]), Rt = { class: "common-table__main" }, Ft = { key: 0 }, Ht = { key: 1 }, Et = {
|
|
1048
|
+
key: 2,
|
|
1049
|
+
class: "bold-text"
|
|
1050
|
+
}, Pt = {
|
|
1051
|
+
key: 0,
|
|
1052
|
+
class: "common-table__pagination"
|
|
1053
|
+
}, It = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
|
|
1054
|
+
__name: "DataTable",
|
|
1055
|
+
props: {
|
|
1056
|
+
/** 列配置:el-table-column 属性 + slotName */
|
|
1057
|
+
propList: {
|
|
1058
|
+
type: Array,
|
|
1059
|
+
default: () => []
|
|
1060
|
+
},
|
|
1061
|
+
/** 表格数据 */
|
|
1062
|
+
dataList: {
|
|
1063
|
+
type: Array,
|
|
1064
|
+
default: () => []
|
|
1065
|
+
},
|
|
1066
|
+
/** 透传给 el-table 的属性 */
|
|
1067
|
+
tableBind: {
|
|
1068
|
+
type: Object,
|
|
1069
|
+
default: () => ({})
|
|
1070
|
+
},
|
|
1071
|
+
/** 行/单元格是否可点击 */
|
|
1072
|
+
canCellClick: {
|
|
1073
|
+
type: Boolean,
|
|
1074
|
+
default: !1
|
|
1075
|
+
},
|
|
1076
|
+
/** 分页:{ page, limit, total } */
|
|
1077
|
+
pagination: {
|
|
1078
|
+
type: Object,
|
|
1079
|
+
default: void 0
|
|
1080
|
+
},
|
|
1081
|
+
pageSizes: {
|
|
1082
|
+
type: Array,
|
|
1083
|
+
default: () => [10, 20, 50, 100]
|
|
1084
|
+
},
|
|
1085
|
+
paginationLayout: {
|
|
1086
|
+
type: String,
|
|
1087
|
+
default: "total, sizes, prev, pager, next, jumper"
|
|
1088
|
+
},
|
|
1089
|
+
showIndex: {
|
|
1090
|
+
type: Boolean,
|
|
1091
|
+
default: !1
|
|
1092
|
+
},
|
|
1093
|
+
indexLabel: {
|
|
1094
|
+
type: String,
|
|
1095
|
+
default: "序号"
|
|
1096
|
+
},
|
|
1097
|
+
indexWidth: {
|
|
1098
|
+
type: [String, Number],
|
|
1099
|
+
default: 64
|
|
1100
|
+
},
|
|
1101
|
+
/**
|
|
1102
|
+
* 撑满父容器高度:表体内部滚动,
|
|
1103
|
+
* 横向滚动条与分页始终贴在可视区域底部
|
|
1104
|
+
*/
|
|
1105
|
+
fillHeight: {
|
|
1106
|
+
type: Boolean,
|
|
1107
|
+
default: !1
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
emits: ["pageChange", "cellClick", "edit", "delete"],
|
|
1111
|
+
setup(e, { emit: n }) {
|
|
1112
|
+
const t = e, r = n, l = {
|
|
1113
|
+
background: "var(--brand-secondary-pale)",
|
|
1114
|
+
color: "var(--brand-text-primary)",
|
|
1115
|
+
fontWeight: 600,
|
|
1116
|
+
fontSize: "13px"
|
|
1117
|
+
}, o = ve(() => ({
|
|
1118
|
+
headerCellStyle: l,
|
|
1119
|
+
...t.tableBind
|
|
1120
|
+
}));
|
|
1121
|
+
function i(d) {
|
|
1122
|
+
const { slotName: h, maxLength: c, ...x } = d || {};
|
|
1123
|
+
return {
|
|
1124
|
+
...x
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
function g(d) {
|
|
1128
|
+
return d == null || d === "" ? "-" : d;
|
|
1129
|
+
}
|
|
1130
|
+
function k(d) {
|
|
1131
|
+
return t.pagination ? (t.pagination.page - 1) * t.pagination.limit + d + 1 : d + 1;
|
|
1132
|
+
}
|
|
1133
|
+
function u(d) {
|
|
1134
|
+
var h;
|
|
1135
|
+
r("pageChange", { page: (h = t.pagination) == null ? void 0 : h.page, limit: d });
|
|
1136
|
+
}
|
|
1137
|
+
function p(d) {
|
|
1138
|
+
var h;
|
|
1139
|
+
r("pageChange", { page: d, limit: (h = t.pagination) == null ? void 0 : h.limit });
|
|
1140
|
+
}
|
|
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();
|
|
1143
|
+
}
|
|
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 }])
|
|
1148
|
+
}, [
|
|
1149
|
+
_("div", Rt, [
|
|
1150
|
+
v(x, me({
|
|
1151
|
+
data: e.dataList,
|
|
1152
|
+
height: e.fillHeight ? "100%" : void 0,
|
|
1153
|
+
class: { "common-pointer-table": e.canCellClick }
|
|
1154
|
+
}, o.value, { onCellClick: w }), {
|
|
1155
|
+
default: S(() => [
|
|
1156
|
+
e.showIndex ? (m(), T(c, {
|
|
1157
|
+
key: 0,
|
|
1158
|
+
type: "index",
|
|
1159
|
+
label: e.indexLabel,
|
|
1160
|
+
width: e.indexWidth,
|
|
1161
|
+
index: k,
|
|
1162
|
+
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 ? {
|
|
1168
|
+
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
|
|
1174
|
+
}, 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
|
|
1179
|
+
}, () => [
|
|
1180
|
+
$(D(g(O[C.prop])), 1)
|
|
1181
|
+
], !0, 3)
|
|
1182
|
+
]),
|
|
1183
|
+
key: "0"
|
|
1184
|
+
} : void 0
|
|
1185
|
+
]), 1040))), 128)),
|
|
1186
|
+
Q(d.$slots, "default", {}, void 0, !0)
|
|
1187
|
+
]),
|
|
1188
|
+
_: 3
|
|
1189
|
+
}, 16, ["data", "height", "class"])
|
|
1190
|
+
]),
|
|
1191
|
+
e.pagination ? (m(), b("div", Pt, [
|
|
1192
|
+
v(M, {
|
|
1193
|
+
background: "",
|
|
1194
|
+
"current-page": e.pagination.page,
|
|
1195
|
+
"page-size": e.pagination.limit,
|
|
1196
|
+
"page-sizes": e.pageSizes,
|
|
1197
|
+
total: e.pagination.total,
|
|
1198
|
+
layout: e.paginationLayout,
|
|
1199
|
+
onSizeChange: u,
|
|
1200
|
+
onCurrentChange: p
|
|
1201
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
|
|
1202
|
+
])) : F("", !0)
|
|
1203
|
+
], 2);
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
}), Bt = /* @__PURE__ */ K(It, [["__scopeId", "data-v-5f80313c"]]), Yt = ["aria-checked", "disabled", "onClick"], jt = {
|
|
1207
|
+
__name: "SegmentedControl",
|
|
1208
|
+
props: {
|
|
1209
|
+
modelValue: { type: [String, Number, Boolean], default: void 0 },
|
|
1210
|
+
/** [{ label, value, disabled? }] */
|
|
1211
|
+
options: { type: Array, default: () => [] }
|
|
1212
|
+
},
|
|
1213
|
+
emits: ["update:modelValue", "change"],
|
|
1214
|
+
setup(e, { emit: n }) {
|
|
1215
|
+
const t = e, r = n, l = L(null), o = L([]), i = L(!1), g = L({
|
|
1216
|
+
width: "0px",
|
|
1217
|
+
transform: "translateX(0px)"
|
|
1218
|
+
});
|
|
1219
|
+
let k = null;
|
|
1220
|
+
function u(d, h) {
|
|
1221
|
+
d && (o.value[h] = d);
|
|
1222
|
+
}
|
|
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)" };
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
const x = d.getBoundingClientRect(), M = c.getBoundingClientRect();
|
|
1232
|
+
g.value = {
|
|
1233
|
+
width: `${M.width}px`,
|
|
1234
|
+
transform: `translateX(${M.left - x.left}px)`
|
|
1235
|
+
}, i.value = !0;
|
|
1236
|
+
}
|
|
1237
|
+
function w(d) {
|
|
1238
|
+
d.disabled || (r("update:modelValue", d.value), r("change", d.value));
|
|
1239
|
+
}
|
|
1240
|
+
return W(
|
|
1241
|
+
() => [t.modelValue, t.options],
|
|
1242
|
+
async () => {
|
|
1243
|
+
await G(), p();
|
|
1244
|
+
},
|
|
1245
|
+
{ 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", {
|
|
1251
|
+
ref_key: "rootRef",
|
|
1252
|
+
ref: l,
|
|
1253
|
+
class: "segmented",
|
|
1254
|
+
role: "radiogroup"
|
|
1255
|
+
}, [
|
|
1256
|
+
_("div", {
|
|
1257
|
+
class: V(["segmented__thumb", { "is-ready": i.value }]),
|
|
1258
|
+
style: X(g.value)
|
|
1259
|
+
}, null, 6),
|
|
1260
|
+
(m(!0), b(P, null, Y(e.options, (c, x) => (m(), b("button", {
|
|
1261
|
+
key: String(c.value),
|
|
1262
|
+
ref_for: !0,
|
|
1263
|
+
ref: (M) => u(M, x),
|
|
1264
|
+
type: "button",
|
|
1265
|
+
class: V(["segmented__item", { "is-active": e.modelValue === c.value }]),
|
|
1266
|
+
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))
|
|
1271
|
+
], 512));
|
|
1272
|
+
}
|
|
1273
|
+
}, zt = /* @__PURE__ */ K(jt, [["__scopeId", "data-v-8bff3e5b"]]);
|
|
1274
|
+
function Kt(e) {
|
|
546
1275
|
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);
|
|
547
1276
|
}
|
|
548
|
-
function
|
|
1277
|
+
function oe(e) {
|
|
549
1278
|
if (e === null || typeof e != "object") return e;
|
|
550
1279
|
if (e instanceof Date) return new Date(e.getTime());
|
|
551
|
-
if (Array.isArray(e)) return e.map((
|
|
552
|
-
const
|
|
553
|
-
return Object.keys(e).forEach((
|
|
554
|
-
t
|
|
555
|
-
}),
|
|
1280
|
+
if (Array.isArray(e)) return e.map((t) => oe(t));
|
|
1281
|
+
const n = {};
|
|
1282
|
+
return Object.keys(e).forEach((t) => {
|
|
1283
|
+
n[t] = oe(e[t]);
|
|
1284
|
+
}), n;
|
|
556
1285
|
}
|
|
557
|
-
function
|
|
558
|
-
let
|
|
559
|
-
return function(...
|
|
560
|
-
|
|
561
|
-
e.apply(this,
|
|
562
|
-
},
|
|
1286
|
+
function qt(e, n = 300) {
|
|
1287
|
+
let t = null;
|
|
1288
|
+
return function(...l) {
|
|
1289
|
+
t && clearTimeout(t), t = setTimeout(() => {
|
|
1290
|
+
e.apply(this, l);
|
|
1291
|
+
}, n);
|
|
563
1292
|
};
|
|
564
1293
|
}
|
|
565
|
-
function
|
|
566
|
-
let
|
|
567
|
-
return function(...
|
|
568
|
-
const
|
|
569
|
-
|
|
1294
|
+
function Wt(e, n = 300) {
|
|
1295
|
+
let t = 0;
|
|
1296
|
+
return function(...l) {
|
|
1297
|
+
const o = Date.now();
|
|
1298
|
+
o - t >= n && (t = o, e.apply(this, l));
|
|
570
1299
|
};
|
|
571
1300
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1301
|
+
function Me(e) {
|
|
1302
|
+
if (e == null || e === "") return null;
|
|
1303
|
+
if (e instanceof Date)
|
|
1304
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
1305
|
+
if (typeof e == "number") {
|
|
1306
|
+
const l = new Date(e);
|
|
1307
|
+
return Number.isNaN(l.getTime()) ? null : l;
|
|
1308
|
+
}
|
|
1309
|
+
const n = String(e).trim();
|
|
1310
|
+
if (!n) return null;
|
|
1311
|
+
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;
|
|
1314
|
+
}
|
|
1315
|
+
if (/[Zz]$|[+-]\d{2}:?\d{2}$/.test(n)) {
|
|
1316
|
+
const l = new Date(n);
|
|
1317
|
+
return Number.isNaN(l.getTime()) ? null : l;
|
|
1318
|
+
}
|
|
1319
|
+
const t = n.match(
|
|
1320
|
+
/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:[\sT]+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,3}))?)?/
|
|
1321
|
+
);
|
|
1322
|
+
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,
|
|
1326
|
+
Number(i),
|
|
1327
|
+
Number(g),
|
|
1328
|
+
Number(k),
|
|
1329
|
+
Number(u),
|
|
1330
|
+
Number(String(p).padEnd(3, "0"))
|
|
1331
|
+
);
|
|
1332
|
+
return Number.isNaN(w.getTime()) ? null : w;
|
|
1333
|
+
}
|
|
1334
|
+
const r = new Date(n);
|
|
1335
|
+
return Number.isNaN(r.getTime()) ? null : r;
|
|
1336
|
+
}
|
|
1337
|
+
function se(e, n = "YYYY-MM-DD HH:mm:ss") {
|
|
1338
|
+
const t = Me(e);
|
|
1339
|
+
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"),
|
|
1344
|
+
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),
|
|
1349
|
+
H: String(i),
|
|
1350
|
+
m: String(g),
|
|
1351
|
+
s: String(k)
|
|
1352
|
+
};
|
|
1353
|
+
return n.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (p) => u[p]);
|
|
1354
|
+
}
|
|
1355
|
+
function Gt() {
|
|
1356
|
+
const e = /* @__PURE__ */ new Date();
|
|
1357
|
+
e.setHours(23, 59, 59, 0);
|
|
1358
|
+
const n = /* @__PURE__ */ new Date();
|
|
1359
|
+
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")
|
|
582
1362
|
};
|
|
583
|
-
return Object.keys(s).reduce((o, i) => o.replace(i, s[i]), t);
|
|
584
1363
|
}
|
|
585
|
-
function
|
|
1364
|
+
function Qt(e) {
|
|
1365
|
+
const n = {};
|
|
1366
|
+
return Object.keys(e || {}).forEach((t) => {
|
|
1367
|
+
const r = e[t];
|
|
1368
|
+
r == null || r === "" || Array.isArray(r) && r.length === 0 || (n[t] = r);
|
|
1369
|
+
}), n;
|
|
1370
|
+
}
|
|
1371
|
+
function Xt(e, n = 2) {
|
|
1372
|
+
if (e == null || e === "") return e;
|
|
1373
|
+
const t = Number(e);
|
|
1374
|
+
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;
|
|
1379
|
+
}
|
|
1380
|
+
function Jt(e = "id") {
|
|
586
1381
|
return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
|
|
587
1382
|
}
|
|
588
|
-
const
|
|
1383
|
+
const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
589
1384
|
__proto__: null,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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
|
|
596
1395
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
597
|
-
function
|
|
1396
|
+
function Zt(e = {}) {
|
|
598
1397
|
const {
|
|
599
|
-
baseURL:
|
|
600
|
-
timeout:
|
|
601
|
-
tokenKey:
|
|
602
|
-
systemIdKey:
|
|
603
|
-
loginUrl:
|
|
604
|
-
} = e,
|
|
605
|
-
let
|
|
606
|
-
function
|
|
607
|
-
typeof localStorage < "u" && localStorage.clear(), !
|
|
608
|
-
typeof window < "u" && window.location.replace(
|
|
1398
|
+
baseURL: n = "",
|
|
1399
|
+
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);
|
|
609
1408
|
}, 1500));
|
|
610
1409
|
}
|
|
611
|
-
return
|
|
612
|
-
(
|
|
613
|
-
if (
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
|
|
1410
|
+
return i.interceptors.request.use(
|
|
1411
|
+
(u) => {
|
|
1412
|
+
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);
|
|
617
1416
|
}
|
|
618
|
-
if (
|
|
619
|
-
const
|
|
620
|
-
|
|
1417
|
+
if (l) {
|
|
1418
|
+
const p = localStorage.getItem(l);
|
|
1419
|
+
p && (u.headers.systemId = p);
|
|
621
1420
|
}
|
|
622
1421
|
}
|
|
623
|
-
return
|
|
624
|
-
},
|
|
625
|
-
(
|
|
626
|
-
),
|
|
627
|
-
(
|
|
628
|
-
if (
|
|
629
|
-
return Promise.reject(new Error(`请求发生错误,状态码 ${
|
|
630
|
-
const { data:
|
|
631
|
-
if (w.responseType === "arraybuffer") return
|
|
632
|
-
if (
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
1422
|
+
return u;
|
|
1423
|
+
},
|
|
1424
|
+
(u) => Promise.reject(u)
|
|
1425
|
+
), i.interceptors.response.use(
|
|
1426
|
+
(u) => {
|
|
1427
|
+
if (u.status !== 200)
|
|
1428
|
+
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) || "请求失败";
|
|
1436
|
+
return Promise.reject(new Error(h));
|
|
1437
|
+
},
|
|
1438
|
+
(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)));
|
|
1445
|
+
}
|
|
1446
|
+
), i;
|
|
1447
|
+
}
|
|
1448
|
+
function be(e) {
|
|
1449
|
+
if (e == null) return "";
|
|
1450
|
+
if (typeof e == "string") return e;
|
|
1451
|
+
if (typeof e != "object") return String(e);
|
|
1452
|
+
const n = [e.message, e.msg, e.data, e.error];
|
|
1453
|
+
for (const t of n)
|
|
1454
|
+
if (!(t == null || t === "") && (typeof t == "string" || typeof t == "number"))
|
|
1455
|
+
return String(t);
|
|
1456
|
+
return "";
|
|
640
1457
|
}
|
|
641
|
-
function
|
|
642
|
-
const
|
|
1458
|
+
function en(e = {}) {
|
|
1459
|
+
const n = Zt(e);
|
|
643
1460
|
return {
|
|
644
|
-
GET(
|
|
645
|
-
return
|
|
1461
|
+
GET(t, r = {}) {
|
|
1462
|
+
return n({ method: "get", url: t, ...r });
|
|
646
1463
|
},
|
|
647
|
-
POST(
|
|
648
|
-
return
|
|
1464
|
+
POST(t, r, l = {}) {
|
|
1465
|
+
return n({ method: "post", url: t, data: r, ...l });
|
|
649
1466
|
},
|
|
650
|
-
DELETE(
|
|
651
|
-
return
|
|
1467
|
+
DELETE(t, r = {}) {
|
|
1468
|
+
return n({ method: "delete", url: t, ...r });
|
|
652
1469
|
}
|
|
653
1470
|
};
|
|
654
1471
|
}
|
|
655
|
-
|
|
656
|
-
function
|
|
657
|
-
|
|
1472
|
+
const De = "__MGACN_COMMONSDK_REQUEST__";
|
|
1473
|
+
function tn(e) {
|
|
1474
|
+
globalThis[De] = e;
|
|
658
1475
|
}
|
|
659
|
-
function
|
|
660
|
-
|
|
1476
|
+
function pn() {
|
|
1477
|
+
const e = globalThis[De];
|
|
1478
|
+
if (!e)
|
|
661
1479
|
throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
|
|
662
|
-
return
|
|
1480
|
+
return e;
|
|
663
1481
|
}
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
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);
|
|
667
1492
|
});
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
},
|
|
671
|
-
install:
|
|
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,
|
|
672
1497
|
version: "1.0.0"
|
|
673
1498
|
};
|
|
674
1499
|
export {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
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
|
|
688
1519
|
};
|