@skyfox2000/webui 1.0.14 → 1.2.0

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 (162) hide show
  1. package/lib/assets/modules/file-upload-CBUcsUnR.js +170 -0
  2. package/lib/assets/modules/form-validate-CgX7aR7T.js +297 -0
  3. package/lib/assets/modules/index-Civhd8xG.js +112 -0
  4. package/lib/assets/modules/index-DQMdt51R.js +726 -0
  5. package/lib/assets/modules/{index-BEWJ_qAH.js → index-DmWrkTXX.js} +1 -1
  6. package/lib/assets/modules/{menuTabs-BXdbFZor.js → menuTabs-BRYvFWA-.js} +131 -121
  7. package/lib/assets/modules/settingInfo-BZakNKIN.js +999 -0
  8. package/lib/assets/modules/uploadList-B7XoxGOh.js +278 -0
  9. package/lib/components/common/icon/index.vue.d.ts +1 -1
  10. package/lib/components/content/dialog/index.vue.d.ts +1 -1
  11. package/lib/components/content/drawer/index.vue.d.ts +1 -1
  12. package/lib/components/content/form/index.vue.d.ts +1 -1
  13. package/lib/components/content/search/index.vue.d.ts +1 -1
  14. package/lib/components/content/table/index.vue.d.ts +1 -1
  15. package/lib/components/content/table/tableOperate.vue.d.ts +1 -1
  16. package/lib/components/content/toolbar/icontool.vue.d.ts +1 -1
  17. package/lib/components/content/toolbar/index.vue.d.ts +1 -1
  18. package/lib/components/content/tree/index.vue.d.ts +1 -1
  19. package/lib/components/form/transfer/transferTable.vue.d.ts +1 -1
  20. package/lib/components/form/treeSelect/index.vue.d.ts +1 -1
  21. package/lib/components/form/upload/uploadList.vue.d.ts +1 -1
  22. package/lib/const/options.d.ts +32 -0
  23. package/lib/directives/enter-submit.d.ts +4 -0
  24. package/lib/directives/index.d.ts +2 -0
  25. package/lib/directives/permission.d.ts +5 -0
  26. package/lib/es/AceEditor/index.js +9 -8
  27. package/lib/es/BasicLayout/index.js +28 -24
  28. package/lib/es/Error403/index.js +15 -10
  29. package/lib/es/Error404/index.js +15 -10
  30. package/lib/es/ExcelForm/index.js +380 -175
  31. package/lib/es/UploadForm/index.js +23 -20
  32. package/lib/index.d.ts +42 -2
  33. package/lib/router/index.d.ts +16 -0
  34. package/lib/stores/appInfo.d.ts +34 -0
  35. package/lib/stores/hostInfo.d.ts +9 -0
  36. package/lib/stores/pageInfo.d.ts +18 -0
  37. package/lib/stores/pinia.d.ts +3 -0
  38. package/lib/stores/settingInfo.d.ts +8 -0
  39. package/lib/stores/userInfo.d.ts +21 -0
  40. package/lib/typings/data.d.ts +80 -0
  41. package/lib/typings/form.d.ts +171 -0
  42. package/lib/typings/menu.d.ts +7 -0
  43. package/lib/typings/option.d.ts +175 -0
  44. package/lib/typings/page.d.ts +69 -0
  45. package/lib/typings/table.d.ts +181 -0
  46. package/lib/typings/tools.d.ts +130 -0
  47. package/lib/typings/tree.d.ts +72 -0
  48. package/lib/typings/upload.d.ts +161 -0
  49. package/lib/typings/urls.d.ts +69 -0
  50. package/lib/utils/cache.d.ts +23 -0
  51. package/lib/utils/data.d.ts +6 -0
  52. package/lib/utils/download.d.ts +4 -0
  53. package/lib/utils/eventbus.d.ts +16 -0
  54. package/lib/utils/export-table.d.ts +12 -0
  55. package/lib/utils/file-upload.d.ts +15 -0
  56. package/lib/utils/form-excel.d.ts +30 -0
  57. package/lib/utils/form-validate.d.ts +29 -0
  58. package/lib/utils/form.d.ts +9 -0
  59. package/lib/utils/icon-loader.d.ts +125 -0
  60. package/lib/utils/isEmpty.d.ts +1 -0
  61. package/lib/utils/main-openapis.d.ts +9 -0
  62. package/lib/utils/menu.d.ts +6 -0
  63. package/lib/utils/options.d.ts +10 -0
  64. package/lib/utils/page.d.ts +25 -0
  65. package/lib/utils/table.d.ts +21 -0
  66. package/lib/utils/tools.d.ts +18 -0
  67. package/lib/utils/tree.d.ts +3 -0
  68. package/lib/vite-env.d.ts +8 -0
  69. package/lib/webui.css +1 -1
  70. package/lib/webui.es.js +890 -724
  71. package/package.json +7 -6
  72. package/src/components/common/icon/appicon.vue +1 -1
  73. package/src/components/common/icon/fullscreen.vue +2 -1
  74. package/src/components/common/icon/index.vue +1 -1
  75. package/src/components/common/icon/layoutIcon.vue +1 -1
  76. package/src/components/common/icon/projectIcon.vue +1 -1
  77. package/src/components/common/icon/toolIcon.vue +1 -1
  78. package/src/components/content/dialog/excelForm.vue +2 -2
  79. package/src/components/content/dialog/index.vue +1 -1
  80. package/src/components/content/dialog/uploadForm.vue +7 -6
  81. package/src/components/content/drawer/index.vue +43 -18
  82. package/src/components/content/form/formItem.vue +1 -1
  83. package/src/components/content/form/index.vue +1 -1
  84. package/src/components/content/search/index.vue +1 -1
  85. package/src/components/content/search/searchItem.vue +1 -1
  86. package/src/components/content/table/index.vue +3 -3
  87. package/src/components/content/table/tableOperate.vue +2 -2
  88. package/src/components/content/toolbar/icontool.vue +2 -2
  89. package/src/components/content/toolbar/index.vue +3 -2
  90. package/src/components/content/tree/index.vue +1 -1
  91. package/src/components/error/error403.vue +2 -2
  92. package/src/components/error/error404.vue +2 -2
  93. package/src/components/form/autoComplete/index.vue +1 -1
  94. package/src/components/form/cascader/index.vue +1 -2
  95. package/src/components/form/checkbox/index.vue +11 -5
  96. package/src/components/form/datePicker/index.vue +1 -1
  97. package/src/components/form/input/index.vue +1 -1
  98. package/src/components/form/input/inputNumber.vue +1 -1
  99. package/src/components/form/input/inputPassword.vue +1 -1
  100. package/src/components/form/radio/index.vue +1 -1
  101. package/src/components/form/radio/radioStatus.vue +1 -1
  102. package/src/components/form/rangePicker/index.vue +1 -1
  103. package/src/components/form/select/index.vue +1 -1
  104. package/src/components/form/switch/index.vue +7 -3
  105. package/src/components/form/textarea/index.vue +1 -1
  106. package/src/components/form/transfer/index.vue +1 -1
  107. package/src/components/form/transfer/transferTable.vue +42 -22
  108. package/src/components/form/treeSelect/index.vue +2 -3
  109. package/src/components/form/upload/uploadList.vue +1 -1
  110. package/src/components/layout/breadcrumb/index.vue +1 -1
  111. package/src/components/layout/header/headerExits.vue +1 -1
  112. package/src/components/layout/header/index.vue +1 -1
  113. package/src/components/layout/header/user.vue +2 -1
  114. package/src/components/layout/menu/index.vue +9 -3
  115. package/src/components/layout/menu/menuTabs.vue +10 -12
  116. package/src/components/layout/page/basicLayout.vue +1 -1
  117. package/src/const/options.ts +114 -0
  118. package/src/directives/enter-submit.ts +13 -0
  119. package/src/directives/index.ts +26 -0
  120. package/src/directives/permission.ts +144 -0
  121. package/src/index.ts +201 -0
  122. package/src/router/index.ts +196 -0
  123. package/src/stores/appInfo.ts +471 -0
  124. package/src/stores/hostInfo.ts +117 -0
  125. package/src/stores/pageInfo.ts +131 -0
  126. package/src/stores/pinia.ts +10 -0
  127. package/src/stores/settingInfo.ts +53 -0
  128. package/src/stores/userInfo.ts +392 -0
  129. package/src/typings/data.d.ts +81 -0
  130. package/src/typings/form.d.ts +172 -0
  131. package/src/typings/menu.d.ts +7 -0
  132. package/src/typings/option.d.ts +177 -0
  133. package/src/typings/page.d.ts +70 -0
  134. package/src/typings/table.d.ts +182 -0
  135. package/src/typings/tools.d.ts +131 -0
  136. package/src/typings/tree.d.ts +73 -0
  137. package/src/typings/upload.d.ts +162 -0
  138. package/src/typings/urls.d.ts +70 -0
  139. package/src/utils/cache.ts +175 -0
  140. package/src/utils/data.ts +189 -0
  141. package/src/utils/download.ts +80 -0
  142. package/src/utils/eventbus.ts +78 -0
  143. package/src/utils/export-table.ts +155 -0
  144. package/src/utils/file-upload.ts +304 -0
  145. package/src/utils/form-excel.ts +523 -0
  146. package/src/utils/form-validate.ts +368 -0
  147. package/src/utils/form.ts +188 -0
  148. package/src/utils/icon-loader.ts +412 -0
  149. package/src/utils/isEmpty.ts +18 -0
  150. package/src/utils/main-openapis.ts +72 -0
  151. package/src/utils/menu.ts +89 -0
  152. package/src/utils/options.ts +324 -0
  153. package/src/utils/page.ts +262 -0
  154. package/src/utils/table.ts +274 -0
  155. package/src/utils/tools.ts +362 -0
  156. package/src/utils/tree.ts +28 -0
  157. package/tsconfig.json +1 -8
  158. package/vite.config.ts +7 -4
  159. package/lib/assets/modules/index-BahGnrAq.js +0 -415
  160. package/lib/assets/modules/index-BoKIa2sr.js +0 -109
  161. package/lib/assets/modules/index-D47Ci-T3.js +0 -107
  162. package/lib/assets/modules/uploadList-Dzlg47V0.js +0 -182
