@skyfox2000/webui 1.2.10 → 1.2.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 (121) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/lib/AceEditor.d.ts +1 -0
  3. package/lib/BasicLayout.d.ts +1 -0
  4. package/lib/Error403.d.ts +1 -0
  5. package/lib/Error404.d.ts +1 -0
  6. package/lib/ExcelForm.d.ts +1 -0
  7. package/lib/UploadForm.d.ts +1 -0
  8. package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  9. package/lib/assets/modules/file-upload-CGyzCx7I.js +204 -0
  10. package/lib/assets/modules/form-excel-DWirWVPA.js +235 -0
  11. package/lib/assets/modules/index-C1zkNPmi.js +109 -0
  12. package/lib/assets/modules/index-Czk7DDWM.js +112 -0
  13. package/lib/assets/modules/menuTabs-BOax-dro.js +671 -0
  14. package/lib/assets/modules/toolIcon-vJF7OgP6.js +50 -0
  15. package/lib/assets/modules/uploadList-BW23uSvi.js +369 -0
  16. package/lib/assets/modules/uploadList-DaUjVXLU.js +2267 -0
  17. package/lib/components/common/button/index.vue.d.ts +41 -0
  18. package/lib/components/common/icon/appicon.vue.d.ts +11 -0
  19. package/lib/components/common/icon/fullscreen.vue.d.ts +3 -0
  20. package/lib/components/common/icon/helper.vue.d.ts +22 -0
  21. package/lib/components/common/icon/index.vue.d.ts +243 -0
  22. package/lib/components/common/icon/layoutIcon.vue.d.ts +43 -0
  23. package/lib/components/common/icon/projectIcon.vue.d.ts +59 -0
  24. package/lib/components/common/icon/toolIcon.vue.d.ts +43 -0
  25. package/lib/components/common/index.d.ts +20 -0
  26. package/lib/components/common/loading/index.vue.d.ts +3 -0
  27. package/lib/components/common/tooltip/index.vue.d.ts +21 -0
  28. package/lib/components/content/dialog/index.vue.d.ts +35 -0
  29. package/lib/components/content/drawer/index.vue.d.ts +28 -0
  30. package/lib/components/content/form/formItem.vue.d.ts +27 -0
  31. package/lib/components/content/form/index.vue.d.ts +25 -0
  32. package/lib/components/content/index.d.ts +22 -0
  33. package/lib/components/content/search/index.vue.d.ts +30 -0
  34. package/lib/components/content/search/searchItem.vue.d.ts +23 -0
  35. package/lib/components/content/table/index.vue.d.ts +36 -0
  36. package/lib/components/content/table/tableOperate.vue.d.ts +18 -0
  37. package/lib/components/content/toolbar/icontool.vue.d.ts +7 -0
  38. package/lib/components/content/toolbar/index.vue.d.ts +18 -0
  39. package/lib/components/content/tree/index.vue.d.ts +46 -0
  40. package/lib/components/form/aceEditor/aceConfig.d.ts +8 -0
  41. package/lib/components/form/autoComplete/index.vue.d.ts +176 -0
  42. package/lib/components/form/cascader/index.vue.d.ts +120 -0
  43. package/lib/components/form/checkbox/index.vue.d.ts +139 -0
  44. package/lib/components/form/datePicker/index.vue.d.ts +6 -0
  45. package/lib/components/form/index.d.ts +39 -0
  46. package/lib/components/form/input/index.vue.d.ts +26 -0
  47. package/lib/components/form/input/inputIcon.vue.d.ts +10 -0
  48. package/lib/components/form/input/inputNumber.vue.d.ts +3 -0
  49. package/lib/components/form/input/inputPassword.vue.d.ts +3 -0
  50. package/lib/components/form/propEditor/index.vue.d.ts +21 -0
  51. package/lib/components/form/radio/index.vue.d.ts +144 -0
  52. package/lib/components/form/radio/radioStatus.vue.d.ts +31 -0
  53. package/lib/components/form/rangePicker/index.vue.d.ts +16 -0
  54. package/lib/components/form/select/index.vue.d.ts +153 -0
  55. package/lib/components/form/switch/index.vue.d.ts +43 -0
  56. package/lib/components/form/textarea/index.vue.d.ts +3 -0
  57. package/lib/components/form/transfer/index.vue.d.ts +38 -0
  58. package/lib/components/form/transfer/transferTable.vue.d.ts +38 -0
  59. package/lib/components/form/treeSelect/index.vue.d.ts +38 -0
  60. package/lib/components/form/upload/uploadList.vue.d.ts +487 -0
  61. package/lib/components/index.d.ts +4 -0
  62. package/lib/components/layout/breadcrumb/index.vue.d.ts +3 -0
  63. package/lib/components/layout/content/index.vue.d.ts +22 -0
  64. package/lib/components/layout/datetime/index.vue.d.ts +3 -0
  65. package/lib/components/layout/header/headerExits.vue.d.ts +3 -0
  66. package/lib/components/layout/header/index.vue.d.ts +3 -0
  67. package/lib/components/layout/header/user.vue.d.ts +3 -0
  68. package/lib/components/layout/index.d.ts +14 -0
  69. package/lib/components/layout/menu/index.vue.d.ts +6 -0
  70. package/lib/components/layout/menu/menuTabs.vue.d.ts +3 -0
  71. package/lib/const/options.d.ts +32 -0
  72. package/lib/directives/enter-submit.d.ts +4 -0
  73. package/lib/directives/index.d.ts +2 -0
  74. package/lib/directives/permission.d.ts +5 -0
  75. package/lib/es/AceEditor/index.js +167 -0
  76. package/lib/es/BasicLayout/index.js +101 -0
  77. package/lib/es/Error403/index.js +39 -0
  78. package/lib/es/Error404/index.js +39 -0
  79. package/lib/es/ExcelForm/index.js +321 -0
  80. package/lib/es/UploadForm/index.js +110 -0
  81. package/lib/index.d.ts +45 -0
  82. package/lib/router/index.d.ts +15 -0
  83. package/lib/stores/appInfo.d.ts +31 -0
  84. package/lib/stores/hostInfo.d.ts +9 -0
  85. package/lib/stores/pageInfo.d.ts +18 -0
  86. package/lib/stores/pinia.d.ts +3 -0
  87. package/lib/stores/settingInfo.d.ts +8 -0
  88. package/lib/stores/userInfo.d.ts +25 -0
  89. package/lib/typings/data.d.ts +80 -0
  90. package/lib/typings/form.d.ts +187 -0
  91. package/lib/typings/menu.d.ts +7 -0
  92. package/lib/typings/option.d.ts +189 -0
  93. package/lib/typings/page.d.ts +70 -0
  94. package/lib/typings/table.d.ts +181 -0
  95. package/lib/typings/tools.d.ts +130 -0
  96. package/lib/typings/tree.d.ts +72 -0
  97. package/lib/typings/upload.d.ts +161 -0
  98. package/lib/typings/urls.d.ts +69 -0
  99. package/lib/utils/cache.d.ts +23 -0
  100. package/lib/utils/data.d.ts +6 -0
  101. package/lib/utils/download.d.ts +4 -0
  102. package/lib/utils/eventbus.d.ts +16 -0
  103. package/lib/utils/export-table.d.ts +12 -0
  104. package/lib/utils/file-upload.d.ts +17 -0
  105. package/lib/utils/form-excel.d.ts +33 -0
  106. package/lib/utils/form-validate.d.ts +29 -0
  107. package/lib/utils/form.d.ts +9 -0
  108. package/lib/utils/icon-loader.d.ts +125 -0
  109. package/lib/utils/isEmpty.d.ts +1 -0
  110. package/lib/utils/main-openapis.d.ts +8 -0
  111. package/lib/utils/menu.d.ts +6 -0
  112. package/lib/utils/options.d.ts +10 -0
  113. package/lib/utils/page.d.ts +25 -0
  114. package/lib/utils/table.d.ts +21 -0
  115. package/lib/utils/tools.d.ts +18 -0
  116. package/lib/utils/tree.d.ts +3 -0
  117. package/lib/vite-env.d.ts +8 -0
  118. package/lib/webui.css +1 -0
  119. package/lib/webui.es.js +2262 -0
  120. package/package.json +4 -4
  121. package/src/components/content/form/formItem.vue +2 -2
