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