@skyfox2000/webui 1.4.1 → 1.4.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/lib/assets/modules/{baseLayout-BLUY_tDF.js → baseLayout-CeyN__cz.js} +6 -6
- package/lib/assets/modules/file-upload-DiUcAspb.js +198 -0
- package/lib/assets/modules/{index-Bb4qTaRC.js → index-C5X-1A4m.js} +2 -2
- package/lib/assets/modules/{index-BuP8i92E.js → index-DbgSOuIs.js} +1 -1
- package/lib/assets/modules/{index-DLY7idvQ.js → index-YIIA7qm8.js} +2 -2
- package/lib/assets/modules/{menuTabs-DzoBrCZE.js → menuTabs-hVwE4xrx.js} +2 -2
- package/lib/assets/modules/{toolIcon-FTelEQwg.js → toolIcon-BHWHHyOp.js} +1 -1
- package/lib/assets/modules/{uploadList-DTAFNhow.js → uploadList-1qFfdb6_.js} +4 -4
- package/lib/assets/modules/{uploadList-DIfhRlbh.js → uploadList-EbG8acej.js} +621 -527
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +2 -2
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +5 -5
- package/lib/es/MenuLayout/index.js +2 -2
- package/lib/es/UploadForm/index.js +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/utils/micro-openapis.d.ts +4 -28
- package/lib/webui.es.js +104 -109
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/utils/micro-openapis.ts +124 -125
- package/lib/assets/modules/file-upload-Dk4VFMgz.js +0 -204
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as _, onMounted as I, createBlock as s, openBlock as o, unref as e, withCtx as l, createCommentVNode as r, createVNode as p, createElementVNode as x, createElementBlock as y, toDisplayString as g, renderSlot as h } from "vue";
|
|
2
2
|
import { Layout as i, LayoutSider as k } from "ant-design-vue";
|
|
3
|
-
import { a as b } from "./toolIcon-
|
|
4
|
-
import { I as C, _ as S, f as w, d as $, g as N } from "./menuTabs-
|
|
5
|
-
import {
|
|
3
|
+
import { a as b } from "./toolIcon-BHWHHyOp.js";
|
|
4
|
+
import { I as C, _ as S, f as w, d as $, g as N } from "./menuTabs-hVwE4xrx.js";
|
|
5
|
+
import { af as v, a as B, ah as E } from "./uploadList-EbG8acej.js";
|
|
6
6
|
import "@skyfox2000/microbase";
|
|
7
7
|
import "@skyfox2000/fapi";
|
|
8
8
|
import L from "vue-m-message";
|
|
@@ -17,8 +17,8 @@ const V = { class: "h-[40px] max-h-[40px] bg-[rgba(240,240,240,0.2)] flex flex-n
|
|
|
17
17
|
props: {
|
|
18
18
|
routes: {}
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
20
|
+
setup(f) {
|
|
21
|
+
const m = f, a = v(), t = B(), u = E();
|
|
22
22
|
return I(() => {
|
|
23
23
|
L.closeAll();
|
|
24
24
|
}), (d, c) => (o(), s(e(i), { class: "h-screen" }, {
|
|
@@ -56,7 +56,7 @@ const V = { class: "h-[40px] max-h-[40px] bg-[rgba(240,240,240,0.2)] flex flex-n
|
|
|
56
56
|
e(t).menuCollapse ? r("", !0) : (o(), y("span", z, g(e(a).appInfo.Name), 1))
|
|
57
57
|
]),
|
|
58
58
|
p(w, {
|
|
59
|
-
routes:
|
|
59
|
+
routes: m.routes
|
|
60
60
|
}, null, 8, ["routes"])
|
|
61
61
|
]),
|
|
62
62
|
_: 1
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var w = (s, r, a) => r in s ? E(s, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[r] = a;
|
|
3
|
+
var f = (s, r, a) => w(s, typeof r != "symbol" ? r + "" : r, a);
|
|
4
|
+
import { hostUrl as y } from "@skyfox2000/fapi";
|
|
5
|
+
import { u as g } from "./uploadList-EbG8acej.js";
|
|
6
|
+
import { mainAppApis as p } from "@skyfox2000/microbase";
|
|
7
|
+
import b from "dayjs";
|
|
8
|
+
import d from "vue-m-message";
|
|
9
|
+
var i = /* @__PURE__ */ ((s) => (s.Pending = "pending", s.Uploading = "uploading", s.Success = "success", s.Error = "error", s.Online = "online", s.Offline = "offline", s))(i || {});
|
|
10
|
+
const k = () => p.value && p.value.getToken ? p.value.getToken() : g().getToken();
|
|
11
|
+
class A {
|
|
12
|
+
/**
|
|
13
|
+
* 连接路径参数,已判断 undefined 或 null 值
|
|
14
|
+
* @param args 路径参数数组
|
|
15
|
+
* @returns 连接后的路径字符串
|
|
16
|
+
*/
|
|
17
|
+
static join(...r) {
|
|
18
|
+
return r.filter((o) => o != null).join("/").replace(/[\/]+/, "/");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class x {
|
|
22
|
+
/**
|
|
23
|
+
* AsyncUploader 构造函数
|
|
24
|
+
* @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
|
|
25
|
+
* @param maxConcurrent 最大允许并发上传的文件数量
|
|
26
|
+
*/
|
|
27
|
+
constructor(r, a = 3) {
|
|
28
|
+
/**
|
|
29
|
+
* 设置 API 端点和最大并发数,所有上传文件通过该类控制
|
|
30
|
+
*/
|
|
31
|
+
f(this, "urlInfo");
|
|
32
|
+
/**
|
|
33
|
+
* 最大并发上传数
|
|
34
|
+
*/
|
|
35
|
+
f(this, "maxConcurrent");
|
|
36
|
+
/**
|
|
37
|
+
* 控制上传任务的中断信号
|
|
38
|
+
*/
|
|
39
|
+
f(this, "abortController");
|
|
40
|
+
this.urlInfo = r, this.maxConcurrent = a;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 执行上传
|
|
44
|
+
* @param fileList 文件列表
|
|
45
|
+
* @param loading 加载状态
|
|
46
|
+
* @param continueOnError 错误时是否继续上传
|
|
47
|
+
* @param onComplete 上传完成回调
|
|
48
|
+
* @param onProgress 上传进度回调
|
|
49
|
+
* @returns 上传结果
|
|
50
|
+
*/
|
|
51
|
+
async doUpload(r, a, c, o, e) {
|
|
52
|
+
if (r.length) {
|
|
53
|
+
if (r.length === 0) {
|
|
54
|
+
d.warning("请选择上传的文件!");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
a.value = !0, await this.uploadFiles(r, e, (l) => {
|
|
58
|
+
let t = !1, h = 0;
|
|
59
|
+
for (const n of l)
|
|
60
|
+
n.status === i.Error && h++;
|
|
61
|
+
h ? h < l.length ? c ? (d.error("上传结束,部分文件上传失败!"), d.warning("保存上传成功的文件!"), t = !0) : d.error("上传结束,部分文件上传失败,取消保存!") : d.error("上传结束,所有文件上传失败!") : (d.success("全部文件上传成功!"), t = !0), a.value = !1, o == null || o(t, l);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 上传多个文件,控制并发数量
|
|
67
|
+
* @param files 文件列表(File[] 或 FileList)
|
|
68
|
+
* @param onProgress 上传进度回调
|
|
69
|
+
* @param onComplete 上传完成回调
|
|
70
|
+
*/
|
|
71
|
+
async uploadFiles(r, a, c) {
|
|
72
|
+
if (!r.length) return;
|
|
73
|
+
const o = Math.min(this.maxConcurrent, r.length), e = [];
|
|
74
|
+
for (const t of r)
|
|
75
|
+
switch (t.status) {
|
|
76
|
+
case i.Success:
|
|
77
|
+
case i.Online:
|
|
78
|
+
case i.Offline:
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
t.status = i.Pending, e.push(t);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const l = [];
|
|
85
|
+
this.abortController = new AbortController();
|
|
86
|
+
try {
|
|
87
|
+
for (; l.length < o && e.length > 0; ) {
|
|
88
|
+
const t = e.shift();
|
|
89
|
+
if (!t) break;
|
|
90
|
+
l.push(this.handleFileStatus(t, l, e, a));
|
|
91
|
+
}
|
|
92
|
+
await Promise.all(l);
|
|
93
|
+
} catch (t) {
|
|
94
|
+
r.forEach((h) => {
|
|
95
|
+
h.status = i.Error, h.error = t instanceof Error ? t : new Error("上传失败"), a == null || a(h);
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
c == null || c(r);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 处理单个文件的上传逻辑
|
|
103
|
+
* @param file 当前上传的文件
|
|
104
|
+
* @param activeUploads 当前正在上传的文件列表
|
|
105
|
+
* @param pendingFiles 等待上传的文件列表
|
|
106
|
+
* @param onProgress 上传进度回调
|
|
107
|
+
*/
|
|
108
|
+
async handleFileStatus(r, a, c, o) {
|
|
109
|
+
try {
|
|
110
|
+
await this.uploadFile(r, this.abortController.signal, (e) => {
|
|
111
|
+
r.percent = e, o == null || o(r);
|
|
112
|
+
});
|
|
113
|
+
} catch (e) {
|
|
114
|
+
r.error = e instanceof Error ? e : new Error("上传失败");
|
|
115
|
+
} finally {
|
|
116
|
+
if (c.length > 0) {
|
|
117
|
+
const e = c.shift();
|
|
118
|
+
e && a.push(this.handleFileStatus(e, a, c, o));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 使用 XMLHttpRequest 上传文件
|
|
124
|
+
* @param file 文件对象
|
|
125
|
+
* @param signal 中断信号
|
|
126
|
+
* @param onProgress 上传进度回调
|
|
127
|
+
*/
|
|
128
|
+
async uploadFile(r, a, c) {
|
|
129
|
+
return r.status = i.Uploading, new Promise((o, e) => {
|
|
130
|
+
const l = new FormData();
|
|
131
|
+
if (l.append("file", r.originFileObj), r.params)
|
|
132
|
+
for (const n in r.params)
|
|
133
|
+
l.append(n, r.params[n]);
|
|
134
|
+
const t = new XMLHttpRequest(), h = y(this.urlInfo);
|
|
135
|
+
if (h === !1) return Promise.resolve(r);
|
|
136
|
+
if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([n, u]) => {
|
|
137
|
+
t.setRequestHeader(n, u);
|
|
138
|
+
}), this.urlInfo.authorize) {
|
|
139
|
+
const n = k();
|
|
140
|
+
if (!n) {
|
|
141
|
+
e(new Error("未授权或授权过期"));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
t.setRequestHeader("Authorization", "Bearer " + n);
|
|
145
|
+
}
|
|
146
|
+
t.upload.addEventListener("progress", (n) => {
|
|
147
|
+
if (n.lengthComputable && n.total > 0) {
|
|
148
|
+
const u = Math.round(n.loaded / n.total * 100);
|
|
149
|
+
c(u);
|
|
150
|
+
}
|
|
151
|
+
}), t.addEventListener("load", () => {
|
|
152
|
+
if (t.status >= 200 && t.status < 300) {
|
|
153
|
+
const n = t.getResponseHeader("Content-Type");
|
|
154
|
+
if (!n || !n.includes("application/json")) {
|
|
155
|
+
e(new Error("返回的结果不是 JSON 格式"));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const u = JSON.parse(t.response);
|
|
160
|
+
if (u.status === "success")
|
|
161
|
+
u.data && (r.minioFile = {
|
|
162
|
+
ETag: u.data.ETag,
|
|
163
|
+
Bucket: u.data.Bucket,
|
|
164
|
+
FileName: r.fileName,
|
|
165
|
+
Key: u.data.Key,
|
|
166
|
+
Size: u.data.Size,
|
|
167
|
+
Type: r.type,
|
|
168
|
+
UpdateTime: b().format("YYYY-MM-DD HH:mm:ss"),
|
|
169
|
+
Status: i.Success
|
|
170
|
+
}), r.status = i.Success, o(r);
|
|
171
|
+
else {
|
|
172
|
+
const m = u.msg;
|
|
173
|
+
r.status = i.Error, e(new Error(m));
|
|
174
|
+
}
|
|
175
|
+
} catch (u) {
|
|
176
|
+
r.status = i.Error, e(new Error("无法解析返回的 JSON 数据: " + u));
|
|
177
|
+
}
|
|
178
|
+
} else
|
|
179
|
+
r.status = i.Error, e(new Error(`上传失败,状态码:${t.status}`));
|
|
180
|
+
}), t.addEventListener("error", () => {
|
|
181
|
+
r.status = i.Error, e(new Error("上传失败,网络异常"));
|
|
182
|
+
}), t.send(l), a.addEventListener("abort", () => {
|
|
183
|
+
t.abort(), e(new Error("上传已取消"));
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 取消当前所有的上传任务
|
|
189
|
+
*/
|
|
190
|
+
cancelUpload() {
|
|
191
|
+
this.abortController && this.abortController.abort();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
x as A,
|
|
196
|
+
i as U,
|
|
197
|
+
A as p
|
|
198
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as F, provide as _, ref as w, watch as p, onMounted as B, createBlock as n, openBlock as r, unref as a, withCtx as i, createElementVNode as N, renderSlot as b, createVNode as V, createCommentVNode as d, createTextVNode as u, toDisplayString as v } from "vue";
|
|
2
|
-
import { _ as m } from "./index-
|
|
2
|
+
import { _ as m } from "./index-DbgSOuIs.js";
|
|
3
3
|
import { Modal as D, Space as E } from "ant-design-vue";
|
|
4
4
|
import "@skyfox2000/fapi";
|
|
5
|
-
import { P as M, d as P, o as $, b as K } from "./uploadList-
|
|
5
|
+
import { P as M, d as P, o as $, b as K } from "./uploadList-EbG8acej.js";
|
|
6
6
|
import "@skyfox2000/microbase";
|
|
7
7
|
import "vue-m-message";
|
|
8
8
|
import "async-validator";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as d, useAttrs as f, createElementBlock as u, openBlock as x, createVNode as e, withCtx as n, unref as o, mergeProps as r, renderSlot as p } from "vue";
|
|
2
2
|
import { Button as _ } from "ant-design-vue";
|
|
3
|
-
import { a as P, _ as k } from "./toolIcon-
|
|
3
|
+
import { a as P, _ as k } from "./toolIcon-BHWHHyOp.js";
|
|
4
4
|
const C = /* @__PURE__ */ d({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "index",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import H from "async-validator";
|
|
2
2
|
import { httpPost as M, ResStatus as V } from "@skyfox2000/fapi";
|
|
3
|
-
import { i as T,
|
|
3
|
+
import { i as T, ai as U, L as $, u as z } from "./uploadList-EbG8acej.js";
|
|
4
4
|
import m from "vue-m-message";
|
|
5
5
|
import { defineComponent as _, useAttrs as B, createElementBlock as A, openBlock as b, createVNode as O, unref as v, mergeProps as S, computed as E, createBlock as R, withCtx as L, normalizeStyle as N } from "vue";
|
|
6
6
|
import { Spin as K, Alert as P } from "ant-design-vue";
|
|
7
|
-
import { _ as W } from "./toolIcon-
|
|
7
|
+
import { _ as W } from "./toolIcon-BHWHHyOp.js";
|
|
8
8
|
const D = (i) => {
|
|
9
9
|
const e = i.split(`
|
|
10
10
|
`).filter((l) => l.trim() !== "");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as x, createBlock as h, createCommentVNode as I, openBlock as u, unref as t, mergeProps as C, useAttrs as W, computed as j, ref as y, watch as k, withCtx as d, createElementBlock as g, normalizeStyle as T, createElementVNode as m, inject as q, onMounted as N, createVNode as l, toDisplayString as $, Fragment as L, createTextVNode as K, reactive as J, nextTick as Y, renderList as G, withModifiers as Q } from "vue";
|
|
2
|
-
import { a as w, _ as b } from "./toolIcon-
|
|
3
|
-
import { c as D, T as E,
|
|
2
|
+
import { a as w, _ as b } from "./toolIcon-BHWHHyOp.js";
|
|
3
|
+
import { c as D, T as E, ah as P, W as U, V as M, u as F, a as V, U as X, r as H, af as z } from "./uploadList-EbG8acej.js";
|
|
4
4
|
import { _ as Z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
5
|
import { theme as O, Breadcrumb as ee, Modal as te, Flex as ne, LayoutHeader as oe, Space as se, Menu as ie, Tabs as ce, TabPane as ae } from "ant-design-vue";
|
|
6
6
|
import { mainAppApis as R } from "@skyfox2000/microbase";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as i, createBlock as s, openBlock as l, unref as a, withCtx as p, renderSlot as f, createCommentVNode as u, mergeProps as d } from "vue";
|
|
2
2
|
import { Tooltip as I } from "ant-design-vue";
|
|
3
3
|
import { SERVER_HOST as r } from "@skyfox2000/fapi";
|
|
4
|
-
import { c as S } from "./uploadList-
|
|
4
|
+
import { c as S } from "./uploadList-EbG8acej.js";
|
|
5
5
|
const T = /* @__PURE__ */ i({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as Z, ref as L, computed as K, watch as P, resolveDirective as ee, createElementBlock as v, openBlock as m, normalizeClass as O, unref as n, createElementVNode as f, withDirectives as x, createBlock as te, mergeProps as oe, withCtx as y, createVNode as p, createTextVNode as E, toDisplayString as $, Fragment as ne, renderList as ae, createCommentVNode as S } from "vue";
|
|
2
|
-
import { _ as se } from "./index-
|
|
3
|
-
import { a as z, _ as A } from "./toolIcon-
|
|
2
|
+
import { _ as se } from "./index-DbgSOuIs.js";
|
|
3
|
+
import { a as z, _ as A } from "./toolIcon-BHWHHyOp.js";
|
|
4
4
|
import { httpPost as R, ResStatus as D } from "@skyfox2000/fapi";
|
|
5
|
-
import { L as V, u as Q, s as ie, _ as re } from "./uploadList-
|
|
6
|
-
import { p as M, U as i } from "./file-upload-
|
|
5
|
+
import { L as V, u as Q, s as ie, _ as re } from "./uploadList-EbG8acej.js";
|
|
6
|
+
import { p as M, U as i } from "./file-upload-DiUcAspb.js";
|
|
7
7
|
import { combineParams as q } from "@skyfox2000/microbase";
|
|
8
8
|
import g from "vue-m-message";
|
|
9
9
|
import "async-validator";
|