@@ -5,7 +5,7 @@
5
5
  "explorer.fileNesting.patterns": {
6
6
  "*.ts": "$(capture).test.ts, $(capture).test.tsx",
7
7
  "*.tsx": "$(capture).test.ts, $(capture).test.tsx",
8
- "package.json": "index.html,pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitignore,.gitattributes,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,.env.*,env.d.ts,.prettierrc,.eslintrc.js,*.md,.cursorignore",
8
+ "package.json": "index.html,pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitignore,.gitattributes,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,.env.*,env.d.ts,.prettierrc,.eslintrc.js,*.md,.cursorignore,.npmignore",
9
9
  "vite.config.ts": "tsconfig.*.json,postcss.config.ts,tailwind.config.ts,tsconfig.json"
10
10
  },
11
11
  "editor.formatOnSave": true,
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,9 @@
1
+ const s = (t, r) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [c, e] of r)
4
+ o[c] = e;
5
+ return o;
6
+ };
7
+ export {
8
+ s as _
9
+ };
@@ -0,0 +1,204 @@
1
+ var m = Object.defineProperty;
2
+ var E = (t, r, n) => r in t ? m(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n;
3
+ var d = (t, r, n) => E(t, typeof r != "symbol" ? r + "" : r, n);
4
+ import { hostUrl as v } from "@skyfox2000/fapi";
5
+ import { ac as S, ab as w, u as g } from "./uploadList-DaUjVXLU.js";
6
+ import { mainAppApis as a } from "@skyfox2000/microbase";
7
+ import y from "dayjs";
8
+ import p from "vue-m-message";
9
+ var i = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Uploading = "uploading", t.Success = "success", t.Error = "error", t.Online = "online", t.Offline = "offline", t))(i || {});
10
+ const U = () => a.value ? a.value.getHostInfo() : S().hostInfo, x = () => a.value && a.value.getAppInfo ? a.value.getAppInfo() : w().appInfo, L = (t) => a.value && a.value.userLogin ? a.value.userLogin(t) : g().login(t, !0), M = () => a.value && a.value.userLogout ? a.value.userLogout() : g().logout(), b = () => a.value && a.value.getToken ? a.value.getToken() : g().getToken(), N = () => a.value && a.value.getUserInfo ? a.value.getUserInfo() : g().getUserInfo();
11
+ class z {
12
+ /**
13
+ * 连接路径参数,已判断 undefined 或 null 值
14
+ * @param args 路径参数数组
15
+ * @returns 连接后的路径字符串
16
+ */
17
+ static join(...r) {
18
+ return r.filter((u) => u != null).join("/").replace(/[\/]+/, "/");
19
+ }
20
+ }
21
+ class C {
22
+ /**
23
+ * AsyncUploader 构造函数
24
+ * @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
25
+ * @param maxConcurrent 最大允许并发上传的文件数量
26
+ */
27
+ constructor(r, n = 3) {
28
+ /**
29
+ * 设置 API 端点和最大并发数,所有上传文件通过该类控制
30
+ */
31
+ d(this, "urlInfo");
32
+ /**
33
+ * 最大并发上传数
34
+ */
35
+ d(this, "maxConcurrent");
36
+ /**
37
+ * 控制上传任务的中断信号
38
+ */
39
+ d(this, "abortController");
40
+ this.urlInfo = r, this.maxConcurrent = n;
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, n, c, u, o) {
52
+ if (r.length) {
53
+ if (r.length === 0) {
54
+ p.warning("请选择上传的文件!");
55
+ return;
56
+ }
57
+ n.value = !0, await this.uploadFiles(r, o, (f) => {
58
+ let e = !1, h = 0;
59
+ for (const s of f)
60
+ s.status === i.Error && h++;
61
+ h ? h < f.length ? c ? (p.error("上传结束,部分文件上传失败!"), p.warning("保存上传成功的文件!"), e = !0) : p.error("上传结束,部分文件上传失败,取消保存!") : p.error("上传结束,所有文件上传失败!") : (p.success("全部文件上传成功!"), e = !0), n.value = !1, u == null || u(e, f);
62
+ });
63
+ }
64
+ }
65
+ /**
66
+ * 上传多个文件,控制并发数量
67
+ * @param files 文件列表(File[] 或 FileList)
68
+ * @param onProgress 上传进度回调
69
+ * @param onComplete 上传完成回调
70
+ */
71
+ async uploadFiles(r, n, c) {
72
+ if (!r.length) return;
73
+ const u = Math.min(this.maxConcurrent, r.length), o = [];
74
+ for (const e of r)
75
+ switch (e.status) {
76
+ case i.Success:
77
+ case i.Online:
78
+ case i.Offline:
79
+ break;
80
+ default:
81
+ e.status = i.Pending, o.push(e);
82
+ break;
83
+ }
84
+ const f = [];
85
+ this.abortController = new AbortController();
86
+ try {
87
+ for (; f.length < u && o.length > 0; ) {
88
+ const e = o.shift();
89
+ if (!e) break;
90
+ f.push(this.handleFileStatus(e, f, o, n));
91
+ }
92
+ await Promise.all(f);
93
+ } catch (e) {
94
+ console.error("上传失败:", e), r.forEach((h) => {
95
+ h.status = i.Error, h.error = e instanceof Error ? e : new Error("上传失败"), n == null || n(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, n, c, u) {
109
+ try {
110
+ await this.uploadFile(r, this.abortController.signal, (o) => {
111
+ r.percent = o, u == null || u(r);
112
+ });
113
+ } catch (o) {
114
+ r.error = o instanceof Error ? o : new Error("上传失败"), console.error(r.error);
115
+ } finally {
116
+ if (c.length > 0) {
117
+ const o = c.shift();
118
+ o && n.push(this.handleFileStatus(o, n, c, u));
119
+ }
120
+ }
121
+ }
122
+ /**
123
+ * 使用 XMLHttpRequest 上传文件
124
+ * @param file 文件对象
125
+ * @param signal 中断信号
126
+ * @param onProgress 上传进度回调
127
+ */
128
+ async uploadFile(r, n, c) {
129
+ return r.status = i.Uploading, new Promise((u, o) => {
130
+ const f = new FormData();
131
+ if (f.append("file", r.originFileObj), r.params)
132
+ for (const s in r.params)
133
+ f.append(s, r.params[s]);
134
+ const e = new XMLHttpRequest(), h = v(this.urlInfo);
135
+ if (h === !1) return Promise.resolve(r);
136
+ if (e.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([s, l]) => {
137
+ e.setRequestHeader(s, l);
138
+ }), this.urlInfo.authorize) {
139
+ const s = b();
140
+ if (!s) {
141
+ o(new Error("未授权或授权过期"));
142
+ return;
143
+ }
144
+ e.setRequestHeader("Authorization", "Bearer " + s);
145
+ }
146
+ e.upload.addEventListener("progress", (s) => {
147
+ if (s.lengthComputable && s.total > 0) {
148
+ const l = Math.round(s.loaded / s.total * 100);
149
+ c(l);
150
+ }
151
+ }), e.addEventListener("load", () => {
152
+ if (e.status >= 200 && e.status < 300) {
153
+ const s = e.getResponseHeader("Content-Type");
154
+ if (!s || !s.includes("application/json")) {
155
+ o(new Error("返回的结果不是 JSON 格式"));
156
+ return;
157
+ }
158
+ try {
159
+ const l = JSON.parse(e.response);
160
+ if (l.status === "success")
161
+ l.data && (r.minioFile = {
162
+ ETag: l.data.ETag,
163
+ Bucket: l.data.Bucket,
164
+ FileName: r.fileName,
165
+ Key: l.data.Key,
166
+ Size: l.data.Size,
167
+ Type: r.type,
168
+ UpdateTime: y().format("YYYY-MM-DD HH:mm:ss"),
169
+ Status: i.Success
170
+ }), r.status = i.Success, u(r);
171
+ else {
172
+ const I = l.msg;
173
+ r.status = i.Error, o(new Error(I));
174
+ }
175
+ } catch (l) {
176
+ r.status = i.Error, o(new Error("无法解析返回的 JSON 数据: " + l));
177
+ }
178
+ } else
179
+ r.status = i.Error, o(new Error(`上传失败,状态码:${e.status}`));
180
+ }), e.addEventListener("error", () => {
181
+ r.status = i.Error, o(new Error("上传失败,网络异常"));
182
+ }), e.send(f), n.addEventListener("abort", () => {
183
+ e.abort(), o(new Error("上传已取消"));
184
+ });
185
+ });
186
+ }
187
+ /**
188
+ * 取消当前所有的上传任务
189
+ */
190
+ cancelUpload() {
191
+ this.abortController && this.abortController.abort();
192
+ }
193
+ }
194
+ export {
195
+ C as A,
196
+ i as U,
197
+ x as a,
198
+ M as b,
199
+ b as c,
200
+ N as d,
201
+ U as g,
202
+ z as p,
203
+ L as u
204
+ };
@@ -0,0 +1,235 @@
1
+ import k from "async-validator";
2
+ import { httpPost as J, ResStatus as C } from "@skyfox2000/fapi";
3
+ import { i as N, ae as R } from "./uploadList-DaUjVXLU.js";
4
+ import E from "vue-m-message";
5
+ const F = async (d) => {
6
+ const o = await import("exceljs"), g = new o.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.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
+ };
@@ -0,0 +1,109 @@
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
+ import { Button as _ } from "ant-design-vue";
3
+ import { a as P, _ as k } from "./toolIcon-vJF7OgP6.js";
4
+ const C = /* @__PURE__ */ d({
5
+ inheritAttrs: !1,
6
+ __name: "index",
7
+ props: {
8
+ /**
9
+ * 提示标题
10
+ * @props
11
+ * @name content
12
+ * @type {string}
13
+ */
14
+ tiptext: String,
15
+ /**
16
+ * 提示显示位置
17
+ * @props
18
+ * @name placement
19
+ * @type {string}
20
+ * @default 'top'
21
+ */
22
+ placement: {
23
+ type: String,
24
+ default: "top"
25
+ },
26
+ /**
27
+ * 内置图标属性设置
28
+ * @props
29
+ * @name iconProps
30
+ * @type {object}
31
+ * @summary 内置图标复杂属性设置,仅支持前置图标
32
+ */
33
+ iconProps: Object,
34
+ /**
35
+ * 默认使用框架图标
36
+ * 其它图标请自定义
37
+ * @props
38
+ * @name icon
39
+ * @type {string}
40
+ */
41
+ icon: String
42
+ // /**
43
+ // * 点击事件
44
+ // * @props
45
+ // * @name clickEvent
46
+ // * @summary 格式 "空间名#事件名",空间名和事件名用#分隔,事件名用.分隔
47
+ // * @type {string}
48
+ // */
49
+ // clickEvent: {
50
+ // type: String
51
+ // },
52
+ // /**
53
+ // * 点击传输数据
54
+ // * @props
55
+ // * @name data
56
+ // * @summary 点击事件传输的默认数据
57
+ // * @type {object|string}
58
+ // */
59
+ // data: {
60
+ // type: [Object, String]
61
+ // }
62
+ },
63
+ emits: [
64
+ /**
65
+ * 点击事件
66
+ * @emits
67
+ * @name click
68
+ * @summary 图标按钮点击时触发的事件
69
+ */
70
+ "click"
71
+ ],
72
+ setup(i, { emit: l }) {
73
+ const c = f(), t = i, a = l, m = () => {
74
+ t.iconProps && t.iconProps.icons && (t.iconProps.iconIndex = (t.iconProps.iconIndex + 1) % t.iconProps.icons.length), a("click");
75
+ };
76
+ return (s, b) => (x(), u("div", null, [
77
+ e(P, {
78
+ title: t.tiptext,
79
+ disabled: t.tiptext ? void 0 : "disabled",
80
+ placement: i.placement
81
+ }, {
82
+ default: n(() => [
83
+ e(o(_), r({ class: "px-[10px] py-[4px] flex items-center gap-1" }, o(c), { onClick: m }), {
84
+ icon: n(() => [
85
+ p(s.$slots, "icon", {}, () => [
86
+ e(k, r({
87
+ icon: t.icon,
88
+ class: [
89
+ o(c).type === "primary" ? "ant-btn-primary" : "",
90
+ "cursor-pointer w-[17px] h-[17px] mx-auto"
91
+ ],
92
+ clickable: ""
93
+ }, t.iconProps), null, 16, ["icon", "class"])
94
+ ])
95
+ ]),
96
+ default: n(() => [
97
+ p(s.$slots, "default")
98
+ ]),
99
+ _: 3
100
+ }, 16)
101
+ ]),
102
+ _: 3
103
+ }, 8, ["title", "disabled", "placement"])
104
+ ]));
105
+ }
106
+ });
107
+ export {
108
+ C as _
109
+ };