@skyfox2000/webui 1.5.10 → 1.5.12

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 (36) hide show
  1. package/lib/assets/modules/{baseLayout-BuQjrozB.js → baseLayout-CRSIlLKU.js} +3 -3
  2. package/lib/assets/modules/file-upload-CrA5-gqr.js +211 -0
  3. package/lib/assets/modules/{index-CW_ZCHWs.js → index-CA_H2eOk.js} +1 -1
  4. package/lib/assets/modules/index-CW7dVG4Z.js +372 -0
  5. package/lib/assets/modules/index-Doi0zREW.js +114 -0
  6. package/lib/assets/modules/{menuTabs-BYSjomB7.js → menuTabs-DRoP9rnS.js} +27 -28
  7. package/lib/assets/modules/{toolIcon-D4vAp0qA.js → toolIcon-CghIoh0a.js} +1 -1
  8. package/lib/assets/modules/{upload-template-NU0Bpg4N.js → upload-template-D6r6X3vP.js} +101 -85
  9. package/lib/assets/modules/uploadList-CIGuBEpz.js +468 -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 +196 -196
  15. package/lib/es/MenuLayout/index.js +2 -2
  16. package/lib/es/TemplateFile/index.js +4 -4
  17. package/lib/es/UploadForm/index.js +4 -4
  18. package/lib/locales/default.d.ts +15 -0
  19. package/lib/webui.css +1 -1
  20. package/lib/webui.es.js +1191 -1194
  21. package/package.json +3 -3
  22. package/src/components/content/dialog/excelForm.vue +2 -2
  23. package/src/components/form/upload/imageList.vue +0 -2
  24. package/src/components/form/upload/uploadList.vue +0 -3
  25. package/src/locales/default.ts +18 -3
  26. package/src/utils/data.ts +1 -1
  27. package/src/utils/excel-preview.ts +10 -10
  28. package/src/utils/excel-view.ts +6 -4
  29. package/src/utils/file-upload.ts +2 -2
  30. package/src/utils/micro-openapis.ts +4 -3
  31. package/src/utils/tools.ts +1 -1
  32. package/src/utils/upload-template.ts +2 -1
  33. package/lib/assets/modules/file-upload-DcusqXDb.js +0 -211
  34. package/lib/assets/modules/index-BlQB5KSU.js +0 -381
  35. package/lib/assets/modules/index-CekzHbWp.js +0 -114
  36. package/lib/assets/modules/uploadList-ENSsTfpD.js +0 -472
@@ -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 k } from "vue";
2
2
  import { Layout as i, LayoutSider as h } from "ant-design-vue";
3
- import { a as b } from "./toolIcon-D4vAp0qA.js";
4
- import { I as C, _ as S, f as w, d as $, g as N } from "./menuTabs-BYSjomB7.js";
5
- import { ak as v, a as B, am as E } from "./upload-template-NU0Bpg4N.js";
3
+ import { a as b } from "./toolIcon-CghIoh0a.js";
4
+ import { I as C, _ as S, f as w, d as $, g as N } from "./menuTabs-DRoP9rnS.js";
5
+ import { ak as v, a as B, am as E } from "./upload-template-D6r6X3vP.js";
6
6
  import "@skyfox2000/microbase";
7
7
  import "@skyfox2000/fapi";
8
8
  import L from "vue-m-message";
