@skyfox2000/webui 1.4.8 → 1.4.10

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