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