@@ -0,0 +1,211 @@
1
+ var b = Object.defineProperty;
2
+ var U = (i, e, a) => e in i ? b(i, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[e] = a;
3
+ var h = (i, e, a) => U(i, typeof e != "symbol" ? e + "" : e, a);
4
+ import { hostUrl as E } from "@skyfox2000/fapi";
5
+ import m from "dayjs";
6
+ import f from "vue-m-message";
7
+ import { $ as n, M as y, u as F } from "./upload-template-D6r6X3vP.js";
8
+ import { isMicroApp as g } from "@skyfox2000/microbase";
9
+ var l = /* @__PURE__ */ ((i) => (i.Pending = "pending", i.Uploading = "uploading", i.Success = "success", i.Error = "error", i.Online = "online", i.Offline = "offline", i))(l || {});
10
+ class M {
11
+ /**
12
+ * 连接路径参数,已判断 undefined 或 null 值
13
+ * @param args 路径参数数组
14
+ * @returns 连接后的路径字符串
15
+ */
16
+ static join(...e) {
17
+ return e.filter((s) => s != null).join("/").replace(/[\/]+/, "/");
18
+ }
19
+ }
20
+ class S {
21
+ /**
22
+ * AsyncUploader 构造函数
23
+ * @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
24
+ * @param maxConcurrent 最大允许并发上传的文件数量
25
+ */
26
+ constructor(e, a = 3) {
27
+ /**
28
+ * 设置 API 端点和最大并发数,所有上传文件通过该类控制
29
+ */
30
+ h(this, "urlInfo");
31
+ /**
32
+ * 最大并发上传数
33
+ */
34
+ h(this, "maxConcurrent");
35
+ /**
36
+ * 控制上传任务的中断信号
37
+ */
38
+ h(this, "abortController");
39
+ this.urlInfo = e, this.maxConcurrent = a;
40
+ }
41
+ /**
42
+ * 执行上传
43
+ * @param fileList 文件列表
44
+ * @param loading 加载状态
45
+ * @param continueOnError 错误时是否继续上传
46
+ * @param onComplete 上传完成回调
47
+ * @param onProgress 上传进度回调
48
+ * @returns 上传结果
49
+ */
50
+ async doUpload(e, a, u, s, t) {
51
+ if (e.length) {
52
+ if (e.length === 0) {
53
+ f.warning(n("webui.utils.fileUpload.pleaseSelectFile"));
54
+ return;
55
+ }
56
+ a.value = !0, await this.uploadFiles(e, t, (d) => {
57
+ let r = !1, p = 0;
58
+ for (const o of d)
59
+ o.status === l.Error && p++;
60
+ p ? p < d.length ? u ? (f.error(n("webui.utils.fileUpload.partialUploadFailed")), f.warning(n("webui.utils.fileUpload.saveUploadSuccess")), r = !0) : f.error(n("webui.utils.fileUpload.partialUploadFailedCancel")) : f.error(n("webui.utils.fileUpload.allUploadFailed")) : (f.success(n("webui.utils.fileUpload.allUploadSuccess")), r = !0), a.value = !1, s == null || s(r, d);
61
+ });
62
+ }
63
+ }
64
+ /**
65
+ * 上传多个文件,控制并发数量
66
+ * @param files 文件列表(File[] 或 FileList)
67
+ * @param onProgress 上传进度回调
68
+ * @param onComplete 上传完成回调
69
+ */
70
+ async uploadFiles(e, a, u) {
71
+ if (!e.length) return;
72
+ const s = Math.min(this.maxConcurrent, e.length), t = [];
73
+ for (const r of e)
74
+ switch (r.status) {
75
+ case l.Success:
76
+ case l.Online:
77
+ case l.Offline:
78
+ break;
79
+ default:
80
+ r.status = l.Pending, t.push(r);
81
+ break;
82
+ }
83
+ const d = [];
84
+ this.abortController = new AbortController();
85
+ try {
86
+ for (; d.length < s && t.length > 0; ) {
87
+ const r = t.shift();
88
+ if (!r) break;
89
+ d.push(this.handleFileStatus(r, d, t, a));
90
+ }
91
+ await Promise.all(d);
92
+ } catch (r) {
93
+ e.forEach((p) => {
94
+ p.status = l.Error, p.error = r instanceof Error ? r : new Error(n("webui.utils.fileUpload.fileUploadFailed")), a == null || a(p);
95
+ });
96
+ } finally {
97
+ u == null || u(e);
98
+ }
99
+ }
100
+ /**
101
+ * 处理单个文件的上传逻辑
102
+ * @param file 当前上传的文件
103
+ * @param activeUploads 当前正在上传的文件列表
104
+ * @param pendingFiles 等待上传的文件列表
105
+ * @param onProgress 上传进度回调
106
+ */
107
+ async handleFileStatus(e, a, u, s) {
108
+ try {
109
+ await this.uploadFile(e, this.abortController.signal, (t) => {
110
+ e.percent = t, s == null || s(e);
111
+ });
112
+ } catch (t) {
113
+ e.error = t instanceof Error ? t : new Error(n("webui.utils.fileUpload.fileUploadFailed"));
114
+ } finally {
115
+ if (u.length > 0) {
116
+ const t = u.shift();
117
+ t && a.push(this.handleFileStatus(t, a, u, s));
118
+ }
119
+ }
120
+ }
121
+ /**
122
+ * 使用 XMLHttpRequest 上传文件
123
+ * @param file 文件对象
124
+ * @param signal 中断信号
125
+ * @param onProgress 上传进度回调
126
+ */
127
+ async uploadFile(e, a, u) {
128
+ return e.status = l.Uploading, new Promise(async (s, t) => {
129
+ const d = new FormData();
130
+ if (d.append("file", e.originFileObj), e.params)
131
+ for (const o in e.params)
132
+ d.append(o, e.params[o]);
133
+ const r = new XMLHttpRequest(), p = E(this.urlInfo);
134
+ if (p === !1) return Promise.resolve(e);
135
+ if (r.open("POST", p, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([o, c]) => {
136
+ r.setRequestHeader(o, c);
137
+ }), this.urlInfo.authorize) {
138
+ const o = g() ? await y.getToken() : F().getToken();
139
+ if (!o) {
140
+ t(new Error(n("webui.utils.fileUpload.unauthorized")));
141
+ return;
142
+ }
143
+ r.setRequestHeader("Authorization", "Bearer " + o);
144
+ }
145
+ r.upload.addEventListener("progress", (o) => {
146
+ if (o.lengthComputable && o.total > 0) {
147
+ const c = Math.round(o.loaded / o.total * 100);
148
+ u(c);
149
+ }
150
+ }), r.addEventListener("load", () => {
151
+ if (r.status >= 200 && r.status < 300) {
152
+ const o = r.getResponseHeader("Content-Type");
153
+ if (!o || !o.includes("application/json")) {
154
+ t(new Error(n("webui.utils.fileUpload.invalidJsonFormat")));
155
+ return;
156
+ }
157
+ try {
158
+ const c = JSON.parse(r.response);
159
+ if (c.status === "success")
160
+ c.data && (e.minioFile = {
161
+ ETag: c.data.ETag,
162
+ Bucket: c.data.Bucket,
163
+ FileName: e.fileName,
164
+ Key: c.data.Key,
165
+ Size: c.data.Size,
166
+ Type: e.type,
167
+ UpdateTime: m().format("YYYY-MM-DD HH:mm:ss"),
168
+ Status: l.Success
169
+ }), e.status = l.Success, s(e);
170
+ else {
171
+ const w = c.msg;
172
+ e.status = l.Error, t(new Error(w));
173
+ }
174
+ } catch (c) {
175
+ e.status = l.Error, t(new Error(n("webui.utils.fileUpload.jsonParseError") + ": " + c));
176
+ }
177
+ } else
178
+ e.status = l.Error, t(new Error(n("webui.utils.fileUpload.uploadFailed") + `:${r.status}`));
179
+ }), r.addEventListener("error", () => {
180
+ e.status = l.Error, t(new Error(n("webui.utils.fileUpload.networkError")));
181
+ }), r.send(d), a.addEventListener("abort", () => {
182
+ r.abort(), t(new Error(n("webui.utils.fileUpload.uploadCancelled")));
183
+ });
184
+ });
185
+ }
186
+ /**
187
+ * 取消当前所有的上传任务
188
+ */
189
+ cancelUpload() {
190
+ this.abortController && this.abortController.abort();
191
+ }
192
+ }
193
+ const x = async (i, e) => {
194
+ const a = new S(i, 1), u = [e];
195
+ await a.uploadFiles(
196
+ u,
197
+ (s) => {
198
+ e.percent = s.percent;
199
+ },
200
+ (s) => {
201
+ const t = s[0];
202
+ e.percent = t.percent, t.status === l.Success ? (e.status = l.Online, f.success(n("webui.utils.fileUpload.fileUploadSuccess"))) : (e.status = l.Error, f.error(n("webui.utils.fileUpload.fileUploadFailed")));
203
+ }
204
+ );
205
+ };
206
+ export {
207
+ S as A,
208
+ l as U,
209
+ x as f,
210
+ M as p
211
+ };
@@ -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-D4vAp0qA.js";
3
+ import { a as P, _ as k } from "./toolIcon-CghIoh0a.js";
4
4
  const C = /* @__PURE__ */ d({
5
5
  inheritAttrs: !1,
6
6
  __name: "index",
@@ -0,0 +1,372 @@
1
+ import H from "async-validator";
2
+ import { httpPost as $, ResStatus as M } from "@skyfox2000/fapi";
3
+ import { $ as d, i as U, au as V, L as j, u as T } from "./upload-template-D6r6X3vP.js";
4
+ import E from "vue-m-message";
5
+ import { defineComponent as S, useAttrs as B, createElementBlock as P, openBlock as y, createVNode as z, unref as v, mergeProps as _, computed as x, createBlock as D, withCtx as A, normalizeStyle as N } from "vue";
6
+ import { Spin as L, Alert as O } from "ant-design-vue";
7
+ import { _ as K } from "./toolIcon-CghIoh0a.js";
8
+ const W = (l) => {
9
+ const e = l.split(`
10
+ `).filter((i) => i.trim() !== "");
11
+ if (e.length === 0)
12
+ return { headers: [], rows: [] };
13
+ const s = e.map((i) => i.split(",").map((r) => {
14
+ const o = r.trim();
15
+ if (o === "" || o === "null") return null;
16
+ const t = Number(o);
17
+ return isNaN(t) ? o : t;
18
+ })), c = s[0].map((i) => String(i || "")), a = s.slice(1);
19
+ return { headers: c, rows: a };
20
+ }, q = async (l) => {
21
+ try {
22
+ const e = await import("exceljs"), s = new e.default.Workbook();
23
+ await s.xlsx.load(l);
24
+ const c = s.worksheets[0];
25
+ if (!c)
26
+ return { headers: [], rows: [] };
27
+ const a = [], i = [];
28
+ return c.getRow(1).eachCell((r) => {
29
+ let o = "";
30
+ r.value !== null && r.value !== void 0 && (typeof r.value == "object" ? "richText" in r.value && Array.isArray(r.value.richText) ? o = r.value.richText.map((t) => t.text || "").join("") : "text" in r.value && typeof r.value.text == "string" ? o = r.value.text : r.value instanceof Date ? o = r.value.toLocaleDateString() : o = String(r.value) : o = String(r.value)), a.push(o);
31
+ }), c.eachRow((r, o) => {
32
+ if (o > 1) {
33
+ const t = [];
34
+ a.forEach((f, n) => {
35
+ const u = r.getCell(n + 1).value;
36
+ u != null ? typeof u == "object" ? "richText" in u && Array.isArray(u.richText) ? t.push(u.richText.map((h) => h.text || "").join("")) : "text" in u && typeof u.text == "string" ? t.push(u.text) : (u instanceof Date, t.push(u)) : t.push(u) : t.push(null);
37
+ }), i.push(t);
38
+ }
39
+ }), { headers: a, rows: i };
40
+ } catch (e) {
41
+ return console.error("Excel解析失败:", e), { headers: [], rows: [] };
42
+ }
43
+ }, k = async (l, e, s) => {
44
+ try {
45
+ const c = await import("exceljs"), a = new c.default.Workbook(), i = a.addWorksheet("Sheet1"), { headers: r, rows: o } = l;
46
+ if (r.length === 0)
47
+ throw new Error(d("webui.utils.excelPreview.dataEmpty"));
48
+ const t = /* @__PURE__ */ new Map();
49
+ s != null && s.markCells && s.markCells.forEach(({ row: h, col: p, color: w }) => {
50
+ const b = `${h}-${p}`;
51
+ t.set(b, w || "FFFF0000");
52
+ });
53
+ const f = i.getRow(1);
54
+ r.forEach((h, p) => {
55
+ const w = f.getCell(p + 1);
56
+ w.value = h, w.font = { bold: !0 }, w.fill = {
57
+ type: "pattern",
58
+ pattern: "solid",
59
+ fgColor: { argb: "FFE0E0E0" }
60
+ }, s != null && s.markHeaders && s.markHeaders.includes(h) && (w.fill = {
61
+ type: "pattern",
62
+ pattern: "solid",
63
+ fgColor: { argb: "FFFF0000" }
64
+ }, w.font = {
65
+ name: "Arial",
66
+ size: 10,
67
+ bold: !0,
68
+ color: { argb: "FFFFFFFF" }
69
+ });
70
+ }), o.forEach((h, p) => {
71
+ const w = i.getRow(p + 2);
72
+ h.forEach((b, F) => {
73
+ const C = w.getCell(F + 1);
74
+ C.value = b;
75
+ const R = `${p + 2}-${F + 1}`;
76
+ t.has(R) && (C.fill = {
77
+ type: "pattern",
78
+ pattern: "solid",
79
+ fgColor: { argb: t.get(R) }
80
+ });
81
+ });
82
+ }), i.columns.forEach((h) => {
83
+ h.width = 15;
84
+ });
85
+ const n = await a.xlsx.writeBuffer(), m = new Blob([n], {
86
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
87
+ });
88
+ return {
89
+ success: !0,
90
+ blobUrl: URL.createObjectURL(m),
91
+ fileName: e.replace(/\.(csv|xlsx?)$/i, ".xlsx")
92
+ };
93
+ } catch (c) {
94
+ return console.error("转换Excel失败:", c), {
95
+ success: !1,
96
+ error: c instanceof Error ? c.message : d("webui.utils.formCsv.unknownError")
97
+ };
98
+ }
99
+ }, ae = async (l, e) => {
100
+ try {
101
+ const s = W(l);
102
+ return await k(s, e);
103
+ } catch (s) {
104
+ return {
105
+ success: !1,
106
+ error: s instanceof Error ? s.message : d("webui.utils.excelPreview.csvProcessingFailed")
107
+ };
108
+ }
109
+ }, ne = async (l, e) => {
110
+ try {
111
+ const s = new Blob([l], {
112
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
113
+ });
114
+ return {
115
+ success: !0,
116
+ blobUrl: URL.createObjectURL(s),
117
+ fileName: e
118
+ };
119
+ } catch (s) {
120
+ return {
121
+ success: !1,
122
+ error: s instanceof Error ? s.message : d("webui.utils.excelPreview.excelProcessingFailed")
123
+ };
124
+ }
125
+ }, ce = async (l, e) => await k(l, e), g = async (l) => {
126
+ const e = await q(l);
127
+ if (e.headers.length === 0)
128
+ return E.error(d("webui.utils.formExcel.noWorksheet")), null;
129
+ const s = [];
130
+ return e.rows.forEach((c) => {
131
+ const a = {};
132
+ e.headers.forEach((i, r) => {
133
+ i && (a[i] = c[r]);
134
+ }), s.push(a);
135
+ }), {
136
+ headers: e.headers,
137
+ excelData: s,
138
+ excelRows: e.rows
139
+ };
140
+ }, J = async (l, e, s) => {
141
+ const c = await g(l);
142
+ if (!c)
143
+ return { success: !1, error: d("webui.utils.formExcel.processFailed") };
144
+ const { headers: a, excelRows: i } = c, { markHeaders: r } = e, o = [...a];
145
+ r && r.length > 0 && r.forEach((f) => {
146
+ o.includes(f) || o.push(f);
147
+ });
148
+ const t = i.map((f) => {
149
+ const n = [...f];
150
+ for (; n.length < o.length; )
151
+ n.push(null);
152
+ return n;
153
+ });
154
+ return await k({ headers: o, rows: t }, s, e);
155
+ }, G = async (l, e) => {
156
+ if (!e || U(e))
157
+ return { hasError: !1 };
158
+ const s = await g(l);
159
+ if (!s) return { hasError: !0 };
160
+ const { headers: c, excelData: a } = s, i = [];
161
+ if (Object.keys(e).forEach((t) => {
162
+ c.includes(t) || i.push(t);
163
+ }), c.length === 0 || a.length === 0)
164
+ return E.error(d("webui.utils.formExcel.insufficientData")), { hasError: !0 };
165
+ const r = new H({});
166
+ r.messages(V.messages()), r.define(e);
167
+ const o = await Q(c, a, r);
168
+ return o.length > 0 || i.length > 0 ? {
169
+ hasError: !0,
170
+ markCells: o.map((f) => ({
171
+ row: f.row + 2,
172
+ // 转为Excel行号(+2是因为表头占一行,且是1-based索引)
173
+ col: f.col + 1,
174
+ // 转为Excel列号(+1是因为是1-based索引)
175
+ color: "FFFF0000"
176
+ // 红色
177
+ })),
178
+ markHeaders: i
179
+ } : { hasError: !1 };
180
+ }, Q = async (l, e, s) => {
181
+ const c = [];
182
+ for (let a = 0; a < e.length; a++) {
183
+ const i = e[a];
184
+ try {
185
+ await s.validate(i).catch(({ errors: r }) => {
186
+ const o = [];
187
+ r.forEach((t) => {
188
+ const f = l.indexOf(t.field);
189
+ f >= 0 && (o.some((m) => m.row === a && m.col === f) || o.push({
190
+ row: a,
191
+ col: f,
192
+ header: t.field,
193
+ message: t.message.replace("${label}", l[f])
194
+ }));
195
+ }), c.push(...o);
196
+ });
197
+ } catch (r) {
198
+ console.error(d("webui.utils.formExcel.validationError") + ":", r), E.error(d("webui.utils.formExcel.validationError") + ":" + r);
199
+ }
200
+ }
201
+ return c;
202
+ }, X = async (l, e, s) => {
203
+ if (!e || e.length === 0)
204
+ return { hasError: !1 };
205
+ const c = await g(l);
206
+ if (!c) return { hasError: !0 };
207
+ const { headers: a, excelData: i } = c, r = [];
208
+ if (e.forEach((n) => {
209
+ a.includes(n) || r.push(n);
210
+ }), r.length > 0)
211
+ return E.error(d("webui.utils.formExcel.missingDuplicateFields") + `: ${r.join(", ")}`), { hasError: !0 };
212
+ const o = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), f = new Array();
213
+ if (i.forEach((n, m) => {
214
+ const u = e.map((w) => n[w]), h = u.join("|");
215
+ f.push(h);
216
+ const p = u.some((w) => w != null && w !== "");
217
+ p && o.has(h) ? (t.add(m), t.add(o.get(h))) : p && o.set(h, m);
218
+ }), s) {
219
+ const n = await $(s, {
220
+ Data: f
221
+ });
222
+ if ((n == null ? void 0 : n.status) == M.SUCCESS)
223
+ (n == null ? void 0 : n.data).forEach((u) => {
224
+ t.add(u);
225
+ });
226
+ else throw (n == null ? void 0 : n.errno) == j ? (T().logout(!1), new Error("登录已过期")) : new Error(n == null ? void 0 : n.msg);
227
+ }
228
+ if (t.size > 0) {
229
+ const n = [];
230
+ return t.forEach((m) => {
231
+ e.forEach((u) => {
232
+ const h = a.indexOf(u);
233
+ h >= 0 && n.push({
234
+ row: m + 2,
235
+ // Excel行号 = 数组索引 + 2(表头和1-based索引)
236
+ col: h + 1,
237
+ // Excel列号 = 数组索引 + 1(1-based索引)
238
+ color: "FFA500"
239
+ // 黄橙色
240
+ });
241
+ });
242
+ }), {
243
+ hasError: !0,
244
+ markCells: n,
245
+ markHeaders: r
246
+ };
247
+ }
248
+ return { hasError: !1 };
249
+ }, le = async (l, e, s, c) => {
250
+ const a = [], i = [];
251
+ let r = !1, o = !1, t = d("webui.utils.formExcel.validationSuccess"), f = d("webui.utils.formExcel.duplicateValidationPending");
252
+ const n = await G(l, e);
253
+ if (n.hasError ? (r = !0, t = d("webui.utils.formExcel.validationFailed"), n.markCells && a.push(...n.markCells), n.markHeaders && i.push(...n.markHeaders)) : e && Object.keys(e).length > 0 && (t = d("webui.utils.formExcel.validationPassed")), s && s.length > 0) {
254
+ const u = await X(l, s, c);
255
+ u.hasError ? (o = !0, f = d("webui.utils.formExcel.duplicateDetected"), u.markCells && u.markCells.forEach((h) => {
256
+ const p = a.find(
257
+ (w) => w.row === h.row && w.col === h.col
258
+ );
259
+ p ? p.color = "8B0000" : a.push(h);
260
+ }), u.markHeaders && i.push(...u.markHeaders)) : f = d("webui.utils.formExcel.duplicateCheckPassed");
261
+ }
262
+ if (r || o) {
263
+ const u = await J(
264
+ l,
265
+ {
266
+ markCells: a,
267
+ markHeaders: i
268
+ },
269
+ "validation_errors.xlsx"
270
+ );
271
+ return u.success && u.blobUrl ? {
272
+ errBlob: await (await fetch(u.blobUrl)).blob(),
273
+ validationMsg: t,
274
+ duplicateMsg: f,
275
+ hasFormatError: r,
276
+ hasDuplicateError: o
277
+ } : {
278
+ validationMsg: t,
279
+ duplicateMsg: f,
280
+ hasFormatError: r,
281
+ hasDuplicateError: o
282
+ };
283
+ }
284
+ return {
285
+ validationMsg: t,
286
+ duplicateMsg: f,
287
+ hasFormatError: !1,
288
+ hasDuplicateError: !1
289
+ };
290
+ }, ie = async (l, e, s) => {
291
+ const c = l.originFileObj;
292
+ if (c) {
293
+ const a = await c.arrayBuffer(), i = await g(a);
294
+ if (!i) {
295
+ E.error(d("webui.utils.formExcel.fileNotExcel"));
296
+ return;
297
+ }
298
+ const { headers: r, excelRows: o, excelData: t } = i;
299
+ s && s.length > 0 ? s.forEach((f) => {
300
+ switch (f) {
301
+ case "Headers":
302
+ e.Headers = r;
303
+ break;
304
+ case "RawRows":
305
+ e.RawRows = o;
306
+ break;
307
+ case "Records":
308
+ e.Records = t;
309
+ break;
310
+ }
311
+ }) : (e.Headers = r, e.RawRows = o, e.Records = t);
312
+ }
313
+ }, Y = { class: "absolute z-[9999] w-full h-full top-0 flex flex-flow row items-center justify-center" }, ue = /* @__PURE__ */ S({
314
+ __name: "index",
315
+ setup(l) {
316
+ const e = B();
317
+ return (s, c) => (y(), P("div", Y, [
318
+ z(v(L), _({ style: { "margin-top": "-10%" } }, v(e)), null, 16)
319
+ ]));
320
+ }
321
+ }), fe = /* @__PURE__ */ S({
322
+ __name: "index",
323
+ props: {
324
+ icon: {},
325
+ type: { default: "info" },
326
+ showIcon: { type: Boolean, default: !0 },
327
+ message: {}
328
+ },
329
+ setup(l) {
330
+ const e = l, s = {
331
+ success: "#52c41a",
332
+ info: "#1890ff",
333
+ warning: "#faad14",
334
+ error: "#ff4d4f"
335
+ }, c = {
336
+ success: "icon-success-fill",
337
+ info: "icon-info-fill",
338
+ warning: "icon-warn-fill",
339
+ error: "icon-error-fill"
340
+ }, a = x(() => e.type || "info"), i = x(() => s[a.value]), r = x(() => c[a.value]), o = Math.random().toString(36).substring(2, 9), t = x(() => `${o}-${a.value}-${r.value}`);
341
+ return (f, n) => (y(), D(v(O), _({
342
+ "show-icon": l.showIcon,
343
+ type: l.type,
344
+ message: l.message
345
+ }, f.$attrs), {
346
+ icon: A(() => [
347
+ (y(), D(K, {
348
+ icon: r.value,
349
+ style: N({ color: i.value }),
350
+ key: t.value
351
+ }, null, 8, ["icon", "style"]))
352
+ ]),
353
+ _: 1
354
+ }, 16, ["show-icon", "type", "message"]));
355
+ }
356
+ });
357
+ export {
358
+ fe as _,
359
+ X as a,
360
+ ie as b,
361
+ ae as c,
362
+ J as d,
363
+ W as e,
364
+ q as f,
365
+ ne as g,
366
+ ue as h,
367
+ le as i,
368
+ ce as n,
369
+ g as p,
370
+ k as t,
371
+ G as v
372
+ };