@skyfox2000/webui 1.5.3 → 1.5.7

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.
Files changed (65) hide show
  1. package/lib/assets/modules/{baseLayout-LU1ysAJM.js → baseLayout-DfTxHOFc.js} +7 -7
  2. package/lib/assets/modules/file-upload-DTOdV5vM.js +211 -0
  3. package/lib/assets/modules/index-BDoBUrYA.js +114 -0
  4. package/lib/assets/modules/{index-C6RrxZBR.js → index-BwMaOrJT.js} +1 -1
  5. package/lib/assets/modules/{index-CHG5bbZG.js → index-M1qERbea.js} +99 -99
  6. package/lib/assets/modules/{menuTabs-Bk8A-zzL.js → menuTabs-DWaBSRNr.js} +42 -42
  7. package/lib/assets/modules/{toolIcon-ADz-Bt4_.js → toolIcon-BYnHhAy-.js} +1 -1
  8. package/lib/assets/modules/upload-template-BKm9mFq8.js +6764 -0
  9. package/lib/assets/modules/uploadList-CHvr6Hp1.js +472 -0
  10. package/lib/es/AceEditor/index.js +3 -3
  11. package/lib/es/BasicLayout/index.js +2 -2
  12. package/lib/es/Error403/index.js +14 -15
  13. package/lib/es/Error404/index.js +16 -17
  14. package/lib/es/ExcelForm/index.js +244 -244
  15. package/lib/es/MenuLayout/index.js +5 -5
  16. package/lib/es/TemplateFile/index.js +53 -54
  17. package/lib/es/UploadForm/index.js +61 -63
  18. package/lib/locales/default.d.ts +287 -103
  19. package/lib/webui.css +1 -1
  20. package/lib/webui.es.js +1440 -1586
  21. package/package.json +1 -1
  22. package/src/components/common/icon/fullscreen.vue +1 -1
  23. package/src/components/content/dialog/excelForm.vue +32 -28
  24. package/src/components/content/dialog/index.vue +3 -3
  25. package/src/components/content/dialog/templateFile.vue +3 -2
  26. package/src/components/content/dialog/uploadForm.vue +5 -4
  27. package/src/components/content/drawer/index.vue +5 -3
  28. package/src/components/content/list/index.vue +2 -1
  29. package/src/components/content/list/listOperate.vue +6 -7
  30. package/src/components/content/search/index.vue +2 -2
  31. package/src/components/content/table/index.vue +2 -1
  32. package/src/components/content/table/tableOperate.vue +8 -9
  33. package/src/components/content/toolbar/icontool.vue +1 -5
  34. package/src/components/content/toolbar/index.vue +4 -5
  35. package/src/components/content/toolpanel/index.vue +20 -20
  36. package/src/components/error/error403.vue +2 -2
  37. package/src/components/error/error404.vue +2 -2
  38. package/src/components/form/input/index.vue +3 -1
  39. package/src/components/form/select/index.vue +3 -2
  40. package/src/components/form/textarea/index.vue +3 -1
  41. package/src/components/form/transfer/index.vue +2 -1
  42. package/src/components/form/upload/uploadList.vue +23 -19
  43. package/src/components/layout/header/headerExits.vue +5 -5
  44. package/src/components/layout/menu/menuTabs.vue +1 -1
  45. package/src/const/options.ts +17 -16
  46. package/src/locales/default.ts +297 -176
  47. package/src/locales/index.ts +12 -4
  48. package/src/stores/appInfo.ts +2 -1
  49. package/src/stores/userInfo.ts +6 -5
  50. package/src/utils/data.ts +9 -8
  51. package/src/utils/download.ts +5 -4
  52. package/src/utils/excel-preview.ts +4 -3
  53. package/src/utils/export-table.ts +7 -6
  54. package/src/utils/file-upload.ts +15 -14
  55. package/src/utils/form-csv.ts +4 -3
  56. package/src/utils/form-excel.ts +14 -13
  57. package/src/utils/form-validate.ts +18 -17
  58. package/src/utils/form.ts +6 -5
  59. package/src/utils/icon-loader.ts +3 -2
  60. package/src/utils/options.ts +2 -1
  61. package/src/utils/tools.ts +18 -17
  62. package/lib/assets/modules/file-upload-BvIYPDBD.js +0 -211
  63. package/lib/assets/modules/index-Bi3hR8Gf.js +0 -114
  64. package/lib/assets/modules/upload-template-mzLL4UUU.js +0 -6462
  65. package/lib/assets/modules/uploadList-DRGJEXDH.js +0 -466
