@skyfox2000/webui 1.2.9 → 1.2.10

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 (120) hide show
  1. package/package.json +1 -1
  2. package/src/stores/userInfo.ts +28 -2
  3. package/lib/AceEditor.d.ts +0 -1
  4. package/lib/BasicLayout.d.ts +0 -1
  5. package/lib/Error403.d.ts +0 -1
  6. package/lib/Error404.d.ts +0 -1
  7. package/lib/ExcelForm.d.ts +0 -1
  8. package/lib/UploadForm.d.ts +0 -1
  9. package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  10. package/lib/assets/modules/file-upload-BYIvmkmy.js +0 -204
  11. package/lib/assets/modules/form-excel-BUX2QW11.js +0 -235
  12. package/lib/assets/modules/index-DcRkhkn2.js +0 -109
  13. package/lib/assets/modules/index-jl5Ie2tZ.js +0 -112
  14. package/lib/assets/modules/menuTabs-DY1XBq16.js +0 -671
  15. package/lib/assets/modules/toolIcon-BDIOj_3l.js +0 -50
  16. package/lib/assets/modules/uploadList-BPG5whz7.js +0 -369
  17. package/lib/assets/modules/uploadList-D2Ux4h1N.js +0 -2253
  18. package/lib/components/common/button/index.vue.d.ts +0 -41
  19. package/lib/components/common/icon/appicon.vue.d.ts +0 -11
  20. package/lib/components/common/icon/fullscreen.vue.d.ts +0 -3
  21. package/lib/components/common/icon/helper.vue.d.ts +0 -22
  22. package/lib/components/common/icon/index.vue.d.ts +0 -243
  23. package/lib/components/common/icon/layoutIcon.vue.d.ts +0 -43
  24. package/lib/components/common/icon/projectIcon.vue.d.ts +0 -59
  25. package/lib/components/common/icon/toolIcon.vue.d.ts +0 -43
  26. package/lib/components/common/index.d.ts +0 -20
  27. package/lib/components/common/loading/index.vue.d.ts +0 -3
  28. package/lib/components/common/tooltip/index.vue.d.ts +0 -21
  29. package/lib/components/content/dialog/index.vue.d.ts +0 -35
  30. package/lib/components/content/drawer/index.vue.d.ts +0 -28
  31. package/lib/components/content/form/formItem.vue.d.ts +0 -27
  32. package/lib/components/content/form/index.vue.d.ts +0 -25
  33. package/lib/components/content/index.d.ts +0 -22
  34. package/lib/components/content/search/index.vue.d.ts +0 -30
  35. package/lib/components/content/search/searchItem.vue.d.ts +0 -23
  36. package/lib/components/content/table/index.vue.d.ts +0 -36
  37. package/lib/components/content/table/tableOperate.vue.d.ts +0 -18
  38. package/lib/components/content/toolbar/icontool.vue.d.ts +0 -7
  39. package/lib/components/content/toolbar/index.vue.d.ts +0 -18
  40. package/lib/components/content/tree/index.vue.d.ts +0 -46
  41. package/lib/components/form/aceEditor/aceConfig.d.ts +0 -8
  42. package/lib/components/form/autoComplete/index.vue.d.ts +0 -176
  43. package/lib/components/form/cascader/index.vue.d.ts +0 -120
  44. package/lib/components/form/checkbox/index.vue.d.ts +0 -139
  45. package/lib/components/form/datePicker/index.vue.d.ts +0 -6
  46. package/lib/components/form/index.d.ts +0 -39
  47. package/lib/components/form/input/index.vue.d.ts +0 -26
  48. package/lib/components/form/input/inputIcon.vue.d.ts +0 -10
  49. package/lib/components/form/input/inputNumber.vue.d.ts +0 -3
  50. package/lib/components/form/input/inputPassword.vue.d.ts +0 -3
  51. package/lib/components/form/propEditor/index.vue.d.ts +0 -21
  52. package/lib/components/form/radio/index.vue.d.ts +0 -144
  53. package/lib/components/form/radio/radioStatus.vue.d.ts +0 -31
  54. package/lib/components/form/rangePicker/index.vue.d.ts +0 -16
  55. package/lib/components/form/select/index.vue.d.ts +0 -153
  56. package/lib/components/form/switch/index.vue.d.ts +0 -43
  57. package/lib/components/form/textarea/index.vue.d.ts +0 -3
  58. package/lib/components/form/transfer/index.vue.d.ts +0 -38
  59. package/lib/components/form/transfer/transferTable.vue.d.ts +0 -38
  60. package/lib/components/form/treeSelect/index.vue.d.ts +0 -38
  61. package/lib/components/form/upload/uploadList.vue.d.ts +0 -487
  62. package/lib/components/index.d.ts +0 -4
  63. package/lib/components/layout/breadcrumb/index.vue.d.ts +0 -3
  64. package/lib/components/layout/content/index.vue.d.ts +0 -22
  65. package/lib/components/layout/datetime/index.vue.d.ts +0 -3
  66. package/lib/components/layout/header/headerExits.vue.d.ts +0 -3
  67. package/lib/components/layout/header/index.vue.d.ts +0 -3
  68. package/lib/components/layout/header/user.vue.d.ts +0 -3
  69. package/lib/components/layout/index.d.ts +0 -14
  70. package/lib/components/layout/menu/index.vue.d.ts +0 -6
  71. package/lib/components/layout/menu/menuTabs.vue.d.ts +0 -3
  72. package/lib/const/options.d.ts +0 -32
  73. package/lib/directives/enter-submit.d.ts +0 -4
  74. package/lib/directives/index.d.ts +0 -2
  75. package/lib/directives/permission.d.ts +0 -5
  76. package/lib/es/AceEditor/index.js +0 -167
  77. package/lib/es/BasicLayout/index.js +0 -101
  78. package/lib/es/Error403/index.js +0 -39
  79. package/lib/es/Error404/index.js +0 -39
  80. package/lib/es/ExcelForm/index.js +0 -321
  81. package/lib/es/UploadForm/index.js +0 -110
  82. package/lib/index.d.ts +0 -45
  83. package/lib/router/index.d.ts +0 -15
  84. package/lib/stores/appInfo.d.ts +0 -31
  85. package/lib/stores/hostInfo.d.ts +0 -9
  86. package/lib/stores/pageInfo.d.ts +0 -18
  87. package/lib/stores/pinia.d.ts +0 -3
  88. package/lib/stores/settingInfo.d.ts +0 -8
  89. package/lib/stores/userInfo.d.ts +0 -24
  90. package/lib/typings/data.d.ts +0 -80
  91. package/lib/typings/form.d.ts +0 -187
  92. package/lib/typings/menu.d.ts +0 -7
  93. package/lib/typings/option.d.ts +0 -189
  94. package/lib/typings/page.d.ts +0 -70
  95. package/lib/typings/table.d.ts +0 -181
  96. package/lib/typings/tools.d.ts +0 -130
  97. package/lib/typings/tree.d.ts +0 -72
  98. package/lib/typings/upload.d.ts +0 -161
  99. package/lib/typings/urls.d.ts +0 -69
  100. package/lib/utils/cache.d.ts +0 -23
  101. package/lib/utils/data.d.ts +0 -6
  102. package/lib/utils/download.d.ts +0 -4
  103. package/lib/utils/eventbus.d.ts +0 -16
  104. package/lib/utils/export-table.d.ts +0 -12
  105. package/lib/utils/file-upload.d.ts +0 -17
  106. package/lib/utils/form-excel.d.ts +0 -33
  107. package/lib/utils/form-validate.d.ts +0 -29
  108. package/lib/utils/form.d.ts +0 -9
  109. package/lib/utils/icon-loader.d.ts +0 -125
  110. package/lib/utils/isEmpty.d.ts +0 -1
  111. package/lib/utils/main-openapis.d.ts +0 -8
  112. package/lib/utils/menu.d.ts +0 -6
  113. package/lib/utils/options.d.ts +0 -10
  114. package/lib/utils/page.d.ts +0 -25
  115. package/lib/utils/table.d.ts +0 -21
  116. package/lib/utils/tools.d.ts +0 -18
  117. package/lib/utils/tree.d.ts +0 -3
  118. package/lib/vite-env.d.ts +0 -8
  119. package/lib/webui.css +0 -1
  120. package/lib/webui.es.js +0 -2262
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyfox2000/webui",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "后台前端通用组件定义",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -1,7 +1,7 @@
1
1
  import { defineStore } from 'pinia';
