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