@@ -1,27 +1,232 @@
1
- import { defineComponent as Y, ref as r, watch as A, onMounted as Z, createBlock as ee, openBlock as d, unref as i, withCtx as _, renderSlot as le, createElementVNode as c, createVNode as m, createElementBlock as f, createCommentVNode as M, createTextVNode as O, toDisplayString as F, normalizeClass as ae, Fragment as P, renderList as $ } from "vue";
2
- import { _ as K } from "../../assets/modules/index-BoKIa2sr.js";
3
- import { Modal as te, Upload as I, Alert as G, Space as re } from "ant-design-vue";
4
- import { ResStatus as oe } from "@skyfox2000/fapi";
5
- import { getRuleTexts as se, AsyncUploader as ie, path as ue, UploadStatus as ne, processExcelFile as ce, doSave as ve, validateExcel as de, checkExcelDuplicates as fe } from "@skyfox2000/webbase";
6
- import "../../assets/modules/index-BEWJ_qAH.js";
7
- import n from "vue-m-message";
8
- import pe from "@vue-office/excel";
9
- const me = { class: "mb-4 flex items-center" }, xe = {
1
+ import { defineComponent as te, ref as E, watch as P, onMounted as ae, createBlock as le, openBlock as N, unref as k, withCtx as T, renderSlot as re, createElementVNode as O, createVNode as L, createElementBlock as U, createCommentVNode as V, createTextVNode as H, toDisplayString as M, normalizeClass as oe, Fragment as q, renderList as G } from "vue";
2
+ import { i as se, v as ie, g as ne, _ as I, b as ce } from "../../assets/modules/form-validate-CgX7aR7T.js";
3
+ import { Modal as ue, Upload as Q, Alert as X, Space as fe } from "ant-design-vue";
4
+ import { httpPost as ve, ResStatus as Y } from "@skyfox2000/fapi";
5
+ import "../../assets/modules/settingInfo-BZakNKIN.js";
6
+ import { A as de, p as pe, U as me } from "../../assets/modules/file-upload-CBUcsUnR.js";
7
+ import "@skyfox2000/microbase";
8
+ import b from "vue-m-message";
9
+ import ge from "async-validator";
10
+ import "dayjs";
11
+ import "../../assets/modules/index-DmWrkTXX.js";
12
+ import he from "@vue-office/excel";
13
+ const K = async (C) => {
14
+ const o = await import("exceljs"), a = new o.Workbook();
15
+ await a.xlsx.load(C);
16
+ const f = a.worksheets[0];
17
+ if (!f)
18
+ return b.error("Excel文件不包含工作表"), null;
19
+ const s = [], y = [];
20
+ return f.getRow(1).eachCell((t) => {
21
+ let r = "";
22
+ if (t.value !== null && t.value !== void 0)
23
+ if (typeof t.value == "object")
24
+ if ("richText" in t.value && Array.isArray(t.value.richText))
25
+ r = t.value.richText.map((l) => l.text || "").join("");
26
+ else if ("text" in t.value && typeof t.value.text == "string")
27
+ r = t.value.text;
28
+ else if (t.value instanceof Date)
29
+ r = t.value.toLocaleDateString();
30
+ else
31
+ try {
32
+ r = JSON.stringify(t.value);
33
+ } catch {
34
+ r = String(t.value);
35
+ }
36
+ else
37
+ r = String(t.value);
38
+ s.push(r);
39
+ }), f.eachRow((t, r) => {
40
+ if (r > 1) {
41
+ const l = {};
42
+ s.forEach((c, i) => {
43
+ if (c) {
44
+ const n = t.getCell(i + 1).value;
45
+ n != null ? typeof n == "object" ? "richText" in n && Array.isArray(n.richText) ? l[c] = n.richText.map((g) => g.text || "").join("") : "text" in n && typeof n.text == "string" ? l[c] = n.text : (n instanceof Date, l[c] = n) : l[c] = n : l[c] = null;
46
+ }
47
+ }), y.push(l);
48
+ }
49
+ }), { workbook: a, worksheet: f, headers: s, excelData: y };
50
+ }, Z = async (C, o) => {
51
+ const a = await import("exceljs"), f = await K(C);
52
+ if (!f) return { hasError: !0 };
53
+ const { worksheet: s, headers: y } = f, { markCells: t, markHeaders: r } = o;
54
+ if (t.length === 0 && (!r || r.length === 0))
55
+ return { hasError: !1 };
56
+ const l = [...y];
57
+ r && r.length > 0 && r.forEach((v) => {
58
+ l.includes(v) || l.push(v);
59
+ });
60
+ const c = new a.Workbook(), i = c.addWorksheet("Sheet1"), p = 15, n = /* @__PURE__ */ new Map();
61
+ t.forEach(({ row: v, col: F, color: u }) => {
62
+ const w = `${v}-${F}`;
63
+ n.set(w, u || "FFFF0000");
64
+ });
65
+ for (let v = 0; v < l.length; v++) {
66
+ const F = i.getColumn(v + 1);
67
+ if (v < s.columnCount && v < y.length) {
68
+ const u = s.getColumn(v + 1);
69
+ u && u.width ? F.width = u.width : F.width = p;
70
+ } else
71
+ F.width = p;
72
+ }
73
+ const g = i.getRow(1);
74
+ l.forEach((v, F) => {
75
+ const u = g.getCell(F + 1);
76
+ u.value = v;
77
+ const w = F < y.length;
78
+ if (w && F < s.columnCount) {
79
+ const e = s.getRow(1).getCell(F + 1);
80
+ e.style && (u.style = JSON.parse(JSON.stringify(e.style))), e.font && (u.font = JSON.parse(JSON.stringify(e.font))), e.alignment && (u.alignment = JSON.parse(JSON.stringify(e.alignment))), e.border && (u.border = JSON.parse(JSON.stringify(e.border))), e.numFmt && (u.numFmt = e.numFmt), e.fill && (u.fill = JSON.parse(JSON.stringify(e.fill)));
81
+ }
82
+ r && r.includes(v) && !w && (u.fill = {
83
+ type: "pattern",
84
+ pattern: "solid",
85
+ fgColor: { argb: "FFFF0000" }
86
+ // 红色背景
87
+ }, u.font = {
88
+ name: "Arial",
89
+ size: 10,
90
+ bold: !0,
91
+ color: { argb: "FFFFFFFF" }
92
+ // 白色文字
93
+ });
94
+ }), g.commit(), s.eachRow((v, F) => {
95
+ if (F > 1) {
96
+ const u = i.getRow(F);
97
+ for (let w = 0; w < l.length; w++) {
98
+ const e = u.getCell(w + 1);
99
+ if (w < y.length && w < s.columnCount) {
100
+ const h = v.getCell(w + 1);
101
+ if (e.value = h.value, e.value !== null && e.value !== void 0 && typeof e.value == "object" && !("richText" in e.value) && !("formula" in e.value) && !("hyperlink" in e.value) && !(e.value instanceof Date))
102
+ try {
103
+ "text" in e.value && typeof e.value.text == "string" ? e.value = e.value.text : e.value = JSON.stringify(e.value);
104
+ } catch {
105
+ e.value = String(e.value);
106
+ }
107
+ h.style && (e.style = JSON.parse(JSON.stringify(h.style))), h.font && (e.font = JSON.parse(JSON.stringify(h.font))), h.alignment && (e.alignment = JSON.parse(JSON.stringify(h.alignment))), h.border && (e.border = JSON.parse(JSON.stringify(h.border))), h.numFmt && (e.numFmt = h.numFmt), h.fill && (e.fill = JSON.parse(JSON.stringify(h.fill)));
108
+ const A = `${F}-${w + 1}`;
109
+ n.has(A) && (e.fill = {
110
+ type: "pattern",
111
+ pattern: "solid",
112
+ fgColor: { argb: n.get(A) }
113
+ });
114
+ } else
115
+ e.value = null;
116
+ }
117
+ v.height && (u.height = v.height), v.outlineLevel && (u.outlineLevel = v.outlineLevel), u.commit();
118
+ }
119
+ });
120
+ const J = await c.xlsx.writeBuffer();
121
+ return { hasError: !0, errBlob: new Blob([J], {
122
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
123
+ }) };
124
+ }, xe = async (C, o) => {
125
+ if (!o || se(o))
126
+ return { hasError: !1 };
127
+ const a = await K(C);
128
+ if (!a) return { hasError: !0 };
129
+ const { headers: f, excelData: s } = a, y = [];
130
+ if (Object.keys(o).forEach((l) => {
131
+ f.includes(l) || y.push(l);
132
+ }), f.length === 0 || s.length === 0)
133
+ return b.error("Excel文件不包含足够的数据"), { hasError: !0 };
134
+ const t = new ge({});
135
+ t.messages(ie.messages()), t.define(o);
136
+ const r = await ye(f, s, t);
137
+ if (r.length > 0 || y.length > 0) {
138
+ const l = r.map((c) => ({
139
+ row: c.row + 2,
140
+ // 转为Excel行号(+2是因为表头占一行,且是1-based索引)
141
+ col: c.col + 1,
142
+ // 转为Excel列号(+1是因为是1-based索引)
143
+ color: "FFFF0000"
144
+ // 红色
145
+ }));
146
+ return Z(C, {
147
+ markCells: l,
148
+ markHeaders: y
149
+ });
150
+ }
151
+ return { hasError: !1 };
152
+ }, ye = async (C, o, a) => {
153
+ const f = [];
154
+ for (let s = 0; s < o.length; s++) {
155
+ const y = o[s];
156
+ try {
157
+ await a.validate(y).catch(({ errors: t }) => {
158
+ const r = [];
159
+ t.forEach((l) => {
160
+ const c = C.indexOf(l.field);
161
+ c >= 0 && (r.some((p) => p.row === s && p.col === c) || r.push({
162
+ row: s,
163
+ col: c,
164
+ header: l.field,
165
+ message: l.message.replace("${label}", C[c])
166
+ }));
167
+ }), f.push(...r);
168
+ });
169
+ } catch (t) {
170
+ console.error("验证表格数据时发生错误:", t), b.error("验证表格数据时发生错误:" + t);
171
+ }
172
+ }
173
+ return f;
174
+ }, we = async (C, o, a) => {
175
+ if (!o || o.length === 0)
176
+ return { hasError: !1 };
177
+ const f = await K(C);
178
+ if (!f) return { hasError: !0 };
179
+ const { headers: s, excelData: y } = f, t = [];
180
+ if (o.forEach((i) => {
181
+ s.includes(i) || t.push(i);
182
+ }), t.length > 0)
183
+ return b.error(`表头缺少重复检测所需字段: ${t.join(", ")}`), { hasError: !0 };
184
+ const r = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), c = new Array();
185
+ if (y.forEach((i, p) => {
186
+ const n = o.map((g) => i[g]).join("|");
187
+ c.push(n), r.has(n) ? (l.add(p), l.add(r.get(n))) : r.set(n, p);
188
+ }), a) {
189
+ const i = await ve(a, {
190
+ Data: c
191
+ });
192
+ if (i != null && i.data && i.data.forEach((p) => {
193
+ l.add(p);
194
+ }), (i == null ? void 0 : i.status) === Y.ERROR)
195
+ throw new Error(i.msg);
196
+ }
197
+ if (l.size > 0) {
198
+ const i = [];
199
+ return l.forEach((p) => {
200
+ o.forEach((n) => {
201
+ const g = s.indexOf(n);
202
+ g >= 0 && i.push({
203
+ row: p + 2,
204
+ // Excel行号 = 数组索引 + 2(表头和1-based索引)
205
+ col: g + 1,
206
+ // Excel列号 = 数组索引 + 1(1-based索引)
207
+ color: "FFFF0000"
208
+ // 红色
209
+ });
210
+ });
211
+ }), Z(C, { markCells: i, markHeaders: t });
212
+ }
213
+ return { hasError: !1 };
214
+ }, be = { class: "mb-4 flex items-center" }, Fe = {
10
215
  key: 0,
11
216
  class: "ml-3 text-gray-600"
12
- }, ge = { class: "flex gap-4" }, ye = {
217
+ }, Ee = { class: "flex gap-4" }, Ce = {
13
218
  key: 0,
14
219
  class: "w-[22%] flex-grow overflow-hidden flex flex-col"
15
- }, he = { class: "bg-gray-50 p-2 rounded border flex-grow flex flex-col" }, _e = {
220
+ }, Se = { class: "bg-gray-50 p-2 rounded border flex-grow flex flex-col" }, ke = {
16
221
  key: 0,
17
222
  class: "text-gray-500"
18
- }, be = {
223
+ }, _e = {
19
224
  key: 1,
20
225
  class: "flex flex-col"
21
- }, we = { class: "overflow-y-auto" }, Ce = { class: "text-[13px] text-gray-600" }, Fe = { class: "pl-5 mt-1 mb-0" }, Ee = {
226
+ }, Oe = { class: "overflow-y-auto" }, De = { class: "text-[13px] text-gray-600" }, Ne = { class: "pl-5 mt-1 mb-0" }, Je = {
22
227
  key: 0,
23
228
  class: "mt-3"
24
- }, Ue = { class: "text-[12px] text-gray-600 p-1" }, Se = { class: "text-[13px] text-gray-600" }, ke = { class: "pl-5 mt-1 mb-0" }, De = { class: "text-[12px] text-gray-600" }, Oe = /* @__PURE__ */ Y({
229
+ }, Ue = { class: "text-[12px] text-gray-600 p-1" }, Le = { class: "text-[13px] text-gray-600" }, Re = { class: "pl-5 mt-1 mb-0" }, Be = { class: "text-[12px] text-gray-600" }, qe = /* @__PURE__ */ te({
25
230
  __name: "excelForm",
26
231
  props: {
27
232
  title: {},
@@ -33,189 +238,189 @@ const me = { class: "mb-4 flex items-center" }, xe = {
33
238
  excelBatchField: {},
34
239
  saveText: {}
35
240
  },
36
- setup(Q) {
37
- const o = Q, e = o.excelCtrl, b = r(!1), w = r(""), q = r([]), x = r(""), E = r(!0), U = r("待验证数据规则"), S = r("warning"), k = r("待验证重复数据"), D = r("warning");
38
- A(
39
- () => e.visible.value,
241
+ setup(C) {
242
+ const o = C, a = o.excelCtrl, f = E(!1), s = E(""), y = E([]), t = E(""), r = E(!0), l = E("待验证数据规则"), c = E("warning"), i = E("待验证重复数据"), p = E("warning");
243
+ P(
244
+ () => a.visible.value,
40
245
  () => {
41
- b.value = e.visible.value;
246
+ f.value = a.visible.value;
42
247
  }
43
- ), A(
44
- () => b.value,
248
+ ), P(
249
+ () => f.value,
45
250
  () => {
46
- e.visible.value = b.value;
251
+ a.visible.value = f.value;
47
252
  }
48
253
  );
49
- const R = r(o.uploadParams), p = r(R.value.uploadUrl), g = r(R.value.duplicateRules), C = r(R.value.duplicateUrl), H = async () => {
50
- const l = p.value;
51
- if (!l) {
52
- n.error("未配置文件上传地址!");
254
+ const n = E(o.uploadParams), g = E(n.value.uploadUrl), J = E(n.value.duplicateRules), R = E(n.value.duplicateUrl), v = async () => {
255
+ const d = g.value;
256
+ if (!d) {
257
+ b.error("未配置文件上传地址!");
53
258
  return;
54
259
  }
55
- if (B.value) {
56
- n.error("表格数据存在验证错误,请修正后再上传!");
260
+ if (u.value) {
261
+ b.error("表格数据存在验证错误,请修正后再上传!");
57
262
  return;
58
263
  }
59
- e.isFormLoading.value = !0;
264
+ a.isFormLoading.value = !0;
60
265
  try {
61
- if (!z.value || !x.value) {
62
- n.warning("请先选择Excel文件!"), e.isFormLoading.value = !1;
266
+ if (!e.value || !t.value) {
267
+ b.warning("请先选择Excel文件!"), a.isFormLoading.value = !1;
63
268
  return;
64
269
  }
65
- const a = new ie(l, 1), s = new File([z.value], x.value, {
270
+ const m = new de(d, 1), S = new File([e.value], t.value, {
66
271
  type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
67
- }), t = ue.join(R.value.basePath, x.value), v = {
272
+ }), x = pe.join(n.value.basePath, t.value), D = {
68
273
  uid: "1",
69
- name: x.value,
70
- originFileObj: s,
71
- status: ne.Uploading,
274
+ name: t.value,
275
+ originFileObj: S,
276
+ status: me.Uploading,
72
277
  percent: 0,
73
278
  params: {
74
- FileKey: t
279
+ FileKey: x
75
280
  }
76
- }, y = new AbortController();
281
+ }, B = new AbortController();
77
282
  try {
78
- await a.uploadFile(v, y.signal, (u) => {
79
- v.percent = u;
80
- }), n.success("文件上传成功,开始业务处理!"), J(v);
81
- } catch (u) {
82
- throw console.error("文件上传错误:", u), n.error((u == null ? void 0 : u.message) || "文件上传失败,请稍后再试!"), u;
283
+ await m.uploadFile(D, B.signal, (_) => {
284
+ D.percent = _;
285
+ }), b.success("文件上传成功,开始业务处理!"), F(D);
286
+ } catch (_) {
287
+ throw console.error("文件上传错误:", _), b.error((_ == null ? void 0 : _.message) || "文件上传失败,请稍后再试!"), _;
83
288
  }
84
- } catch (a) {
85
- console.error("上传处理错误:", a), n.error("上传处理失败:" + ((a == null ? void 0 : a.message) || "未知错误"));
289
+ } catch (m) {
290
+ console.error("上传处理错误:", m), b.error("上传处理失败:" + ((m == null ? void 0 : m.message) || "未知错误"));
86
291
  } finally {
87
- e.isFormLoading.value = !1;
292
+ a.isFormLoading.value = !1;
88
293
  }
89
- }, J = async (l) => {
90
- if (e.formData.value) {
294
+ }, F = async (d) => {
295
+ if (a.formData.value) {
91
296
  if (o.excelBatchField) {
92
- const t = await ce(z.value);
93
- if (!t) return null;
94
- const { excelData: v } = t, y = v.map((u) => {
95
- const h = {};
96
- for (const L in u) {
97
- const j = o.excelFieldMap[L];
98
- j && (h[j] = u[L]);
297
+ const x = await K(e.value);
298
+ if (!x) return null;
299
+ const { excelData: D } = x, B = D.map((_) => {
300
+ const j = {};
301
+ for (const $ in _) {
302
+ const z = o.excelFieldMap[$];
303
+ z && (j[z] = _[$]);
99
304
  }
100
- return h;
305
+ return j;
101
306
  });
102
- e.formData.value[o.excelBatchField] = y;
307
+ a.formData.value[o.excelBatchField] = B;
103
308
  }
104
- const a = o.fileField ?? "FileInfo";
105
- e.formData.value[a] = l, e.beforeSave && e.beforeSave();
106
- const s = {
309
+ const m = o.fileField ?? "FileInfo";
310
+ a.formData.value[m] = d, a.beforeSave && a.beforeSave();
311
+ const S = {
107
312
  Data: {
108
- ...e.formData.value
313
+ ...a.formData.value
109
314
  },
110
315
  Query: {
111
- [o.excelCtrl.primaryKey]: e.formData.value[o.excelCtrl.primaryKey]
316
+ [o.excelCtrl.primaryKey]: a.formData.value[o.excelCtrl.primaryKey]
112
317
  }
113
318
  };
114
- e.isFormLoading.value = !0;
319
+ a.isFormLoading.value = !0;
115
320
  try {
116
- const t = await ve(o.excelCtrl, {
117
- params: s,
321
+ const x = await ce(o.excelCtrl, {
322
+ params: S,
118
323
  urlKey: "save",
119
324
  url: o.excelCtrl.saveUrl
120
325
  });
121
- (t == null ? void 0 : t.status) === oe.SUCCESS ? (n.success("数据保存成功!"), e.afterSave && e.afterSave(), e.visible.value = !1) : n.error("保存失败:" + ((t == null ? void 0 : t.msg) || "未知错误"));
122
- } catch (t) {
123
- console.error("保存错误:", t), n.error("数据保存失败,请稍后再试!");
326
+ (x == null ? void 0 : x.status) === Y.SUCCESS ? (b.success("数据保存成功!"), a.afterSave && a.afterSave(), a.visible.value = !1) : b.error("保存失败:" + ((x == null ? void 0 : x.msg) || "未知错误"));
327
+ } catch (x) {
328
+ console.error("保存错误:", x), b.error("数据保存失败,请稍后再试!");
124
329
  } finally {
125
- e.isFormLoading.value = !1;
330
+ a.isFormLoading.value = !1;
126
331
  }
127
332
  }
128
- }, B = r(!1), N = r(!1), z = r(null), W = async (l) => {
129
- if (!(l.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || l.type === "application/vnd.ms-excel"))
130
- return n.error("只能上传Excel文件!"), I.LIST_IGNORE;
333
+ }, u = E(!1), w = E(!1), e = E(null), W = async (d) => {
334
+ if (!(d.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || d.type === "application/vnd.ms-excel"))
335
+ return b.error("只能上传Excel文件!"), Q.LIST_IGNORE;
131
336
  try {
132
- x.value = l.name, B.value = !1, N.value = !1, E.value = !0, U.value = "待验证数据规则", S.value = "warning", k.value = "待验证重复数据", D.value = "warning";
133
- const s = await l.arrayBuffer();
134
- z.value = s;
135
- const t = new FileReader();
136
- t.readAsDataURL(l), t.onload = async (v) => {
137
- if (v.target) {
138
- const { hasError: y, errBlob: u } = await de(s, e.formRules.value);
139
- if (y) {
140
- if (u) {
141
- B.value = !0, E.value = !1, U.value = "数据验证失败", S.value = "error";
142
- const h = URL.createObjectURL(u);
143
- w.value = h;
337
+ t.value = d.name, u.value = !1, w.value = !1, r.value = !0, l.value = "待验证数据规则", c.value = "warning", i.value = "待验证重复数据", p.value = "warning";
338
+ const S = await d.arrayBuffer();
339
+ e.value = S;
340
+ const x = new FileReader();
341
+ x.readAsDataURL(d), x.onload = async (D) => {
342
+ if (D.target) {
343
+ const { hasError: B, errBlob: _ } = await xe(S, a.formRules.value);
344
+ if (B) {
345
+ if (_) {
346
+ u.value = !0, r.value = !1, l.value = "数据验证失败", c.value = "error";
347
+ const j = URL.createObjectURL(_);
348
+ s.value = j;
144
349
  }
145
350
  return;
146
351
  } else
147
- U.value = "数据验证成功", S.value = "success";
148
- if (g.value && g.value.length > 0 && C.value)
352
+ l.value = "数据验证成功", c.value = "success";
353
+ if (J.value && J.value.length > 0 && R.value)
149
354
  try {
150
- C.value.api || (C.value.api = o.gridCtrl.page.api), C.value.authorize === void 0 && (C.value.authorize = o.gridCtrl.page.authorize);
151
- const { hasError: h, errBlob: L } = await fe(
152
- s,
153
- g.value,
154
- C.value
355
+ R.value.api || (R.value.api = o.gridCtrl.page.api), R.value.authorize === void 0 && (R.value.authorize = o.gridCtrl.page.authorize);
356
+ const { hasError: j, errBlob: $ } = await we(
357
+ S,
358
+ J.value,
359
+ R.value
155
360
  );
156
- if (h) {
157
- if (L) {
158
- N.value = !0, k.value = "检测到重复数据", D.value = "error";
159
- const j = URL.createObjectURL(L);
160
- w.value = j;
361
+ if (j) {
362
+ if ($) {
363
+ w.value = !0, i.value = "检测到重复数据", p.value = "error";
364
+ const z = URL.createObjectURL($);
365
+ s.value = z;
161
366
  }
162
367
  return;
163
368
  } else
164
- N.value = !1, k.value = "数据验证通过", D.value = "success";
369
+ w.value = !1, i.value = "数据验证通过", p.value = "success";
165
370
  } catch {
166
- k.value = "重复检测异常", D.value = "error";
371
+ i.value = "重复检测异常", p.value = "error";
167
372
  }
168
- w.value = v.target.result, E.value = !1;
373
+ s.value = D.target.result, r.value = !1;
169
374
  } else
170
- n.error("加载Excel文件失败,请检查文件格式!");
375
+ b.error("加载Excel文件失败,请检查文件格式!");
171
376
  };
172
- } catch (s) {
173
- console.error("Excel处理错误:", s), n.error("Excel文件处理失败,请检查文件格式!"), E.value = !1, U.value = "Excel处理错误", S.value = "error";
377
+ } catch (S) {
378
+ console.error("Excel处理错误:", S), b.error("Excel文件处理失败,请检查文件格式!"), r.value = !1, l.value = "Excel处理错误", c.value = "error";
174
379
  }
175
380
  return !1;
176
- }, T = se(e.formRules.value);
177
- Z(() => {
178
- const l = o.gridCtrl.page;
179
- if (p.value = p.value ?? l.urls.upload, !p.value) {
180
- n.error("未配置文件上传地址!");
381
+ }, h = ne(a.formRules.value);
382
+ ae(() => {
383
+ const d = o.gridCtrl.page;
384
+ if (g.value = g.value ?? d.urls.upload, !g.value) {
385
+ b.error("未配置文件上传地址!");
181
386
  return;
182
387
  }
183
- p.value.api || (p.value.api = l.api), p.value.authorize === void 0 && (p.value.authorize = l.authorize);
184
- for (const a in e.formData.value)
185
- o.gridCtrl.rowData.value && (e.formData.value[a] = o.gridCtrl.rowData.value[a]);
186
- b.value = e.visible.value;
388
+ g.value.api || (g.value.api = d.api), g.value.authorize === void 0 && (g.value.authorize = d.authorize);
389
+ for (const m in a.formData.value)
390
+ o.gridCtrl.rowData.value && (a.formData.value[m] = o.gridCtrl.rowData.value[m]);
391
+ f.value = a.visible.value;
187
392
  });
188
- const V = () => {
189
- e.visible.value = !1;
190
- }, X = () => {
393
+ const A = () => {
394
+ a.visible.value = !1;
395
+ }, ee = () => {
191
396
  console.error("渲染失败");
192
397
  };
193
- return (l, a) => (d(), ee(i(te), {
194
- title: l.title ?? "Excel文件上传",
195
- open: b.value,
196
- "onUpdate:open": a[0] || (a[0] = (s) => b.value = s),
197
- wrapClassName: ["modal", "mx-auto", l.$attrs.width ? "w-[" + l.$attrs.width + "]" : ""].join(" "),
398
+ return (d, m) => (N(), le(k(ue), {
399
+ title: d.title ?? "Excel文件上传",
400
+ open: f.value,
401
+ "onUpdate:open": m[0] || (m[0] = (S) => f.value = S),
402
+ wrapClassName: ["modal", "mx-auto", d.$attrs.width ? "w-[" + d.$attrs.width + "]" : ""].join(" "),
198
403
  width: 940,
199
- onClose: V
404
+ onClose: A
200
405
  }, {
201
- footer: _(() => [
202
- m(i(re), null, {
203
- default: _(() => [
204
- m(i(K), { onClick: V }, {
205
- default: _(() => a[2] || (a[2] = [
206
- O("取消")
406
+ footer: T(() => [
407
+ L(k(fe), null, {
408
+ default: T(() => [
409
+ L(k(I), { onClick: A }, {
410
+ default: T(() => m[2] || (m[2] = [
411
+ H("取消")
207
412
  ])),
208
413
  _: 1,
209
414
  __: [2]
210
415
  }),
211
- m(i(K), {
212
- onClick: H,
416
+ L(k(I), {
417
+ onClick: v,
213
418
  type: "primary",
214
- loading: i(e).isFormSaving.value,
215
- disabled: !w.value || B.value || N.value || E.value
419
+ loading: k(a).isFormSaving.value,
420
+ disabled: !s.value || u.value || w.value || r.value
216
421
  }, {
217
- default: _(() => [
218
- O(F(l.saveText ?? "上传文件"), 1)
422
+ default: T(() => [
423
+ H(M(d.saveText ?? "上传文件"), 1)
219
424
  ]),
220
425
  _: 1
221
426
  }, 8, ["loading", "disabled"])
@@ -223,19 +428,19 @@ const me = { class: "mb-4 flex items-center" }, xe = {
223
428
  _: 1
224
429
  })
225
430
  ]),
226
- default: _(() => [
227
- le(l.$slots, "default"),
228
- c("div", me, [
229
- m(i(I), {
230
- "file-list": q.value,
431
+ default: T(() => [
432
+ re(d.$slots, "default"),
433
+ O("div", be, [
434
+ L(k(Q), {
435
+ "file-list": y.value,
231
436
  "before-upload": W,
232
437
  accept: ".xlsx,.xls",
233
438
  showUploadList: !0
234
439
  }, {
235
- default: _(() => [
236
- m(i(K), { type: "primary" }, {
237
- default: _(() => a[1] || (a[1] = [
238
- O("选择Excel文件")
440
+ default: T(() => [
441
+ L(k(I), { type: "primary" }, {
442
+ default: T(() => m[1] || (m[1] = [
443
+ H("选择Excel文件")
239
444
  ])),
240
445
  _: 1,
241
446
  __: [1]
@@ -243,18 +448,18 @@ const me = { class: "mb-4 flex items-center" }, xe = {
243
448
  ]),
244
449
  _: 1
245
450
  }, 8, ["file-list"]),
246
- w.value && x.value ? (d(), f("div", xe, [
247
- c("span", null, F(x.value), 1)
248
- ])) : M("", !0)
451
+ s.value && t.value ? (N(), U("div", Fe, [
452
+ O("span", null, M(t.value), 1)
453
+ ])) : V("", !0)
249
454
  ]),
250
- c("div", ge, [
251
- c("div", {
252
- class: ae(["flex-shrink-0 excel-container", [i(T).length === 0 ? "w-[100%]" : "w-[80%]"]]),
455
+ O("div", Ee, [
456
+ O("div", {
457
+ class: oe(["flex-shrink-0 excel-container", [k(h).length === 0 ? "w-[100%]" : "w-[80%]"]]),
253
458
  style: { height: "430px" }
254
459
  }, [
255
- m(i(pe), {
256
- src: w.value,
257
- onError: X,
460
+ L(k(he), {
461
+ src: s.value,
462
+ onError: ee,
258
463
  style: { width: "100%", height: "100%" },
259
464
  options: {
260
465
  styles: !0,
@@ -266,46 +471,46 @@ const me = { class: "mb-4 flex items-center" }, xe = {
266
471
  }
267
472
  }, null, 8, ["src"])
268
473
  ], 2),
269
- i(T).length > 0 ? (d(), f("div", ye, [
270
- c("div", he, [
271
- i(T).length === 0 ? (d(), f("div", _e, "没有设置验证规则")) : (d(), f("div", be, [
272
- m(i(G), {
273
- message: U.value,
274
- type: S.value,
474
+ k(h).length > 0 ? (N(), U("div", Ce, [
475
+ O("div", Se, [
476
+ k(h).length === 0 ? (N(), U("div", ke, "没有设置验证规则")) : (N(), U("div", _e, [
477
+ L(k(X), {
478
+ message: l.value,
479
+ type: c.value,
275
480
  "show-icon": "",
276
481
  class: "mb-2"
277
482
  }, null, 8, ["message", "type"]),
278
- c("div", we, [
279
- (d(!0), f(P, null, $(i(T), (s, t) => (d(), f("div", {
280
- key: t,
483
+ O("div", Oe, [
484
+ (N(!0), U(q, null, G(k(h), (S, x) => (N(), U("div", {
485
+ key: x,
281
486
  class: "border-b pb-0"
282
487
  }, [
283
- c("div", Ce, F(s.field), 1),
284
- c("ul", Fe, [
285
- (d(!0), f(P, null, $(s.rules, (v, y) => (d(), f("li", {
286
- key: y,
488
+ O("div", De, M(S.field), 1),
489
+ O("ul", Ne, [
490
+ (N(!0), U(q, null, G(S.rules, (D, B) => (N(), U("li", {
491
+ key: B,
287
492
  class: "text-[12px] text-gray-600"
288
- }, F(v), 1))), 128))
493
+ }, M(D), 1))), 128))
289
494
  ])
290
495
  ]))), 128))
291
496
  ]),
292
- g.value && g.value.length > 0 ? (d(), f("div", Ee, [
293
- m(i(G), {
294
- message: k.value,
295
- type: D.value,
497
+ J.value && J.value.length > 0 ? (N(), U("div", Je, [
498
+ L(k(X), {
499
+ message: i.value,
500
+ type: p.value,
296
501
  "show-icon": "",
297
502
  class: "mt-2 mb-2"
298
503
  }, null, 8, ["message", "type"]),
299
- c("div", Ue, [
300
- c("div", Se, " 以下" + F(g.value.length > 1 ? "组合" : "字段") + "必须唯一 ", 1),
301
- c("ul", ke, [
302
- c("li", De, F(g.value.join(", ")), 1)
504
+ O("div", Ue, [
505
+ O("div", Le, " 以下" + M(J.value.length > 1 ? "组合" : "字段") + "必须唯一 ", 1),
506
+ O("ul", Re, [
507
+ O("li", Be, M(J.value.join(", ")), 1)
303
508
  ])
304
509
  ])
305
- ])) : M("", !0)
510
+ ])) : V("", !0)
306
511
  ]))
307
512
  ])
308
- ])) : M("", !0)
513
+ ])) : V("", !0)
309
514
  ])
310
515
  ]),
311
516
  _: 3
@@ -313,5 +518,5 @@ const me = { class: "mb-4 flex items-center" }, xe = {
313
518
  }
314
519
  });
315
520
  export {
316
- Oe as default
521
+ qe as default
317
522
  };