2
2
  import { ApiResponse, httpPost, IUrlInfo, ReqParams, ResStatus, setToken } from '@skyfox2000/fapi';
3
3
  import message from 'vue-m-message';
4
- import { LoginInfo, UserInfo } from '@skyfox2000/microbase';
4
+ import { isMicroApp, LoginInfo, UserInfo } from '@skyfox2000/microbase';
5
5
  import { ref } from 'vue';
6
6
  import { useAppInfo } from './appInfo';
7
7
 
@@ -203,6 +203,22 @@ export const useUserInfo = defineStore('userInfo', {
203
203
  refreshToken: '',
204
204
  }),
205
205
  actions: {
206
+ /**
207
+ * 启动时初始化用户信息
208
+ */
209
+ init() {
210
+ // 非子应用,则需要检查token
211
+ if (!isMicroApp()) {
212
+ if (this.token) {
213
+ checkToken(this.token, () => this.clean());
214
+ setToken(this.token);
215
+ userLevel.value = this.userInfo.UserLevel;
216
+ this.isLogin = true;
217
+ } else {
218
+ this.clean();
219
+ }
220
+ }
221
+ },
206
222
  /**
207
223
  * 登录操作
208
224
  * @param loginInfo 登录信息
@@ -428,5 +444,15 @@ export const useUserInfo = defineStore('userInfo', {
428
444
  return Promise.resolve();
429
445
  },
430
446
  },
431
- persist: false,
447
+ persist: !isMicroApp()
448
+ ? {
449
+ key: 'MICROAPP_USER_INFO',
450
+ storage: localStorage,
451
+ pick: ['token', 'userInfo'], // 只存储token和userInfo
452
+ afterHydrate: (ctx: any) => {
453
+ // 加载后自动调用init()验证是否过期
454
+ ctx.store.init();
455
+ },
456
+ }
457
+ : false,
432
458
  });
@@ -1 +0,0 @@
1
- export {}
@@ -1 +0,0 @@
1
- export {}
package/lib/Error403.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
package/lib/Error404.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
@@ -1 +0,0 @@
1
- export {}
@@ -1 +0,0 @@
1
- export {}
@@ -1,9 +0,0 @@
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
- };
@@ -1,204 +0,0 @@
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-D2Ux4h1N.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
- };
@@ -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, ae as R } from "./uploadList-D2Ux4h1N.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
- };
@@ -1,109 +0,0 @@
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-BDIOj_3l.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
- };