@skyfox2000/webui 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/modules/{file-upload-BVB9c-eZ.js → file-upload-BBlFaIXB.js} +1 -1
- package/lib/assets/modules/index-4kDAt8nS.js +333 -0
- package/lib/assets/modules/{index-CaaMz5sz.js → index-BG1SqSVl.js} +1 -1
- package/lib/assets/modules/{index-k_AnrbPY.js → index-m5rogIyM.js} +2 -2
- package/lib/assets/modules/{menuTabs-_Ph7P8ES.js → menuTabs-tPIz4a89.js} +2 -2
- package/lib/assets/modules/{toolIcon-QMXCkImG.js → toolIcon-DwWoD9TN.js} +1 -1
- package/lib/assets/modules/{uploadList-D-FOtndj.js → uploadList-D_Z-Y2tw.js} +482 -508
- package/lib/assets/modules/uploadList-Da7mQUNK.js +382 -0
- package/lib/components/form/autoComplete/index.vue.d.ts +10 -48
- package/lib/components/form/upload/uploadList.vue.d.ts +1 -0
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +3 -3
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +332 -202
- package/lib/es/UploadForm/index.js +4 -4
- package/lib/index.d.ts +4 -3
- package/lib/utils/download.d.ts +2 -0
- package/lib/utils/excel-view.d.ts +25 -0
- package/lib/utils/form-csv.d.ts +18 -0
- package/lib/utils/form-excel.d.ts +2 -13
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +773 -742
- package/package.json +2 -2
- package/src/components/common/loading/index.vue +1 -1
- package/src/components/content/dialog/excelForm.vue +384 -106
- package/src/components/content/table/index.vue +22 -10
- package/src/components/form/autoComplete/index.vue +29 -60
- package/src/components/form/upload/uploadList.vue +50 -11
- package/src/index.ts +26 -3
- package/src/utils/download.ts +31 -0
- package/src/utils/excel-view.ts +340 -0
- package/src/utils/form-csv.ts +55 -0
- package/src/utils/form-excel.ts +59 -192
- package/src/utils/options.ts +0 -1
- package/vite.config.ts +0 -1
- package/lib/assets/modules/form-excel-CsQBtfkA.js +0 -235
- package/lib/assets/modules/uploadList-CXa3siDj.js +0 -327
package/vite.config.ts
CHANGED
|
@@ -47,7 +47,6 @@ export default defineConfig(({ mode }: ConfigEnv) => {
|
|
|
47
47
|
'@': path.resolve('./src'),
|
|
48
48
|
'@skyfox2000/fapi': path.resolve('../502417_fapi'),
|
|
49
49
|
'@skyfox2000/microbase': path.resolve('../502424_MicroBase'),
|
|
50
|
-
'@skyfox2000/webbase': path.resolve('../502428_WebBase'),
|
|
51
50
|
},
|
|
52
51
|
extensions: ['.js', '.ts', '.vue', 'json'],
|
|
53
52
|
},
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import k from "async-validator";
|
|
2
|
-
import { httpPost as J, ResStatus as C } from "@skyfox2000/fapi";
|
|
3
|
-
import { i as N, ag as R } from "./uploadList-D-FOtndj.js";
|
|
4
|
-
import E from "vue-m-message";
|
|
5
|
-
const F = async (d) => {
|
|
6
|
-
const o = await import("exceljs"), g = new o.default.Workbook();
|
|
7
|
-
await g.xlsx.load(d);
|
|
8
|
-
const c = g.worksheets[0];
|
|
9
|
-
if (!c)
|
|
10
|
-
return E.error("Excel文件不包含工作表"), null;
|
|
11
|
-
const s = [], h = [], i = [];
|
|
12
|
-
return c.getRow(1).eachCell((e) => {
|
|
13
|
-
let r = "";
|
|
14
|
-
if (e.value !== null && e.value !== void 0)
|
|
15
|
-
if (typeof e.value == "object")
|
|
16
|
-
if ("richText" in e.value && Array.isArray(e.value.richText))
|
|
17
|
-
r = e.value.richText.map((a) => a.text || "").join("");
|
|
18
|
-
else if ("text" in e.value && typeof e.value.text == "string")
|
|
19
|
-
r = e.value.text;
|
|
20
|
-
else if (e.value instanceof Date)
|
|
21
|
-
r = e.value.toLocaleDateString();
|
|
22
|
-
else
|
|
23
|
-
try {
|
|
24
|
-
r = JSON.stringify(e.value);
|
|
25
|
-
} catch {
|
|
26
|
-
r = String(e.value);
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
r = String(e.value);
|
|
30
|
-
s.push(r);
|
|
31
|
-
}), c.eachRow((e, r) => {
|
|
32
|
-
if (r > 1) {
|
|
33
|
-
const a = {}, n = [];
|
|
34
|
-
s.forEach((l, y) => {
|
|
35
|
-
if (l) {
|
|
36
|
-
const m = e.getCell(y + 1).value;
|
|
37
|
-
m != null ? typeof m == "object" ? "richText" in m && Array.isArray(m.richText) ? a[l] = m.richText.map((O) => O.text || "").join("") : "text" in m && typeof m.text == "string" ? a[l] = m.text : (m instanceof Date, a[l] = m) : a[l] = m : a[l] = null, n.push(a[l]);
|
|
38
|
-
}
|
|
39
|
-
}), h.push(a), i.push(n);
|
|
40
|
-
}
|
|
41
|
-
}), { workbook: g, worksheet: c, headers: s, excelData: h, excelRows: i };
|
|
42
|
-
}, b = async (d, o) => {
|
|
43
|
-
const g = await import("exceljs"), c = await F(d);
|
|
44
|
-
if (!c) return { hasError: !0 };
|
|
45
|
-
const { worksheet: s, headers: h } = c, { markCells: i, markHeaders: e } = o;
|
|
46
|
-
if (i.length === 0 && (!e || e.length === 0))
|
|
47
|
-
return { hasError: !1 };
|
|
48
|
-
const r = [...h];
|
|
49
|
-
e && e.length > 0 && e.forEach((f) => {
|
|
50
|
-
r.includes(f) || r.push(f);
|
|
51
|
-
});
|
|
52
|
-
const a = new g.default.Workbook(), n = a.addWorksheet("Sheet1"), l = 15, y = /* @__PURE__ */ new Map();
|
|
53
|
-
i.forEach(({ row: f, col: p, color: u }) => {
|
|
54
|
-
const v = `${f}-${p}`;
|
|
55
|
-
y.set(v, u || "FFFF0000");
|
|
56
|
-
});
|
|
57
|
-
for (let f = 0; f < r.length; f++) {
|
|
58
|
-
const p = n.getColumn(f + 1);
|
|
59
|
-
if (f < s.columnCount && f < h.length) {
|
|
60
|
-
const u = s.getColumn(f + 1);
|
|
61
|
-
u && u.width ? p.width = u.width : p.width = l;
|
|
62
|
-
} else
|
|
63
|
-
p.width = l;
|
|
64
|
-
}
|
|
65
|
-
const x = n.getRow(1);
|
|
66
|
-
r.forEach((f, p) => {
|
|
67
|
-
const u = x.getCell(p + 1);
|
|
68
|
-
u.value = f;
|
|
69
|
-
const v = p < h.length;
|
|
70
|
-
if (v && p < s.columnCount) {
|
|
71
|
-
const t = s.getRow(1).getCell(p + 1);
|
|
72
|
-
t.style && (u.style = JSON.parse(JSON.stringify(t.style))), t.font && (u.font = JSON.parse(JSON.stringify(t.font))), t.alignment && (u.alignment = JSON.parse(JSON.stringify(t.alignment))), t.border && (u.border = JSON.parse(JSON.stringify(t.border))), t.numFmt && (u.numFmt = t.numFmt), t.fill && (u.fill = JSON.parse(JSON.stringify(t.fill)));
|
|
73
|
-
}
|
|
74
|
-
e && e.includes(f) && !v && (u.fill = {
|
|
75
|
-
type: "pattern",
|
|
76
|
-
pattern: "solid",
|
|
77
|
-
fgColor: { argb: "FFFF0000" }
|
|
78
|
-
// 红色背景
|
|
79
|
-
}, u.font = {
|
|
80
|
-
name: "Arial",
|
|
81
|
-
size: 10,
|
|
82
|
-
bold: !0,
|
|
83
|
-
color: { argb: "FFFFFFFF" }
|
|
84
|
-
// 白色文字
|
|
85
|
-
});
|
|
86
|
-
}), x.commit(), s.eachRow((f, p) => {
|
|
87
|
-
if (p > 1) {
|
|
88
|
-
const u = n.getRow(p);
|
|
89
|
-
for (let v = 0; v < r.length; v++) {
|
|
90
|
-
const t = u.getCell(v + 1);
|
|
91
|
-
if (v < h.length && v < s.columnCount) {
|
|
92
|
-
const w = f.getCell(v + 1);
|
|
93
|
-
if (t.value = w.value, t.value !== null && t.value !== void 0 && typeof t.value == "object" && !("richText" in t.value) && !("formula" in t.value) && !("hyperlink" in t.value) && !(t.value instanceof Date))
|
|
94
|
-
try {
|
|
95
|
-
"text" in t.value && typeof t.value.text == "string" ? t.value = t.value.text : t.value = JSON.stringify(t.value);
|
|
96
|
-
} catch {
|
|
97
|
-
t.value = String(t.value);
|
|
98
|
-
}
|
|
99
|
-
w.style && (t.style = JSON.parse(JSON.stringify(w.style))), w.font && (t.font = JSON.parse(JSON.stringify(w.font))), w.alignment && (t.alignment = JSON.parse(JSON.stringify(w.alignment))), w.border && (t.border = JSON.parse(JSON.stringify(w.border))), w.numFmt && (t.numFmt = w.numFmt), w.fill && (t.fill = JSON.parse(JSON.stringify(w.fill)));
|
|
100
|
-
const S = `${p}-${v + 1}`;
|
|
101
|
-
y.has(S) && (t.fill = {
|
|
102
|
-
type: "pattern",
|
|
103
|
-
pattern: "solid",
|
|
104
|
-
fgColor: { argb: y.get(S) }
|
|
105
|
-
});
|
|
106
|
-
} else
|
|
107
|
-
t.value = null;
|
|
108
|
-
}
|
|
109
|
-
f.height && (u.height = f.height), f.outlineLevel && (u.outlineLevel = f.outlineLevel), u.commit();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const m = await a.xlsx.writeBuffer();
|
|
113
|
-
return { hasError: !0, errBlob: new Blob([m], {
|
|
114
|
-
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
115
|
-
}) };
|
|
116
|
-
}, W = async (d, o) => {
|
|
117
|
-
if (!o || N(o))
|
|
118
|
-
return { hasError: !1 };
|
|
119
|
-
const g = await F(d);
|
|
120
|
-
if (!g) return { hasError: !0 };
|
|
121
|
-
const { headers: c, excelData: s } = g, h = [];
|
|
122
|
-
if (Object.keys(o).forEach((r) => {
|
|
123
|
-
c.includes(r) || h.push(r);
|
|
124
|
-
}), c.length === 0 || s.length === 0)
|
|
125
|
-
return E.error("Excel文件不包含足够的数据"), { hasError: !0 };
|
|
126
|
-
const i = new k({});
|
|
127
|
-
i.messages(R.messages()), i.define(o);
|
|
128
|
-
const e = await D(c, s, i);
|
|
129
|
-
if (e.length > 0 || h.length > 0) {
|
|
130
|
-
const r = e.map((a) => ({
|
|
131
|
-
row: a.row + 2,
|
|
132
|
-
// 转为Excel行号(+2是因为表头占一行,且是1-based索引)
|
|
133
|
-
col: a.col + 1,
|
|
134
|
-
// 转为Excel列号(+1是因为是1-based索引)
|
|
135
|
-
color: "FFFF0000"
|
|
136
|
-
// 红色
|
|
137
|
-
}));
|
|
138
|
-
return b(d, {
|
|
139
|
-
markCells: r,
|
|
140
|
-
markHeaders: h
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return { hasError: !1 };
|
|
144
|
-
}, D = async (d, o, g) => {
|
|
145
|
-
const c = [];
|
|
146
|
-
for (let s = 0; s < o.length; s++) {
|
|
147
|
-
const h = o[s];
|
|
148
|
-
try {
|
|
149
|
-
await g.validate(h).catch(({ errors: i }) => {
|
|
150
|
-
const e = [];
|
|
151
|
-
i.forEach((r) => {
|
|
152
|
-
const a = d.indexOf(r.field);
|
|
153
|
-
a >= 0 && (e.some((l) => l.row === s && l.col === a) || e.push({
|
|
154
|
-
row: s,
|
|
155
|
-
col: a,
|
|
156
|
-
header: r.field,
|
|
157
|
-
message: r.message.replace("${label}", d[a])
|
|
158
|
-
}));
|
|
159
|
-
}), c.push(...e);
|
|
160
|
-
});
|
|
161
|
-
} catch (i) {
|
|
162
|
-
console.error("验证表格数据时发生错误:", i), E.error("验证表格数据时发生错误:" + i);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return c;
|
|
166
|
-
}, $ = async (d, o, g) => {
|
|
167
|
-
if (!o || o.length === 0)
|
|
168
|
-
return { hasError: !1 };
|
|
169
|
-
const c = await F(d);
|
|
170
|
-
if (!c) return { hasError: !0 };
|
|
171
|
-
const { headers: s, excelData: h } = c, i = [];
|
|
172
|
-
if (o.forEach((n) => {
|
|
173
|
-
s.includes(n) || i.push(n);
|
|
174
|
-
}), i.length > 0)
|
|
175
|
-
return E.error(`表头缺少重复检测所需字段: ${i.join(", ")}`), { hasError: !0 };
|
|
176
|
-
const e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), a = new Array();
|
|
177
|
-
if (h.forEach((n, l) => {
|
|
178
|
-
const y = o.map((x) => n[x]).join("|");
|
|
179
|
-
a.push(y), e.has(y) ? (r.add(l), r.add(e.get(y))) : e.set(y, l);
|
|
180
|
-
}), g) {
|
|
181
|
-
const n = await J(g, {
|
|
182
|
-
Data: a
|
|
183
|
-
});
|
|
184
|
-
if (n != null && n.data && n.data.forEach((l) => {
|
|
185
|
-
r.add(l);
|
|
186
|
-
}), (n == null ? void 0 : n.status) === C.ERROR)
|
|
187
|
-
throw new Error(n.msg);
|
|
188
|
-
}
|
|
189
|
-
if (r.size > 0) {
|
|
190
|
-
const n = [];
|
|
191
|
-
return r.forEach((l) => {
|
|
192
|
-
o.forEach((y) => {
|
|
193
|
-
const x = s.indexOf(y);
|
|
194
|
-
x >= 0 && n.push({
|
|
195
|
-
row: l + 2,
|
|
196
|
-
// Excel行号 = 数组索引 + 2(表头和1-based索引)
|
|
197
|
-
col: x + 1,
|
|
198
|
-
// Excel列号 = 数组索引 + 1(1-based索引)
|
|
199
|
-
color: "FFFF0000"
|
|
200
|
-
// 红色
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}), b(d, { markCells: n, markHeaders: i });
|
|
204
|
-
}
|
|
205
|
-
return { hasError: !1 };
|
|
206
|
-
}, B = async (d, o, g) => {
|
|
207
|
-
const c = d.originFileObj;
|
|
208
|
-
if (c) {
|
|
209
|
-
const s = await c.arrayBuffer(), h = await F(s);
|
|
210
|
-
if (!h) {
|
|
211
|
-
E.error("上传的文件不是Excel文件");
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const { headers: i, excelRows: e, excelData: r } = h;
|
|
215
|
-
g && g.length > 0 ? g.forEach((a) => {
|
|
216
|
-
switch (a) {
|
|
217
|
-
case "Headers":
|
|
218
|
-
o.Headers = i;
|
|
219
|
-
break;
|
|
220
|
-
case "RawRows":
|
|
221
|
-
o.RawRows = e;
|
|
222
|
-
break;
|
|
223
|
-
case "Records":
|
|
224
|
-
o.Records = r;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}) : (o.Headers = i, o.RawRows = e, o.Records = r);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
export {
|
|
231
|
-
B as a,
|
|
232
|
-
$ as c,
|
|
233
|
-
F as p,
|
|
234
|
-
W as v
|
|
235
|
-
};
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import { defineComponent as G, ref as z, computed as j, watch as L, resolveDirective as H, createElementBlock as x, openBlock as f, normalizeClass as k, unref as a, createElementVNode as r, withDirectives as _, createBlock as J, mergeProps as W, withCtx as v, createVNode as u, createTextVNode as S, toDisplayString as B, Fragment as X, renderList as Y, createCommentVNode as g } from "vue";
|
|
2
|
-
import { _ as Z } from "./index-CaaMz5sz.js";
|
|
3
|
-
import { a as P, _ as M } from "./toolIcon-QMXCkImG.js";
|
|
4
|
-
import { httpPost as ee, ResStatus as te } from "@skyfox2000/fapi";
|
|
5
|
-
import { s as oe, _ as ae } from "./uploadList-D-FOtndj.js";
|
|
6
|
-
import { p as K, U as s } from "./file-upload-BVB9c-eZ.js";
|
|
7
|
-
import { combineParams as ne } from "@skyfox2000/microbase";
|
|
8
|
-
import U from "vue-m-message";
|
|
9
|
-
import "async-validator";
|
|
10
|
-
import "dayjs";
|
|
11
|
-
import { Upload as se, Tag as le, Popconfirm as ie, Progress as re } from "ant-design-vue";
|
|
12
|
-
import "vue-draggable-next";
|
|
13
|
-
import { _ as ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
|
-
const ue = (c, y) => {
|
|
15
|
-
const e = document.createElement("a"), h = URL.createObjectURL(c);
|
|
16
|
-
e.href = h, e.download = y, e.style.display = "none", document.body.appendChild(e), e.click(), URL.revokeObjectURL(h), document.body.removeChild(e);
|
|
17
|
-
}, de = (c, y, e) => {
|
|
18
|
-
try {
|
|
19
|
-
e && (c.api || (c.api = e.api), c.authorize === void 0 && (c.authorize = e.authorize));
|
|
20
|
-
const h = ne(c.params, y);
|
|
21
|
-
return ee(c, h).then((d) => {
|
|
22
|
-
if ((d == null ? void 0 : d.status) === te.SUCCESS && d.data) {
|
|
23
|
-
const i = d.data, F = i.Content, O = i.Key.split("/").pop(), p = atob(F), b = [];
|
|
24
|
-
for (let w = 0; w < p.length; w++)
|
|
25
|
-
b.push(p.charCodeAt(w));
|
|
26
|
-
const E = new Blob([new Uint8Array(b)], {
|
|
27
|
-
type: i.Type
|
|
28
|
-
});
|
|
29
|
-
ue(E, O);
|
|
30
|
-
} else
|
|
31
|
-
U.error("下载文件失败!");
|
|
32
|
-
});
|
|
33
|
-
} catch (h) {
|
|
34
|
-
console.error("下载失败:", h), U.error("文件下载失败,请稍后重试");
|
|
35
|
-
}
|
|
36
|
-
}, pe = { class: "flex items-center justify-between w-full" }, me = { class: "w-35 mx-3" }, fe = { class: "mt-4 px-3" }, he = { class: "flex items-center justify-between" }, xe = { class: "flex items-center" }, ve = { class: "flex items-center" }, _e = {
|
|
37
|
-
key: 0,
|
|
38
|
-
class: "mr-2"
|
|
39
|
-
}, ye = {
|
|
40
|
-
key: 1,
|
|
41
|
-
class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
|
|
42
|
-
}, we = ["onClick"], Ce = { class: "flex items-center text-red-500 hover:text-red-700 cursor-pointer" }, ge = ["onClick"], Ue = {
|
|
43
|
-
key: 0,
|
|
44
|
-
class: "text-sm text-nowrap"
|
|
45
|
-
}, be = { key: 0 }, ke = /* @__PURE__ */ G({
|
|
46
|
-
__name: "uploadList",
|
|
47
|
-
props: {
|
|
48
|
-
autoUpload: { type: Boolean, default: !1 },
|
|
49
|
-
uploadUrl: {},
|
|
50
|
-
downloadUrl: {},
|
|
51
|
-
fileList: { default: () => [] },
|
|
52
|
-
placeholder: { default: "" },
|
|
53
|
-
fileExt: {},
|
|
54
|
-
maxFileSize: { default: 20 },
|
|
55
|
-
maxCount: { default: 5 },
|
|
56
|
-
maxCountTip: { type: Boolean, default: !1 },
|
|
57
|
-
maxFileSizeTip: { type: Boolean, default: !0 },
|
|
58
|
-
fileExtTip: { type: Boolean, default: !0 },
|
|
59
|
-
parentPath: {},
|
|
60
|
-
showActionText: { type: Boolean, default: !0 },
|
|
61
|
-
showOnlineSwitch: { type: Boolean, default: !1 }
|
|
62
|
-
},
|
|
63
|
-
emits: ["update:file-list"],
|
|
64
|
-
setup(c, { emit: y }) {
|
|
65
|
-
const e = c, h = oe(), { errInfo: d } = h, i = z(e.fileList), F = z(), O = y, p = z(!1), b = j(() => {
|
|
66
|
-
var t;
|
|
67
|
-
return (t = e.fileExt) != null && t.length ? e.fileExt.map((o) => `.${o}`).join(",") : "";
|
|
68
|
-
}), E = (t) => {
|
|
69
|
-
var o;
|
|
70
|
-
if (e.fileExt && e.fileExt.length > 0) {
|
|
71
|
-
const n = ((o = t.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
|
|
72
|
-
if (!e.fileExt.includes(n))
|
|
73
|
-
return U.error("文件类型不支持"), !1;
|
|
74
|
-
}
|
|
75
|
-
return t.size / 1024 / 1024 > e.maxFileSize ? (U.error(`文件大小超过 ${e.maxFileSize}MB 限制`), !1) : e.maxCount > 1 && i.value.length >= e.maxCount ? (U.error(`最多上传 ${e.maxCount} 个文件`), !1) : (p.value = !1, e.autoUpload);
|
|
76
|
-
}, w = (t) => {
|
|
77
|
-
t.forEach((o) => {
|
|
78
|
-
const n = o;
|
|
79
|
-
n.fileName || (n.fileName = n.name), e.parentPath && (n.name = K.join("/", e.parentPath, n.fileName)), n.params || (n.params = {}), n.params.FileKey = n.name, n.status = s.Pending;
|
|
80
|
-
});
|
|
81
|
-
}, R = j(() => ({
|
|
82
|
-
accept: b.value,
|
|
83
|
-
multiple: !0,
|
|
84
|
-
fileList: i.value,
|
|
85
|
-
"onUpdate:fileList": w,
|
|
86
|
-
beforeUpload: E,
|
|
87
|
-
listType: "text",
|
|
88
|
-
maxCount: e.maxCount,
|
|
89
|
-
showUploadList: !1,
|
|
90
|
-
onChange: (t) => {
|
|
91
|
-
e.autoUpload || (i.value = t.fileList);
|
|
92
|
-
}
|
|
93
|
-
}));
|
|
94
|
-
L(
|
|
95
|
-
() => e.fileList,
|
|
96
|
-
(t) => {
|
|
97
|
-
i.value = t;
|
|
98
|
-
},
|
|
99
|
-
{ deep: !0, immediate: !0 }
|
|
100
|
-
), L(
|
|
101
|
-
() => i.value,
|
|
102
|
-
(t) => {
|
|
103
|
-
O("update:file-list", t);
|
|
104
|
-
},
|
|
105
|
-
{ deep: !0 }
|
|
106
|
-
), L(
|
|
107
|
-
() => e.parentPath,
|
|
108
|
-
(t) => {
|
|
109
|
-
t && i.value.forEach((o) => {
|
|
110
|
-
o.params.FileKey = K.join("/", t, o.fileName);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
const $ = (t) => {
|
|
115
|
-
if (!e.downloadUrl) return;
|
|
116
|
-
const o = i.value[t].minioFile, n = {
|
|
117
|
-
api: e.downloadUrl.api,
|
|
118
|
-
authorize: e.downloadUrl.authorize,
|
|
119
|
-
url: e.downloadUrl.url,
|
|
120
|
-
params: {
|
|
121
|
-
Query: {
|
|
122
|
-
FileKey: o.Key
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
de(n);
|
|
127
|
-
}, D = (t) => {
|
|
128
|
-
t.minioFile && (t.minioFile.Status = t.status);
|
|
129
|
-
}, T = (t) => {
|
|
130
|
-
i.value.splice(t, 1), p.value = !1;
|
|
131
|
-
}, I = (t, o) => {
|
|
132
|
-
if (o === s.Pending) {
|
|
133
|
-
T(t);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
p.value = !0;
|
|
137
|
-
}, V = () => {
|
|
138
|
-
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} 个文件` : "";
|
|
139
|
-
return [o, t, n].filter(Boolean).join(",");
|
|
140
|
-
}, Q = (t) => {
|
|
141
|
-
switch (t) {
|
|
142
|
-
case s.Uploading:
|
|
143
|
-
return "blue";
|
|
144
|
-
case s.Success:
|
|
145
|
-
return "green";
|
|
146
|
-
case s.Error:
|
|
147
|
-
return "red";
|
|
148
|
-
case s.Online:
|
|
149
|
-
return "green";
|
|
150
|
-
case s.Offline:
|
|
151
|
-
return "pink";
|
|
152
|
-
default:
|
|
153
|
-
return "cyan";
|
|
154
|
-
}
|
|
155
|
-
}, q = (t) => {
|
|
156
|
-
switch (t) {
|
|
157
|
-
case s.Uploading:
|
|
158
|
-
return "上传中";
|
|
159
|
-
case s.Success:
|
|
160
|
-
return "上传完成";
|
|
161
|
-
case s.Error:
|
|
162
|
-
return "上传失败";
|
|
163
|
-
case s.Online:
|
|
164
|
-
return "在线";
|
|
165
|
-
case s.Offline:
|
|
166
|
-
return "已下线";
|
|
167
|
-
default:
|
|
168
|
-
return "待上传";
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
return (t, o) => {
|
|
172
|
-
var A, N;
|
|
173
|
-
const n = H("auth");
|
|
174
|
-
return f(), x("div", {
|
|
175
|
-
class: k(["w-full border border-solid border-gray-100 mt-1 rounded-md py-5", [(A = a(d)) == null ? void 0 : A.errClass]])
|
|
176
|
-
}, [
|
|
177
|
-
r("div", pe, [
|
|
178
|
-
r("div", me, [
|
|
179
|
-
_((f(), J(a(se), W({
|
|
180
|
-
ref_key: "fileUploader",
|
|
181
|
-
ref: F
|
|
182
|
-
}, R.value), {
|
|
183
|
-
default: v(() => {
|
|
184
|
-
var l;
|
|
185
|
-
return [
|
|
186
|
-
u(a(Z), {
|
|
187
|
-
class: k([((l = a(d)) == null ? void 0 : l.errClass) + "-text"])
|
|
188
|
-
}, {
|
|
189
|
-
default: v(() => o[2] || (o[2] = [
|
|
190
|
-
S("选择文件")
|
|
191
|
-
])),
|
|
192
|
-
_: 1,
|
|
193
|
-
__: [2]
|
|
194
|
-
}, 8, ["class"])
|
|
195
|
-
];
|
|
196
|
-
}),
|
|
197
|
-
_: 1
|
|
198
|
-
}, 16)), [
|
|
199
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
|
|
200
|
-
])
|
|
201
|
-
]),
|
|
202
|
-
r("div", {
|
|
203
|
-
class: k(["flex-1 text-sm text-gray-500", [((N = a(d)) == null ? void 0 : N.errClass) + "-text"]])
|
|
204
|
-
}, B(V()), 3)
|
|
205
|
-
]),
|
|
206
|
-
r("div", fe, [
|
|
207
|
-
(f(!0), x(X, null, Y(i.value, (l, C) => (f(), x("div", {
|
|
208
|
-
key: C,
|
|
209
|
-
class: "mb-2 pb-1"
|
|
210
|
-
}, [
|
|
211
|
-
r("div", he, [
|
|
212
|
-
r("div", xe, [
|
|
213
|
-
r("span", {
|
|
214
|
-
class: k(["text-gray-700 mr-2", [l.status == a(s).Offline ? "line-through" : ""]])
|
|
215
|
-
}, B(l.fileName ?? l.name), 3),
|
|
216
|
-
r("span", null, [
|
|
217
|
-
u(a(le), {
|
|
218
|
-
color: Q(l.status)
|
|
219
|
-
}, {
|
|
220
|
-
default: v(() => [
|
|
221
|
-
S(B(q(l.status)), 1)
|
|
222
|
-
]),
|
|
223
|
-
_: 2
|
|
224
|
-
}, 1032, ["color"])
|
|
225
|
-
])
|
|
226
|
-
]),
|
|
227
|
-
r("div", ve, [
|
|
228
|
-
t.showOnlineSwitch && (l.status == a(s).Online || l.status == a(s).Offline) ? (f(), x("div", _e, [
|
|
229
|
-
u(a(P), { title: "上线或下线" }, {
|
|
230
|
-
default: v(() => [
|
|
231
|
-
_(u(a(ae), {
|
|
232
|
-
checked: l.status,
|
|
233
|
-
"onUpdate:checked": (m) => l.status = m,
|
|
234
|
-
data: [
|
|
235
|
-
{ label: "上线", value: a(s).Online },
|
|
236
|
-
{ label: "下线", value: a(s).Offline }
|
|
237
|
-
],
|
|
238
|
-
onChange: (m) => D(l)
|
|
239
|
-
}, null, 8, ["checked", "onUpdate:checked", "data", "onChange"]), [
|
|
240
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:online" }]
|
|
241
|
-
])
|
|
242
|
-
]),
|
|
243
|
-
_: 2
|
|
244
|
-
}, 1024)
|
|
245
|
-
])) : g("", !0),
|
|
246
|
-
t.downloadUrl && (l.status == a(s).Online || l.status == a(s).Offline) ? (f(), x("div", ye, [
|
|
247
|
-
u(a(P), { title: "下载" }, {
|
|
248
|
-
default: v(() => [
|
|
249
|
-
_(u(a(M), {
|
|
250
|
-
icon: "icon-download",
|
|
251
|
-
clickable: "",
|
|
252
|
-
onClick: (m) => $(C)
|
|
253
|
-
}, null, 8, ["onClick"]), [
|
|
254
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
|
|
255
|
-
]),
|
|
256
|
-
t.showActionText ? _((f(), x("span", {
|
|
257
|
-
key: 0,
|
|
258
|
-
class: "mr-2 text-sm text-nowrap",
|
|
259
|
-
onClick: (m) => $(C)
|
|
260
|
-
}, o[3] || (o[3] = [
|
|
261
|
-
S("下载")
|
|
262
|
-
]), 8, we)), [
|
|
263
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
|
|
264
|
-
]) : g("", !0)
|
|
265
|
-
]),
|
|
266
|
-
_: 2
|
|
267
|
-
}, 1024)
|
|
268
|
-
])) : g("", !0),
|
|
269
|
-
r("div", Ce, [
|
|
270
|
-
u(a(ie), {
|
|
271
|
-
open: p.value,
|
|
272
|
-
"onUpdate:open": o[0] || (o[0] = (m) => p.value = m),
|
|
273
|
-
cancelText: "否",
|
|
274
|
-
okText: "是",
|
|
275
|
-
title: "确定删除该文件吗?",
|
|
276
|
-
okButtonProps: { size: "small" },
|
|
277
|
-
cancelButtonProps: { size: "small" },
|
|
278
|
-
onConfirm: (m) => T(C),
|
|
279
|
-
onCancel: o[1] || (o[1] = (m) => p.value = !1)
|
|
280
|
-
}, {
|
|
281
|
-
default: v(() => [
|
|
282
|
-
u(a(P), { title: "删除" }, {
|
|
283
|
-
default: v(() => [
|
|
284
|
-
r("div", {
|
|
285
|
-
onClick: (m) => I(C, l.status)
|
|
286
|
-
}, [
|
|
287
|
-
_(u(a(M), {
|
|
288
|
-
icon: "icon-new",
|
|
289
|
-
angle: 45,
|
|
290
|
-
clickable: ""
|
|
291
|
-
}, null, 512), [
|
|
292
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
|
|
293
|
-
]),
|
|
294
|
-
t.showActionText ? _((f(), x("span", Ue, o[4] || (o[4] = [
|
|
295
|
-
S("删除")
|
|
296
|
-
]))), [
|
|
297
|
-
[n, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
|
|
298
|
-
]) : g("", !0)
|
|
299
|
-
], 8, ge)
|
|
300
|
-
]),
|
|
301
|
-
_: 2
|
|
302
|
-
}, 1024)
|
|
303
|
-
]),
|
|
304
|
-
_: 2
|
|
305
|
-
}, 1032, ["open", "onConfirm"])
|
|
306
|
-
])
|
|
307
|
-
])
|
|
308
|
-
]),
|
|
309
|
-
l.status !== a(s).Online && l.status !== a(s).Offline && l.status !== a(s).Success ? (f(), x("div", be, [
|
|
310
|
-
u(a(re), {
|
|
311
|
-
percent: l.percent,
|
|
312
|
-
"stroke-width": 2,
|
|
313
|
-
"show-info": !1,
|
|
314
|
-
style: { height: "2px" }
|
|
315
|
-
}, null, 8, ["percent"])
|
|
316
|
-
])) : g("", !0)
|
|
317
|
-
]))), 128))
|
|
318
|
-
])
|
|
319
|
-
], 2);
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
}), Me = /* @__PURE__ */ ce(ke, [["__scopeId", "data-v-78bfcd29"]]);
|
|
323
|
-
export {
|
|
324
|
-
Me as U,
|
|
325
|
-
de as a,
|
|
326
|
-
ue as d
|
|
327
|
-
};
|