@skyfox2000/webui 1.4.10 → 1.4.11
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/lib/assets/modules/{file-upload-BefTs4CH.js → file-upload-T2kmeyGd.js} +58 -44
- package/lib/assets/modules/uploadList-B8p45yS2.js +423 -0
- package/lib/es/ExcelForm/index.js +1 -1
- package/lib/es/TemplateFile/index.js +3 -2
- package/lib/es/UploadForm/index.js +2 -2
- package/lib/utils/file-upload.d.ts +2 -1
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +3 -3
- package/package.json +1 -1
- package/src/components/form/upload/uploadList.vue +20 -6
- package/src/utils/file-upload.ts +31 -1
- package/lib/assets/modules/uploadList-BfCPE5Gb.js +0 -420
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
|
-
var m = (n, r,
|
|
3
|
-
var
|
|
2
|
+
var m = (n, r, s) => r in n ? E(n, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[r] = s;
|
|
3
|
+
var d = (n, r, s) => m(n, typeof r != "symbol" ? r + "" : r, s);
|
|
4
4
|
import { hostUrl as w } from "@skyfox2000/fapi";
|
|
5
5
|
import y from "dayjs";
|
|
6
|
-
import
|
|
6
|
+
import f from "vue-m-message";
|
|
7
7
|
import { ad as b, u as g } from "./upload-template-BK8iQQYz.js";
|
|
8
|
-
import { isMicroApp as
|
|
8
|
+
import { isMicroApp as O } from "@skyfox2000/microbase";
|
|
9
9
|
var i = /* @__PURE__ */ ((n) => (n.Pending = "pending", n.Uploading = "uploading", n.Success = "success", n.Error = "error", n.Online = "online", n.Offline = "offline", n))(i || {});
|
|
10
|
-
class
|
|
10
|
+
class x {
|
|
11
11
|
/**
|
|
12
12
|
* 连接路径参数,已判断 undefined 或 null 值
|
|
13
13
|
* @param args 路径参数数组
|
|
14
14
|
* @returns 连接后的路径字符串
|
|
15
15
|
*/
|
|
16
16
|
static join(...r) {
|
|
17
|
-
return r.filter((
|
|
17
|
+
return r.filter((a) => a != null).join("/").replace(/[\/]+/, "/");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
class
|
|
20
|
+
class S {
|
|
21
21
|
/**
|
|
22
22
|
* AsyncUploader 构造函数
|
|
23
23
|
* @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
|
|
24
24
|
* @param maxConcurrent 最大允许并发上传的文件数量
|
|
25
25
|
*/
|
|
26
|
-
constructor(r,
|
|
26
|
+
constructor(r, s = 3) {
|
|
27
27
|
/**
|
|
28
28
|
* 设置 API 端点和最大并发数,所有上传文件通过该类控制
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
d(this, "urlInfo");
|
|
31
31
|
/**
|
|
32
32
|
* 最大并发上传数
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
d(this, "maxConcurrent");
|
|
35
35
|
/**
|
|
36
36
|
* 控制上传任务的中断信号
|
|
37
37
|
*/
|
|
38
|
-
|
|
39
|
-
this.urlInfo = r, this.maxConcurrent =
|
|
38
|
+
d(this, "abortController");
|
|
39
|
+
this.urlInfo = r, this.maxConcurrent = s;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* 执行上传
|
|
@@ -47,17 +47,17 @@ class x {
|
|
|
47
47
|
* @param onProgress 上传进度回调
|
|
48
48
|
* @returns 上传结果
|
|
49
49
|
*/
|
|
50
|
-
async doUpload(r,
|
|
50
|
+
async doUpload(r, s, c, a, e) {
|
|
51
51
|
if (r.length) {
|
|
52
52
|
if (r.length === 0) {
|
|
53
|
-
|
|
53
|
+
f.warning("请选择上传的文件!");
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
s.value = !0, await this.uploadFiles(r, e, (l) => {
|
|
57
57
|
let t = !1, h = 0;
|
|
58
|
-
for (const
|
|
59
|
-
|
|
60
|
-
h ? h < l.length ? c ? (
|
|
58
|
+
for (const o of l)
|
|
59
|
+
o.status === i.Error && h++;
|
|
60
|
+
h ? h < l.length ? c ? (f.error("上传结束,部分文件上传失败!"), f.warning("保存上传成功的文件!"), t = !0) : f.error("上传结束,部分文件上传失败,取消保存!") : f.error("上传结束,所有文件上传失败!") : (f.success("全部文件上传成功!"), t = !0), s.value = !1, a == null || a(t, l);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -67,9 +67,9 @@ class x {
|
|
|
67
67
|
* @param onProgress 上传进度回调
|
|
68
68
|
* @param onComplete 上传完成回调
|
|
69
69
|
*/
|
|
70
|
-
async uploadFiles(r,
|
|
70
|
+
async uploadFiles(r, s, c) {
|
|
71
71
|
if (!r.length) return;
|
|
72
|
-
const
|
|
72
|
+
const a = Math.min(this.maxConcurrent, r.length), e = [];
|
|
73
73
|
for (const t of r)
|
|
74
74
|
switch (t.status) {
|
|
75
75
|
case i.Success:
|
|
@@ -83,15 +83,15 @@ class x {
|
|
|
83
83
|
const l = [];
|
|
84
84
|
this.abortController = new AbortController();
|
|
85
85
|
try {
|
|
86
|
-
for (; l.length <
|
|
86
|
+
for (; l.length < a && e.length > 0; ) {
|
|
87
87
|
const t = e.shift();
|
|
88
88
|
if (!t) break;
|
|
89
|
-
l.push(this.handleFileStatus(t, l, e,
|
|
89
|
+
l.push(this.handleFileStatus(t, l, e, s));
|
|
90
90
|
}
|
|
91
91
|
await Promise.all(l);
|
|
92
92
|
} catch (t) {
|
|
93
93
|
r.forEach((h) => {
|
|
94
|
-
h.status = i.Error, h.error = t instanceof Error ? t : new Error("上传失败"),
|
|
94
|
+
h.status = i.Error, h.error = t instanceof Error ? t : new Error("上传失败"), s == null || s(h);
|
|
95
95
|
});
|
|
96
96
|
} finally {
|
|
97
97
|
c == null || c(r);
|
|
@@ -104,17 +104,17 @@ class x {
|
|
|
104
104
|
* @param pendingFiles 等待上传的文件列表
|
|
105
105
|
* @param onProgress 上传进度回调
|
|
106
106
|
*/
|
|
107
|
-
async handleFileStatus(r,
|
|
107
|
+
async handleFileStatus(r, s, c, a) {
|
|
108
108
|
try {
|
|
109
109
|
await this.uploadFile(r, this.abortController.signal, (e) => {
|
|
110
|
-
r.percent = e,
|
|
110
|
+
r.percent = e, a == null || a(r);
|
|
111
111
|
});
|
|
112
112
|
} catch (e) {
|
|
113
113
|
r.error = e instanceof Error ? e : new Error("上传失败");
|
|
114
114
|
} finally {
|
|
115
115
|
if (c.length > 0) {
|
|
116
116
|
const e = c.shift();
|
|
117
|
-
e &&
|
|
117
|
+
e && s.push(this.handleFileStatus(e, s, c, a));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -124,33 +124,33 @@ class x {
|
|
|
124
124
|
* @param signal 中断信号
|
|
125
125
|
* @param onProgress 上传进度回调
|
|
126
126
|
*/
|
|
127
|
-
async uploadFile(r,
|
|
128
|
-
return r.status = i.Uploading, new Promise(async (
|
|
127
|
+
async uploadFile(r, s, c) {
|
|
128
|
+
return r.status = i.Uploading, new Promise(async (a, e) => {
|
|
129
129
|
const l = new FormData();
|
|
130
130
|
if (l.append("file", r.originFileObj), r.params)
|
|
131
|
-
for (const
|
|
132
|
-
l.append(
|
|
131
|
+
for (const o in r.params)
|
|
132
|
+
l.append(o, r.params[o]);
|
|
133
133
|
const t = new XMLHttpRequest(), h = w(this.urlInfo);
|
|
134
134
|
if (h === !1) return Promise.resolve(r);
|
|
135
|
-
if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([
|
|
136
|
-
t.setRequestHeader(
|
|
135
|
+
if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([o, u]) => {
|
|
136
|
+
t.setRequestHeader(o, u);
|
|
137
137
|
}), this.urlInfo.authorize) {
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
138
|
+
const o = O() ? await b.getToken() : g().getToken();
|
|
139
|
+
if (!o) {
|
|
140
140
|
e(new Error("未授权或授权过期"));
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
t.setRequestHeader("Authorization", "Bearer " +
|
|
143
|
+
t.setRequestHeader("Authorization", "Bearer " + o);
|
|
144
144
|
}
|
|
145
|
-
t.upload.addEventListener("progress", (
|
|
146
|
-
if (
|
|
147
|
-
const u = Math.round(
|
|
145
|
+
t.upload.addEventListener("progress", (o) => {
|
|
146
|
+
if (o.lengthComputable && o.total > 0) {
|
|
147
|
+
const u = Math.round(o.loaded / o.total * 100);
|
|
148
148
|
c(u);
|
|
149
149
|
}
|
|
150
150
|
}), t.addEventListener("load", () => {
|
|
151
151
|
if (t.status >= 200 && t.status < 300) {
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
152
|
+
const o = t.getResponseHeader("Content-Type");
|
|
153
|
+
if (!o || !o.includes("application/json")) {
|
|
154
154
|
e(new Error("返回的结果不是 JSON 格式"));
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
@@ -166,7 +166,7 @@ class x {
|
|
|
166
166
|
Type: r.type,
|
|
167
167
|
UpdateTime: y().format("YYYY-MM-DD HH:mm:ss"),
|
|
168
168
|
Status: i.Success
|
|
169
|
-
}), r.status = i.Success,
|
|
169
|
+
}), r.status = i.Success, a(r);
|
|
170
170
|
else {
|
|
171
171
|
const p = u.msg;
|
|
172
172
|
r.status = i.Error, e(new Error(p));
|
|
@@ -178,7 +178,7 @@ class x {
|
|
|
178
178
|
r.status = i.Error, e(new Error(`上传失败,状态码:${t.status}`));
|
|
179
179
|
}), t.addEventListener("error", () => {
|
|
180
180
|
r.status = i.Error, e(new Error("上传失败,网络异常"));
|
|
181
|
-
}), t.send(l),
|
|
181
|
+
}), t.send(l), s.addEventListener("abort", () => {
|
|
182
182
|
t.abort(), e(new Error("上传已取消"));
|
|
183
183
|
});
|
|
184
184
|
});
|
|
@@ -190,8 +190,22 @@ class x {
|
|
|
190
190
|
this.abortController && this.abortController.abort();
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
const M = async (n, r) => {
|
|
194
|
+
const s = new S(n, 1), c = [r];
|
|
195
|
+
await s.uploadFiles(
|
|
196
|
+
c,
|
|
197
|
+
(a) => {
|
|
198
|
+
r.percent = a.percent;
|
|
199
|
+
},
|
|
200
|
+
(a) => {
|
|
201
|
+
const e = a[0];
|
|
202
|
+
r.percent = e.percent, e.status === i.Success ? (r.status = i.Online, f.success("文件上传成功!")) : (r.status = i.Error, f.error("上传文件失败!"));
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
};
|
|
193
206
|
export {
|
|
194
|
-
|
|
207
|
+
S as A,
|
|
195
208
|
i as U,
|
|
196
|
-
|
|
209
|
+
M as f,
|
|
210
|
+
x as p
|
|
197
211
|
};
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { defineComponent as ae, ref as P, computed as D, watch as B, resolveDirective as ie, createElementBlock as d, openBlock as u, normalizeClass as $, unref as n, createElementVNode as h, withDirectives as y, createBlock as re, mergeProps as le, withCtx as w, createVNode as p, createTextVNode as z, toDisplayString as T, Fragment as ce, renderList as ue, createCommentVNode as C } from "vue";
|
|
2
|
+
import { _ as pe } from "./index-C6BAsERS.js";
|
|
3
|
+
import { a as A, _ as I } from "./toolIcon-DDp0EFRE.js";
|
|
4
|
+
import { httpPost as K, ResStatus as j } from "@skyfox2000/fapi";
|
|
5
|
+
import { L as V, u as q, t as de, _ as me } from "./upload-template-BK8iQQYz.js";
|
|
6
|
+
import { U as i, f as fe, p as Q } from "./file-upload-T2kmeyGd.js";
|
|
7
|
+
import { combineParams as G } from "@skyfox2000/microbase";
|
|
8
|
+
import _ from "vue-m-message";
|
|
9
|
+
import "async-validator";
|
|
10
|
+
import "dayjs";
|
|
11
|
+
import { Upload as he, Tag as ve, Popconfirm as xe, Progress as ye } from "ant-design-vue";
|
|
12
|
+
import "vue-draggable-next";
|
|
13
|
+
import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
|
+
const Ce = (l, U) => {
|
|
15
|
+
const t = document.createElement("a"), m = URL.createObjectURL(l);
|
|
16
|
+
t.href = m, t.download = U, t.style.display = "none", document.body.appendChild(t), t.click(), URL.revokeObjectURL(m), document.body.removeChild(t);
|
|
17
|
+
}, _e = (l, U, t) => {
|
|
18
|
+
try {
|
|
19
|
+
t && (l.api || (l.api = t.api), l.authorize === void 0 && (l.authorize = t.authorize));
|
|
20
|
+
const m = G(l.params, U);
|
|
21
|
+
return K(l, m).then((c) => {
|
|
22
|
+
if ((c == null ? void 0 : c.status) === j.SUCCESS && c.data) {
|
|
23
|
+
const s = c.data, S = s.Content, F = s.Key.split("/").pop(), g = atob(S), k = [];
|
|
24
|
+
for (let E = 0; E < g.length; E++)
|
|
25
|
+
k.push(g.charCodeAt(E));
|
|
26
|
+
const x = new Blob([new Uint8Array(k)], {
|
|
27
|
+
type: s.Type
|
|
28
|
+
});
|
|
29
|
+
Ce(x, F);
|
|
30
|
+
} else if ((c == null ? void 0 : c.errno) == V) {
|
|
31
|
+
q().logout(!1);
|
|
32
|
+
return;
|
|
33
|
+
} else
|
|
34
|
+
_.error("下载文件失败!");
|
|
35
|
+
});
|
|
36
|
+
} catch (m) {
|
|
37
|
+
console.error("下载失败:", m), _.error("文件下载失败,请稍后重试");
|
|
38
|
+
}
|
|
39
|
+
}, Ue = ["xlsx", "xls", "csv", "txt"], Se = (l, U, t) => {
|
|
40
|
+
const m = U.split(".").pop();
|
|
41
|
+
if (Ue.includes(m))
|
|
42
|
+
console.log(l);
|
|
43
|
+
else
|
|
44
|
+
return _.error("文件类型不支持预览"), !1;
|
|
45
|
+
const c = G(l.params, t);
|
|
46
|
+
return K(l, c).then((s) => {
|
|
47
|
+
if ((s == null ? void 0 : s.status) === j.SUCCESS && s.data) {
|
|
48
|
+
const F = s.data.Content, g = atob(F), k = [];
|
|
49
|
+
for (let x = 0; x < g.length; x++)
|
|
50
|
+
k.push(g.charCodeAt(x));
|
|
51
|
+
} else if ((s == null ? void 0 : s.errno) == V) {
|
|
52
|
+
q().logout(!1);
|
|
53
|
+
return;
|
|
54
|
+
} else
|
|
55
|
+
_.error("文件预览失败!");
|
|
56
|
+
});
|
|
57
|
+
}, ge = { class: "flex items-center justify-between w-full" }, be = { class: "w-35 mx-3" }, ke = { class: "mt-4 px-3" }, Fe = { class: "flex items-center justify-between" }, Ee = { class: "flex items-center" }, Oe = { class: "flex items-center" }, ze = {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "mr-2"
|
|
60
|
+
}, Le = {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
|
|
63
|
+
}, Pe = ["onClick"], $e = {
|
|
64
|
+
key: 2,
|
|
65
|
+
class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
|
|
66
|
+
}, Ae = ["onClick"], Be = {
|
|
67
|
+
key: 3,
|
|
68
|
+
class: "flex items-center text-red-500 hover:text-red-700 cursor-pointer"
|
|
69
|
+
}, Te = ["onClick"], Ie = {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: "text-sm text-nowrap"
|
|
72
|
+
}, Ke = { key: 0 }, je = /* @__PURE__ */ ae({
|
|
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: U }) {
|
|
95
|
+
const t = l, m = de(), { errInfo: c } = m, s = P(t.fileList), S = P([]), F = P(), g = U, k = D(() => {
|
|
96
|
+
var e;
|
|
97
|
+
return (e = t.fileExt) != null && e.length ? t.fileExt.map((o) => `.${o}`).join(",") : "";
|
|
98
|
+
}), x = (e) => {
|
|
99
|
+
var o;
|
|
100
|
+
if (t.fileExt && t.fileExt.length > 0) {
|
|
101
|
+
const r = ((o = e.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
|
|
102
|
+
if (!t.fileExt.includes(r))
|
|
103
|
+
return _.error("文件类型不支持"), !1;
|
|
104
|
+
}
|
|
105
|
+
return e.size / 1024 / 1024 > t.maxFileSize ? (_.error(`文件大小超过 ${t.maxFileSize}MB 限制`), !1) : !0;
|
|
106
|
+
}, E = () => t.maxCount > 1 && s.value.length >= t.maxCount, H = (e) => {
|
|
107
|
+
const o = e;
|
|
108
|
+
return o.params || (o.params = {}), o.params.FileKey = o.name, t.parentPath && (o.params.FileKey = Q.join("/", t.parentPath, o.name)), o.status = i.Pending, o;
|
|
109
|
+
}, J = (e) => x(e) && t.autoUpload, W = async (e) => {
|
|
110
|
+
if (e.length === 0) return;
|
|
111
|
+
const o = [...s.value];
|
|
112
|
+
let r = !1;
|
|
113
|
+
for (const O of e) {
|
|
114
|
+
if (!x(O)) {
|
|
115
|
+
r = !0;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const b = H(O);
|
|
119
|
+
if (t.maxCount === 1) {
|
|
120
|
+
o.length = 0, o.push(b);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
if (E()) {
|
|
124
|
+
_.error(`最多上传 ${t.maxCount} 个文件`), r = !0;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
const a = o.findIndex(
|
|
128
|
+
(f) => f.name === b.name
|
|
129
|
+
);
|
|
130
|
+
a > -1 ? o[a] = b : o.push(b);
|
|
131
|
+
}
|
|
132
|
+
(!r || o.length > 0) && (s.value = o), S.value = [];
|
|
133
|
+
}, X = (e) => {
|
|
134
|
+
S.value = e, W(e);
|
|
135
|
+
}, Y = D(() => ({
|
|
136
|
+
accept: k.value,
|
|
137
|
+
multiple: t.maxCount !== 1,
|
|
138
|
+
fileList: S.value,
|
|
139
|
+
"onUpdate:fileList": X,
|
|
140
|
+
beforeUpload: J,
|
|
141
|
+
listType: "text",
|
|
142
|
+
showUploadList: !1,
|
|
143
|
+
customRequest: async () => {
|
|
144
|
+
if (t.autoUpload && t.uploadUrl)
|
|
145
|
+
for (const e of s.value)
|
|
146
|
+
e.percent === 0 && e.status === i.Pending && await fe(t.uploadUrl, e);
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
B(
|
|
150
|
+
() => t.fileList,
|
|
151
|
+
(e) => {
|
|
152
|
+
s.value = e;
|
|
153
|
+
},
|
|
154
|
+
{ deep: !0, immediate: !0 }
|
|
155
|
+
), B(
|
|
156
|
+
() => s.value,
|
|
157
|
+
(e) => {
|
|
158
|
+
g("update:file-list", e);
|
|
159
|
+
},
|
|
160
|
+
{ deep: !0 }
|
|
161
|
+
), B(
|
|
162
|
+
() => t.parentPath,
|
|
163
|
+
(e) => {
|
|
164
|
+
e && s.value.forEach((o) => {
|
|
165
|
+
o.params.FileKey = Q.join("/", e, o.fileName);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
const M = (e) => {
|
|
170
|
+
const o = s.value[e].minioFile, r = {
|
|
171
|
+
api: t.downloadUrl.api,
|
|
172
|
+
authorize: t.downloadUrl.authorize,
|
|
173
|
+
url: t.downloadUrl.url,
|
|
174
|
+
params: {
|
|
175
|
+
Query: {
|
|
176
|
+
FileKey: o.Key
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
_e(r);
|
|
181
|
+
}, Z = (e) => {
|
|
182
|
+
e.minioFile && (e.minioFile.Status = e.status);
|
|
183
|
+
}, N = (e) => {
|
|
184
|
+
const o = s.value[e].minioFile, r = {
|
|
185
|
+
api: t.previewUrl.api,
|
|
186
|
+
authorize: t.previewUrl.authorize,
|
|
187
|
+
url: t.previewUrl.url,
|
|
188
|
+
params: {
|
|
189
|
+
Query: {
|
|
190
|
+
FileKey: o.Key
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
Se(r, o.FileName);
|
|
195
|
+
}, R = (e) => {
|
|
196
|
+
const o = s.value[e];
|
|
197
|
+
t.deleteUrl && o.minioFile && o.minioFile.Key ? K(t.deleteUrl, {
|
|
198
|
+
Query: {
|
|
199
|
+
FileKey: o.minioFile.Key
|
|
200
|
+
}
|
|
201
|
+
}).then((r) => {
|
|
202
|
+
r && r.status === j.SUCCESS && (_.success("删除文件成功!"), s.value.splice(e, 1));
|
|
203
|
+
}) : s.value.splice(e, 1), L.value = -1;
|
|
204
|
+
}, L = P(-1), ee = (e, o) => {
|
|
205
|
+
if (L.value = e, o === i.Pending) {
|
|
206
|
+
R(e);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
}, te = (e) => e === L.value, oe = () => {
|
|
210
|
+
const e = t.fileExt && t.fileExt.length && t.fileExtTip ? `文件必须为 ${t.fileExt.join("/")}` : "", o = t.maxFileSize !== 0 && t.maxFileSizeTip ? `单文件最大 ${t.maxFileSize}MB` : "", r = t.maxCount !== 0 && t.maxCountTip ? `最多 ${t.maxCount} 个文件` : "";
|
|
211
|
+
return [o, e, r].filter(Boolean).join(",");
|
|
212
|
+
}, ne = (e) => {
|
|
213
|
+
switch (e) {
|
|
214
|
+
case i.Uploading:
|
|
215
|
+
return "blue";
|
|
216
|
+
case i.Success:
|
|
217
|
+
return "green";
|
|
218
|
+
case i.Error:
|
|
219
|
+
return "red";
|
|
220
|
+
case i.Online:
|
|
221
|
+
return "green";
|
|
222
|
+
case i.Offline:
|
|
223
|
+
return "pink";
|
|
224
|
+
default:
|
|
225
|
+
return "cyan";
|
|
226
|
+
}
|
|
227
|
+
}, se = (e) => {
|
|
228
|
+
switch (e) {
|
|
229
|
+
case i.Uploading:
|
|
230
|
+
return "上传中";
|
|
231
|
+
case i.Success:
|
|
232
|
+
return "上传完成";
|
|
233
|
+
case i.Error:
|
|
234
|
+
return "上传失败";
|
|
235
|
+
case i.Online:
|
|
236
|
+
return "在线";
|
|
237
|
+
case i.Offline:
|
|
238
|
+
return "已下线";
|
|
239
|
+
default:
|
|
240
|
+
return "待上传";
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return (e, o) => {
|
|
244
|
+
var O, b;
|
|
245
|
+
const r = ie("auth");
|
|
246
|
+
return u(), d("div", {
|
|
247
|
+
class: $(["w-full border border-solid border-gray-100 mt-1 rounded-md py-5", [(O = n(c)) == null ? void 0 : O.errClass]])
|
|
248
|
+
}, [
|
|
249
|
+
h("div", ge, [
|
|
250
|
+
h("div", be, [
|
|
251
|
+
y((u(), re(n(he), le({
|
|
252
|
+
ref_key: "fileUploader",
|
|
253
|
+
ref: F
|
|
254
|
+
}, Y.value), {
|
|
255
|
+
default: w(() => {
|
|
256
|
+
var a;
|
|
257
|
+
return [
|
|
258
|
+
p(n(pe), {
|
|
259
|
+
class: $([((a = n(c)) == null ? void 0 : a.errClass) + "-text"])
|
|
260
|
+
}, {
|
|
261
|
+
default: w(() => o[1] || (o[1] = [
|
|
262
|
+
z("选择文件")
|
|
263
|
+
])),
|
|
264
|
+
_: 1,
|
|
265
|
+
__: [1]
|
|
266
|
+
}, 8, ["class"])
|
|
267
|
+
];
|
|
268
|
+
}),
|
|
269
|
+
_: 1
|
|
270
|
+
}, 16)), [
|
|
271
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
|
|
272
|
+
])
|
|
273
|
+
]),
|
|
274
|
+
h("div", {
|
|
275
|
+
class: $(["flex-1 text-sm text-gray-500", [((b = n(c)) == null ? void 0 : b.errClass) + "-text"]])
|
|
276
|
+
}, T(oe()), 3)
|
|
277
|
+
]),
|
|
278
|
+
h("div", ke, [
|
|
279
|
+
(u(!0), d(ce, null, ue(s.value, (a, f) => (u(), d("div", {
|
|
280
|
+
key: f,
|
|
281
|
+
class: "mb-2 pb-1"
|
|
282
|
+
}, [
|
|
283
|
+
h("div", Fe, [
|
|
284
|
+
h("div", Ee, [
|
|
285
|
+
h("span", {
|
|
286
|
+
class: $(["text-gray-700 mr-2", [a.status == n(i).Offline ? "line-through" : ""]])
|
|
287
|
+
}, T(a.fileName ?? a.name), 3),
|
|
288
|
+
h("span", null, [
|
|
289
|
+
p(n(ve), {
|
|
290
|
+
color: ne(a.status)
|
|
291
|
+
}, {
|
|
292
|
+
default: w(() => [
|
|
293
|
+
z(T(se(a.status)), 1)
|
|
294
|
+
]),
|
|
295
|
+
_: 2
|
|
296
|
+
}, 1032, ["color"])
|
|
297
|
+
])
|
|
298
|
+
]),
|
|
299
|
+
h("div", Oe, [
|
|
300
|
+
e.showOnlineSwitch && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", ze, [
|
|
301
|
+
p(n(A), { title: "上线或下线" }, {
|
|
302
|
+
default: w(() => [
|
|
303
|
+
y(p(n(me), {
|
|
304
|
+
checked: a.status,
|
|
305
|
+
"onUpdate:checked": (v) => a.status = v,
|
|
306
|
+
data: [
|
|
307
|
+
{ label: "上线", value: n(i).Online },
|
|
308
|
+
{ label: "下线", value: n(i).Offline }
|
|
309
|
+
],
|
|
310
|
+
onChange: (v) => Z(a)
|
|
311
|
+
}, null, 8, ["checked", "onUpdate:checked", "data", "onChange"]), [
|
|
312
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:online" }]
|
|
313
|
+
])
|
|
314
|
+
]),
|
|
315
|
+
_: 2
|
|
316
|
+
}, 1024)
|
|
317
|
+
])) : C("", !0),
|
|
318
|
+
e.downloadUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", Le, [
|
|
319
|
+
p(n(A), { title: "下载" }, {
|
|
320
|
+
default: w(() => [
|
|
321
|
+
y(p(n(I), {
|
|
322
|
+
icon: "icon-download",
|
|
323
|
+
clickable: "",
|
|
324
|
+
onClick: (v) => M(f)
|
|
325
|
+
}, null, 8, ["onClick"]), [
|
|
326
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
|
|
327
|
+
]),
|
|
328
|
+
e.showActionText ? y((u(), d("span", {
|
|
329
|
+
key: 0,
|
|
330
|
+
class: "mr-2 text-sm text-nowrap",
|
|
331
|
+
onClick: (v) => M(f)
|
|
332
|
+
}, o[2] || (o[2] = [
|
|
333
|
+
z("下载")
|
|
334
|
+
]), 8, Pe)), [
|
|
335
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
|
|
336
|
+
]) : C("", !0)
|
|
337
|
+
]),
|
|
338
|
+
_: 2
|
|
339
|
+
}, 1024)
|
|
340
|
+
])) : C("", !0),
|
|
341
|
+
e.previewUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", $e, [
|
|
342
|
+
p(n(A), { title: "预览" }, {
|
|
343
|
+
default: w(() => [
|
|
344
|
+
y(p(n(I), {
|
|
345
|
+
icon: "icon-eye",
|
|
346
|
+
clickable: "",
|
|
347
|
+
onClick: (v) => N(f)
|
|
348
|
+
}, null, 8, ["onClick"]), [
|
|
349
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
|
|
350
|
+
]),
|
|
351
|
+
e.showActionText ? y((u(), d("span", {
|
|
352
|
+
key: 0,
|
|
353
|
+
class: "mr-2 text-sm text-nowrap",
|
|
354
|
+
onClick: (v) => N(f)
|
|
355
|
+
}, o[3] || (o[3] = [
|
|
356
|
+
z("预览")
|
|
357
|
+
]), 8, Ae)), [
|
|
358
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
|
|
359
|
+
]) : C("", !0)
|
|
360
|
+
]),
|
|
361
|
+
_: 2
|
|
362
|
+
}, 1024)
|
|
363
|
+
])) : C("", !0),
|
|
364
|
+
e.showDelete !== !1 ? (u(), d("div", Be, [
|
|
365
|
+
p(n(xe), {
|
|
366
|
+
open: te(f),
|
|
367
|
+
cancelText: "否",
|
|
368
|
+
okText: "是",
|
|
369
|
+
title: "确定删除该文件吗?",
|
|
370
|
+
okButtonProps: { size: "small" },
|
|
371
|
+
cancelButtonProps: { size: "small" },
|
|
372
|
+
onConfirm: (v) => R(f),
|
|
373
|
+
onCancel: o[0] || (o[0] = (v) => L.value = -1)
|
|
374
|
+
}, {
|
|
375
|
+
default: w(() => [
|
|
376
|
+
p(n(A), { title: "删除" }, {
|
|
377
|
+
default: w(() => [
|
|
378
|
+
h("div", {
|
|
379
|
+
onClick: (v) => ee(f, a.status)
|
|
380
|
+
}, [
|
|
381
|
+
y(p(n(I), {
|
|
382
|
+
icon: "icon-new",
|
|
383
|
+
angle: 45,
|
|
384
|
+
clickable: ""
|
|
385
|
+
}, null, 512), [
|
|
386
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
|
|
387
|
+
]),
|
|
388
|
+
e.showActionText ? y((u(), d("span", Ie, o[4] || (o[4] = [
|
|
389
|
+
z("删除")
|
|
390
|
+
]))), [
|
|
391
|
+
[r, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
|
|
392
|
+
]) : C("", !0)
|
|
393
|
+
], 8, Te)
|
|
394
|
+
]),
|
|
395
|
+
_: 2
|
|
396
|
+
}, 1024)
|
|
397
|
+
]),
|
|
398
|
+
_: 2
|
|
399
|
+
}, 1032, ["open", "onConfirm"])
|
|
400
|
+
])) : C("", !0)
|
|
401
|
+
])
|
|
402
|
+
]),
|
|
403
|
+
a.status !== n(i).Online && a.status !== n(i).Offline && a.status !== n(i).Success ? (u(), d("div", Ke, [
|
|
404
|
+
p(n(ye), {
|
|
405
|
+
percent: a.percent,
|
|
406
|
+
"stroke-width": 2,
|
|
407
|
+
"show-info": !1,
|
|
408
|
+
style: { height: "2px" }
|
|
409
|
+
}, null, 8, ["percent"])
|
|
410
|
+
])) : C("", !0)
|
|
411
|
+
]))), 128))
|
|
412
|
+
])
|
|
413
|
+
], 2);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}), Ze = /* @__PURE__ */ we(je, [["__scopeId", "data-v-063bdf08"]]);
|
|
417
|
+
export {
|
|
418
|
+
Ue as C,
|
|
419
|
+
Ze as U,
|
|
420
|
+
_e as a,
|
|
421
|
+
Ce as d,
|
|
422
|
+
Se as p
|
|
423
|
+
};
|
|
@@ -3,7 +3,7 @@ import { _ as Y } from "../../assets/modules/index-C6BAsERS.js";
|
|
|
3
3
|
import { Modal as Fe, Upload as ue, Space as _e } from "ant-design-vue";
|
|
4
4
|
import { httpGet as Ue, ResStatus as fe } from "@skyfox2000/fapi";
|
|
5
5
|
import { F as Te, a3 as Se, a9 as Ee } from "../../assets/modules/upload-template-BK8iQQYz.js";
|
|
6
|
-
import { A as Re, p as De, U as ce } from "../../assets/modules/file-upload-
|
|
6
|
+
import { A as Re, p as De, U as ce } from "../../assets/modules/file-upload-T2kmeyGd.js";
|
|
7
7
|
import "@skyfox2000/microbase";
|
|
8
8
|
import p from "vue-m-message";
|
|
9
9
|
import { c as ke, _ as Z, h as Le, p as Ne, i as Ke } from "../../assets/modules/index-DkMjvF98.js";
|
|
@@ -3,13 +3,13 @@ import { _ as L } from "../../assets/modules/index-C6BAsERS.js";
|
|
|
3
3
|
import { Modal as z, Space as D } from "ant-design-vue";
|
|
4
4
|
import { httpPost as N, ResStatus as O } from "@skyfox2000/fapi";
|
|
5
5
|
import { aj as d } from "../../assets/modules/upload-template-BK8iQQYz.js";
|
|
6
|
-
import { U as b } from "../../assets/modules/file-upload-
|
|
6
|
+
import { U as b } from "../../assets/modules/file-upload-T2kmeyGd.js";
|
|
7
7
|
import "@skyfox2000/microbase";
|
|
8
8
|
import "vue-m-message";
|
|
9
9
|
import "async-validator";
|
|
10
10
|
import "dayjs";
|
|
11
11
|
import "vue-draggable-next";
|
|
12
|
-
import { U as j } from "../../assets/modules/uploadList-
|
|
12
|
+
import { U as j } from "../../assets/modules/uploadList-B8p45yS2.js";
|
|
13
13
|
const _ = /* @__PURE__ */ x({
|
|
14
14
|
__name: "templateFile",
|
|
15
15
|
props: {
|
|
@@ -161,6 +161,7 @@ const _ = /* @__PURE__ */ x({
|
|
|
161
161
|
f(j, {
|
|
162
162
|
"file-list": n.value,
|
|
163
163
|
"onUpdate:fileList": l[0] || (l[0] = (i) => n.value = i),
|
|
164
|
+
"auto-upload": "",
|
|
164
165
|
"parent-path": a.templateType,
|
|
165
166
|
"upload-url": c.value,
|
|
166
167
|
"download-url": v.value,
|