mgacn-commonsdk 1.3.4 → 1.3.6
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/dist/FilePreview-Dx4GAw4K.js +1381 -0
- package/dist/mgacn-admin.js +2 -2
- package/dist/mgacn-commonsdk.js +1091 -984
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/FilePreview-BfYgqJbP.js +0 -877
package/dist/mgacn-commonsdk.js
CHANGED
|
@@ -1,202 +1,58 @@
|
|
|
1
|
-
import { Plus as
|
|
2
|
-
import { ElMessage as G, ElMessageBox as
|
|
1
|
+
import { Plus as ot, Delete as ut, CircleCloseFilled as ct, Document as dt, Close as pt, CircleClose as We, CircleCheck as ft, ArrowUp as ht, ArrowDown as gt } from "@element-plus/icons-vue";
|
|
2
|
+
import { ElMessage as G, ElMessageBox as Ye } from "element-plus";
|
|
3
3
|
import mt from "cropperjs";
|
|
4
|
-
import
|
|
5
|
-
import { g as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
globalThis[We] = String(e || "").replace(/\/$/, "");
|
|
4
|
+
import { _ as Z, k as qe, u as Ge, t as be, l as E, m as ce, n as Je, p as vt, q as yt, r as se, v as _e, w as Ve, x as bt, y as Xe, z as _t, A as wt, B as Qe, F as xt, C as St, D as kt, E as Ut, G as Ct, H as Ft, I as Lt } from "./FilePreview-Dx4GAw4K.js";
|
|
5
|
+
import { i as fl, J as hl, j as gl, c as ml, K as vl, L as yl, M as bl, g as _l, N as wl, O as xl, b as Sl, P as kl, Q as Ul, R as Cl, S as Fl, o as Ll, T as Nl, a as Al, s as Rl, U as $l } from "./FilePreview-Dx4GAw4K.js";
|
|
6
|
+
import { resolveComponent as N, openBlock as d, createElementBlock as m, createElementVNode as b, toDisplayString as T, createCommentVNode as V, createTextVNode as q, Fragment as Q, renderList as te, normalizeStyle as de, normalizeClass as j, createVNode as S, withCtx as F, withModifiers as we, withDirectives as ae, vShow as oe, createBlock as B, mergeProps as Ne, computed as xe, ref as O, watch as ne, onMounted as Se, reactive as Ie, nextTick as J, onBeforeUnmount as Re, withKeys as Oe, unref as ue, renderSlot as ie, createSlots as Nt } from "vue";
|
|
7
|
+
let De = 0;
|
|
8
|
+
function Ze() {
|
|
9
|
+
return De += 1, `mg-img-${Date.now()}-${De}`;
|
|
11
10
|
}
|
|
12
|
-
function
|
|
13
|
-
return globalThis[We] || "";
|
|
14
|
-
}
|
|
15
|
-
function Oe(e) {
|
|
16
|
-
return String(e).padStart(2, "0");
|
|
17
|
-
}
|
|
18
|
-
function Nt() {
|
|
19
|
-
const e = /* @__PURE__ */ new Date();
|
|
20
|
-
return `${e.getFullYear()}${Oe(e.getMonth() + 1)}${Oe(e.getDate())}`;
|
|
21
|
-
}
|
|
22
|
-
function qe(e = 10) {
|
|
23
|
-
const t = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
24
|
-
let n = "";
|
|
25
|
-
for (let a = 0; a < e; a++)
|
|
26
|
-
n += t[Math.floor(Math.random() * t.length)];
|
|
27
|
-
return n;
|
|
28
|
-
}
|
|
29
|
-
function xe(e = "portal_cms") {
|
|
30
|
-
return `${e}/${Nt()}/`;
|
|
31
|
-
}
|
|
32
|
-
function Ge(e) {
|
|
33
|
-
return gt().getOssSts(e);
|
|
34
|
-
}
|
|
35
|
-
function $t(e = {}) {
|
|
36
|
-
const t = e.accessKeyId || e.AccessKeyId || e.accessKeyID || "", n = e.accessKeySecret || e.AccessKeySecret || "", a = e.securityToken || e.SecurityToken || e.stsToken || e.token || "", l = e.bucketName || e.bucket || e.BucketName || "";
|
|
37
|
-
let i = String(e.endPoint || e.endpoint || e.EndPoint || "").replace(/^https?:\/\//i, "").replace(/\/$/, "");
|
|
38
|
-
l && i.startsWith(`${l}.`) && (i = i.slice(l.length + 1));
|
|
39
|
-
const p = e.region || (i.startsWith("oss-") ? i.replace(/\.aliyuncs\.com.*$/i, "") : ""), m = String(e.ossUrl || e.domain || e.cdnDomain || "").replace(/\/$/, ""), _ = l && i ? `https://${l}.${i}` : Ye();
|
|
40
|
-
return {
|
|
41
|
-
accessKeyId: t,
|
|
42
|
-
accessKeySecret: n,
|
|
43
|
-
securityToken: a,
|
|
44
|
-
bucketName: l,
|
|
45
|
-
endPoint: i,
|
|
46
|
-
region: p,
|
|
47
|
-
ossUrl: m || _
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
async function Fe(e = {}) {
|
|
51
|
-
const { dir: t, foldName: n, getOss: a, ossinfo: l } = e, i = t || xe(n || "portal_cms"), p = l || (typeof a == "function" ? await a(i) : await Ge(i)), m = $t(p || {});
|
|
52
|
-
if (!m.accessKeyId || !m.accessKeySecret || !m.bucketName)
|
|
53
|
-
throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:凭证字段不完整");
|
|
54
|
-
if (!m.securityToken)
|
|
55
|
-
throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:缺少 securityToken");
|
|
56
|
-
const _ = {
|
|
57
|
-
bucket: m.bucketName,
|
|
58
|
-
accessKeyId: m.accessKeyId,
|
|
59
|
-
accessKeySecret: m.accessKeySecret,
|
|
60
|
-
stsToken: m.securityToken,
|
|
61
|
-
secure: !0,
|
|
62
|
-
success_action_status: "200"
|
|
63
|
-
};
|
|
64
|
-
m.region && (_.region = m.region), m.endPoint && (_.endpoint = m.endPoint);
|
|
65
|
-
const w = new Ft(_);
|
|
66
|
-
return w.options.ossUrl = m.ossUrl || Ye(), w.options.uploadDir = i, w;
|
|
67
|
-
}
|
|
68
|
-
async function Xe(e = {}) {
|
|
69
|
-
var J, Q;
|
|
70
|
-
const { client: t, file: n, dir: a, foldName: l, fileName: i, onProgress: p } = e;
|
|
71
|
-
if (!n)
|
|
72
|
-
throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
|
|
73
|
-
const m = t || await Fe({ dir: a, foldName: l }), _ = a || m.options.uploadDir || xe(l);
|
|
74
|
-
let w = i;
|
|
75
|
-
if (!w) {
|
|
76
|
-
const z = n.name || "file", g = z.lastIndexOf("."), b = g > -1 ? z.slice(g) : "";
|
|
77
|
-
w = `${_}${qe(10)}${b}`;
|
|
78
|
-
}
|
|
79
|
-
const F = (z) => {
|
|
80
|
-
typeof p == "function" && p(Math.min(100, Math.max(0, Math.floor(Number(z) * 100))));
|
|
81
|
-
}, P = n.size > 1 * 1024 * 1024, f = {
|
|
82
|
-
progress: async (z) => {
|
|
83
|
-
F(z);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
let c;
|
|
87
|
-
const u = async (z) => {
|
|
88
|
-
const g = z ? { "x-oss-object-acl": "public-read" } : void 0;
|
|
89
|
-
return P ? m.multipartUpload(w, n, {
|
|
90
|
-
...f,
|
|
91
|
-
...g ? { headers: g } : {}
|
|
92
|
-
}) : m.put(w, n, {
|
|
93
|
-
...f,
|
|
94
|
-
...g ? { headers: g } : {}
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
try {
|
|
98
|
-
F(0.01), c = await u(!0);
|
|
99
|
-
} catch {
|
|
100
|
-
F(0.01), c = await u(!1);
|
|
101
|
-
}
|
|
102
|
-
const L = ((J = c == null ? void 0 : c.res) == null ? void 0 : J.statusCode) ?? ((Q = c == null ? void 0 : c.res) == null ? void 0 : Q.status);
|
|
103
|
-
if (L && L !== 200)
|
|
104
|
-
throw new Error("[mgacn-commonsdk] 上传失败");
|
|
105
|
-
F(1);
|
|
106
|
-
const M = (m.options.ossUrl || "").replace(/\/$/, ""), H = M ? `${M}/${w}` : w;
|
|
107
|
-
let O = H;
|
|
108
|
-
try {
|
|
109
|
-
O = m.signatureUrl(w, { expires: 3600 * 24 });
|
|
110
|
-
} catch {
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
name: w,
|
|
114
|
-
url: H,
|
|
115
|
-
previewUrl: O,
|
|
116
|
-
raw: c,
|
|
117
|
-
client: m
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function Mt(e = "", t = "") {
|
|
121
|
-
const n = String(e || "").trim();
|
|
122
|
-
if (!n) return "";
|
|
123
|
-
if (!/^https?:\/\//i.test(n)) return n.replace(/^\//, "");
|
|
124
|
-
try {
|
|
125
|
-
const a = new URL(n);
|
|
126
|
-
let l = decodeURIComponent(a.pathname.replace(/^\//, ""));
|
|
127
|
-
if (t) {
|
|
128
|
-
const i = String(t).replace(/\/$/, "");
|
|
129
|
-
n.startsWith(`${i}/`) && (l = decodeURIComponent(n.slice(i.length + 1).split("?")[0]));
|
|
130
|
-
}
|
|
131
|
-
return l.split("?")[0];
|
|
132
|
-
} catch {
|
|
133
|
-
return "";
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async function Rt(e, t = {}) {
|
|
137
|
-
const n = t.client || await Fe(t), a = Mt(e, n.options.ossUrl);
|
|
138
|
-
if (!a) return e;
|
|
139
|
-
try {
|
|
140
|
-
return n.signatureUrl(a, { expires: t.expires || 3600 * 24 });
|
|
141
|
-
} catch {
|
|
142
|
-
return e;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const Je = {
|
|
146
|
-
methods: {
|
|
147
|
-
getDir() {
|
|
148
|
-
return xe(this.foldName || "portal_cms");
|
|
149
|
-
},
|
|
150
|
-
randomString: qe,
|
|
151
|
-
getOss() {
|
|
152
|
-
return Ge(this.getDir());
|
|
153
|
-
},
|
|
154
|
-
async createOssClient() {
|
|
155
|
-
return Fe({
|
|
156
|
-
dir: this.getDir(),
|
|
157
|
-
getOss: () => this.getOss()
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
let Ve = 0;
|
|
163
|
-
function Qe() {
|
|
164
|
-
return Ve += 1, `mg-img-${Date.now()}-${Ve}`;
|
|
165
|
-
}
|
|
166
|
-
function Pt(e) {
|
|
11
|
+
function At(e) {
|
|
167
12
|
return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
|
|
168
13
|
}
|
|
169
|
-
function
|
|
170
|
-
return e.map((
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
14
|
+
function Ee(e, t = "private") {
|
|
15
|
+
return e.map((n) => {
|
|
16
|
+
const l = String(n || "").trim();
|
|
17
|
+
if (!l) return null;
|
|
18
|
+
const r = be(l, { bucketKind: t });
|
|
19
|
+
return r ? {
|
|
20
|
+
uid: Ze(),
|
|
21
|
+
url: r,
|
|
22
|
+
status: "success",
|
|
23
|
+
percent: 100,
|
|
24
|
+
previewUrl: E(l) ? l : ""
|
|
25
|
+
} : null;
|
|
26
|
+
}).filter(Boolean);
|
|
177
27
|
}
|
|
178
28
|
function ge(e = "") {
|
|
179
29
|
return String(e).startsWith("blob:");
|
|
180
30
|
}
|
|
181
|
-
function
|
|
182
|
-
return
|
|
31
|
+
function Rt(e = "") {
|
|
32
|
+
return vt(e);
|
|
183
33
|
}
|
|
184
|
-
function
|
|
34
|
+
function $t(e = "") {
|
|
185
35
|
const t = e.lastIndexOf(".");
|
|
186
36
|
return t > -1 ? e.slice(t + 1).toLowerCase() : "";
|
|
187
37
|
}
|
|
188
|
-
const
|
|
38
|
+
const Mt = {
|
|
189
39
|
name: "MgImageUpload",
|
|
190
|
-
mixins: [
|
|
191
|
-
components: { CircleCloseFilled:
|
|
40
|
+
mixins: [qe],
|
|
41
|
+
components: { CircleCloseFilled: ct, Delete: ut, Plus: ot },
|
|
192
42
|
props: {
|
|
193
|
-
/** v-model 统一为 string[]
|
|
43
|
+
/** v-model 统一为 string[](存 object key;公共读可为永久 URL);入参兼容 string / string[] */
|
|
194
44
|
modelValue: { type: [Array, String], default: () => [] },
|
|
195
45
|
greyTips: String,
|
|
196
46
|
otherTips: String,
|
|
197
47
|
maxFileSize: { type: Number, default: 100 },
|
|
198
48
|
fileNum: { type: Number, default: 1 },
|
|
199
49
|
initFileList: { type: Array, default: () => [] },
|
|
50
|
+
/** private(默认)| public(富文本配图) */
|
|
51
|
+
bucketKind: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "private",
|
|
54
|
+
validator: (e) => ["private", "public"].includes(e)
|
|
55
|
+
},
|
|
200
56
|
isCropper: Boolean,
|
|
201
57
|
isDegree: Boolean,
|
|
202
58
|
degree: { type: Number, default: 3 },
|
|
@@ -239,7 +95,7 @@ const Dt = {
|
|
|
239
95
|
return this.accept.split(",").map((e) => e.replace(".", "").trim().toLowerCase()).filter(Boolean);
|
|
240
96
|
},
|
|
241
97
|
successUrls() {
|
|
242
|
-
return this.fileList.filter((e) => e.status === "success").map((e) => e.url);
|
|
98
|
+
return this.fileList.filter((e) => e.status === "success" && e.url).map((e) => be(e.url, { bucketKind: this.bucketKind })).filter(Boolean);
|
|
243
99
|
}
|
|
244
100
|
},
|
|
245
101
|
watch: {
|
|
@@ -253,24 +109,24 @@ const Dt = {
|
|
|
253
109
|
deep: !0,
|
|
254
110
|
immediate: !0,
|
|
255
111
|
handler(e) {
|
|
256
|
-
e != null && e.length && (this.replaceList(
|
|
112
|
+
e != null && e.length && (this.replaceList(Ee(e, this.bucketKind)), this.ensureSignedPreviews());
|
|
257
113
|
}
|
|
258
114
|
},
|
|
259
115
|
modelValue: {
|
|
260
116
|
immediate: !0,
|
|
261
117
|
handler(e) {
|
|
262
|
-
var
|
|
263
|
-
if ((
|
|
264
|
-
const t =
|
|
265
|
-
if (
|
|
118
|
+
var U;
|
|
119
|
+
if ((U = this.initFileList) != null && U.length) return;
|
|
120
|
+
const t = At(e), n = t.map((h) => be(h, { bucketKind: this.bucketKind })).filter(Boolean), l = this.successUrls;
|
|
121
|
+
if (n.length === l.length && n.every((h, C) => h === l[C]))
|
|
266
122
|
return;
|
|
267
|
-
const
|
|
268
|
-
this.fileList.map((
|
|
269
|
-
),
|
|
270
|
-
...
|
|
271
|
-
previewUrl:
|
|
123
|
+
const r = new Map(
|
|
124
|
+
this.fileList.map((h) => [h.url, h.previewUrl]).filter(([h]) => h)
|
|
125
|
+
), a = Ee(t, this.bucketKind).map((h) => ({
|
|
126
|
+
...h,
|
|
127
|
+
previewUrl: h.previewUrl || r.get(h.url) || ""
|
|
272
128
|
}));
|
|
273
|
-
this.replaceList(
|
|
129
|
+
this.replaceList(a), t.some((h, C) => String(h || "").trim() !== (n[C] || "")) && this.$nextTick(() => this.emitFile()), this.ensureSignedPreviews();
|
|
274
130
|
}
|
|
275
131
|
},
|
|
276
132
|
cropImageUrl(e) {
|
|
@@ -299,28 +155,32 @@ const Dt = {
|
|
|
299
155
|
ge(e.previewUrl) && URL.revokeObjectURL(e.previewUrl);
|
|
300
156
|
});
|
|
301
157
|
},
|
|
302
|
-
/**
|
|
158
|
+
/** 私有桶回显:仅 key、无签名预览时走平台批量续签(禁止依赖 STS GetObject) */
|
|
303
159
|
async ensureSignedPreviews() {
|
|
304
160
|
const e = this.fileList.filter(
|
|
305
|
-
(t) => t.status === "success" && t.url && !ge(t.previewUrl) && !
|
|
161
|
+
(t) => t.status === "success" && t.url && !ge(t.previewUrl) && !E(t.previewUrl || "") && !Rt(t.previewUrl || t.url)
|
|
306
162
|
);
|
|
307
163
|
if (e.length)
|
|
308
164
|
try {
|
|
309
|
-
const t =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
);
|
|
165
|
+
const t = e.map((a) => ce(a.url)).filter(Boolean);
|
|
166
|
+
if (!t.length) return;
|
|
167
|
+
const n = await Je({ keys: t.slice(0, 50) }), l = Array.isArray(n == null ? void 0 : n.items) ? n.items : [], r = Object.fromEntries(l.map((a) => [a.key, a.url]));
|
|
168
|
+
e.forEach((a) => {
|
|
169
|
+
const u = ce(a.url);
|
|
170
|
+
r[u] && (a.previewUrl = r[u]);
|
|
171
|
+
});
|
|
316
172
|
} catch (t) {
|
|
317
|
-
console.warn("[MgImageUpload]
|
|
173
|
+
console.warn("[MgImageUpload] 批量续签预览失败", t);
|
|
318
174
|
}
|
|
319
175
|
},
|
|
320
176
|
emitFile() {
|
|
321
177
|
const e = [...this.successUrls];
|
|
322
178
|
this.$emit("update:modelValue", e), this.$emit("sendFile", e);
|
|
323
179
|
},
|
|
180
|
+
/** 规范化单条入库地址(私有→key,公共读永久 URL 保留) */
|
|
181
|
+
toSaveUrl(e) {
|
|
182
|
+
return be(e, { bucketKind: this.bucketKind });
|
|
183
|
+
},
|
|
324
184
|
openFilePicker() {
|
|
325
185
|
const e = this.$refs.fileInput;
|
|
326
186
|
e && (e.value = "", e.click());
|
|
@@ -355,18 +215,18 @@ const Dt = {
|
|
|
355
215
|
onFileChange(e) {
|
|
356
216
|
const t = [...e.target.files || []];
|
|
357
217
|
if (!t.length) return;
|
|
358
|
-
const n = this.dialogVisible || this.isCropper,
|
|
359
|
-
if (!n && t.length >
|
|
218
|
+
const n = this.dialogVisible || this.isCropper, l = this.fileNum - this.fileList.length;
|
|
219
|
+
if (!n && t.length > l) {
|
|
360
220
|
G.error(`文件数量不超过${this.fileNum}个`);
|
|
361
221
|
return;
|
|
362
222
|
}
|
|
363
|
-
const
|
|
364
|
-
if (t.forEach((
|
|
365
|
-
this.acceptList.includes(
|
|
366
|
-
}),
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
`已过滤以下 ${
|
|
223
|
+
const r = [], a = [];
|
|
224
|
+
if (t.forEach((u) => {
|
|
225
|
+
this.acceptList.includes($t(u.name)) ? r.push(u) : a.push(u);
|
|
226
|
+
}), a.length) {
|
|
227
|
+
const u = a.map((U) => U.name).join(",");
|
|
228
|
+
Ye.confirm(
|
|
229
|
+
`已过滤以下 ${a.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${u}</p><br/>只接受:${this.acceptList.join("/")}`,
|
|
370
230
|
"提示",
|
|
371
231
|
{
|
|
372
232
|
confirmButtonText: "确认",
|
|
@@ -377,22 +237,22 @@ const Dt = {
|
|
|
377
237
|
).catch(() => {
|
|
378
238
|
});
|
|
379
239
|
}
|
|
380
|
-
if (
|
|
240
|
+
if (r.length) {
|
|
381
241
|
if (this.isCropper) {
|
|
382
|
-
this.openCropper(
|
|
242
|
+
this.openCropper(r[0]);
|
|
383
243
|
return;
|
|
384
244
|
}
|
|
385
|
-
this.startUpload(
|
|
245
|
+
this.startUpload(r);
|
|
386
246
|
}
|
|
387
247
|
},
|
|
388
248
|
openCropper(e) {
|
|
389
249
|
const t = new FileReader();
|
|
390
250
|
t.onloadend = (n) => {
|
|
391
|
-
const
|
|
392
|
-
this.cropImageUrl =
|
|
251
|
+
const l = n.target.result;
|
|
252
|
+
this.cropImageUrl = l, this.dialogVisible = !0, this.$nextTick(() => {
|
|
393
253
|
requestAnimationFrame(() => {
|
|
394
254
|
if (this.cropper) {
|
|
395
|
-
this.cropper.replace(
|
|
255
|
+
this.cropper.replace(l);
|
|
396
256
|
return;
|
|
397
257
|
}
|
|
398
258
|
this.initCropper();
|
|
@@ -404,38 +264,46 @@ const Dt = {
|
|
|
404
264
|
startUpload(e) {
|
|
405
265
|
(this.resetFilelist || this.fileNum === 1) && this.replaceList([]);
|
|
406
266
|
const t = this.maxFileSize * 1024 * 1024, n = [];
|
|
407
|
-
return e.forEach((
|
|
408
|
-
if (
|
|
409
|
-
G.error(`「${
|
|
267
|
+
return e.forEach((l) => {
|
|
268
|
+
if (l.size > t) {
|
|
269
|
+
G.error(`「${l.name}」超出 ${this.maxFileSize}MB 限制`);
|
|
410
270
|
return;
|
|
411
271
|
}
|
|
412
|
-
const
|
|
413
|
-
uid:
|
|
414
|
-
url:
|
|
415
|
-
previewUrl:
|
|
272
|
+
const r = URL.createObjectURL(l), a = {
|
|
273
|
+
uid: Ze(),
|
|
274
|
+
url: r,
|
|
275
|
+
previewUrl: r,
|
|
416
276
|
status: "uploading",
|
|
417
277
|
percent: 0,
|
|
418
|
-
raw:
|
|
278
|
+
raw: l
|
|
419
279
|
};
|
|
420
|
-
this.fileList.push(
|
|
280
|
+
this.fileList.push(a);
|
|
281
|
+
const u = this.fileList[this.fileList.length - 1];
|
|
282
|
+
n.push(this.uploadOne(u));
|
|
421
283
|
}), Promise.all(n);
|
|
422
284
|
},
|
|
423
285
|
async uploadOne(e) {
|
|
424
|
-
const t = e.previewUrl, n = (
|
|
425
|
-
const
|
|
426
|
-
e.percent =
|
|
286
|
+
const t = e.previewUrl, n = (l) => {
|
|
287
|
+
const r = Math.min(100, Math.max(0, Math.round(Number(l) || 0)));
|
|
288
|
+
e.percent = r, this.$emit("progress", r, e.raw);
|
|
427
289
|
};
|
|
428
290
|
this.activeUploadCount += 1, this.$emit("update:uploading", !0);
|
|
429
291
|
try {
|
|
430
292
|
n(0);
|
|
431
|
-
const
|
|
293
|
+
const l = await Ge({
|
|
432
294
|
file: e.raw,
|
|
433
295
|
dir: this.getDir(),
|
|
296
|
+
bucketKind: this.bucketKind,
|
|
434
297
|
onProgress: n
|
|
435
298
|
});
|
|
436
|
-
e.url =
|
|
437
|
-
|
|
438
|
-
|
|
299
|
+
if (e.url = this.toSaveUrl(l.key || l.url) || l.key || l.url, e.previewUrl = l.previewUrl || "", ge(t))
|
|
300
|
+
try {
|
|
301
|
+
URL.revokeObjectURL(t);
|
|
302
|
+
} catch {
|
|
303
|
+
}
|
|
304
|
+
e.status = "success", n(100), e.raw = null, this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", { ...l, url: e.url }, e);
|
|
305
|
+
} catch (l) {
|
|
306
|
+
e.status = "fail", n(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), G.error((l == null ? void 0 : l.message) || "上传失败"), this.$emit("error", l, e);
|
|
439
307
|
}
|
|
440
308
|
},
|
|
441
309
|
initCropper() {
|
|
@@ -472,9 +340,9 @@ const Dt = {
|
|
|
472
340
|
this.handleBack(), this.$nextTick(() => this.startUpload([t]));
|
|
473
341
|
},
|
|
474
342
|
base64ToFile(e) {
|
|
475
|
-
const [t, n] = e.split(","),
|
|
476
|
-
for (let
|
|
477
|
-
return new File([
|
|
343
|
+
const [t, n] = e.split(","), l = t.match(/:(.*?);/)[1], r = l.split("/")[1], a = atob(n), u = new Uint8Array(a.length);
|
|
344
|
+
for (let U = 0; U < a.length; U++) u[U] = a.charCodeAt(U);
|
|
345
|
+
return new File([u], `${Date.now()}.${r}`, { type: l });
|
|
478
346
|
},
|
|
479
347
|
handleBack() {
|
|
480
348
|
this.cropImageUrl = "", this.dialogVisible = !1;
|
|
@@ -484,245 +352,263 @@ const Dt = {
|
|
|
484
352
|
!t || t.status === "uploading" || (this.revokePreview(t), this.fileList.splice(e, 1), this.emitFile());
|
|
485
353
|
}
|
|
486
354
|
}
|
|
487
|
-
},
|
|
355
|
+
}, Tt = { class: "upload-image-cropper" }, Pt = ["multiple", "accept"], Bt = {
|
|
488
356
|
key: 0,
|
|
489
357
|
class: "grey-tips"
|
|
490
|
-
},
|
|
358
|
+
}, Vt = { key: 0 }, It = { class: "list-box" }, Ot = {
|
|
491
359
|
key: 0,
|
|
492
360
|
class: "status-mask is-uploading"
|
|
493
|
-
},
|
|
361
|
+
}, Dt = { class: "progress-wrap" }, Et = { class: "percent-text" }, Ht = {
|
|
494
362
|
key: 1,
|
|
495
363
|
class: "status-mask is-fail"
|
|
496
|
-
},
|
|
364
|
+
}, zt = ["onClick"], Kt = { class: "cropper-box" }, jt = ["src"], Wt = {
|
|
497
365
|
key: 0,
|
|
498
366
|
class: "cropper-placeholder"
|
|
499
|
-
},
|
|
367
|
+
}, Yt = {
|
|
500
368
|
key: 0,
|
|
501
369
|
class: "btn-box btn-box--rotate"
|
|
502
|
-
},
|
|
503
|
-
function
|
|
504
|
-
const
|
|
505
|
-
return d(),
|
|
506
|
-
|
|
370
|
+
}, qt = { class: "btn-box" };
|
|
371
|
+
function Gt(e, t, n, l, r, a) {
|
|
372
|
+
const u = N("el-image"), U = N("el-progress"), h = N("CircleCloseFilled"), C = N("el-icon"), L = N("Delete"), P = N("Plus"), c = N("el-button"), _ = N("el-dialog");
|
|
373
|
+
return d(), m("div", Tt, [
|
|
374
|
+
b("input", {
|
|
507
375
|
ref: "fileInput",
|
|
508
376
|
type: "file",
|
|
509
377
|
class: "file-input",
|
|
510
|
-
multiple:
|
|
378
|
+
multiple: a.multiple,
|
|
511
379
|
accept: n.accept,
|
|
512
|
-
onChange: t[0] || (t[0] = (...
|
|
513
|
-
}, null, 40,
|
|
514
|
-
n.greyTips ? (d(),
|
|
515
|
-
n.otherTips ? (d(),
|
|
516
|
-
q(" " +
|
|
380
|
+
onChange: t[0] || (t[0] = (...p) => a.onFileChange && a.onFileChange(...p))
|
|
381
|
+
}, null, 40, Pt),
|
|
382
|
+
n.greyTips ? (d(), m("div", Bt, [
|
|
383
|
+
n.otherTips ? (d(), m("div", Vt, T(n.otherTips), 1)) : V("", !0),
|
|
384
|
+
q(" " + T(n.greyTips), 1)
|
|
517
385
|
])) : V("", !0),
|
|
518
|
-
|
|
519
|
-
(d(!0),
|
|
520
|
-
key:
|
|
521
|
-
class:
|
|
522
|
-
style:
|
|
386
|
+
b("div", It, [
|
|
387
|
+
(d(!0), m(Q, null, te(r.fileList, (p, A) => (d(), m("div", {
|
|
388
|
+
key: p.uid,
|
|
389
|
+
class: j(["image-box", [`is-${p.status}`]]),
|
|
390
|
+
style: de(n.imageStyle)
|
|
523
391
|
}, [
|
|
524
|
-
S(
|
|
525
|
-
src:
|
|
392
|
+
S(u, {
|
|
393
|
+
src: p.previewUrl || p.url,
|
|
526
394
|
fit: "cover",
|
|
527
395
|
class: "img"
|
|
528
396
|
}, null, 8, ["src"]),
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
S(
|
|
397
|
+
p.status === "uploading" ? (d(), m("div", Ot, [
|
|
398
|
+
b("div", Dt, [
|
|
399
|
+
S(U, {
|
|
532
400
|
type: "circle",
|
|
533
|
-
percentage:
|
|
401
|
+
percentage: p.percent,
|
|
534
402
|
width: 30,
|
|
535
403
|
"stroke-width": 3,
|
|
536
404
|
"show-text": !1,
|
|
537
405
|
color: "var(--mg-primary, #ff5722)"
|
|
538
406
|
}, null, 8, ["percentage"]),
|
|
539
|
-
|
|
407
|
+
b("span", Et, T(p.percent) + "%", 1)
|
|
540
408
|
])
|
|
541
|
-
])) :
|
|
542
|
-
S(
|
|
409
|
+
])) : p.status === "fail" ? (d(), m("div", Ht, [
|
|
410
|
+
S(C, {
|
|
543
411
|
class: "fail-icon",
|
|
544
412
|
size: 16
|
|
545
413
|
}, {
|
|
546
|
-
default:
|
|
547
|
-
S(
|
|
414
|
+
default: F(() => [
|
|
415
|
+
S(h)
|
|
548
416
|
]),
|
|
549
417
|
_: 1
|
|
550
418
|
}),
|
|
551
|
-
t[5] || (t[5] =
|
|
552
|
-
S(
|
|
419
|
+
t[5] || (t[5] = b("span", { class: "fail-text" }, "失败", -1)),
|
|
420
|
+
S(C, {
|
|
553
421
|
class: "remove-icon",
|
|
554
422
|
size: 14,
|
|
555
423
|
title: "删除",
|
|
556
|
-
onClick:
|
|
424
|
+
onClick: we(($) => a.removeImg(A), ["stop"])
|
|
557
425
|
}, {
|
|
558
|
-
default:
|
|
559
|
-
S(
|
|
426
|
+
default: F(() => [
|
|
427
|
+
S(L)
|
|
560
428
|
]),
|
|
561
429
|
_: 1
|
|
562
430
|
}, 8, ["onClick"])
|
|
563
|
-
])) : (d(),
|
|
431
|
+
])) : (d(), m("div", {
|
|
564
432
|
key: 2,
|
|
565
433
|
class: "status-mask is-success",
|
|
566
|
-
onClick: (
|
|
434
|
+
onClick: ($) => a.removeImg(A)
|
|
567
435
|
}, [
|
|
568
|
-
S(
|
|
436
|
+
S(C, {
|
|
569
437
|
class: "remove-icon",
|
|
570
438
|
size: 16
|
|
571
439
|
}, {
|
|
572
|
-
default:
|
|
573
|
-
S(
|
|
440
|
+
default: F(() => [
|
|
441
|
+
S(L)
|
|
574
442
|
]),
|
|
575
443
|
_: 1
|
|
576
444
|
})
|
|
577
|
-
], 8,
|
|
445
|
+
], 8, zt))
|
|
578
446
|
], 6))), 128)),
|
|
579
|
-
|
|
447
|
+
ae(b("div", {
|
|
580
448
|
class: "image-box upload-btn",
|
|
581
|
-
style:
|
|
582
|
-
onClick: t[1] || (t[1] = (...
|
|
449
|
+
style: de(n.imageStyle),
|
|
450
|
+
onClick: t[1] || (t[1] = (...p) => a.handleUpload && a.handleUpload(...p))
|
|
583
451
|
}, [
|
|
584
|
-
S(
|
|
452
|
+
S(C, {
|
|
585
453
|
class: "icon",
|
|
586
454
|
size: 14
|
|
587
455
|
}, {
|
|
588
|
-
default:
|
|
456
|
+
default: F(() => [
|
|
589
457
|
S(P)
|
|
590
458
|
]),
|
|
591
459
|
_: 1
|
|
592
460
|
}),
|
|
593
|
-
t[6] || (t[6] =
|
|
461
|
+
t[6] || (t[6] = b("div", null, "上传图片", -1))
|
|
594
462
|
], 4), [
|
|
595
|
-
[
|
|
463
|
+
[oe, a.showUploadBtn]
|
|
596
464
|
])
|
|
597
465
|
]),
|
|
598
|
-
S(
|
|
599
|
-
modelValue:
|
|
600
|
-
"onUpdate:modelValue": t[4] || (t[4] = (
|
|
466
|
+
S(_, {
|
|
467
|
+
modelValue: r.dialogVisible,
|
|
468
|
+
"onUpdate:modelValue": t[4] || (t[4] = (p) => r.dialogVisible = p),
|
|
601
469
|
title: "裁剪图片",
|
|
602
470
|
width: "650px",
|
|
603
471
|
top: "5vh",
|
|
604
472
|
"append-to-body": "",
|
|
605
473
|
class: "mg-image-upload-dialog",
|
|
606
474
|
"close-on-click-modal": !1,
|
|
607
|
-
onClose:
|
|
475
|
+
onClose: a.handleBack
|
|
608
476
|
}, {
|
|
609
|
-
footer:
|
|
610
|
-
n.isDegree ? (d(),
|
|
611
|
-
S(
|
|
612
|
-
onClick: t[2] || (t[2] = (
|
|
477
|
+
footer: F(() => [
|
|
478
|
+
n.isDegree ? (d(), m("div", Yt, [
|
|
479
|
+
S(c, {
|
|
480
|
+
onClick: t[2] || (t[2] = (p) => a.rotate(-n.degree))
|
|
613
481
|
}, {
|
|
614
|
-
default:
|
|
482
|
+
default: F(() => [...t[7] || (t[7] = [
|
|
615
483
|
q("向左旋转", -1)
|
|
616
484
|
])]),
|
|
617
485
|
_: 1
|
|
618
486
|
}),
|
|
619
|
-
S(
|
|
620
|
-
onClick: t[3] || (t[3] = (
|
|
487
|
+
S(c, {
|
|
488
|
+
onClick: t[3] || (t[3] = (p) => a.rotate(n.degree))
|
|
621
489
|
}, {
|
|
622
|
-
default:
|
|
490
|
+
default: F(() => [...t[8] || (t[8] = [
|
|
623
491
|
q("向右旋转", -1)
|
|
624
492
|
])]),
|
|
625
493
|
_: 1
|
|
626
494
|
})
|
|
627
495
|
])) : V("", !0),
|
|
628
|
-
|
|
629
|
-
S(
|
|
496
|
+
b("div", qt, [
|
|
497
|
+
S(c, {
|
|
630
498
|
type: "primary",
|
|
631
|
-
onClick:
|
|
499
|
+
onClick: a.openFilePicker
|
|
632
500
|
}, {
|
|
633
|
-
default:
|
|
634
|
-
q(
|
|
501
|
+
default: F(() => [
|
|
502
|
+
q(T(r.cropImageUrl ? "重新上传" : "点击上传"), 1)
|
|
635
503
|
]),
|
|
636
504
|
_: 1
|
|
637
505
|
}, 8, ["onClick"]),
|
|
638
|
-
S(
|
|
506
|
+
S(c, {
|
|
639
507
|
type: "primary",
|
|
640
|
-
onClick:
|
|
508
|
+
onClick: a.confirmCrop
|
|
641
509
|
}, {
|
|
642
|
-
default:
|
|
510
|
+
default: F(() => [...t[9] || (t[9] = [
|
|
643
511
|
q("确定", -1)
|
|
644
512
|
])]),
|
|
645
513
|
_: 1
|
|
646
514
|
}, 8, ["onClick"])
|
|
647
515
|
])
|
|
648
516
|
]),
|
|
649
|
-
default:
|
|
650
|
-
|
|
651
|
-
|
|
517
|
+
default: F(() => [
|
|
518
|
+
b("div", Kt, [
|
|
519
|
+
ae(b("img", {
|
|
652
520
|
ref: "cropImage",
|
|
653
|
-
src:
|
|
521
|
+
src: r.cropImageUrl,
|
|
654
522
|
class: "cropper-img"
|
|
655
|
-
}, null, 8,
|
|
656
|
-
[
|
|
523
|
+
}, null, 8, jt), [
|
|
524
|
+
[oe, r.cropImageUrl]
|
|
657
525
|
]),
|
|
658
|
-
|
|
526
|
+
r.cropImageUrl ? V("", !0) : (d(), m("div", Wt, "请选择图片后进行裁剪"))
|
|
659
527
|
])
|
|
660
528
|
]),
|
|
661
529
|
_: 1
|
|
662
530
|
}, 8, ["modelValue", "onClose"])
|
|
663
531
|
]);
|
|
664
532
|
}
|
|
665
|
-
const
|
|
666
|
-
let
|
|
667
|
-
function
|
|
668
|
-
return
|
|
533
|
+
const Jt = /* @__PURE__ */ Z(Mt, [["render", Gt], ["__scopeId", "data-v-7df361ca"]]), Xt = ".mp4,.mov,.jpg,.jpeg,.m3u8,.png,.m4v,.doc,.docx,.xls,.xlsx,.pdf";
|
|
534
|
+
let He = 0;
|
|
535
|
+
function $e() {
|
|
536
|
+
return He += 1, `mg-file-${Date.now()}-${He}`;
|
|
669
537
|
}
|
|
670
|
-
function
|
|
538
|
+
function Qt(e) {
|
|
671
539
|
return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
|
|
672
540
|
}
|
|
673
|
-
function
|
|
541
|
+
function Zt(e) {
|
|
674
542
|
return Array.isArray(e) ? e.map((t) => {
|
|
675
|
-
|
|
676
|
-
if (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}).filter(Boolean) : [];
|
|
543
|
+
const n = _e(t);
|
|
544
|
+
if (!n) return null;
|
|
545
|
+
const l = t && typeof t == "object" ? String(t.previewSrc || t.previewUrl || t.fileUrl || t.url || "").trim() : typeof t == "string" ? t.trim() : "", r = E(l) ? l : "";
|
|
546
|
+
return {
|
|
547
|
+
...n,
|
|
548
|
+
previewSrc: r
|
|
549
|
+
};
|
|
550
|
+
}).filter((t) => t == null ? void 0 : t.fileUrl) : [];
|
|
684
551
|
}
|
|
685
|
-
function
|
|
686
|
-
return e.length !== t.length ? !1 : e.every((n,
|
|
687
|
-
const
|
|
688
|
-
return n.fileUrl ===
|
|
552
|
+
function en(e = [], t = []) {
|
|
553
|
+
return e.length !== t.length ? !1 : e.every((n, l) => {
|
|
554
|
+
const r = t[l];
|
|
555
|
+
return n.fileUrl === r.fileUrl && n.fileName === r.fileName;
|
|
689
556
|
});
|
|
690
557
|
}
|
|
691
|
-
function
|
|
558
|
+
function Ae(e = "") {
|
|
692
559
|
try {
|
|
693
560
|
return decodeURIComponent(String(e).split("?")[0]).split("/").filter(Boolean).pop() || "file";
|
|
694
561
|
} catch {
|
|
695
562
|
return "file";
|
|
696
563
|
}
|
|
697
564
|
}
|
|
698
|
-
function
|
|
699
|
-
return e.map((t) =>
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
565
|
+
function ze(e) {
|
|
566
|
+
return e.map((t) => {
|
|
567
|
+
const n = ce(t) || t;
|
|
568
|
+
return {
|
|
569
|
+
uid: $e(),
|
|
570
|
+
name: Ae(t),
|
|
571
|
+
url: n,
|
|
572
|
+
previewSrc: E(t) ? t : "",
|
|
573
|
+
status: "success",
|
|
574
|
+
percent: 100,
|
|
575
|
+
raw: null
|
|
576
|
+
};
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
function tn(e = []) {
|
|
580
|
+
return e.map((t) => {
|
|
581
|
+
const n = _e(t);
|
|
582
|
+
if (!n) return null;
|
|
583
|
+
const l = t && typeof t == "object" && (t.previewSrc || t.fileUrl || t.url) || "";
|
|
584
|
+
return {
|
|
585
|
+
uid: $e(),
|
|
586
|
+
id: n.id,
|
|
587
|
+
name: n.fileName,
|
|
588
|
+
url: n.fileUrl,
|
|
589
|
+
previewSrc: E(String(l)) ? String(l) : "",
|
|
590
|
+
status: "success",
|
|
591
|
+
percent: 100,
|
|
592
|
+
raw: null
|
|
593
|
+
};
|
|
594
|
+
}).filter(Boolean);
|
|
707
595
|
}
|
|
708
|
-
function
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
raw: null
|
|
716
|
-
}));
|
|
596
|
+
function Ke(e) {
|
|
597
|
+
const t = (e == null ? void 0 : e.previewSrc) || "";
|
|
598
|
+
if (t.startsWith("blob:"))
|
|
599
|
+
try {
|
|
600
|
+
URL.revokeObjectURL(t);
|
|
601
|
+
} catch {
|
|
602
|
+
}
|
|
717
603
|
}
|
|
718
|
-
function
|
|
604
|
+
function nn(e = "") {
|
|
719
605
|
const t = e.lastIndexOf(".");
|
|
720
606
|
return t > -1 ? e.slice(t + 1).toLowerCase() : "";
|
|
721
607
|
}
|
|
722
|
-
const
|
|
608
|
+
const ln = {
|
|
723
609
|
name: "MgFileUpload",
|
|
724
|
-
mixins: [
|
|
725
|
-
components: { CircleCheck:
|
|
610
|
+
mixins: [qe],
|
|
611
|
+
components: { CircleCheck: ft, CircleClose: We, Close: pt, Document: dt },
|
|
726
612
|
props: {
|
|
727
613
|
/** v-model:valueFormat=url 时为 string[];valueFormat=file 时为 { fileName, fileUrl }[] */
|
|
728
614
|
modelValue: { type: [Array, String], default: () => [] },
|
|
@@ -741,8 +627,14 @@ const rn = {
|
|
|
741
627
|
initFileList: { type: Array, default: () => [] },
|
|
742
628
|
/** 选满后是否清空再传 */
|
|
743
629
|
resetFilelist: Boolean,
|
|
744
|
-
accept: { type: String, default:
|
|
630
|
+
accept: { type: String, default: Xt },
|
|
745
631
|
foldName: { type: String, default: "portal_cms" },
|
|
632
|
+
/** private(默认)| public(仅富文本配图等) */
|
|
633
|
+
bucketKind: {
|
|
634
|
+
type: String,
|
|
635
|
+
default: "private",
|
|
636
|
+
validator: (e) => ["private", "public"].includes(e)
|
|
637
|
+
},
|
|
746
638
|
disabled: Boolean,
|
|
747
639
|
buttonText: { type: String, default: "点击上传" },
|
|
748
640
|
/** 是否展示默认「点击上传」按钮(为 false 时可由外部调用 openFilePicker) */
|
|
@@ -783,12 +675,18 @@ const rn = {
|
|
|
783
675
|
},
|
|
784
676
|
modelOutputValue() {
|
|
785
677
|
const e = this.fileList.filter((t) => t.status === "success" && t.url);
|
|
786
|
-
return this.valueFormat === "file" ? e.map(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
678
|
+
return this.valueFormat === "file" ? e.map(
|
|
679
|
+
(t) => _e({
|
|
680
|
+
id: t.id,
|
|
681
|
+
fileName: t.name,
|
|
682
|
+
fileUrl: t.url
|
|
683
|
+
})
|
|
684
|
+
).filter(Boolean) : e.map((t) => ce(t.url) || t.url);
|
|
790
685
|
}
|
|
791
686
|
},
|
|
687
|
+
beforeUnmount() {
|
|
688
|
+
this.fileList.forEach(Ke);
|
|
689
|
+
},
|
|
792
690
|
watch: {
|
|
793
691
|
hasPendingUpload: {
|
|
794
692
|
immediate: !0,
|
|
@@ -800,26 +698,31 @@ const rn = {
|
|
|
800
698
|
deep: !0,
|
|
801
699
|
immediate: !0,
|
|
802
700
|
handler(e) {
|
|
803
|
-
e != null && e.length && (this.fileList =
|
|
701
|
+
e != null && e.length && (this.fileList = ze(e));
|
|
804
702
|
}
|
|
805
703
|
},
|
|
806
704
|
modelValue: {
|
|
807
705
|
immediate: !0,
|
|
808
706
|
handler(e) {
|
|
809
|
-
var
|
|
810
|
-
if ((
|
|
707
|
+
var l;
|
|
708
|
+
if ((l = this.initFileList) != null && l.length || this.activeUploadCount > 0 || this.fileList.some((r) => r.status === "uploading"))
|
|
811
709
|
return;
|
|
812
710
|
if (this.valueFormat === "file") {
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
815
|
-
this.settledFiles =
|
|
711
|
+
const r = Zt(e);
|
|
712
|
+
if (en(r, this.settledFiles)) return;
|
|
713
|
+
this.settledFiles = r.map((u) => ({ ...u })), this.fileList = tn(this.settledFiles), Array.isArray(e) && (e.length !== r.length || e.some((u, U) => {
|
|
714
|
+
const h = typeof u == "string" ? u : (u == null ? void 0 : u.fileUrl) || (u == null ? void 0 : u.url) || "", C = r[U];
|
|
715
|
+
if (!C) return !0;
|
|
716
|
+
const L = typeof u == "object" ? u == null ? void 0 : u.id : void 0;
|
|
717
|
+
return ce(h) !== C.fileUrl || L != null && L !== "" && L !== C.id || E(h);
|
|
718
|
+
})) && this.$nextTick(() => this.emitFile());
|
|
816
719
|
return;
|
|
817
720
|
}
|
|
818
|
-
const t =
|
|
819
|
-
t.length === n.length && t.every((
|
|
820
|
-
fileName:
|
|
821
|
-
fileUrl:
|
|
822
|
-
})), this.fileList =
|
|
721
|
+
const t = Qt(e), n = this.successUrls;
|
|
722
|
+
t.length === n.length && t.every((r, a) => r === n[a]) || (this.settledFiles = t.map((r) => ({
|
|
723
|
+
fileName: Ae(r),
|
|
724
|
+
fileUrl: r
|
|
725
|
+
})), this.fileList = ze(t));
|
|
823
726
|
}
|
|
824
727
|
}
|
|
825
728
|
},
|
|
@@ -828,13 +731,20 @@ const rn = {
|
|
|
828
731
|
return this.hasPendingUpload;
|
|
829
732
|
},
|
|
830
733
|
emitFile() {
|
|
831
|
-
const e = this.valueFormat === "file" ? this.settledFiles
|
|
734
|
+
const e = this.valueFormat === "file" ? Ve(this.settledFiles) : Ve(this.settledFiles).map((t) => t.fileUrl);
|
|
832
735
|
this.$emit("update:modelValue", e), this.$emit("sendFile", e);
|
|
833
736
|
},
|
|
834
|
-
rememberSettled(e, t) {
|
|
835
|
-
|
|
836
|
-
|
|
737
|
+
rememberSettled(e, t, n = "", l, r) {
|
|
738
|
+
const a = _e({
|
|
739
|
+
id: r,
|
|
740
|
+
fileName: e,
|
|
837
741
|
fileUrl: t
|
|
742
|
+
});
|
|
743
|
+
a && (this.settledFiles.some((u) => u.fileUrl === a.fileUrl) || this.settledFiles.length >= this.fileNum || this.settledFiles.push({
|
|
744
|
+
...a,
|
|
745
|
+
// 仅组件内部缓存,emit 时会被 toOssSaveFiles 丢掉
|
|
746
|
+
previewSrc: n || "",
|
|
747
|
+
...l != null ? { expireAt: l } : {}
|
|
838
748
|
}));
|
|
839
749
|
},
|
|
840
750
|
openFilePicker() {
|
|
@@ -862,13 +772,13 @@ const rn = {
|
|
|
862
772
|
G.error(`文件数量不超过${this.fileNum}个`);
|
|
863
773
|
return;
|
|
864
774
|
}
|
|
865
|
-
const
|
|
866
|
-
if (t.forEach((
|
|
867
|
-
this.acceptList.includes(
|
|
868
|
-
}),
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
`已过滤以下 ${
|
|
775
|
+
const l = [], r = [];
|
|
776
|
+
if (t.forEach((a) => {
|
|
777
|
+
this.acceptList.includes(nn(a.name)) ? l.push(a) : r.push(a);
|
|
778
|
+
}), r.length) {
|
|
779
|
+
const a = r.map((u) => u.name).join(",");
|
|
780
|
+
Ye.confirm(
|
|
781
|
+
`已过滤以下 ${r.length} 个不符合要求的文件:<br/><p style="color:#f56c6c;font-size:12px;">${a}</p><br/>只接受:${this.acceptList.join("/")}`,
|
|
872
782
|
"提示",
|
|
873
783
|
{
|
|
874
784
|
confirmButtonText: "确认",
|
|
@@ -879,161 +789,341 @@ const rn = {
|
|
|
879
789
|
).catch(() => {
|
|
880
790
|
});
|
|
881
791
|
}
|
|
882
|
-
|
|
792
|
+
l.length && this.startUpload(l);
|
|
883
793
|
},
|
|
884
794
|
startUpload(e) {
|
|
885
795
|
(this.resetFilelist || this.fileNum === 1) && (this.fileList = [], this.settledFiles = []);
|
|
886
796
|
const t = this.maxFileSize * 1024 * 1024, n = [];
|
|
887
|
-
return e.forEach((
|
|
888
|
-
if (
|
|
889
|
-
G.error(`「${
|
|
797
|
+
return e.forEach((l) => {
|
|
798
|
+
if (l.size > t) {
|
|
799
|
+
G.error(`「${l.name}」超出 ${this.maxFileSize}MB 限制`);
|
|
890
800
|
return;
|
|
891
801
|
}
|
|
892
|
-
const
|
|
893
|
-
uid:
|
|
894
|
-
name:
|
|
802
|
+
const r = {
|
|
803
|
+
uid: $e(),
|
|
804
|
+
name: l.name,
|
|
895
805
|
url: "",
|
|
806
|
+
previewSrc: "",
|
|
896
807
|
status: "uploading",
|
|
897
808
|
percent: 0,
|
|
898
|
-
raw:
|
|
809
|
+
raw: l
|
|
899
810
|
};
|
|
900
|
-
this.fileList.push(
|
|
811
|
+
this.fileList.push(r);
|
|
812
|
+
const a = this.fileList[this.fileList.length - 1];
|
|
813
|
+
n.push(this.uploadOne(a));
|
|
901
814
|
}), Promise.all(n);
|
|
902
815
|
},
|
|
903
816
|
async uploadOne(e) {
|
|
904
817
|
const t = (n) => {
|
|
905
|
-
const
|
|
906
|
-
e.percent =
|
|
818
|
+
const l = Math.min(100, Math.max(0, Math.round(Number(n) || 0)));
|
|
819
|
+
e.percent = l, this.$emit("progress", l, e.raw);
|
|
907
820
|
};
|
|
908
821
|
this.activeUploadCount += 1, this.$emit("update:uploading", !0);
|
|
909
822
|
try {
|
|
910
823
|
t(0);
|
|
911
|
-
const n = await
|
|
824
|
+
const n = await Ge({
|
|
912
825
|
file: e.raw,
|
|
913
826
|
dir: this.getDir(),
|
|
827
|
+
bucketKind: this.bucketKind,
|
|
914
828
|
onProgress: t
|
|
915
829
|
});
|
|
916
|
-
e.url = n.url, e.name = e.name ||
|
|
917
|
-
const
|
|
918
|
-
e.raw = null, this.fileList.some((
|
|
830
|
+
e.url = n.key || n.url, e.previewSrc = n.previewUrl || "", e.expireAt = n.expireAt, e.name = e.name || Ae(e.url), e.status = "success", t(100);
|
|
831
|
+
const l = e.raw;
|
|
832
|
+
e.raw = null, this.fileList.some((r) => r.uid === e.uid) || this.fileList.push(e), this.rememberSettled(e.name, e.url, e.previewSrc, e.expireAt), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), this.emitFile(), this.$emit("success", n, { ...e, raw: l });
|
|
919
833
|
} catch (n) {
|
|
920
834
|
e.status = "fail", t(0), this.activeUploadCount = Math.max(0, this.activeUploadCount - 1), this.$emit("update:uploading", this.activeUploadCount > 0), G.error((n == null ? void 0 : n.message) || "上传失败"), this.$emit("error", n, e);
|
|
921
835
|
}
|
|
922
836
|
},
|
|
923
|
-
onFileClick(e) {
|
|
924
|
-
(e == null ? void 0 : e.status) !== "success"
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
837
|
+
async onFileClick(e) {
|
|
838
|
+
if ((e == null ? void 0 : e.status) !== "success") return;
|
|
839
|
+
const t = await yt(
|
|
840
|
+
{
|
|
841
|
+
fileUrl: e.previewSrc || e.url,
|
|
842
|
+
fileKey: e.url,
|
|
843
|
+
fileName: e.name,
|
|
844
|
+
expireAt: e.expireAt,
|
|
845
|
+
previewSrc: e.previewSrc
|
|
846
|
+
},
|
|
847
|
+
{ forceResign: !0 }
|
|
848
|
+
);
|
|
849
|
+
t != null && t.src && (e.previewSrc = t.src, e.expireAt = se(t.src) || e.expireAt);
|
|
928
850
|
},
|
|
929
851
|
removeFile(e) {
|
|
930
852
|
const t = this.fileList[e];
|
|
931
|
-
!t || t.status === "uploading" || (this.fileList.splice(e, 1), t.url && (this.settledFiles = this.settledFiles.filter((n) => n.fileUrl !== t.url)), this.emitFile());
|
|
853
|
+
!t || t.status === "uploading" || (Ke(t), this.fileList.splice(e, 1), t.url && (this.settledFiles = this.settledFiles.filter((n) => n.fileUrl !== t.url)), this.emitFile());
|
|
932
854
|
}
|
|
933
855
|
}
|
|
934
|
-
},
|
|
856
|
+
}, rn = { class: "mg-file-upload" }, sn = ["multiple", "accept", "disabled"], an = {
|
|
935
857
|
key: 1,
|
|
936
858
|
class: "el-upload__tip"
|
|
937
|
-
},
|
|
859
|
+
}, on = {
|
|
938
860
|
key: 2,
|
|
939
861
|
class: "mg-file-list"
|
|
940
|
-
},
|
|
862
|
+
}, un = { class: "mg-file-item__row" }, cn = ["onClick"], dn = ["title"], pn = {
|
|
941
863
|
key: 0,
|
|
942
864
|
class: "mg-file-item__percent"
|
|
943
|
-
},
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
865
|
+
}, fn = ["onClick"], hn = {
|
|
866
|
+
key: 0,
|
|
867
|
+
class: "mg-file-item__progress",
|
|
868
|
+
"aria-hidden": "true"
|
|
869
|
+
};
|
|
870
|
+
function gn(e, t, n, l, r, a) {
|
|
871
|
+
const u = N("el-button"), U = N("Document"), h = N("el-icon"), C = N("CircleCheck"), L = N("CircleClose"), P = N("Close");
|
|
872
|
+
return d(), m("div", rn, [
|
|
873
|
+
b("input", {
|
|
948
874
|
ref: "fileInput",
|
|
949
875
|
type: "file",
|
|
950
876
|
class: "file-input",
|
|
951
|
-
multiple:
|
|
877
|
+
multiple: a.multiple,
|
|
952
878
|
accept: n.accept,
|
|
953
879
|
disabled: n.disabled,
|
|
954
|
-
onChange: t[0] || (t[0] = (...c) =>
|
|
955
|
-
}, null, 40,
|
|
956
|
-
n.showButton ? (d(),
|
|
880
|
+
onChange: t[0] || (t[0] = (...c) => a.onFileChange && a.onFileChange(...c))
|
|
881
|
+
}, null, 40, sn),
|
|
882
|
+
n.showButton ? (d(), B(u, {
|
|
957
883
|
key: 0,
|
|
958
884
|
type: "primary",
|
|
959
|
-
disabled: n.disabled || !
|
|
960
|
-
onClick:
|
|
885
|
+
disabled: n.disabled || !a.showUploadBtn,
|
|
886
|
+
onClick: a.handleUpload
|
|
961
887
|
}, {
|
|
962
|
-
default:
|
|
963
|
-
q(
|
|
888
|
+
default: F(() => [
|
|
889
|
+
q(T(n.buttonText), 1)
|
|
964
890
|
]),
|
|
965
891
|
_: 1
|
|
966
892
|
}, 8, ["disabled", "onClick"])) : V("", !0),
|
|
967
|
-
|
|
968
|
-
n.showFileList ? (d(),
|
|
969
|
-
(d(!0),
|
|
893
|
+
a.tipText ? (d(), m("div", an, T(a.tipText), 1)) : V("", !0),
|
|
894
|
+
n.showFileList ? (d(), m("ul", on, [
|
|
895
|
+
(d(!0), m(Q, null, te(r.fileList, (c, _) => (d(), m("li", {
|
|
970
896
|
key: c.uid,
|
|
971
|
-
class:
|
|
897
|
+
class: j(["mg-file-item", [`is-${c.status}`]])
|
|
972
898
|
}, [
|
|
973
|
-
|
|
974
|
-
|
|
899
|
+
b("div", un, [
|
|
900
|
+
b("a", {
|
|
975
901
|
class: "mg-file-item__name",
|
|
976
|
-
href:
|
|
977
|
-
target: c.url ? "_blank" : void 0,
|
|
902
|
+
href: "javascript:;",
|
|
978
903
|
rel: "noopener noreferrer",
|
|
979
|
-
onClick:
|
|
904
|
+
onClick: we((p) => a.onFileClick(c), ["prevent"])
|
|
980
905
|
}, [
|
|
981
|
-
S(
|
|
982
|
-
default:
|
|
983
|
-
S(
|
|
906
|
+
S(h, { class: "mg-file-item__doc" }, {
|
|
907
|
+
default: F(() => [
|
|
908
|
+
S(U)
|
|
984
909
|
]),
|
|
985
910
|
_: 1
|
|
986
911
|
}),
|
|
987
|
-
|
|
912
|
+
b("span", {
|
|
988
913
|
class: "mg-file-item__text",
|
|
989
914
|
title: c.name
|
|
990
|
-
},
|
|
991
|
-
], 8,
|
|
992
|
-
c.status === "uploading" ? (d(),
|
|
915
|
+
}, T(c.name), 9, dn)
|
|
916
|
+
], 8, cn),
|
|
917
|
+
c.status === "uploading" ? (d(), m("span", pn, T(c.percent) + "% ", 1)) : c.status === "success" ? (d(), B(h, {
|
|
993
918
|
key: 1,
|
|
994
919
|
class: "mg-file-item__status is-success"
|
|
995
920
|
}, {
|
|
996
|
-
default:
|
|
997
|
-
S(
|
|
921
|
+
default: F(() => [
|
|
922
|
+
S(C)
|
|
998
923
|
]),
|
|
999
924
|
_: 1
|
|
1000
|
-
})) : c.status === "fail" ? (d(),
|
|
925
|
+
})) : c.status === "fail" ? (d(), B(h, {
|
|
1001
926
|
key: 2,
|
|
1002
927
|
class: "mg-file-item__status is-fail"
|
|
1003
928
|
}, {
|
|
1004
|
-
default:
|
|
1005
|
-
S(
|
|
929
|
+
default: F(() => [
|
|
930
|
+
S(L)
|
|
1006
931
|
]),
|
|
1007
932
|
_: 1
|
|
1008
933
|
})) : V("", !0),
|
|
1009
|
-
c.status !== "uploading" ? (d(),
|
|
934
|
+
c.status !== "uploading" ? (d(), m("button", {
|
|
1010
935
|
key: 3,
|
|
1011
936
|
type: "button",
|
|
1012
937
|
class: "mg-file-item__remove",
|
|
1013
938
|
title: "删除",
|
|
1014
|
-
onClick:
|
|
939
|
+
onClick: we((p) => a.removeFile(_), ["stop"])
|
|
1015
940
|
}, [
|
|
1016
|
-
S(
|
|
1017
|
-
default:
|
|
941
|
+
S(h, { size: 14 }, {
|
|
942
|
+
default: F(() => [
|
|
1018
943
|
S(P)
|
|
1019
944
|
]),
|
|
1020
945
|
_: 1
|
|
1021
946
|
})
|
|
1022
|
-
], 8,
|
|
947
|
+
], 8, fn)) : V("", !0)
|
|
1023
948
|
]),
|
|
1024
|
-
c.status === "uploading" ? (d(),
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
"show-text": !1
|
|
1031
|
-
}, null, 8, ["percentage"])) : V("", !0)
|
|
949
|
+
c.status === "uploading" ? (d(), m("div", hn, [
|
|
950
|
+
b("div", {
|
|
951
|
+
class: "mg-file-item__progress-inner",
|
|
952
|
+
style: de({ width: `${Math.min(100, Math.max(0, c.percent || 0))}%` })
|
|
953
|
+
}, null, 4)
|
|
954
|
+
])) : V("", !0)
|
|
1032
955
|
], 2))), 128))
|
|
1033
956
|
])) : V("", !0)
|
|
1034
957
|
]);
|
|
1035
958
|
}
|
|
1036
|
-
const
|
|
959
|
+
const mn = /* @__PURE__ */ Z(ln, [["render", gn], ["__scopeId", "data-v-4cd4fc2a"]]), vn = 12e4, je = 5e3, yn = {
|
|
960
|
+
name: "MgOssImg",
|
|
961
|
+
inheritAttrs: !1,
|
|
962
|
+
props: {
|
|
963
|
+
src: { type: String, default: "" },
|
|
964
|
+
fileKey: { type: String, default: "" },
|
|
965
|
+
expireAt: { type: [Number, String], default: void 0 },
|
|
966
|
+
alt: { type: String, default: "" },
|
|
967
|
+
resign: { type: Function, default: null }
|
|
968
|
+
},
|
|
969
|
+
emits: ["load", "error", "resign"],
|
|
970
|
+
data() {
|
|
971
|
+
return {
|
|
972
|
+
innerSrc: "",
|
|
973
|
+
innerExpireAt: void 0,
|
|
974
|
+
retried: !1,
|
|
975
|
+
signing: !1,
|
|
976
|
+
renewTimer: null,
|
|
977
|
+
lastRenewAt: 0
|
|
978
|
+
};
|
|
979
|
+
},
|
|
980
|
+
computed: {
|
|
981
|
+
displaySrc() {
|
|
982
|
+
return this.innerSrc ? this.innerSrc : E(this.src) ? this.src : "";
|
|
983
|
+
},
|
|
984
|
+
resolveKey() {
|
|
985
|
+
const e = ce(this.src) || (E(this.src) ? "" : String(this.src || "").trim());
|
|
986
|
+
return e || String(this.fileKey || "").trim();
|
|
987
|
+
},
|
|
988
|
+
resolveExpireAt() {
|
|
989
|
+
return this.innerExpireAt != null ? Number(this.innerExpireAt) : this.expireAt != null && this.expireAt !== "" ? Number(this.expireAt) : se(this.innerSrc || this.src);
|
|
990
|
+
}
|
|
991
|
+
},
|
|
992
|
+
watch: {
|
|
993
|
+
src: {
|
|
994
|
+
immediate: !0,
|
|
995
|
+
handler() {
|
|
996
|
+
this.resetAndBootstrap();
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
fileKey() {
|
|
1000
|
+
this.retried = !1, !E(this.src) && !this.innerSrc && this.ensureSigned();
|
|
1001
|
+
},
|
|
1002
|
+
expireAt() {
|
|
1003
|
+
this.scheduleRenew();
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
beforeUnmount() {
|
|
1007
|
+
this.clearRenewTimer();
|
|
1008
|
+
},
|
|
1009
|
+
methods: {
|
|
1010
|
+
onLoad() {
|
|
1011
|
+
this.$emit("load");
|
|
1012
|
+
},
|
|
1013
|
+
clearRenewTimer() {
|
|
1014
|
+
this.renewTimer != null && (clearTimeout(this.renewTimer), this.renewTimer = null);
|
|
1015
|
+
},
|
|
1016
|
+
resetAndBootstrap() {
|
|
1017
|
+
if (this.clearRenewTimer(), this.innerSrc = "", this.innerExpireAt = void 0, this.retried = !1, E(this.src)) {
|
|
1018
|
+
this.innerExpireAt = this.expireAt != null && this.expireAt !== "" ? Number(this.expireAt) : se(this.src), this.scheduleRenew();
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
this.ensureSigned();
|
|
1022
|
+
},
|
|
1023
|
+
/**
|
|
1024
|
+
* 计算下次续签等待时间:
|
|
1025
|
+
* - 已过期 → 立刻(受 MIN_RENEW_GAP 约束)
|
|
1026
|
+
* - 剩余 > lead → expireAt - lead
|
|
1027
|
+
* - 剩余 ≤ lead 但仍有效 → 剩余时间的一半(避免短 TTL 一挂载就狂打 batchSign)
|
|
1028
|
+
*/
|
|
1029
|
+
calcRenewWaitMs(e) {
|
|
1030
|
+
if (e == null || Number.isNaN(Number(e))) return null;
|
|
1031
|
+
const t = Number(e) * 1e3 - Date.now();
|
|
1032
|
+
if (t <= 0) return 0;
|
|
1033
|
+
const n = t - vn;
|
|
1034
|
+
return n > 0 ? n : Math.max(t / 2, 1e3);
|
|
1035
|
+
},
|
|
1036
|
+
scheduleRenew() {
|
|
1037
|
+
this.clearRenewTimer();
|
|
1038
|
+
const e = this.resolveKey, t = this.resolveExpireAt;
|
|
1039
|
+
if (!e || t == null || Number.isNaN(t)) return;
|
|
1040
|
+
const n = this.calcRenewWaitMs(t);
|
|
1041
|
+
if (n != null) {
|
|
1042
|
+
if (n <= 0 && bt(t, 0)) {
|
|
1043
|
+
this.renewNow();
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
this.renewTimer = setTimeout(() => {
|
|
1047
|
+
this.renewTimer = null, this.renewNow();
|
|
1048
|
+
}, Math.max(n, 0));
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
pickSignedUrl(e, t) {
|
|
1052
|
+
if (!e || !t) return { url: "", expireAt: void 0 };
|
|
1053
|
+
if (Array.isArray(e.items)) {
|
|
1054
|
+
const n = e.items.find((l) => l.key === t);
|
|
1055
|
+
return {
|
|
1056
|
+
url: (n == null ? void 0 : n.url) || "",
|
|
1057
|
+
expireAt: (n == null ? void 0 : n.expireAt) ?? e.expireAt
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
return typeof e == "object" && e[t] ? { url: e[t], expireAt: e.expireAt } : { url: "", expireAt: void 0 };
|
|
1061
|
+
},
|
|
1062
|
+
async callResign(e) {
|
|
1063
|
+
return (typeof this.resign == "function" ? this.resign : (n) => Je({ keys: n }))([e]);
|
|
1064
|
+
},
|
|
1065
|
+
async renewNow() {
|
|
1066
|
+
const e = this.resolveKey;
|
|
1067
|
+
if (!e || this.signing) return;
|
|
1068
|
+
const t = Date.now() - this.lastRenewAt;
|
|
1069
|
+
if (t < je) {
|
|
1070
|
+
this.clearRenewTimer(), this.renewTimer = setTimeout(() => {
|
|
1071
|
+
this.renewTimer = null, this.renewNow();
|
|
1072
|
+
}, je - t);
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
this.signing = !0, this.lastRenewAt = Date.now();
|
|
1076
|
+
try {
|
|
1077
|
+
const n = await this.callResign(e), { url: l, expireAt: r } = this.pickSignedUrl(n, e);
|
|
1078
|
+
if (l && E(l)) {
|
|
1079
|
+
const a = l === this.innerSrc || l === this.src;
|
|
1080
|
+
this.innerSrc = l, this.innerExpireAt = r != null ? Number(r) : se(l), a || this.$emit("resign", { key: e, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew();
|
|
1081
|
+
}
|
|
1082
|
+
} catch (n) {
|
|
1083
|
+
console.warn("[MgOssImg] 到期续签失败", n);
|
|
1084
|
+
} finally {
|
|
1085
|
+
this.signing = !1;
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
async ensureSigned() {
|
|
1089
|
+
if (E(this.src) || this.signing) return;
|
|
1090
|
+
const e = this.resolveKey;
|
|
1091
|
+
if (e) {
|
|
1092
|
+
this.signing = !0, this.lastRenewAt = Date.now();
|
|
1093
|
+
try {
|
|
1094
|
+
const t = await this.callResign(e), { url: n, expireAt: l } = this.pickSignedUrl(t, e);
|
|
1095
|
+
n && E(n) && (this.innerSrc = n, this.innerExpireAt = l != null ? Number(l) : se(n), this.$emit("resign", { key: e, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew());
|
|
1096
|
+
} catch (t) {
|
|
1097
|
+
console.warn("[MgOssImg] 预签名失败", t);
|
|
1098
|
+
} finally {
|
|
1099
|
+
this.signing = !1;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
async onError(e) {
|
|
1104
|
+
if (this.$emit("error", e), this.retried || this.signing) return;
|
|
1105
|
+
const t = this.resolveKey;
|
|
1106
|
+
if (t) {
|
|
1107
|
+
this.retried = !0;
|
|
1108
|
+
try {
|
|
1109
|
+
const n = await this.callResign(t), { url: l, expireAt: r } = this.pickSignedUrl(n, t);
|
|
1110
|
+
l && E(l) && (this.innerSrc = l, this.innerExpireAt = r != null ? Number(r) : se(l), this.$emit("resign", { key: t, url: this.innerSrc, expireAt: this.innerExpireAt }), this.scheduleRenew());
|
|
1111
|
+
} catch (n) {
|
|
1112
|
+
console.warn("[MgOssImg] 裂图续签失败", n);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}, bn = ["src", "alt"];
|
|
1118
|
+
function _n(e, t, n, l, r, a) {
|
|
1119
|
+
return d(), m("img", Ne({ class: "mg-oss-img" }, e.$attrs, {
|
|
1120
|
+
src: a.displaySrc,
|
|
1121
|
+
alt: n.alt,
|
|
1122
|
+
onError: t[0] || (t[0] = (...u) => a.onError && a.onError(...u)),
|
|
1123
|
+
onLoad: t[1] || (t[1] = (...u) => a.onLoad && a.onLoad(...u))
|
|
1124
|
+
}), null, 16, bn);
|
|
1125
|
+
}
|
|
1126
|
+
const wn = /* @__PURE__ */ Z(yn, [["render", _n], ["__scopeId", "data-v-5a56c5a2"]]), xn = {
|
|
1037
1127
|
__name: "DateRangePicker",
|
|
1038
1128
|
props: {
|
|
1039
1129
|
start: {
|
|
@@ -1064,87 +1154,87 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
|
|
|
1064
1154
|
},
|
|
1065
1155
|
emits: ["update:start", "update:end", "change"],
|
|
1066
1156
|
setup(e, { emit: t }) {
|
|
1067
|
-
const n = t,
|
|
1068
|
-
function
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
1157
|
+
const n = t, l = e;
|
|
1158
|
+
function r(c) {
|
|
1159
|
+
const _ = new Date(c);
|
|
1160
|
+
return _.setHours(0, 0, 0, 0), _;
|
|
1071
1161
|
}
|
|
1072
|
-
function
|
|
1073
|
-
const
|
|
1074
|
-
return
|
|
1162
|
+
function a(c) {
|
|
1163
|
+
const _ = new Date(c);
|
|
1164
|
+
return _.setHours(23, 59, 59, 0), _;
|
|
1075
1165
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1166
|
+
function u(c) {
|
|
1167
|
+
const _ = a(/* @__PURE__ */ new Date()), p = r(/* @__PURE__ */ new Date());
|
|
1168
|
+
return c(p), [p, _];
|
|
1079
1169
|
}
|
|
1080
|
-
const
|
|
1170
|
+
const U = [
|
|
1081
1171
|
{
|
|
1082
1172
|
text: "七天内",
|
|
1083
|
-
value: () =>
|
|
1084
|
-
|
|
1173
|
+
value: () => u((c) => {
|
|
1174
|
+
c.setDate(c.getDate() - 6);
|
|
1085
1175
|
})
|
|
1086
1176
|
},
|
|
1087
1177
|
{
|
|
1088
1178
|
text: "一个月内",
|
|
1089
|
-
value: () =>
|
|
1090
|
-
|
|
1179
|
+
value: () => u((c) => {
|
|
1180
|
+
c.setMonth(c.getMonth() - 1);
|
|
1091
1181
|
})
|
|
1092
1182
|
},
|
|
1093
1183
|
{
|
|
1094
1184
|
text: "一年内",
|
|
1095
|
-
value: () =>
|
|
1096
|
-
|
|
1185
|
+
value: () => u((c) => {
|
|
1186
|
+
c.setFullYear(c.getFullYear() - 1);
|
|
1097
1187
|
})
|
|
1098
1188
|
}
|
|
1099
|
-
],
|
|
1100
|
-
var
|
|
1101
|
-
if (
|
|
1102
|
-
return (
|
|
1103
|
-
}),
|
|
1104
|
-
function
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
1189
|
+
], h = xe(() => {
|
|
1190
|
+
var c;
|
|
1191
|
+
if (l.showShortcuts)
|
|
1192
|
+
return (c = l.shortcuts) != null && c.length ? l.shortcuts : U;
|
|
1193
|
+
}), C = O([]);
|
|
1194
|
+
function L(c, _) {
|
|
1195
|
+
if (c && _) {
|
|
1196
|
+
C.value = [c, _];
|
|
1107
1197
|
return;
|
|
1108
1198
|
}
|
|
1109
|
-
|
|
1199
|
+
C.value = [];
|
|
1110
1200
|
}
|
|
1111
|
-
|
|
1112
|
-
() => [
|
|
1113
|
-
([
|
|
1114
|
-
|
|
1201
|
+
ne(
|
|
1202
|
+
() => [l.start, l.end],
|
|
1203
|
+
([c, _]) => {
|
|
1204
|
+
L(c, _);
|
|
1115
1205
|
}
|
|
1116
|
-
),
|
|
1117
|
-
|
|
1206
|
+
), Se(() => {
|
|
1207
|
+
L(l.start, l.end);
|
|
1118
1208
|
});
|
|
1119
|
-
function P(
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1209
|
+
function P(c) {
|
|
1210
|
+
const _ = Array.isArray(c) ? c[0] : "", p = Array.isArray(c) ? c[1] : "";
|
|
1211
|
+
_ && p ? (n("update:start", _), n("update:end", p)) : (n("update:start", ""), n("update:end", "")), n("change");
|
|
1122
1212
|
}
|
|
1123
|
-
return (
|
|
1124
|
-
const
|
|
1125
|
-
return d(),
|
|
1126
|
-
modelValue:
|
|
1127
|
-
"onUpdate:modelValue":
|
|
1213
|
+
return (c, _) => {
|
|
1214
|
+
const p = N("el-date-picker");
|
|
1215
|
+
return d(), B(p, {
|
|
1216
|
+
modelValue: C.value,
|
|
1217
|
+
"onUpdate:modelValue": _[0] || (_[0] = (A) => C.value = A),
|
|
1128
1218
|
type: e.type,
|
|
1129
1219
|
"range-separator": "至",
|
|
1130
1220
|
"start-placeholder": e.title ? `${e.title} 开始` : "开始",
|
|
1131
1221
|
"end-placeholder": "结束",
|
|
1132
1222
|
"value-format": e.valueFormat,
|
|
1133
1223
|
"default-time": e.defaultTime,
|
|
1134
|
-
shortcuts:
|
|
1224
|
+
shortcuts: h.value,
|
|
1135
1225
|
class: "date-range-picker",
|
|
1136
1226
|
onChange: P,
|
|
1137
1227
|
clearable: e.canClearable
|
|
1138
1228
|
}, null, 8, ["modelValue", "type", "start-placeholder", "value-format", "default-time", "shortcuts", "clearable"]);
|
|
1139
1229
|
};
|
|
1140
1230
|
}
|
|
1141
|
-
},
|
|
1231
|
+
}, et = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-0dfa12ab"]]), Sn = { class: "common-search__body" }, kn = { class: "common-search__control-wrap" }, Un = ["onKeyup"], Cn = { class: "common-search__range-sep" }, Fn = {
|
|
1142
1232
|
key: 5,
|
|
1143
1233
|
class: "common-search__range"
|
|
1144
|
-
},
|
|
1234
|
+
}, Ln = {
|
|
1145
1235
|
key: 0,
|
|
1146
1236
|
class: "common-search__actions is-inline"
|
|
1147
|
-
},
|
|
1237
|
+
}, Nn = { class: "common-search__actions-main" }, An = /* @__PURE__ */ Object.assign({ name: "MgSearchForm" }, {
|
|
1148
1238
|
__name: "SearchForm",
|
|
1149
1239
|
props: {
|
|
1150
1240
|
modelValue: { type: Object, default: () => ({}) },
|
|
@@ -1152,432 +1242,432 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
|
|
|
1152
1242
|
},
|
|
1153
1243
|
emits: ["change", "search", "reset", "update:modelValue"],
|
|
1154
1244
|
setup(e, { emit: t }) {
|
|
1155
|
-
const n = e,
|
|
1156
|
-
let
|
|
1157
|
-
function
|
|
1245
|
+
const n = e, l = t, r = O({}), a = Ie({}), u = Ie({});
|
|
1246
|
+
let U = !1;
|
|
1247
|
+
function h(s, o) {
|
|
1158
1248
|
return JSON.stringify(s ?? {}) === JSON.stringify(o ?? {});
|
|
1159
1249
|
}
|
|
1160
|
-
const
|
|
1161
|
-
let
|
|
1162
|
-
const
|
|
1163
|
-
if (!(!P.value ||
|
|
1250
|
+
const C = O(null), L = O(!1), P = O(!1), c = O(0), _ = O(0), p = O(0), A = O(null);
|
|
1251
|
+
let $ = null, W = !1, D = !1;
|
|
1252
|
+
const pe = xe(() => {
|
|
1253
|
+
if (!(!P.value || A.value == null))
|
|
1164
1254
|
return {
|
|
1165
|
-
maxHeight: `${
|
|
1255
|
+
maxHeight: `${A.value}px`,
|
|
1166
1256
|
overflow: "hidden"
|
|
1167
1257
|
};
|
|
1168
1258
|
});
|
|
1169
|
-
function
|
|
1259
|
+
function fe(s = {}) {
|
|
1170
1260
|
return String(s.label || s.title || "").trim();
|
|
1171
1261
|
}
|
|
1172
|
-
function
|
|
1173
|
-
return String(s.tip ||
|
|
1262
|
+
function me(s = {}) {
|
|
1263
|
+
return String(s.tip || fe(s) || "").trim();
|
|
1174
1264
|
}
|
|
1175
1265
|
function g(s = "") {
|
|
1176
1266
|
const o = String(s).trim();
|
|
1177
1267
|
return !o || (/* @__PURE__ */ new Set(["全部", "或选择", "请输入或选择"])).has(o) ? "" : o.replace(/^请(输入|选择)/, "").trim() || o;
|
|
1178
1268
|
}
|
|
1179
|
-
function
|
|
1269
|
+
function y(s = {}, o = "") {
|
|
1180
1270
|
if (s.placeholder != null && s.placeholder !== "") {
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1271
|
+
const x = g(s.placeholder);
|
|
1272
|
+
if (x) return x;
|
|
1183
1273
|
}
|
|
1184
|
-
const
|
|
1185
|
-
return
|
|
1274
|
+
const f = fe(s);
|
|
1275
|
+
return f || g(o) || o;
|
|
1186
1276
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const
|
|
1189
|
-
return
|
|
1277
|
+
function M(s = {}, o = "min") {
|
|
1278
|
+
const f = o === "min" ? s.minPlaceholder : s.maxPlaceholder, w = fe(s), x = o === "min" ? "最小值" : "最大值", R = /* @__PURE__ */ new Set(["最小", "最大", "最小值", "最大值"]);
|
|
1279
|
+
return f != null && f !== "" ? w && R.has(String(f).trim()) ? `${w}${f}` : f : w ? `${w}${x}` : x;
|
|
1190
1280
|
}
|
|
1191
|
-
|
|
1281
|
+
ne(
|
|
1192
1282
|
() => n.modelValue,
|
|
1193
1283
|
(s) => {
|
|
1194
|
-
|
|
1195
|
-
|
|
1284
|
+
h(s, r.value) || (U = !0, r.value = { ...s || {} }, J(() => {
|
|
1285
|
+
U = !1;
|
|
1196
1286
|
}));
|
|
1197
1287
|
},
|
|
1198
1288
|
{ deep: !0, immediate: !0 }
|
|
1199
|
-
),
|
|
1200
|
-
|
|
1289
|
+
), ne(
|
|
1290
|
+
r,
|
|
1201
1291
|
() => {
|
|
1202
|
-
|
|
1292
|
+
U || l("update:modelValue", { ...r.value });
|
|
1203
1293
|
},
|
|
1204
1294
|
{ deep: !0 }
|
|
1205
|
-
),
|
|
1295
|
+
), ne(
|
|
1206
1296
|
() => n.itemList,
|
|
1207
1297
|
() => {
|
|
1208
|
-
|
|
1298
|
+
L.value = !1, c.value = 0, J(() => re());
|
|
1209
1299
|
},
|
|
1210
1300
|
{ deep: !0 }
|
|
1211
|
-
),
|
|
1212
|
-
|
|
1213
|
-
!
|
|
1214
|
-
}),
|
|
1215
|
-
}),
|
|
1216
|
-
|
|
1301
|
+
), Se(() => {
|
|
1302
|
+
J(() => re()), typeof ResizeObserver < "u" && ($ = new ResizeObserver(() => {
|
|
1303
|
+
!W && !D && re();
|
|
1304
|
+
}), C.value && $.observe(C.value)), window.addEventListener("resize", I);
|
|
1305
|
+
}), Re(() => {
|
|
1306
|
+
$ == null || $.disconnect(), window.removeEventListener("resize", I);
|
|
1217
1307
|
});
|
|
1218
1308
|
function I() {
|
|
1219
|
-
!
|
|
1309
|
+
!W && !D && re();
|
|
1220
1310
|
}
|
|
1221
|
-
function
|
|
1311
|
+
function X(s) {
|
|
1222
1312
|
const o = n.itemList.length;
|
|
1223
1313
|
if (!o) return !1;
|
|
1224
|
-
const
|
|
1225
|
-
return s === Math.min(
|
|
1314
|
+
const f = c.value > 0 ? c.value : o;
|
|
1315
|
+
return s === Math.min(f, o) - 1;
|
|
1226
1316
|
}
|
|
1227
|
-
function
|
|
1228
|
-
let
|
|
1229
|
-
for (let
|
|
1230
|
-
const K = s[
|
|
1231
|
-
R +
|
|
1317
|
+
function k(s, o, f, w) {
|
|
1318
|
+
let x = 1, R = s[o].offsetWidth;
|
|
1319
|
+
for (let z = o + 1; z < s.length; z += 1) {
|
|
1320
|
+
const K = s[z].offsetWidth;
|
|
1321
|
+
R + w + K > f ? (x += 1, R = K) : R += w + K;
|
|
1232
1322
|
}
|
|
1233
|
-
return
|
|
1323
|
+
return x;
|
|
1234
1324
|
}
|
|
1235
|
-
function
|
|
1236
|
-
let
|
|
1237
|
-
for (let
|
|
1238
|
-
const K = s[
|
|
1239
|
-
if (
|
|
1240
|
-
|
|
1325
|
+
function le(s, o, f, w) {
|
|
1326
|
+
let x = 0, R = 0;
|
|
1327
|
+
for (let z = 0; z < s.length; z += 1) {
|
|
1328
|
+
const K = s[z].offsetWidth, ee = x === 0 ? K : x + w + K;
|
|
1329
|
+
if (ee + w + f <= o)
|
|
1330
|
+
x = ee, R = z + 1;
|
|
1241
1331
|
else
|
|
1242
1332
|
break;
|
|
1243
1333
|
}
|
|
1244
1334
|
return R || 1;
|
|
1245
1335
|
}
|
|
1246
|
-
function
|
|
1247
|
-
const o = s.type === "number-range" || s.type === "numberRange",
|
|
1336
|
+
function H(s) {
|
|
1337
|
+
const o = s.type === "number-range" || s.type === "numberRange", f = 360;
|
|
1248
1338
|
if (!s.width) {
|
|
1249
1339
|
if (o) {
|
|
1250
|
-
const R = `${
|
|
1340
|
+
const R = `${f}px`;
|
|
1251
1341
|
return { width: R, minWidth: R };
|
|
1252
1342
|
}
|
|
1253
1343
|
return;
|
|
1254
1344
|
}
|
|
1255
|
-
let
|
|
1256
|
-
const
|
|
1257
|
-
return { width:
|
|
1345
|
+
let w = typeof s.width == "number" ? s.width : parseInt(String(s.width), 10);
|
|
1346
|
+
const x = typeof s.width == "number" || Number.isFinite(w) ? `${w}px` : s.width;
|
|
1347
|
+
return { width: x, minWidth: x };
|
|
1258
1348
|
}
|
|
1259
|
-
function
|
|
1349
|
+
function Me(s, o) {
|
|
1260
1350
|
if (s == null) return "";
|
|
1261
1351
|
if (typeof s != "object") return String(s);
|
|
1262
|
-
const
|
|
1263
|
-
return typeof
|
|
1352
|
+
const f = o.optionsLabel || "label";
|
|
1353
|
+
return typeof f == "string" ? s[f] : Array.isArray(f) ? `${s[f[0]]}(${s[f[1]]})` : s.label;
|
|
1264
1354
|
}
|
|
1265
|
-
function
|
|
1355
|
+
function ve(s, o) {
|
|
1266
1356
|
return s == null || typeof s != "object" ? s : s[o.optionsValue || "value"];
|
|
1267
1357
|
}
|
|
1268
|
-
function
|
|
1358
|
+
function ke(s) {
|
|
1269
1359
|
return {
|
|
1270
1360
|
startKey: s.start || `${s.prop}Min`,
|
|
1271
1361
|
endKey: s.end || `${s.prop}Max`
|
|
1272
1362
|
};
|
|
1273
1363
|
}
|
|
1274
|
-
function
|
|
1364
|
+
function Te(s, o = 2) {
|
|
1275
1365
|
if (s == null || s === "") return;
|
|
1276
|
-
const
|
|
1277
|
-
if (
|
|
1278
|
-
const
|
|
1279
|
-
return Number.isFinite(
|
|
1366
|
+
const f = Xe(s, o);
|
|
1367
|
+
if (f == null || f === "") return;
|
|
1368
|
+
const w = Number(String(f).replace(/,/g, ""));
|
|
1369
|
+
return Number.isFinite(w) ? w : void 0;
|
|
1280
1370
|
}
|
|
1281
|
-
function
|
|
1282
|
-
const { startKey: o, endKey:
|
|
1283
|
-
let
|
|
1284
|
-
|
|
1285
|
-
}
|
|
1286
|
-
function tt(s) {
|
|
1287
|
-
we(s), Y();
|
|
1371
|
+
function Ue(s) {
|
|
1372
|
+
const { startKey: o, endKey: f } = ke(s), w = s.precision ?? 2;
|
|
1373
|
+
let x = Te(r.value[o], w), R = Te(r.value[f], w);
|
|
1374
|
+
x != null && R != null && x > R && ([x, R] = [R, x]), r.value[o] = x, r.value[f] = R;
|
|
1288
1375
|
}
|
|
1289
1376
|
function nt(s) {
|
|
1290
|
-
|
|
1291
|
-
return k != null && k !== "" || U != null && U !== "";
|
|
1377
|
+
Ue(s), Y();
|
|
1292
1378
|
}
|
|
1293
1379
|
function lt(s) {
|
|
1380
|
+
const { startKey: o, endKey: f } = ke(s), w = r.value[o], x = r.value[f];
|
|
1381
|
+
return w != null && w !== "" || x != null && x !== "";
|
|
1382
|
+
}
|
|
1383
|
+
function rt(s) {
|
|
1294
1384
|
if (s.disabled) return;
|
|
1295
|
-
const { startKey: o, endKey:
|
|
1296
|
-
|
|
1385
|
+
const { startKey: o, endKey: f } = ke(s);
|
|
1386
|
+
r.value[o] = void 0, r.value[f] = void 0, Y();
|
|
1297
1387
|
}
|
|
1298
1388
|
async function st(s, o) {
|
|
1299
1389
|
if (typeof s.remoteMethod == "function") {
|
|
1300
|
-
|
|
1390
|
+
u[s.prop] = !0;
|
|
1301
1391
|
try {
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1392
|
+
const f = await s.remoteMethod(o);
|
|
1393
|
+
a[s.prop] = Array.isArray(f) ? f : [];
|
|
1304
1394
|
} finally {
|
|
1305
|
-
|
|
1395
|
+
u[s.prop] = !1;
|
|
1306
1396
|
}
|
|
1307
1397
|
}
|
|
1308
1398
|
}
|
|
1309
1399
|
function Ce(s) {
|
|
1310
|
-
const o = s.style.maxHeight,
|
|
1400
|
+
const o = s.style.maxHeight, f = s.style.overflow, w = s.style.transition;
|
|
1311
1401
|
s.style.transition = "none", s.style.maxHeight = "none", s.style.overflow = "visible";
|
|
1312
|
-
const
|
|
1313
|
-
return s.style.maxHeight = o, s.style.overflow =
|
|
1402
|
+
const x = s.scrollHeight;
|
|
1403
|
+
return s.style.maxHeight = o, s.style.overflow = f, s.offsetHeight, s.style.transition = w, x;
|
|
1314
1404
|
}
|
|
1315
|
-
function
|
|
1316
|
-
const s =
|
|
1317
|
-
if (!s ||
|
|
1318
|
-
|
|
1319
|
-
const o = s.closest(".common-search"),
|
|
1320
|
-
if (!
|
|
1321
|
-
P.value = !1,
|
|
1405
|
+
function re() {
|
|
1406
|
+
const s = C.value;
|
|
1407
|
+
if (!s || W || D) return;
|
|
1408
|
+
W = !0;
|
|
1409
|
+
const o = s.closest(".common-search"), f = Array.from(s.querySelectorAll(".common-search__field")), w = s.querySelector(".common-search__actions");
|
|
1410
|
+
if (!f.length || !o) {
|
|
1411
|
+
P.value = !1, _.value = 0, p.value = 0, A.value = null, c.value = 0, W = !1;
|
|
1322
1412
|
return;
|
|
1323
1413
|
}
|
|
1324
|
-
|
|
1325
|
-
const
|
|
1326
|
-
let
|
|
1327
|
-
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
const
|
|
1331
|
-
P.value =
|
|
1414
|
+
_.value = f[0].offsetHeight, p.value = Ce(s);
|
|
1415
|
+
const x = 16, R = o.clientWidth, z = (w == null ? void 0 : w.offsetWidth) || 220, K = le(f, R, z, x);
|
|
1416
|
+
let ee = 1;
|
|
1417
|
+
f.length > K && (ee += k(f, K, R, x));
|
|
1418
|
+
const he = c.value;
|
|
1419
|
+
c.value = K;
|
|
1420
|
+
const i = ee > 1, ye = P.value;
|
|
1421
|
+
P.value = i, i ? L.value ? A.value = null : A.value = _.value : (L.value = !1, A.value = null), W = !1, (ye !== i || he !== K) && J(() => re());
|
|
1332
1422
|
}
|
|
1333
|
-
function
|
|
1334
|
-
const s =
|
|
1335
|
-
if (!s ||
|
|
1336
|
-
|
|
1337
|
-
const o = s.getBoundingClientRect().height ||
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1423
|
+
function it() {
|
|
1424
|
+
const s = C.value;
|
|
1425
|
+
if (!s || D) return;
|
|
1426
|
+
D = !0;
|
|
1427
|
+
const o = s.getBoundingClientRect().height || _.value;
|
|
1428
|
+
if (L.value)
|
|
1429
|
+
A.value = o || Ce(s), L.value = !1, requestAnimationFrame(() => {
|
|
1340
1430
|
requestAnimationFrame(() => {
|
|
1341
|
-
|
|
1431
|
+
A.value = _.value;
|
|
1342
1432
|
});
|
|
1343
1433
|
});
|
|
1344
1434
|
else {
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1435
|
+
A.value = o;
|
|
1436
|
+
const f = Ce(s);
|
|
1437
|
+
p.value = f, L.value = !0, requestAnimationFrame(() => {
|
|
1348
1438
|
requestAnimationFrame(() => {
|
|
1349
|
-
|
|
1439
|
+
A.value = Math.max(f, _.value || 0);
|
|
1350
1440
|
});
|
|
1351
1441
|
});
|
|
1352
1442
|
}
|
|
1353
1443
|
window.setTimeout(() => {
|
|
1354
|
-
|
|
1444
|
+
D = !1, L.value && (A.value = null), re();
|
|
1355
1445
|
}, 380);
|
|
1356
1446
|
}
|
|
1357
|
-
function
|
|
1447
|
+
function at() {
|
|
1358
1448
|
const s = {};
|
|
1359
1449
|
return n.itemList.forEach((o) => {
|
|
1360
1450
|
o.type === "daterange" || o.type === "dateRange" ? (s[o.start || o.startProp] = void 0, s[o.end || o.endProp] = void 0) : o.type === "number-range" || o.type === "numberRange" ? (s[o.start || `${o.prop}Min`] = void 0, s[o.end || `${o.prop}Max`] = void 0) : o.multiple ? s[o.prop] = [] : o.prop && (s[o.prop] = void 0);
|
|
1361
1451
|
}), s;
|
|
1362
1452
|
}
|
|
1363
|
-
function
|
|
1364
|
-
|
|
1453
|
+
function Pe() {
|
|
1454
|
+
l("update:modelValue", { ...r.value });
|
|
1365
1455
|
}
|
|
1366
1456
|
function Y() {
|
|
1367
|
-
|
|
1457
|
+
Pe(), l("change", { ...r.value }), l("search", { ...r.value });
|
|
1368
1458
|
}
|
|
1369
|
-
function
|
|
1370
|
-
|
|
1459
|
+
function Be() {
|
|
1460
|
+
r.value = at(), Pe(), l("reset", { ...r.value }), l("change", { ...r.value });
|
|
1371
1461
|
}
|
|
1372
1462
|
return (s, o) => {
|
|
1373
|
-
const
|
|
1374
|
-
return
|
|
1375
|
-
class:
|
|
1463
|
+
const f = N("el-input"), w = N("el-option"), x = N("el-select"), R = N("el-input-number"), z = N("el-icon"), K = N("el-date-picker"), ee = N("el-tooltip"), he = N("el-button");
|
|
1464
|
+
return ae((d(), m("div", {
|
|
1465
|
+
class: j(["common-search", {
|
|
1376
1466
|
"is-single-row": !P.value,
|
|
1377
1467
|
"is-multi-row": P.value,
|
|
1378
|
-
"is-expanded": P.value &&
|
|
1379
|
-
"is-collapsed": P.value && !
|
|
1468
|
+
"is-expanded": P.value && L.value,
|
|
1469
|
+
"is-collapsed": P.value && !L.value
|
|
1380
1470
|
}])
|
|
1381
1471
|
}, [
|
|
1382
|
-
|
|
1383
|
-
|
|
1472
|
+
b("div", Sn, [
|
|
1473
|
+
b("div", {
|
|
1384
1474
|
ref_key: "fieldsRef",
|
|
1385
|
-
ref:
|
|
1475
|
+
ref: C,
|
|
1386
1476
|
class: "common-search__fields",
|
|
1387
|
-
style:
|
|
1477
|
+
style: de(pe.value)
|
|
1388
1478
|
}, [
|
|
1389
|
-
(d(!0),
|
|
1390
|
-
key:
|
|
1479
|
+
(d(!0), m(Q, null, te(e.itemList, (i, ye) => (d(), m(Q, {
|
|
1480
|
+
key: i.prop || i.start || ye
|
|
1391
1481
|
}, [
|
|
1392
|
-
|
|
1393
|
-
class:
|
|
1394
|
-
style:
|
|
1482
|
+
b("div", {
|
|
1483
|
+
class: j(["common-search__field", [`is-${i.type}`, i.className]]),
|
|
1484
|
+
style: de(H(i))
|
|
1395
1485
|
}, [
|
|
1396
|
-
S(
|
|
1397
|
-
content:
|
|
1398
|
-
disabled: !
|
|
1486
|
+
S(ee, {
|
|
1487
|
+
content: me(i),
|
|
1488
|
+
disabled: !me(i),
|
|
1399
1489
|
placement: "top",
|
|
1400
1490
|
"show-after": 280
|
|
1401
1491
|
}, {
|
|
1402
|
-
default:
|
|
1403
|
-
|
|
1404
|
-
|
|
1492
|
+
default: F(() => [
|
|
1493
|
+
b("div", kn, [
|
|
1494
|
+
i.type === "input" || i.type === "text" ? (d(), B(f, {
|
|
1405
1495
|
key: 0,
|
|
1406
|
-
modelValue:
|
|
1407
|
-
"onUpdate:modelValue": (v) =>
|
|
1496
|
+
modelValue: r.value[i.prop],
|
|
1497
|
+
"onUpdate:modelValue": (v) => r.value[i.prop] = v,
|
|
1408
1498
|
modelModifiers: { trim: !0 },
|
|
1409
1499
|
clearable: "",
|
|
1410
|
-
placeholder:
|
|
1411
|
-
maxlength:
|
|
1412
|
-
disabled:
|
|
1500
|
+
placeholder: y(i, "请输入"),
|
|
1501
|
+
maxlength: i.maxlength || 200,
|
|
1502
|
+
disabled: i.disabled,
|
|
1413
1503
|
class: "common-search__control",
|
|
1414
|
-
onKeyup:
|
|
1504
|
+
onKeyup: Oe(Y, ["enter"]),
|
|
1415
1505
|
onClear: Y
|
|
1416
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) :
|
|
1506
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "maxlength", "disabled"])) : i.type === "select" ? (d(), B(x, {
|
|
1417
1507
|
key: 1,
|
|
1418
|
-
modelValue:
|
|
1419
|
-
"onUpdate:modelValue": (v) =>
|
|
1420
|
-
placeholder:
|
|
1508
|
+
modelValue: r.value[i.prop],
|
|
1509
|
+
"onUpdate:modelValue": (v) => r.value[i.prop] = v,
|
|
1510
|
+
placeholder: y(i, "请选择"),
|
|
1421
1511
|
clearable: "",
|
|
1422
|
-
filterable:
|
|
1423
|
-
multiple:
|
|
1424
|
-
"collapse-tags":
|
|
1425
|
-
"collapse-tags-tooltip":
|
|
1426
|
-
disabled:
|
|
1512
|
+
filterable: i.filterable !== !1,
|
|
1513
|
+
multiple: i.multiple,
|
|
1514
|
+
"collapse-tags": i.multiple,
|
|
1515
|
+
"collapse-tags-tooltip": i.multiple,
|
|
1516
|
+
disabled: i.disabled,
|
|
1427
1517
|
class: "common-search__control",
|
|
1428
1518
|
onChange: Y
|
|
1429
1519
|
}, {
|
|
1430
|
-
default:
|
|
1431
|
-
(d(!0),
|
|
1432
|
-
key: `${
|
|
1433
|
-
label:
|
|
1434
|
-
value:
|
|
1520
|
+
default: F(() => [
|
|
1521
|
+
(d(!0), m(Q, null, te(i.options || [], (v, Fe) => (d(), B(w, {
|
|
1522
|
+
key: `${ve(v, i)}-${Fe}`,
|
|
1523
|
+
label: Me(v, i),
|
|
1524
|
+
value: ve(v, i),
|
|
1435
1525
|
disabled: typeof v == "object" && (v == null ? void 0 : v.disabled)
|
|
1436
1526
|
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
1437
1527
|
]),
|
|
1438
1528
|
_: 2
|
|
1439
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) :
|
|
1529
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable", "multiple", "collapse-tags", "collapse-tags-tooltip", "disabled"])) : i.type === "remote-select" || i.type === "remoteSelect" ? (d(), B(x, {
|
|
1440
1530
|
key: 2,
|
|
1441
|
-
modelValue:
|
|
1442
|
-
"onUpdate:modelValue": (v) =>
|
|
1443
|
-
placeholder:
|
|
1531
|
+
modelValue: r.value[i.prop],
|
|
1532
|
+
"onUpdate:modelValue": (v) => r.value[i.prop] = v,
|
|
1533
|
+
placeholder: y(i, "请输入关键词搜索"),
|
|
1444
1534
|
clearable: "",
|
|
1445
1535
|
filterable: "",
|
|
1446
1536
|
remote: "",
|
|
1447
|
-
multiple:
|
|
1448
|
-
"collapse-tags":
|
|
1449
|
-
"collapse-tags-tooltip":
|
|
1537
|
+
multiple: i.multiple,
|
|
1538
|
+
"collapse-tags": i.multiple,
|
|
1539
|
+
"collapse-tags-tooltip": i.multiple,
|
|
1450
1540
|
"reserve-keyword": !1,
|
|
1451
|
-
"remote-method": (v) => st(
|
|
1452
|
-
loading: !!
|
|
1453
|
-
disabled:
|
|
1541
|
+
"remote-method": (v) => st(i, v),
|
|
1542
|
+
loading: !!u[i.prop],
|
|
1543
|
+
disabled: i.disabled,
|
|
1454
1544
|
class: "common-search__control",
|
|
1455
|
-
onClear: (v) => i
|
|
1545
|
+
onClear: (v) => a[i.prop] = [],
|
|
1456
1546
|
onChange: Y
|
|
1457
1547
|
}, {
|
|
1458
|
-
default:
|
|
1459
|
-
(d(!0),
|
|
1460
|
-
key: `${
|
|
1461
|
-
label:
|
|
1462
|
-
value:
|
|
1548
|
+
default: F(() => [
|
|
1549
|
+
(d(!0), m(Q, null, te(a[i.prop] || i.options || [], (v, Fe) => (d(), B(w, {
|
|
1550
|
+
key: `${ve(v, i)}-${Fe}`,
|
|
1551
|
+
label: Me(v, i),
|
|
1552
|
+
value: ve(v, i),
|
|
1463
1553
|
disabled: typeof v == "object" && (v == null ? void 0 : v.disabled)
|
|
1464
1554
|
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
1465
1555
|
]),
|
|
1466
1556
|
_: 2
|
|
1467
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) :
|
|
1557
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip", "remote-method", "loading", "disabled", "onClear"])) : i.type === "number-range" || i.type === "numberRange" ? (d(), m("div", {
|
|
1468
1558
|
key: 3,
|
|
1469
1559
|
class: "common-search__range common-search__range--number",
|
|
1470
|
-
onKeyup:
|
|
1560
|
+
onKeyup: Oe((v) => nt(i), ["enter"])
|
|
1471
1561
|
}, [
|
|
1472
1562
|
S(R, {
|
|
1473
|
-
modelValue:
|
|
1474
|
-
"onUpdate:modelValue": (v) =>
|
|
1563
|
+
modelValue: r.value[i.start || `${i.prop}Min`],
|
|
1564
|
+
"onUpdate:modelValue": (v) => r.value[i.start || `${i.prop}Min`] = v,
|
|
1475
1565
|
controls: !1,
|
|
1476
|
-
min:
|
|
1477
|
-
max:
|
|
1478
|
-
placeholder:
|
|
1479
|
-
disabled:
|
|
1566
|
+
min: i.min,
|
|
1567
|
+
max: i.max,
|
|
1568
|
+
placeholder: M(i, "min"),
|
|
1569
|
+
disabled: i.disabled,
|
|
1480
1570
|
class: "common-search__range-input",
|
|
1481
|
-
onBlur: (v) =>
|
|
1571
|
+
onBlur: (v) => Ue(i)
|
|
1482
1572
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "placeholder", "disabled", "onBlur"]),
|
|
1483
|
-
|
|
1573
|
+
b("span", Cn, T(i.separator || "至"), 1),
|
|
1484
1574
|
S(R, {
|
|
1485
|
-
modelValue:
|
|
1486
|
-
"onUpdate:modelValue": (v) =>
|
|
1575
|
+
modelValue: r.value[i.end || `${i.prop}Max`],
|
|
1576
|
+
"onUpdate:modelValue": (v) => r.value[i.end || `${i.prop}Max`] = v,
|
|
1487
1577
|
controls: !1,
|
|
1488
|
-
min:
|
|
1489
|
-
max:
|
|
1490
|
-
placeholder:
|
|
1491
|
-
disabled:
|
|
1578
|
+
min: i.min,
|
|
1579
|
+
max: i.max,
|
|
1580
|
+
placeholder: M(i, "max"),
|
|
1581
|
+
disabled: i.disabled,
|
|
1492
1582
|
class: "common-search__range-input",
|
|
1493
|
-
onBlur: (v) =>
|
|
1583
|
+
onBlur: (v) => Ue(i)
|
|
1494
1584
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "placeholder", "disabled", "onBlur"]),
|
|
1495
|
-
|
|
1585
|
+
i.clearable !== !1 && lt(i) ? (d(), B(z, {
|
|
1496
1586
|
key: 0,
|
|
1497
1587
|
class: "common-search__range-clear",
|
|
1498
|
-
onMousedown: o[0] || (o[0] =
|
|
1588
|
+
onMousedown: o[0] || (o[0] = we(() => {
|
|
1499
1589
|
}, ["prevent"])),
|
|
1500
|
-
onClick: (v) =>
|
|
1590
|
+
onClick: (v) => rt(i)
|
|
1501
1591
|
}, {
|
|
1502
|
-
default:
|
|
1503
|
-
S(
|
|
1592
|
+
default: F(() => [
|
|
1593
|
+
S(ue(We))
|
|
1504
1594
|
]),
|
|
1505
1595
|
_: 1
|
|
1506
1596
|
}, 8, ["onClick"])) : V("", !0)
|
|
1507
|
-
], 40,
|
|
1597
|
+
], 40, Un)) : i.type === "date" ? (d(), B(K, {
|
|
1508
1598
|
key: 4,
|
|
1509
|
-
modelValue:
|
|
1510
|
-
"onUpdate:modelValue": (v) =>
|
|
1511
|
-
type:
|
|
1512
|
-
placeholder:
|
|
1513
|
-
"value-format":
|
|
1514
|
-
format:
|
|
1515
|
-
clearable:
|
|
1516
|
-
disabled:
|
|
1599
|
+
modelValue: r.value[i.prop],
|
|
1600
|
+
"onUpdate:modelValue": (v) => r.value[i.prop] = v,
|
|
1601
|
+
type: i.dateType || "date",
|
|
1602
|
+
placeholder: y(i, "年/月/日"),
|
|
1603
|
+
"value-format": i.valueFormat || "YYYY-MM-DD",
|
|
1604
|
+
format: i.format || "YYYY/MM/DD",
|
|
1605
|
+
clearable: i.clearable !== !1,
|
|
1606
|
+
disabled: i.disabled,
|
|
1517
1607
|
class: "common-search__control",
|
|
1518
1608
|
onChange: Y
|
|
1519
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) :
|
|
1520
|
-
S(
|
|
1521
|
-
start:
|
|
1522
|
-
"onUpdate:start": (v) =>
|
|
1523
|
-
end:
|
|
1524
|
-
"onUpdate:end": (v) =>
|
|
1525
|
-
title:
|
|
1526
|
-
type:
|
|
1527
|
-
"value-format":
|
|
1528
|
-
format:
|
|
1529
|
-
"show-shortcuts":
|
|
1530
|
-
shortcuts:
|
|
1531
|
-
"can-clearable":
|
|
1609
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "value-format", "format", "clearable", "disabled"])) : i.type === "daterange" || i.type === "dateRange" ? (d(), m("div", Fn, [
|
|
1610
|
+
S(et, {
|
|
1611
|
+
start: r.value[i.start || i.startProp],
|
|
1612
|
+
"onUpdate:start": (v) => r.value[i.start || i.startProp] = v,
|
|
1613
|
+
end: r.value[i.end || i.endProp],
|
|
1614
|
+
"onUpdate:end": (v) => r.value[i.end || i.endProp] = v,
|
|
1615
|
+
title: i.label || i.title || "",
|
|
1616
|
+
type: i.dateType || i.pickerType || "daterange",
|
|
1617
|
+
"value-format": i.valueFormat || "YYYY-MM-DD HH:mm:ss",
|
|
1618
|
+
format: i.format,
|
|
1619
|
+
"show-shortcuts": i.showShortcuts !== !1,
|
|
1620
|
+
shortcuts: i.shortcuts,
|
|
1621
|
+
"can-clearable": i.clearable !== !1,
|
|
1532
1622
|
onChange: Y
|
|
1533
1623
|
}, null, 8, ["start", "onUpdate:start", "end", "onUpdate:end", "title", "type", "value-format", "format", "show-shortcuts", "shortcuts", "can-clearable"])
|
|
1534
|
-
])) :
|
|
1535
|
-
item:
|
|
1536
|
-
form:
|
|
1624
|
+
])) : ie(s.$slots, i.slotName || i.prop, {
|
|
1625
|
+
item: i,
|
|
1626
|
+
form: r.value
|
|
1537
1627
|
}, void 0, !0, 6)
|
|
1538
1628
|
])
|
|
1539
1629
|
]),
|
|
1540
1630
|
_: 2
|
|
1541
1631
|
}, 1032, ["content", "disabled"])
|
|
1542
1632
|
], 6),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1633
|
+
X(ye) ? (d(), m("div", Ln, [
|
|
1634
|
+
b("div", Nn, [
|
|
1635
|
+
ie(s.$slots, "actions", {
|
|
1546
1636
|
search: Y,
|
|
1547
|
-
reset:
|
|
1548
|
-
form:
|
|
1637
|
+
reset: Be,
|
|
1638
|
+
form: r.value
|
|
1549
1639
|
}, () => [
|
|
1550
|
-
S(
|
|
1640
|
+
S(he, {
|
|
1551
1641
|
class: "common-search__reset",
|
|
1552
|
-
onClick:
|
|
1642
|
+
onClick: Be
|
|
1553
1643
|
}, {
|
|
1554
|
-
default:
|
|
1644
|
+
default: F(() => [...o[1] || (o[1] = [
|
|
1555
1645
|
q("重置", -1)
|
|
1556
1646
|
])]),
|
|
1557
1647
|
_: 1
|
|
1558
1648
|
}),
|
|
1559
|
-
S(
|
|
1649
|
+
S(he, {
|
|
1560
1650
|
type: "primary",
|
|
1561
1651
|
class: "common-search__submit",
|
|
1562
1652
|
onClick: Y
|
|
1563
1653
|
}, {
|
|
1564
|
-
default:
|
|
1654
|
+
default: F(() => [...o[2] || (o[2] = [
|
|
1565
1655
|
q(" 搜索 ", -1)
|
|
1566
1656
|
])]),
|
|
1567
1657
|
_: 1
|
|
1568
1658
|
})
|
|
1569
1659
|
], !0),
|
|
1570
|
-
P.value ? (d(),
|
|
1660
|
+
P.value ? (d(), B(he, {
|
|
1571
1661
|
key: 0,
|
|
1572
1662
|
link: "",
|
|
1573
1663
|
type: "primary",
|
|
1574
|
-
onClick:
|
|
1664
|
+
onClick: it
|
|
1575
1665
|
}, {
|
|
1576
|
-
default:
|
|
1577
|
-
q(
|
|
1578
|
-
S(
|
|
1579
|
-
default:
|
|
1580
|
-
|
|
1666
|
+
default: F(() => [
|
|
1667
|
+
q(T(L.value ? "收起" : "展开") + " ", 1),
|
|
1668
|
+
S(z, { class: "el-icon--right" }, {
|
|
1669
|
+
default: F(() => [
|
|
1670
|
+
L.value ? (d(), B(ue(ht), { key: 0 })) : (d(), B(ue(gt), { key: 1 }))
|
|
1581
1671
|
]),
|
|
1582
1672
|
_: 1
|
|
1583
1673
|
})
|
|
@@ -1590,11 +1680,11 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
|
|
|
1590
1680
|
], 4)
|
|
1591
1681
|
])
|
|
1592
1682
|
], 2)), [
|
|
1593
|
-
[
|
|
1683
|
+
[oe, e.itemList.length]
|
|
1594
1684
|
]);
|
|
1595
1685
|
};
|
|
1596
1686
|
}
|
|
1597
|
-
}),
|
|
1687
|
+
}), Rn = /* @__PURE__ */ Z(An, [["__scopeId", "data-v-006c1ace"]]), $n = {
|
|
1598
1688
|
name: "MgOverflowHid",
|
|
1599
1689
|
props: {
|
|
1600
1690
|
label: String,
|
|
@@ -1617,65 +1707,65 @@ const vn = /* @__PURE__ */ ae(rn, [["render", yn], ["__scopeId", "data-v-226ee18
|
|
|
1617
1707
|
return n && n.length > t && (n = n.slice(0, t) + "..."), n;
|
|
1618
1708
|
}
|
|
1619
1709
|
}
|
|
1620
|
-
},
|
|
1621
|
-
function
|
|
1622
|
-
const
|
|
1623
|
-
return d(),
|
|
1624
|
-
n.value && n.value.length > n.maxLength ? (d(),
|
|
1710
|
+
}, Mn = { class: "tableOverflowHid" }, Tn = ["innerHTML"], Pn = { class: "name-wrapper" }, Bn = ["innerHTML"], Vn = { key: 1 }, In = ["innerHTML"];
|
|
1711
|
+
function On(e, t, n, l, r, a) {
|
|
1712
|
+
const u = N("el-popover");
|
|
1713
|
+
return d(), m("div", Mn, [
|
|
1714
|
+
n.value && n.value.length > n.maxLength ? (d(), B(u, {
|
|
1625
1715
|
key: 0,
|
|
1626
1716
|
trigger: "hover",
|
|
1627
1717
|
placement: "bottom",
|
|
1628
1718
|
width: "400"
|
|
1629
1719
|
}, {
|
|
1630
|
-
reference:
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
class:
|
|
1634
|
-
},
|
|
1635
|
-
[
|
|
1720
|
+
reference: F(() => [
|
|
1721
|
+
b("div", Pn, [
|
|
1722
|
+
ae(b("span", {
|
|
1723
|
+
class: j(n.labelClassName)
|
|
1724
|
+
}, T(n.label) + ":", 3), [
|
|
1725
|
+
[oe, n.label]
|
|
1636
1726
|
]),
|
|
1637
|
-
|
|
1638
|
-
class:
|
|
1639
|
-
innerHTML:
|
|
1640
|
-
}, null, 10,
|
|
1727
|
+
b("span", {
|
|
1728
|
+
class: j(n.valueClassName),
|
|
1729
|
+
innerHTML: a.cutString(n.value, n.maxLength)
|
|
1730
|
+
}, null, 10, Bn)
|
|
1641
1731
|
])
|
|
1642
1732
|
]),
|
|
1643
|
-
default:
|
|
1644
|
-
|
|
1645
|
-
class:
|
|
1646
|
-
},
|
|
1647
|
-
[
|
|
1733
|
+
default: F(() => [
|
|
1734
|
+
ae(b("span", {
|
|
1735
|
+
class: j(n.labelClassName)
|
|
1736
|
+
}, T(n.label) + ":", 3), [
|
|
1737
|
+
[oe, n.label]
|
|
1648
1738
|
]),
|
|
1649
|
-
|
|
1739
|
+
b("span", { innerHTML: n.value }, null, 8, Tn)
|
|
1650
1740
|
]),
|
|
1651
1741
|
_: 1
|
|
1652
|
-
})) : (d(),
|
|
1653
|
-
|
|
1654
|
-
class:
|
|
1655
|
-
},
|
|
1656
|
-
[
|
|
1742
|
+
})) : (d(), m("div", Vn, [
|
|
1743
|
+
ae(b("span", {
|
|
1744
|
+
class: j(n.labelClassName)
|
|
1745
|
+
}, T(n.label) + ":", 3), [
|
|
1746
|
+
[oe, n.label]
|
|
1657
1747
|
]),
|
|
1658
|
-
|
|
1659
|
-
class:
|
|
1748
|
+
b("span", {
|
|
1749
|
+
class: j([n.valueClassName, "value"])
|
|
1660
1750
|
}, [
|
|
1661
|
-
|
|
1751
|
+
b("span", { innerHTML: n.value }, null, 8, In)
|
|
1662
1752
|
], 2)
|
|
1663
1753
|
]))
|
|
1664
1754
|
]);
|
|
1665
1755
|
}
|
|
1666
|
-
const
|
|
1756
|
+
const tt = /* @__PURE__ */ Z($n, [["render", On], ["__scopeId", "data-v-ef86ea54"]]), Dn = { key: 0 }, En = { key: 1 }, Hn = {
|
|
1667
1757
|
key: 2,
|
|
1668
1758
|
class: "price-text"
|
|
1669
|
-
},
|
|
1759
|
+
}, zn = {
|
|
1670
1760
|
key: 3,
|
|
1671
1761
|
class: "rate-text"
|
|
1672
|
-
},
|
|
1762
|
+
}, Kn = {
|
|
1673
1763
|
key: 4,
|
|
1674
1764
|
class: "bold-text"
|
|
1675
|
-
},
|
|
1765
|
+
}, jn = {
|
|
1676
1766
|
key: 0,
|
|
1677
1767
|
class: "common-table__pagination"
|
|
1678
|
-
},
|
|
1768
|
+
}, Wn = { class: "common-table__pagination-left" }, Yn = /* @__PURE__ */ Object.assign({ name: "MgDataTable" }, {
|
|
1679
1769
|
__name: "DataTable",
|
|
1680
1770
|
props: {
|
|
1681
1771
|
/** 列配置:el-table-column 属性 + slotName */
|
|
@@ -1748,111 +1838,111 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
|
|
|
1748
1838
|
},
|
|
1749
1839
|
emits: ["pageChange", "cellClick", "edit", "delete", "selectionChange"],
|
|
1750
1840
|
setup(e, { expose: t, emit: n }) {
|
|
1751
|
-
const
|
|
1752
|
-
let
|
|
1753
|
-
const
|
|
1754
|
-
if (
|
|
1755
|
-
return
|
|
1756
|
-
}),
|
|
1841
|
+
const l = e, r = n, a = O(null), u = O(null), U = O(360);
|
|
1842
|
+
let h = null;
|
|
1843
|
+
const C = xe(() => {
|
|
1844
|
+
if (l.fillHeight)
|
|
1845
|
+
return U.value;
|
|
1846
|
+
}), L = {
|
|
1757
1847
|
background: "var(--brand-secondary)",
|
|
1758
1848
|
color: "var(--brand-text-regular)",
|
|
1759
1849
|
fontWeight: 600,
|
|
1760
1850
|
fontSize: "13px"
|
|
1761
|
-
}, P =
|
|
1762
|
-
headerCellStyle:
|
|
1763
|
-
...
|
|
1851
|
+
}, P = xe(() => ({
|
|
1852
|
+
headerCellStyle: L,
|
|
1853
|
+
...l.tableBind
|
|
1764
1854
|
}));
|
|
1765
|
-
function
|
|
1766
|
-
const { slotName:
|
|
1855
|
+
function c(g) {
|
|
1856
|
+
const { slotName: y, headerSlotName: M, maxLength: I, ...X } = g || {};
|
|
1767
1857
|
return {
|
|
1768
|
-
...
|
|
1858
|
+
...X
|
|
1769
1859
|
};
|
|
1770
1860
|
}
|
|
1771
|
-
function
|
|
1772
|
-
return
|
|
1861
|
+
function _(g) {
|
|
1862
|
+
return l.pagination ? (l.pagination.page - 1) * l.pagination.limit + g + 1 : g + 1;
|
|
1773
1863
|
}
|
|
1774
|
-
function
|
|
1775
|
-
if (!
|
|
1776
|
-
const g = Math.max(120, Math.floor(
|
|
1777
|
-
g > 0 && g !==
|
|
1778
|
-
var
|
|
1779
|
-
return (
|
|
1864
|
+
function p() {
|
|
1865
|
+
if (!l.fillHeight || !u.value) return;
|
|
1866
|
+
const g = Math.max(120, Math.floor(u.value.clientHeight) - 2);
|
|
1867
|
+
g > 0 && g !== U.value && (U.value = g, J(() => {
|
|
1868
|
+
var y, M;
|
|
1869
|
+
return (M = (y = a.value) == null ? void 0 : y.doLayout) == null ? void 0 : M.call(y);
|
|
1780
1870
|
}));
|
|
1781
1871
|
}
|
|
1782
|
-
function
|
|
1783
|
-
var
|
|
1784
|
-
|
|
1872
|
+
function A(g) {
|
|
1873
|
+
var y;
|
|
1874
|
+
r("pageChange", { page: (y = l.pagination) == null ? void 0 : y.page, limit: g });
|
|
1785
1875
|
}
|
|
1786
|
-
function
|
|
1787
|
-
var
|
|
1788
|
-
|
|
1876
|
+
function $(g) {
|
|
1877
|
+
var y;
|
|
1878
|
+
r("pageChange", { page: g, limit: (y = l.pagination) == null ? void 0 : y.limit });
|
|
1789
1879
|
}
|
|
1790
|
-
function
|
|
1791
|
-
|
|
1880
|
+
function W(g, y, M, I) {
|
|
1881
|
+
r("cellClick", g, y, M, I), l.canCellClick && (y == null ? void 0 : y.label) !== "操作" && window.getSelection().toString();
|
|
1792
1882
|
}
|
|
1793
|
-
function
|
|
1794
|
-
var
|
|
1795
|
-
if (!
|
|
1796
|
-
const I =
|
|
1797
|
-
(
|
|
1883
|
+
function D(g, y, M) {
|
|
1884
|
+
var X, k, le;
|
|
1885
|
+
if (!l.showSelection || (y == null ? void 0 : y.type) === "selection") return;
|
|
1886
|
+
const I = M == null ? void 0 : M.target;
|
|
1887
|
+
(X = I == null ? void 0 : I.closest) != null && X.call(I, "a, button, .el-button, .el-checkbox, .link-btn, input, textarea") || typeof l.selectable == "function" && !l.selectable(g, 0) || (le = (k = a.value) == null ? void 0 : k.toggleRowSelection) == null || le.call(k, g);
|
|
1798
1888
|
}
|
|
1799
|
-
function
|
|
1800
|
-
|
|
1889
|
+
function pe(g) {
|
|
1890
|
+
r("selectionChange", g);
|
|
1801
1891
|
}
|
|
1802
|
-
function
|
|
1803
|
-
var g,
|
|
1804
|
-
(
|
|
1892
|
+
function fe() {
|
|
1893
|
+
var g, y;
|
|
1894
|
+
(y = (g = a.value) == null ? void 0 : g.clearSelection) == null || y.call(g);
|
|
1805
1895
|
}
|
|
1806
|
-
function
|
|
1807
|
-
var
|
|
1808
|
-
(I = (
|
|
1896
|
+
function me(g, y) {
|
|
1897
|
+
var M, I;
|
|
1898
|
+
(I = (M = a.value) == null ? void 0 : M.toggleRowSelection) == null || I.call(M, g, y);
|
|
1809
1899
|
}
|
|
1810
|
-
return t({ clearSelection:
|
|
1811
|
-
!
|
|
1812
|
-
requestAnimationFrame(
|
|
1813
|
-
}),
|
|
1814
|
-
}),
|
|
1815
|
-
|
|
1816
|
-
}),
|
|
1817
|
-
() =>
|
|
1900
|
+
return t({ clearSelection: fe, toggleRowSelection: me }), Se(() => {
|
|
1901
|
+
!l.fillHeight || !u.value || (p(), h = new ResizeObserver(() => {
|
|
1902
|
+
requestAnimationFrame(p);
|
|
1903
|
+
}), h.observe(u.value));
|
|
1904
|
+
}), Re(() => {
|
|
1905
|
+
h == null || h.disconnect(), h = null;
|
|
1906
|
+
}), ne(
|
|
1907
|
+
() => l.dataList,
|
|
1818
1908
|
() => {
|
|
1819
|
-
|
|
1820
|
-
var g,
|
|
1821
|
-
|
|
1909
|
+
J(() => {
|
|
1910
|
+
var g, y;
|
|
1911
|
+
p(), (y = (g = a.value) == null ? void 0 : g.doLayout) == null || y.call(g);
|
|
1822
1912
|
});
|
|
1823
1913
|
}
|
|
1824
|
-
),
|
|
1825
|
-
() =>
|
|
1914
|
+
), ne(
|
|
1915
|
+
() => l.fillHeight,
|
|
1826
1916
|
(g) => {
|
|
1827
|
-
g &&
|
|
1828
|
-
|
|
1829
|
-
requestAnimationFrame(
|
|
1830
|
-
}),
|
|
1917
|
+
g && J(() => {
|
|
1918
|
+
p(), !h && u.value && (h = new ResizeObserver(() => {
|
|
1919
|
+
requestAnimationFrame(p);
|
|
1920
|
+
}), h.observe(u.value));
|
|
1831
1921
|
});
|
|
1832
1922
|
}
|
|
1833
|
-
), (g,
|
|
1834
|
-
const
|
|
1835
|
-
return d(),
|
|
1836
|
-
class:
|
|
1923
|
+
), (g, y) => {
|
|
1924
|
+
const M = N("el-table-column"), I = N("el-table"), X = N("el-pagination");
|
|
1925
|
+
return d(), m("div", {
|
|
1926
|
+
class: j(["common-table", { "is-fill-height": e.fillHeight }])
|
|
1837
1927
|
}, [
|
|
1838
|
-
|
|
1928
|
+
b("div", {
|
|
1839
1929
|
ref_key: "mainRef",
|
|
1840
|
-
ref:
|
|
1930
|
+
ref: u,
|
|
1841
1931
|
class: "common-table__main"
|
|
1842
1932
|
}, [
|
|
1843
|
-
S(I,
|
|
1933
|
+
S(I, Ne({
|
|
1844
1934
|
ref_key: "tableRef",
|
|
1845
|
-
ref:
|
|
1935
|
+
ref: a,
|
|
1846
1936
|
data: e.dataList,
|
|
1847
|
-
height:
|
|
1937
|
+
height: C.value,
|
|
1848
1938
|
class: { "common-pointer-table": e.canCellClick || e.showSelection }
|
|
1849
1939
|
}, P.value, {
|
|
1850
|
-
onCellClick:
|
|
1851
|
-
onRowClick:
|
|
1852
|
-
onSelectionChange:
|
|
1940
|
+
onCellClick: W,
|
|
1941
|
+
onRowClick: D,
|
|
1942
|
+
onSelectionChange: pe
|
|
1853
1943
|
}), {
|
|
1854
|
-
default:
|
|
1855
|
-
e.showSelection ? (d(),
|
|
1944
|
+
default: F(() => [
|
|
1945
|
+
e.showSelection ? (d(), B(M, {
|
|
1856
1946
|
key: 0,
|
|
1857
1947
|
type: "selection",
|
|
1858
1948
|
width: e.selectionWidth,
|
|
@@ -1860,60 +1950,60 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
|
|
|
1860
1950
|
selectable: e.selectable,
|
|
1861
1951
|
fixed: "left"
|
|
1862
1952
|
}, null, 8, ["width", "selectable"])) : V("", !0),
|
|
1863
|
-
e.showIndex ? (d(),
|
|
1953
|
+
e.showIndex ? (d(), B(M, {
|
|
1864
1954
|
key: 1,
|
|
1865
1955
|
type: "index",
|
|
1866
1956
|
label: e.indexLabel,
|
|
1867
1957
|
width: e.indexWidth,
|
|
1868
|
-
index:
|
|
1958
|
+
index: _,
|
|
1869
1959
|
align: "center"
|
|
1870
1960
|
}, null, 8, ["label", "width"])) : V("", !0),
|
|
1871
|
-
(d(!0),
|
|
1872
|
-
key:
|
|
1873
|
-
}, { ref_for: !0 },
|
|
1874
|
-
|
|
1961
|
+
(d(!0), m(Q, null, te(e.propList, (k, le) => (d(), B(M, Ne({
|
|
1962
|
+
key: k.prop || k.slotName || le
|
|
1963
|
+
}, { ref_for: !0 }, c(k)), Nt({ _: 2 }, [
|
|
1964
|
+
k.headerSlotName ? {
|
|
1875
1965
|
name: "header",
|
|
1876
|
-
fn:
|
|
1877
|
-
|
|
1966
|
+
fn: F(() => [
|
|
1967
|
+
ie(g.$slots, k.headerSlotName, { column: k }, void 0, !0)
|
|
1878
1968
|
]),
|
|
1879
1969
|
key: "0"
|
|
1880
1970
|
} : void 0,
|
|
1881
|
-
|
|
1971
|
+
k.slotName ? {
|
|
1882
1972
|
name: "default",
|
|
1883
|
-
fn:
|
|
1884
|
-
|
|
1885
|
-
S(
|
|
1886
|
-
value: String(
|
|
1887
|
-
"max-length":
|
|
1973
|
+
fn: F((H) => [
|
|
1974
|
+
k.slotName === "overtext" ? (d(), m("div", Dn, [
|
|
1975
|
+
S(tt, {
|
|
1976
|
+
value: String(H.row[k.prop] ?? ""),
|
|
1977
|
+
"max-length": k.maxLength || 18
|
|
1888
1978
|
}, null, 8, ["value", "max-length"])
|
|
1889
|
-
])) :
|
|
1890
|
-
|
|
1891
|
-
class:
|
|
1892
|
-
"whether-yes":
|
|
1893
|
-
"whether-no":
|
|
1979
|
+
])) : k.slotName === "whether" ? (d(), m("div", En, [
|
|
1980
|
+
b("span", {
|
|
1981
|
+
class: j({
|
|
1982
|
+
"whether-yes": H.row[k.prop] == 1,
|
|
1983
|
+
"whether-no": H.row[k.prop] == 0
|
|
1894
1984
|
})
|
|
1895
|
-
},
|
|
1896
|
-
])) :
|
|
1897
|
-
row:
|
|
1898
|
-
index:
|
|
1899
|
-
column:
|
|
1985
|
+
}, T(H.row[k.prop] == 0 ? "否" : H.row[k.prop] == 1 ? "是" : ""), 3)
|
|
1986
|
+
])) : k.slotName === "price" ? (d(), m("div", Hn, T(ue(Xe)(H.row[k.prop], 2)), 1)) : k.slotName === "rate" ? (d(), m("div", zn, T(ue(_t)(H.row[k.prop], 2, "toPercentText")), 1)) : k.slotName === "boldtext" ? (d(), m("div", Kn, T(H.row[k.prop]), 1)) : ie(g.$slots, k.slotName, {
|
|
1987
|
+
row: H.row,
|
|
1988
|
+
index: H.$index,
|
|
1989
|
+
column: k
|
|
1900
1990
|
}, () => [
|
|
1901
|
-
q(
|
|
1991
|
+
q(T(ue(wt)(H.row[k.prop])), 1)
|
|
1902
1992
|
], !0, 5)
|
|
1903
1993
|
]),
|
|
1904
1994
|
key: "1"
|
|
1905
1995
|
} : void 0
|
|
1906
1996
|
]), 1040))), 128)),
|
|
1907
|
-
|
|
1997
|
+
ie(g.$slots, "default", {}, void 0, !0)
|
|
1908
1998
|
]),
|
|
1909
1999
|
_: 3
|
|
1910
2000
|
}, 16, ["data", "height", "class"])
|
|
1911
2001
|
], 512),
|
|
1912
|
-
e.pagination ? (d(),
|
|
1913
|
-
|
|
1914
|
-
|
|
2002
|
+
e.pagination ? (d(), m("div", jn, [
|
|
2003
|
+
b("div", Wn, [
|
|
2004
|
+
ie(g.$slots, "pagination-left", {}, void 0, !0)
|
|
1915
2005
|
]),
|
|
1916
|
-
S(
|
|
2006
|
+
S(X, {
|
|
1917
2007
|
class: "common-table__pagination-right",
|
|
1918
2008
|
background: "",
|
|
1919
2009
|
"current-page": Number(e.pagination.page) || 1,
|
|
@@ -1921,17 +2011,17 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
|
|
|
1921
2011
|
"page-sizes": e.pageSizes,
|
|
1922
2012
|
total: Number(e.pagination.total) || 0,
|
|
1923
2013
|
layout: e.paginationLayout,
|
|
1924
|
-
onSizeChange:
|
|
1925
|
-
onCurrentChange:
|
|
2014
|
+
onSizeChange: A,
|
|
2015
|
+
onCurrentChange: $
|
|
1926
2016
|
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
|
|
1927
2017
|
])) : V("", !0)
|
|
1928
2018
|
], 2);
|
|
1929
2019
|
};
|
|
1930
2020
|
}
|
|
1931
|
-
}),
|
|
2021
|
+
}), qn = /* @__PURE__ */ Z(Yn, [["__scopeId", "data-v-dd7169fd"]]), Gn = ["aria-checked", "disabled", "onClick"], Jn = { class: "segmented__label" }, Xn = {
|
|
1932
2022
|
key: 0,
|
|
1933
2023
|
class: "segmented__badge"
|
|
1934
|
-
},
|
|
2024
|
+
}, Qn = {
|
|
1935
2025
|
__name: "SegmentedControl",
|
|
1936
2026
|
props: {
|
|
1937
2027
|
modelValue: { type: [String, Number, Boolean], default: void 0 },
|
|
@@ -1940,162 +2030,179 @@ const et = /* @__PURE__ */ ae(Nn, [["render", Dn], ["__scopeId", "data-v-ef86ea5
|
|
|
1940
2030
|
},
|
|
1941
2031
|
emits: ["update:modelValue", "change"],
|
|
1942
2032
|
setup(e, { emit: t }) {
|
|
1943
|
-
const n = e,
|
|
2033
|
+
const n = e, l = t, r = O(null), a = O([]), u = O(!1), U = O({
|
|
1944
2034
|
width: "0px",
|
|
1945
2035
|
transform: "translateX(0px)"
|
|
1946
2036
|
});
|
|
1947
|
-
let
|
|
1948
|
-
function
|
|
1949
|
-
return (
|
|
2037
|
+
let h = null;
|
|
2038
|
+
function C(p) {
|
|
2039
|
+
return (p == null ? void 0 : p.count) != null || (p == null ? void 0 : p.badge) != null;
|
|
1950
2040
|
}
|
|
1951
|
-
function
|
|
1952
|
-
return
|
|
2041
|
+
function L(p) {
|
|
2042
|
+
return p.count != null ? p.count : p.badge;
|
|
1953
2043
|
}
|
|
1954
|
-
function P(
|
|
1955
|
-
|
|
2044
|
+
function P(p, A) {
|
|
2045
|
+
p && (a.value[A] = p);
|
|
1956
2046
|
}
|
|
1957
|
-
function
|
|
1958
|
-
const
|
|
1959
|
-
if (!
|
|
1960
|
-
const
|
|
1961
|
-
if (
|
|
1962
|
-
|
|
2047
|
+
function c() {
|
|
2048
|
+
const p = r.value;
|
|
2049
|
+
if (!p) return;
|
|
2050
|
+
const A = n.options.findIndex((pe) => pe.value === n.modelValue), $ = a.value[A];
|
|
2051
|
+
if (!$) {
|
|
2052
|
+
U.value = { width: "0px", transform: "translateX(0px)" };
|
|
1963
2053
|
return;
|
|
1964
2054
|
}
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1967
|
-
width: `${
|
|
1968
|
-
transform: `translateX(${
|
|
1969
|
-
},
|
|
2055
|
+
const W = p.getBoundingClientRect(), D = $.getBoundingClientRect();
|
|
2056
|
+
U.value = {
|
|
2057
|
+
width: `${D.width}px`,
|
|
2058
|
+
transform: `translateX(${D.left - W.left}px)`
|
|
2059
|
+
}, u.value = !0;
|
|
1970
2060
|
}
|
|
1971
|
-
function
|
|
1972
|
-
|
|
2061
|
+
function _(p) {
|
|
2062
|
+
p.disabled || (l("update:modelValue", p.value), l("change", p.value));
|
|
1973
2063
|
}
|
|
1974
|
-
return
|
|
2064
|
+
return ne(
|
|
1975
2065
|
() => [n.modelValue, n.options],
|
|
1976
2066
|
async () => {
|
|
1977
|
-
await
|
|
2067
|
+
await J(), c();
|
|
1978
2068
|
},
|
|
1979
2069
|
{ deep: !0 }
|
|
1980
|
-
),
|
|
1981
|
-
await
|
|
1982
|
-
}),
|
|
1983
|
-
|
|
1984
|
-
}), (
|
|
2070
|
+
), Se(async () => {
|
|
2071
|
+
await J(), c(), typeof ResizeObserver < "u" && r.value && (h = new ResizeObserver(() => c()), h.observe(r.value));
|
|
2072
|
+
}), Re(() => {
|
|
2073
|
+
h == null || h.disconnect(), h = null;
|
|
2074
|
+
}), (p, A) => (d(), m("div", {
|
|
1985
2075
|
ref_key: "rootRef",
|
|
1986
|
-
ref:
|
|
2076
|
+
ref: r,
|
|
1987
2077
|
class: "segmented",
|
|
1988
2078
|
role: "radiogroup"
|
|
1989
2079
|
}, [
|
|
1990
|
-
|
|
1991
|
-
class:
|
|
1992
|
-
style:
|
|
2080
|
+
b("div", {
|
|
2081
|
+
class: j(["segmented__thumb", { "is-ready": u.value }]),
|
|
2082
|
+
style: de(U.value)
|
|
1993
2083
|
}, null, 6),
|
|
1994
|
-
(d(!0),
|
|
1995
|
-
key: String(
|
|
2084
|
+
(d(!0), m(Q, null, te(e.options, ($, W) => (d(), m("button", {
|
|
2085
|
+
key: String($.value),
|
|
1996
2086
|
ref_for: !0,
|
|
1997
|
-
ref: (
|
|
2087
|
+
ref: (D) => P(D, W),
|
|
1998
2088
|
type: "button",
|
|
1999
|
-
class:
|
|
2089
|
+
class: j(["segmented__item", { "is-active": e.modelValue === $.value }]),
|
|
2000
2090
|
role: "radio",
|
|
2001
|
-
"aria-checked": e.modelValue ===
|
|
2002
|
-
disabled:
|
|
2003
|
-
onClick: (
|
|
2091
|
+
"aria-checked": e.modelValue === $.value,
|
|
2092
|
+
disabled: $.disabled,
|
|
2093
|
+
onClick: (D) => _($)
|
|
2004
2094
|
}, [
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
], 10,
|
|
2095
|
+
b("span", Jn, T($.label), 1),
|
|
2096
|
+
C($) ? (d(), m("span", Xn, T(L($)), 1)) : V("", !0)
|
|
2097
|
+
], 10, Gn))), 128))
|
|
2008
2098
|
], 512));
|
|
2009
2099
|
}
|
|
2010
|
-
},
|
|
2011
|
-
function
|
|
2100
|
+
}, Zn = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-b7b0abe9"]]);
|
|
2101
|
+
function el(e) {
|
|
2012
2102
|
return e == null || e === "" ? [] : Array.isArray(e) ? e.map((t) => String(t).trim()).filter(Boolean) : String(e).split(",").map((t) => t.trim()).filter(Boolean);
|
|
2013
2103
|
}
|
|
2014
|
-
function
|
|
2104
|
+
function tl(e) {
|
|
2015
2105
|
if (!e.parentNode) {
|
|
2016
2106
|
e.style.display = "none";
|
|
2017
2107
|
return;
|
|
2018
2108
|
}
|
|
2019
2109
|
if ((typeof e.className == "string" ? e.className : "").includes("el-tab-pane") && e.id) {
|
|
2020
|
-
const n = e.id.split("-")[1],
|
|
2021
|
-
|
|
2110
|
+
const n = e.id.split("-")[1], l = n ? document.getElementById(`tab-${n}`) : null;
|
|
2111
|
+
l && (l.style.display = "none");
|
|
2022
2112
|
}
|
|
2023
2113
|
e.parentNode.removeChild(e);
|
|
2024
2114
|
}
|
|
2025
|
-
function
|
|
2026
|
-
const
|
|
2027
|
-
if (!
|
|
2028
|
-
let
|
|
2029
|
-
|
|
2115
|
+
function Le(e, t, n, l = !1) {
|
|
2116
|
+
const r = el(t.value);
|
|
2117
|
+
if (!r.length) return;
|
|
2118
|
+
let a = Qe(r, n);
|
|
2119
|
+
l && (a = !a), a || tl(e);
|
|
2030
2120
|
}
|
|
2031
|
-
function
|
|
2121
|
+
function nl(e) {
|
|
2032
2122
|
e.directive("hasPermission", {
|
|
2033
2123
|
mounted(t, n) {
|
|
2034
|
-
|
|
2124
|
+
Le(t, n, "and");
|
|
2035
2125
|
}
|
|
2036
2126
|
}), e.directive("hasAnyPermission", {
|
|
2037
2127
|
mounted(t, n) {
|
|
2038
|
-
|
|
2128
|
+
Le(t, n, "or");
|
|
2039
2129
|
}
|
|
2040
2130
|
}), e.directive("hasNoPermission", {
|
|
2041
2131
|
mounted(t, n) {
|
|
2042
|
-
|
|
2132
|
+
Le(t, n, "or", !0);
|
|
2043
2133
|
}
|
|
2044
2134
|
});
|
|
2045
2135
|
}
|
|
2046
|
-
const
|
|
2047
|
-
MgImageUpload:
|
|
2048
|
-
MgFileUpload:
|
|
2049
|
-
MgFilePreview:
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2136
|
+
const ll = {
|
|
2137
|
+
MgImageUpload: Jt,
|
|
2138
|
+
MgFileUpload: mn,
|
|
2139
|
+
MgFilePreview: xt,
|
|
2140
|
+
MgOssImg: wn,
|
|
2141
|
+
MgSearchForm: Rn,
|
|
2142
|
+
MgDataTable: qn,
|
|
2143
|
+
MgDateRangePicker: et,
|
|
2144
|
+
MgSegmentedControl: Zn,
|
|
2145
|
+
MgOverflowHid: tt
|
|
2146
|
+
}, rl = (e, t = {}) => {
|
|
2147
|
+
Object.entries(ll).forEach(([r, a]) => {
|
|
2148
|
+
e.component(a.name || r, a);
|
|
2149
|
+
}), t.ossUrl && St(t.ossUrl), typeof t.getPermissions == "function" && kt(t.getPermissions), nl(e);
|
|
2150
|
+
const n = Ut(t), l = Ct(n);
|
|
2151
|
+
Ft(n), Lt(l), e.config.globalProperties.$request = n, e.config.globalProperties.$api = l, e.config.globalProperties.$hasPermission = Qe;
|
|
2152
|
+
}, cl = {
|
|
2153
|
+
install: rl,
|
|
2063
2154
|
version: "1.2.2"
|
|
2064
2155
|
};
|
|
2065
2156
|
export {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2157
|
+
qn as DataTable,
|
|
2158
|
+
et as DateRangePicker,
|
|
2159
|
+
fl as FILE_PREVIEW_ROUTE_PATH,
|
|
2160
|
+
xt as FilePreview,
|
|
2161
|
+
mn as FileUpload,
|
|
2162
|
+
Jt as ImageUpload,
|
|
2163
|
+
wn as OssImg,
|
|
2164
|
+
Rn as SearchForm,
|
|
2165
|
+
Zn as SegmentedControl,
|
|
2166
|
+
tt as TableOverflowHid,
|
|
2167
|
+
qe as aliOssMixin,
|
|
2168
|
+
Je as batchSign,
|
|
2169
|
+
hl as batchSignOss,
|
|
2170
|
+
gl as buildFilePreviewHref,
|
|
2171
|
+
ml as checkPermission,
|
|
2172
|
+
Ct as createApi,
|
|
2173
|
+
vl as createOssClient,
|
|
2174
|
+
yl as createOssResign,
|
|
2175
|
+
Ut as createRequest,
|
|
2176
|
+
bl as createService,
|
|
2177
|
+
cl as default,
|
|
2178
|
+
ce as extractObjectKey,
|
|
2179
|
+
_l as getApi,
|
|
2180
|
+
wl as getOssSts,
|
|
2181
|
+
xl as getPermissionGetter,
|
|
2182
|
+
Sl as getRequest,
|
|
2183
|
+
kl as getSystemId,
|
|
2184
|
+
Ul as getUploadSign,
|
|
2185
|
+
Cl as getUserId,
|
|
2186
|
+
Qe as hasPermission,
|
|
2187
|
+
rl as install,
|
|
2188
|
+
nl as installPermissionDirectives,
|
|
2189
|
+
bt as isExpiringSoon,
|
|
2190
|
+
E as isHttpUrl,
|
|
2191
|
+
vt as isSignedUrl,
|
|
2192
|
+
Fl as normalizeAttachFile,
|
|
2193
|
+
Ll as openFilePreview,
|
|
2194
|
+
yt as openOssFile,
|
|
2195
|
+
se as parseExpireAtFromUrl,
|
|
2196
|
+
Nl as resolveUploadPreviewUrl,
|
|
2197
|
+
Lt as setApi,
|
|
2198
|
+
St as setDefaultOssUrl,
|
|
2199
|
+
kt as setPermissionGetter,
|
|
2200
|
+
Ft as setRequest,
|
|
2201
|
+
Al as setSystemId,
|
|
2202
|
+
Rl as setUserId,
|
|
2203
|
+
_e as toOssSaveFile,
|
|
2204
|
+
Ve as toOssSaveFiles,
|
|
2205
|
+
be as toOssSaveUrl,
|
|
2206
|
+
Ge as uploadToOss,
|
|
2207
|
+
$l as utils
|
|
2101
2208
|
};
|