@@ -1,466 +0,0 @@
1
- import { defineComponent as pe, ref as O, computed as $, watch as T, resolveDirective as de, createElementBlock as d, openBlock as c, normalizeClass as z, unref as n, createElementVNode as h, withDirectives as x, createCommentVNode as w, createBlock as V, mergeProps as q, withCtx as v, createVNode as p, createTextVNode as P, toDisplayString as I, Fragment as me, renderList as fe } from "vue";
2
- import { _ as G } from "./index-C6RrxZBR.js";
3
- import { a as B, _ as R } from "./toolIcon-ADz-Bt4_.js";
4
- import { httpPost as K, ResStatus as N } from "@skyfox2000/fapi";
5
- import { L as W, u as X, v as he, _ as ve } from "./upload-template-mzLL4UUU.js";
6
- import { U as i, f as ye, p as H } from "./file-upload-BvIYPDBD.js";
7
- import { combineParams as Y } from "@skyfox2000/microbase";
8
- import _ from "vue-m-message";
9
- import "async-validator";
10
- import "dayjs";
11
- import { Upload as J, Tag as xe, Popconfirm as we, Progress as Ue } from "ant-design-vue";
12
- import "vue-draggable-next";
13
- import { _ as _e } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- const Ce = (u, C) => {
15
- const o = document.createElement("a"), m = URL.createObjectURL(u);
16
- o.href = m, o.download = C, o.style.display = "none", document.body.appendChild(o), o.click(), URL.revokeObjectURL(m), document.body.removeChild(o);
17
- }, be = (u, C, o) => {
18
- try {
19
- o && (u.api || (u.api = o.api), u.authorize === void 0 && (u.authorize = o.authorize));
20
- const m = Y(u.params, C);
21
- return K(u, m).then((r) => {
22
- if ((r == null ? void 0 : r.status) === N.SUCCESS && r.data) {
23
- const s = r.data, b = s.Content, E = s.Key.split("/").pop(), k = atob(b), g = [];
24
- for (let F = 0; F < k.length; F++)
25
- g.push(k.charCodeAt(F));
26
- const U = new Blob([new Uint8Array(g)], {
27
- type: s.Type
28
- });
29
- Ce(U, E);
30
- } else if ((r == null ? void 0 : r.errno) == W) {
31
- X().logout(!1);
32
- return;
33
- } else
34
- _.error("下载文件失败!");
35
- });
36
- } catch (m) {
37
- console.error("下载失败:", m), _.error("文件下载失败,请稍后重试");
38
- }
39
- }, ke = ["xlsx", "xls", "csv", "txt"], Se = (u, C, o) => {
40
- const m = C.split(".").pop();
41
- if (ke.includes(m))
42
- console.log(u);
43
- else
44
- return _.error("文件类型不支持预览"), !1;
45
- const r = Y(u.params, o);
46
- return K(u, r).then((s) => {
47
- if ((s == null ? void 0 : s.status) === N.SUCCESS && s.data) {
48
- const E = s.data.Content, k = atob(E), g = [];
49
- for (let U = 0; U < k.length; U++)
50
- g.push(k.charCodeAt(U));
51
- } else if ((s == null ? void 0 : s.errno) == W) {
52
- X().logout(!1);
53
- return;
54
- } else
55
- _.error("文件预览失败!");
56
- });
57
- }, ge = { class: "flex items-center justify-between w-full" }, Fe = { class: "w-35 mx-3 flex gap-2" }, Pe = { class: "mt-4 px-3" }, Ee = { class: "flex items-center justify-between" }, Le = { class: "flex items-center" }, Oe = ["title"], ze = { class: "flex items-center" }, Ae = {
58
- key: 0,
59
- class: "mr-2"
60
- }, Be = {
61
- key: 1,
62
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
63
- }, $e = ["onClick"], Te = {
64
- key: 2,
65
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
66
- }, Ie = ["onClick"], Re = {
67
- key: 3,
68
- class: "flex items-center text-red-500 hover:text-red-700 cursor-pointer"
69
- }, Ke = ["onClick"], Ne = {
70
- key: 0,
71
- class: "text-sm text-nowrap"
72
- }, je = { key: 0 }, Me = /* @__PURE__ */ pe({
73
- __name: "uploadList",
74
- props: {
75
- autoUpload: { type: Boolean, default: !1 },
76
- uploadUrl: {},
77
- downloadUrl: {},
78
- previewUrl: {},
79
- deleteUrl: {},
80
- fileList: { default: () => [] },
81
- placeholder: { default: "" },
82
- fileExt: {},
83
- maxFileSize: { default: 20 },
84
- maxCount: { default: 5 },
85
- maxCountTip: { type: Boolean, default: !1 },
86
- maxFileSizeTip: { type: Boolean, default: !0 },
87
- fileExtTip: { type: Boolean, default: !0 },
88
- parentPath: {},
89
- showActionText: { type: Boolean, default: !0 },
90
- showOnlineSwitch: { type: Boolean, default: !1 },
91
- showDelete: { type: Boolean, default: !0 },
92
- showFolderUpload: { type: Boolean, default: !1 }
93
- },
94
- emits: ["update:file-list"],
95
- setup(u, { emit: C }) {
96
- const o = u, m = he(), { errInfo: r } = m, s = O(o.fileList), b = O([]), E = O(), k = O(), g = C, U = $(() => {
97
- var e;
98
- return (e = o.fileExt) != null && e.length ? o.fileExt.map((t) => `.${t}`).join(",") : "";
99
- }), F = (e) => {
100
- var t;
101
- if (o.fileExt && o.fileExt.length > 0) {
102
- const l = ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
103
- if (!o.fileExt.includes(l))
104
- return _.error("文件类型不支持"), !1;
105
- }
106
- return e.size / 1024 / 1024 > o.maxFileSize ? (_.error(`文件大小超过 ${o.maxFileSize}MB 限制`), !1) : !0;
107
- }, Z = () => o.maxCount > 1 && s.value.length >= o.maxCount, ee = (e) => {
108
- const t = e;
109
- t.params || (t.params = {});
110
- let l = t.name;
111
- return t.webkitRelativePath && (l = t.webkitRelativePath), t.webkitRelativePath && (t.name = t.webkitRelativePath, t.fileName = t.webkitRelativePath.split("/").pop()), t.params.FileKey = t.name, o.parentPath && (t.params.FileKey = H.join("/", o.parentPath, t.name)), t.status = i.Pending, t.webkitRelativePath && (t.relativePath = l), t;
112
- }, te = (e) => F(e) && o.autoUpload, j = async (e) => {
113
- if (e.length === 0) return;
114
- const t = [...s.value];
115
- let l = !1;
116
- for (const L of e) {
117
- if (!F(L)) {
118
- l = !0;
119
- continue;
120
- }
121
- const S = ee(L);
122
- if (o.maxCount === 1) {
123
- t.length = 0, t.push(S);
124
- break;
125
- }
126
- if (Z()) {
127
- _.error(`最多上传 ${o.maxCount} 个文件`), l = !0;
128
- break;
129
- }
130
- const a = t.findIndex(
131
- (f) => f.name === S.name
132
- );
133
- a > -1 ? t[a] = S : t.push(S);
134
- }
135
- (!l || t.length > 0) && (s.value = t), b.value = [];
136
- }, oe = (e) => {
137
- b.value = e, j(e);
138
- }, ae = $(() => ({
139
- accept: U.value,
140
- multiple: o.maxCount !== 1,
141
- fileList: b.value,
142
- "onUpdate:fileList": oe,
143
- beforeUpload: te,
144
- listType: "text",
145
- showUploadList: !1,
146
- customRequest: async () => {
147
- if (o.autoUpload && o.uploadUrl)
148
- for (const e of s.value)
149
- e.percent === 0 && e.status === i.Pending && await ye(o.uploadUrl, e);
150
- }
151
- })), ne = $(() => ({
152
- accept: U.value,
153
- multiple: !0,
154
- directory: !0,
155
- // 添加标准属性
156
- webkitdirectory: !0,
157
- // Webkit属性
158
- fileList: [],
159
- "onUpdate:fileList": (e) => j(e),
160
- beforeUpload: () => !1,
161
- listType: "text",
162
- showUploadList: !1,
163
- customRequest: () => {
164
- }
165
- }));
166
- T(
167
- () => o.fileList,
168
- (e) => {
169
- s.value = e;
170
- },
171
- { deep: !0, immediate: !0 }
172
- ), T(
173
- () => s.value,
174
- (e) => {
175
- g("update:file-list", e);
176
- },
177
- { deep: !0 }
178
- ), T(
179
- () => o.parentPath,
180
- (e) => {
181
- e && s.value.forEach((t) => {
182
- t.params.FileKey = H.join("/", e, t.fileName);
183
- });
184
- }
185
- );
186
- const M = (e) => {
187
- const t = s.value[e].minioFile, l = {
188
- api: o.downloadUrl.api,
189
- authorize: o.downloadUrl.authorize,
190
- url: o.downloadUrl.url,
191
- params: {
192
- Query: {
193
- FileKey: t.Key
194
- }
195
- }
196
- };
197
- be(l);
198
- }, se = (e) => {
199
- e.minioFile && (e.minioFile.Status = e.status);
200
- }, D = (e) => {
201
- const t = s.value[e].minioFile, l = {
202
- api: o.previewUrl.api,
203
- authorize: o.previewUrl.authorize,
204
- url: o.previewUrl.url,
205
- params: {
206
- Query: {
207
- FileKey: t.Key
208
- }
209
- }
210
- };
211
- Se(l, t.FileName);
212
- }, Q = (e) => {
213
- const t = s.value[e];
214
- o.deleteUrl && t.minioFile && t.minioFile.Key ? K(o.deleteUrl, {
215
- Query: {
216
- FileKey: t.minioFile.Key
217
- }
218
- }).then((l) => {
219
- l && l.status === N.SUCCESS && (_.success("删除文件成功!"), s.value.splice(e, 1));
220
- }) : s.value.splice(e, 1), A.value = -1;
221
- }, A = O(-1), le = (e, t) => {
222
- if (A.value = e, t === i.Pending) {
223
- Q(e);
224
- return;
225
- }
226
- }, ie = (e) => e === A.value, re = () => {
227
- const e = o.fileExt && o.fileExt.length && o.fileExtTip ? `文件必须为 ${o.fileExt.join("/")}` : "", t = o.maxFileSize !== 0 && o.maxFileSizeTip ? `单文件最大 ${o.maxFileSize}MB` : "", l = o.maxCount !== 0 && o.maxCountTip ? `最多 ${o.maxCount} 个文件` : "";
228
- return [t, e, l].filter(Boolean).join(",");
229
- }, ue = (e) => {
230
- switch (e) {
231
- case i.Uploading:
232
- return "blue";
233
- case i.Success:
234
- return "green";
235
- case i.Error:
236
- return "red";
237
- case i.Online:
238
- return "green";
239
- case i.Offline:
240
- return "pink";
241
- default:
242
- return "cyan";
243
- }
244
- }, ce = (e) => {
245
- switch (e) {
246
- case i.Uploading:
247
- return "上传中";
248
- case i.Success:
249
- return "上传完成";
250
- case i.Error:
251
- return "上传失败";
252
- case i.Online:
253
- return "在线";
254
- case i.Offline:
255
- return "已下线";
256
- default:
257
- return "待上传";
258
- }
259
- };
260
- return (e, t) => {
261
- var L, S;
262
- const l = de("auth");
263
- return c(), d("div", {
264
- class: z(["w-full border border-solid border-gray-100 mt-1 rounded-md py-5", [(L = n(r)) == null ? void 0 : L.errClass]])
265
- }, [
266
- h("div", ge, [
267
- h("div", Fe, [
268
- x((c(), V(n(J), q({
269
- ref_key: "fileUploader",
270
- ref: E
271
- }, ae.value), {
272
- default: v(() => {
273
- var a;
274
- return [
275
- p(n(G), {
276
- class: z([((a = n(r)) == null ? void 0 : a.errClass) + "-text"])
277
- }, {
278
- default: v(() => t[1] || (t[1] = [
279
- P("选择文件")
280
- ])),
281
- _: 1,
282
- __: [1]
283
- }, 8, ["class"])
284
- ];
285
- }),
286
- _: 1
287
- }, 16)), [
288
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
289
- ]),
290
- e.showFolderUpload ? x((c(), V(n(J), q({
291
- key: 0,
292
- ref_key: "fileFolderUploader",
293
- ref: k,
294
- webkitdirectory: !0,
295
- directory: !0
296
- }, ne.value), {
297
- default: v(() => {
298
- var a;
299
- return [
300
- p(n(G), {
301
- class: z([((a = n(r)) == null ? void 0 : a.errClass) + "-text"])
302
- }, {
303
- default: v(() => t[2] || (t[2] = [
304
- P("选择目录")
305
- ])),
306
- _: 1,
307
- __: [2]
308
- }, 8, ["class"])
309
- ];
310
- }),
311
- _: 1
312
- }, 16)), [
313
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
314
- ]) : w("", !0)
315
- ]),
316
- h("div", {
317
- class: z(["flex-1 text-sm text-gray-500", [((S = n(r)) == null ? void 0 : S.errClass) + "-text"]])
318
- }, I(re()), 3)
319
- ]),
320
- h("div", Pe, [
321
- (c(!0), d(me, null, fe(s.value, (a, f) => (c(), d("div", {
322
- key: (o.parentPath || "") + (a.relativePath || a.name || f),
323
- class: "mb-2 pb-1"
324
- }, [
325
- h("div", Ee, [
326
- h("div", Le, [
327
- h("span", {
328
- class: z(["text-gray-700 mr-2", [a.status == n(i).Offline ? "line-through" : ""]]),
329
- title: a.relativePath || a.fileName || a.name
330
- }, I(a.fileName ?? a.name), 11, Oe),
331
- h("span", null, [
332
- p(n(xe), {
333
- color: ue(a.status)
334
- }, {
335
- default: v(() => [
336
- P(I(ce(a.status)), 1)
337
- ]),
338
- _: 2
339
- }, 1032, ["color"])
340
- ])
341
- ]),
342
- h("div", ze, [
343
- e.showOnlineSwitch && (a.status == n(i).Online || a.status == n(i).Offline) ? (c(), d("div", Ae, [
344
- p(n(B), { title: "上线或下线" }, {
345
- default: v(() => [
346
- x(p(n(ve), {
347
- checked: a.status,
348
- "onUpdate:checked": (y) => a.status = y,
349
- data: [
350
- { label: "上线", value: n(i).Online },
351
- { label: "下线", value: n(i).Offline }
352
- ],
353
- onChange: (y) => se(a)
354
- }, null, 8, ["checked", "onUpdate:checked", "data", "onChange"]), [
355
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:online" }]
356
- ])
357
- ]),
358
- _: 2
359
- }, 1024)
360
- ])) : w("", !0),
361
- e.downloadUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (c(), d("div", Be, [
362
- p(n(B), { title: "下载" }, {
363
- default: v(() => [
364
- x(p(n(R), {
365
- icon: "icon-download",
366
- clickable: "",
367
- onClick: (y) => M(f)
368
- }, null, 8, ["onClick"]), [
369
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
370
- ]),
371
- e.showActionText ? x((c(), d("span", {
372
- key: 0,
373
- class: "mr-2 text-sm text-nowrap",
374
- onClick: (y) => M(f)
375
- }, t[3] || (t[3] = [
376
- P("下载")
377
- ]), 8, $e)), [
378
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
379
- ]) : w("", !0)
380
- ]),
381
- _: 2
382
- }, 1024)
383
- ])) : w("", !0),
384
- e.previewUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (c(), d("div", Te, [
385
- p(n(B), { title: "预览" }, {
386
- default: v(() => [
387
- x(p(n(R), {
388
- icon: "icon-eye",
389
- clickable: "",
390
- onClick: (y) => D(f)
391
- }, null, 8, ["onClick"]), [
392
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
393
- ]),
394
- e.showActionText ? x((c(), d("span", {
395
- key: 0,
396
- class: "mr-2 text-sm text-nowrap",
397
- onClick: (y) => D(f)
398
- }, t[4] || (t[4] = [
399
- P("预览")
400
- ]), 8, Ie)), [
401
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
402
- ]) : w("", !0)
403
- ]),
404
- _: 2
405
- }, 1024)
406
- ])) : w("", !0),
407
- e.showDelete !== !1 ? (c(), d("div", Re, [
408
- p(n(we), {
409
- open: ie(f),
410
- cancelText: "否",
411
- okText: "是",
412
- title: "确定删除该文件吗?",
413
- okButtonProps: { size: "small" },
414
- cancelButtonProps: { size: "small" },
415
- onConfirm: (y) => Q(f),
416
- onCancel: t[0] || (t[0] = (y) => A.value = -1)
417
- }, {
418
- default: v(() => [
419
- p(n(B), { title: "删除" }, {
420
- default: v(() => [
421
- h("div", {
422
- onClick: (y) => le(f, a.status)
423
- }, [
424
- x(p(n(R), {
425
- icon: "icon-new",
426
- angle: 45,
427
- clickable: ""
428
- }, null, 512), [
429
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
430
- ]),
431
- e.showActionText ? x((c(), d("span", Ne, t[5] || (t[5] = [
432
- P("删除")
433
- ]))), [
434
- [l, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
435
- ]) : w("", !0)
436
- ], 8, Ke)
437
- ]),
438
- _: 2
439
- }, 1024)
440
- ]),
441
- _: 2
442
- }, 1032, ["open", "onConfirm"])
443
- ])) : w("", !0)
444
- ])
445
- ]),
446
- a.status !== n(i).Online && a.status !== n(i).Offline && a.status !== n(i).Success ? (c(), d("div", je, [
447
- p(n(Ue), {
448
- percent: a.percent,
449
- "stroke-width": 2,
450
- "show-info": !1,
451
- style: { height: "2px" }
452
- }, null, 8, ["percent"])
453
- ])) : w("", !0)
454
- ]))), 128))
455
- ])
456
- ], 2);
457
- };
458
- }
459
- }), ot = /* @__PURE__ */ _e(Me, [["__scopeId", "data-v-7ba0982f"]]);
460
- export {
461
- ke as C,
462
- ot as U,
463
- be as a,
464
- Ce as d,
465
- Se as p
466
- };