@skyfox2000/webui 1.5.4 → 1.5.7

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 (64) hide show
  1. package/lib/assets/modules/{baseLayout-BEy-FjcZ.js → baseLayout-DfTxHOFc.js} +7 -7
  2. package/lib/assets/modules/file-upload-DTOdV5vM.js +211 -0
  3. package/lib/assets/modules/index-BDoBUrYA.js +114 -0
  4. package/lib/assets/modules/{index-BTD6d1d_.js → index-BwMaOrJT.js} +1 -1
  5. package/lib/assets/modules/{index-BFxnKhwl.js → index-M1qERbea.js} +99 -99
  6. package/lib/assets/modules/{menuTabs-DUBWuf7t.js → menuTabs-DWaBSRNr.js} +42 -42
  7. package/lib/assets/modules/{toolIcon-DQLIuud3.js → toolIcon-BYnHhAy-.js} +1 -1
  8. package/lib/assets/modules/upload-template-BKm9mFq8.js +6764 -0
  9. package/lib/assets/modules/uploadList-CHvr6Hp1.js +472 -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 +14 -15
  13. package/lib/es/Error404/index.js +16 -17
  14. package/lib/es/ExcelForm/index.js +244 -244
  15. package/lib/es/MenuLayout/index.js +5 -5
  16. package/lib/es/TemplateFile/index.js +53 -54
  17. package/lib/es/UploadForm/index.js +61 -63
  18. package/lib/locales/default.d.ts +287 -103
  19. package/lib/webui.css +1 -1
  20. package/lib/webui.es.js +1440 -1586
  21. package/package.json +1 -1
  22. package/src/components/common/icon/fullscreen.vue +1 -1
  23. package/src/components/content/dialog/excelForm.vue +32 -28
  24. package/src/components/content/dialog/index.vue +3 -3
  25. package/src/components/content/dialog/templateFile.vue +3 -2
  26. package/src/components/content/dialog/uploadForm.vue +5 -4
  27. package/src/components/content/drawer/index.vue +5 -3
  28. package/src/components/content/list/index.vue +2 -1
  29. package/src/components/content/list/listOperate.vue +6 -7
  30. package/src/components/content/search/index.vue +2 -2
  31. package/src/components/content/table/index.vue +2 -1
  32. package/src/components/content/table/tableOperate.vue +8 -9
  33. package/src/components/content/toolbar/icontool.vue +1 -5
  34. package/src/components/content/toolbar/index.vue +4 -5
  35. package/src/components/content/toolpanel/index.vue +20 -20
  36. package/src/components/error/error403.vue +2 -2
  37. package/src/components/error/error404.vue +2 -2
  38. package/src/components/form/input/index.vue +3 -1
  39. package/src/components/form/select/index.vue +3 -2
  40. package/src/components/form/textarea/index.vue +3 -1
  41. package/src/components/form/transfer/index.vue +2 -1
  42. package/src/components/form/upload/uploadList.vue +23 -19
  43. package/src/components/layout/header/headerExits.vue +5 -5
  44. package/src/components/layout/menu/menuTabs.vue +1 -1
  45. package/src/const/options.ts +17 -16
  46. package/src/locales/default.ts +297 -176
  47. package/src/stores/appInfo.ts +2 -1
  48. package/src/stores/userInfo.ts +6 -5
  49. package/src/utils/data.ts +9 -8
  50. package/src/utils/download.ts +5 -4
  51. package/src/utils/excel-preview.ts +4 -3
  52. package/src/utils/export-table.ts +7 -6
  53. package/src/utils/file-upload.ts +15 -14
  54. package/src/utils/form-csv.ts +4 -3
  55. package/src/utils/form-excel.ts +14 -13
  56. package/src/utils/form-validate.ts +18 -17
  57. package/src/utils/form.ts +6 -5
  58. package/src/utils/icon-loader.ts +3 -2
  59. package/src/utils/options.ts +2 -1
  60. package/src/utils/tools.ts +18 -17
  61. package/lib/assets/modules/file-upload-_mcZy7EK.js +0 -211
  62. package/lib/assets/modules/index-DyE2ppxB.js +0 -114
  63. package/lib/assets/modules/upload-template-DZuy1BOF.js +0 -6465
  64. package/lib/assets/modules/uploadList-CCquj3c_.js +0 -466
@@ -1,19 +1,19 @@
1
- import { defineComponent as we, ref as f, computed as T, watch as H, onMounted as be, createBlock as W, openBlock as d, unref as n, withCtx as S, renderSlot as J, createElementBlock as g, createCommentVNode as K, createElementVNode as h, createVNode as C, createTextVNode as X, toDisplayString as E, normalizeClass as Ce, Fragment as ie, renderList as ne } from "vue";
2
- import { _ as Y } from "../../assets/modules/index-BTD6d1d_.js";
3
- import { Modal as Fe, Upload as ue, Space as _e } from "ant-design-vue";
4
- import { httpGet as Ue, ResStatus as fe } from "@skyfox2000/fapi";
5
- import { G as Te, a5 as Se, ab as Ee } from "../../assets/modules/upload-template-DZuy1BOF.js";
6
- import { A as Re, p as De, U as ce } from "../../assets/modules/file-upload-_mcZy7EK.js";
1
+ import { defineComponent as he, ref as p, computed as R, watch as W, onMounted as Fe, createBlock as J, openBlock as f, unref as r, withCtx as S, renderSlot as X, createElementBlock as g, createCommentVNode as P, createElementVNode as b, createVNode as U, createTextVNode as Y, toDisplayString as _, normalizeClass as Ce, Fragment as ne, renderList as ce } from "vue";
2
+ import { _ as Z } from "../../assets/modules/index-BwMaOrJT.js";
3
+ import { Modal as Ue, Upload as ue, Space as _e } from "ant-design-vue";
4
+ import { httpGet as Te, ResStatus as pe } from "@skyfox2000/fapi";
5
+ import { $ as o, S as Ee, ah as Re, an as Se } from "../../assets/modules/upload-template-BKm9mFq8.js";
6
+ import { c as De, _ as ee, h as ke, p as Le, i as Ne } from "../../assets/modules/index-M1qERbea.js";
7
+ import { A as Ke, p as Pe, U as de } from "../../assets/modules/file-upload-DTOdV5vM.js";
7
8
  import "@skyfox2000/microbase";
8
- import p from "vue-m-message";
9
- import { c as ke, _ as Z, h as Le, p as Ne, i as Ke } from "../../assets/modules/index-BFxnKhwl.js";
9
+ import m from "vue-m-message";
10
10
  import "dayjs";
11
11
  import "vue-draggable-next";
12
12
  import "async-validator";
13
- import Ve from "@vue-office/excel";
14
- const Be = (l) => l.includes(",") || l.includes(`
15
- `), Me = (l, s) => l === "text/csv" || (s == null ? void 0 : s.toLowerCase().includes(".csv")) || !1, ze = (l, s) => l === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || l === "application/vnd.ms-excel" || (s == null ? void 0 : s.toLowerCase().match(/\.(xlsx|xls)$/)) !== null, ee = async (l, s = "preview.csv") => {
16
- const e = await ke(l, s);
13
+ import Be from "@vue-office/excel";
14
+ const Me = (a) => a.includes(",") || a.includes(`
15
+ `), Ae = (a, i) => a === "text/csv" || (i == null ? void 0 : i.toLowerCase().includes(".csv")) || !1, $e = (a, i) => a === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || a === "application/vnd.ms-excel" || (i == null ? void 0 : i.toLowerCase().match(/\.(xlsx|xls)$/)) !== null, le = async (a, i = "preview.csv") => {
16
+ const e = await De(a, i);
17
17
  if (e.success)
18
18
  return {
19
19
  success: !0,
@@ -21,16 +21,16 @@ const Be = (l) => l.includes(",") || l.includes(`
21
21
  fileName: e.fileName
22
22
  };
23
23
  throw new Error(e.error || "CSV格式处理失败");
24
- }, ae = (l, s, e = "预览文件.xlsx") => ({
24
+ }, ae = (a, i, e = "预览文件.xlsx") => ({
25
25
  success: !0,
26
- blobUrl: `data:${s || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};base64,${l}`,
26
+ blobUrl: `data:${i || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};base64,${a}`,
27
27
  fileName: e
28
- }), ve = async (l, s = !1) => {
29
- if (s) {
30
- if (typeof l == "string")
31
- return Be(l) ? await ee(l) : ae(l);
32
- if (l instanceof ArrayBuffer || l instanceof Uint8Array) {
33
- const e = new Blob([l], {
28
+ }), ve = async (a, i = !1) => {
29
+ if (i) {
30
+ if (typeof a == "string")
31
+ return Me(a) ? await le(a) : ae(a);
32
+ if (a instanceof ArrayBuffer || a instanceof Uint8Array) {
33
+ const e = new Blob([a], {
34
34
  type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
35
35
  });
36
36
  return {
@@ -41,68 +41,68 @@ const Be = (l) => l.includes(",") || l.includes(`
41
41
  } else
42
42
  throw new Error("不支持的原始文件格式");
43
43
  }
44
- if (l.Content && l.Type)
45
- return Me(l.Type, l.FileName) ? await ee(l.Content, l.FileName || "preview.csv") : ze(l.Type, l.FileName) ? ae(l.Content, l.Type, l.FileName || "预览文件.xlsx") : ae(l.Content);
46
- if (l.url)
44
+ if (a.Content && a.Type)
45
+ return Ae(a.Type, a.FileName) ? await le(a.Content, a.FileName || "preview.csv") : $e(a.Type, a.FileName) ? ae(a.Content, a.Type, a.FileName || "预览文件.xlsx") : ae(a.Content);
46
+ if (a.url)
47
47
  return {
48
48
  success: !0,
49
- blobUrl: l.url,
50
- fileName: l.fileName || "预览文件.xlsx"
49
+ blobUrl: a.url,
50
+ fileName: a.fileName || "预览文件.xlsx"
51
51
  };
52
- if (typeof l == "string")
53
- return await ee(l);
52
+ if (typeof a == "string")
53
+ return await le(a);
54
54
  throw new Error("不支持的文件格式");
55
- }, Pe = async (l, s) => {
56
- if (!l || !s)
57
- return p.error("预览URL或Excel控制器未配置"), { success: !1 };
55
+ }, ze = async (a, i) => {
56
+ if (!a || !i)
57
+ return m.error(o("webui.utils.excelPreview.previewUrlNotConfigured")), { success: !1 };
58
58
  try {
59
59
  let e = null;
60
- if (l.method === "GET") {
61
- const a = {
62
- ...l,
60
+ if (a.method === "GET") {
61
+ const l = {
62
+ ...a,
63
63
  method: "GET",
64
- api: l.api || s.page.api,
65
- authorize: l.authorize ?? s.page.authorize
64
+ api: a.api || i.page.api,
65
+ authorize: a.authorize ?? i.page.authorize
66
66
  };
67
- e = await Ue(a);
67
+ e = await Te(l);
68
68
  } else {
69
- const a = l.params;
70
- e = await Te(s, {
71
- url: l,
69
+ const l = a.params;
70
+ e = await Ee(i, {
71
+ url: a,
72
72
  urlKey: "preview",
73
- params: a,
73
+ params: l,
74
74
  hideErrorToast: !0
75
75
  });
76
76
  }
77
- if (l.raw)
77
+ if (a.raw)
78
78
  return await ve(e, !0);
79
- if ((e == null ? void 0 : e.status) === fe.SUCCESS && e.data) {
80
- const a = e.data;
81
- return await ve(a, !1);
79
+ if ((e == null ? void 0 : e.status) === pe.SUCCESS && e.data) {
80
+ const l = e.data;
81
+ return await ve(l, !1);
82
82
  } else
83
- throw new Error((e == null ? void 0 : e.msg) || "文件加载失败");
83
+ throw new Error((e == null ? void 0 : e.msg) || o("webui.utils.excelPreview.fileLoadFailed"));
84
84
  } catch (e) {
85
- throw console.error("预览文件加载错误:", e), p.error("文件加载失败:" + ((e == null ? void 0 : e.message) || "未知错误")), e;
85
+ throw console.error("预览文件加载错误:", e), m.error(o("webui.utils.excelPreview.fileLoadFailed") + ":" + ((e == null ? void 0 : e.message) || "未知错误")), e;
86
86
  }
87
- }, $e = {
87
+ }, Ve = {
88
88
  key: 0,
89
89
  class: "mb-4 flex items-center"
90
90
  }, je = {
91
91
  key: 0,
92
92
  class: "ml-3 text-gray-600"
93
- }, Ae = { class: "flex gap-4 relative" }, Oe = {
93
+ }, Oe = { class: "flex gap-4 relative" }, qe = {
94
94
  key: 1,
95
95
  class: "w-[22%] flex-grow overflow-hidden flex flex-col"
96
96
  }, Ge = { class: "bg-gray-50 p-2 rounded border flex-grow flex flex-col" }, Ie = {
97
97
  key: 0,
98
98
  class: "text-gray-500"
99
- }, qe = {
99
+ }, Qe = {
100
100
  key: 1,
101
101
  class: "flex flex-col"
102
- }, Qe = { class: "overflow-y-auto" }, He = { class: "text-[13px] text-gray-600" }, We = { class: "pl-5 mt-1 mb-0" }, Je = {
102
+ }, He = { class: "overflow-y-auto" }, We = { class: "text-[13px] text-gray-600" }, Je = { class: "pl-5 mt-1 mb-0" }, Xe = {
103
103
  key: 0,
104
104
  class: "mt-3"
105
- }, Xe = { class: "text-[12px] text-gray-600 p-1" }, Ye = { class: "text-[13px] text-gray-600" }, Ze = { class: "pl-5 mt-1 mb-0" }, ea = { class: "text-[12px] text-gray-600" }, ma = /* @__PURE__ */ we({
105
+ }, Ye = { class: "text-[12px] text-gray-600 p-1" }, Ze = { class: "text-[13px] text-gray-600" }, el = { class: "pl-5 mt-1 mb-0" }, ll = { class: "text-[12px] text-gray-600" }, wl = /* @__PURE__ */ he({
106
106
  __name: "excelForm",
107
107
  props: {
108
108
  title: {},
@@ -120,8 +120,8 @@ const Be = (l) => l.includes(",") || l.includes(`
120
120
  previewUrl: {},
121
121
  fileType: {}
122
122
  },
123
- setup(l, { expose: s }) {
124
- const e = l, a = e.excelCtrl, m = f(!1), b = f(""), le = f([]), y = f(""), z = T(() => !!e.previewUrl), te = T(() => e.enableUpload), de = T(() => {
123
+ setup(a, { expose: i }) {
124
+ const e = a, l = e.excelCtrl, w = p(!1), F = p(""), te = p([]), x = p(""), $ = R(() => !!e.previewUrl), oe = R(() => e.enableUpload), fe = R(() => {
125
125
  switch (e.fileType || "both") {
126
126
  case "excel":
127
127
  return ".xlsx,.xls";
@@ -131,252 +131,252 @@ const Be = (l) => l.includes(",") || l.includes(`
131
131
  default:
132
132
  return ".xlsx,.xls,.csv";
133
133
  }
134
- }), pe = T(() => {
134
+ }), me = R(() => {
135
135
  switch (e.fileType || "both") {
136
136
  case "excel":
137
- return "请选择Excel文件";
137
+ return o("webui.components.content.dialog.chooseExcelFile");
138
138
  case "csv":
139
- return "请选择CSV文件";
139
+ return o("webui.components.content.dialog.chooseCsvFile");
140
140
  case "both":
141
141
  default:
142
- return "请选择Excel或CSV文件";
142
+ return o("webui.components.content.dialog.chooseExcelOrCsvFile");
143
143
  }
144
- }), V = f("待验证数据规则"), B = f("warning"), P = f("待验证重复数据"), $ = f("warning");
145
- H(
146
- () => a.visible.value,
144
+ }), B = p(o("webui.components.content.dialog.validationRules")), M = p("warning"), z = p(o("webui.components.content.dialog.duplicateData")), V = p("warning");
145
+ W(
146
+ () => l.visible.value,
147
147
  () => {
148
- m.value = a.visible.value, m.value && (A(), e.previewUrl && I());
148
+ w.value = l.visible.value, w.value && (O(), e.previewUrl && I());
149
149
  }
150
- ), H(
151
- () => m.value,
150
+ ), W(
151
+ () => w.value,
152
152
  () => {
153
- a.visible.value = m.value, m.value || A();
153
+ l.visible.value = w.value, w.value || O();
154
154
  }
155
- ), H(
155
+ ), W(
156
156
  () => e.previewUrl,
157
157
  () => {
158
- m.value && e.previewUrl && I();
158
+ w.value && e.previewUrl && I();
159
159
  },
160
160
  { deep: !0 }
161
161
  );
162
- const F = f(e.uploadParams), R = T(() => {
162
+ const T = p(e.uploadParams), D = R(() => {
163
163
  var t;
164
- return (t = F.value) == null ? void 0 : t.uploadUrl;
165
- }), _ = T(() => {
164
+ return (t = T.value) == null ? void 0 : t.uploadUrl;
165
+ }), C = R(() => {
166
166
  var t;
167
- return (t = F.value) == null ? void 0 : t.duplicateRules;
168
- }), D = T(() => {
167
+ return (t = T.value) == null ? void 0 : t.duplicateRules;
168
+ }), k = R(() => {
169
169
  var t;
170
- return (t = F.value) == null ? void 0 : t.duplicateUrl;
170
+ return (t = T.value) == null ? void 0 : t.duplicateUrl;
171
171
  }), I = async () => {
172
- if (!(!e.previewUrl || !a)) {
173
- a.isFormLoading.value = !0;
172
+ if (!(!e.previewUrl || !l)) {
173
+ l.isFormLoading.value = !0;
174
174
  try {
175
- const t = await Pe(e.previewUrl, a);
176
- t.success && (b.value = t.blobUrl, y.value = t.fileName);
175
+ const t = await ze(e.previewUrl, l);
176
+ t.success && (F.value = t.blobUrl, x.value = t.fileName);
177
177
  } finally {
178
178
  setTimeout(() => {
179
- a.isFormLoading.value = !1;
179
+ l.isFormLoading.value = !1;
180
180
  }, 1e3);
181
181
  }
182
182
  }
183
- }, me = async () => {
184
- var o;
185
- F.value = e.uploadParams;
186
- const t = R.value;
183
+ }, we = async () => {
184
+ var n;
185
+ T.value = e.uploadParams;
186
+ const t = D.value;
187
187
  if (!t) {
188
- p.error("未配置文件上传地址!");
188
+ m.error(o("webui.components.content.excelForm.uploadAddressNotConfigured"));
189
189
  return;
190
190
  }
191
- if (U.value) {
192
- p.error("表格数据存在验证错误,请修正后再上传!");
191
+ if (E.value) {
192
+ m.error(o("webui.components.content.excelForm.validationError"));
193
193
  return;
194
194
  }
195
- a.isFormSaving.value = !0;
195
+ l.isFormSaving.value = !0;
196
196
  try {
197
- if (!L.value || !y.value) {
198
- p.warning("请先选择文件!"), a.isFormSaving.value = !1;
197
+ if (!N.value || !x.value) {
198
+ m.warning(o("webui.components.content.excelForm.pleaseSelectFileFirst")), l.isFormSaving.value = !1;
199
199
  return;
200
200
  }
201
- const r = new Re(t, 1), u = q.value || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", i = new File([L.value], y.value, {
201
+ const s = new Ke(t, 1), u = Q.value || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", c = new File([N.value], x.value, {
202
202
  type: u
203
- }), c = De.join(((o = F.value) == null ? void 0 : o.basePath) ?? "", y.value), v = {
203
+ }), d = Pe.join(((n = T.value) == null ? void 0 : n.basePath) ?? "", x.value), v = {
204
204
  uid: "1",
205
- name: y.value,
206
- originFileObj: i,
207
- status: ce.Uploading,
205
+ name: x.value,
206
+ originFileObj: c,
207
+ status: de.Uploading,
208
208
  percent: 0,
209
209
  params: {
210
- FileKey: c
210
+ FileKey: d
211
211
  }
212
- }, x = new AbortController();
213
- (await r.uploadFile(v, x.signal, (w) => {
214
- v.percent = w;
215
- })).status === ce.Success && (p.success("文件上传成功,开始业务处理!"), ye(v));
216
- } catch (r) {
217
- console.error("上传处理错误:", r), p.error("上传处理失败:" + ((r == null ? void 0 : r.message) || "未知错误"));
212
+ }, y = new AbortController();
213
+ (await s.uploadFile(v, y.signal, (h) => {
214
+ v.percent = h;
215
+ })).status === de.Success && (m.success(o("webui.components.content.excelForm.fileUploadSuccess")), xe(v));
216
+ } catch (s) {
217
+ console.error("上传处理错误:", s), m.error(o("webui.components.content.excelForm.uploadFailed") + ((s == null ? void 0 : s.message) || o("webui.components.content.excelForm.unknownError")));
218
218
  } finally {
219
- a.isFormSaving.value = !1;
219
+ l.isFormSaving.value = !1;
220
220
  }
221
- }, ye = async (t) => {
222
- if (a.formData.value) {
221
+ }, xe = async (t) => {
222
+ if (l.formData.value) {
223
223
  if (e.excelRecordsKey || e.excelRowsKey) {
224
- const i = await Ne(L.value);
225
- if (!i) return null;
226
- const { excelData: c, excelRows: v } = i, x = c.map((N) => {
227
- var Q;
228
- const w = {};
229
- for (const O in N) {
230
- const G = (Q = e.excelFieldMap) == null ? void 0 : Q[O];
231
- G && (w[G] = N[O]);
224
+ const c = await Le(N.value);
225
+ if (!c) return null;
226
+ const { excelData: d, excelRows: v } = c, y = d.map((K) => {
227
+ var H;
228
+ const h = {};
229
+ for (const q in K) {
230
+ const G = (H = e.excelFieldMap) == null ? void 0 : H[q];
231
+ G && (h[G] = K[q]);
232
232
  }
233
- return w;
233
+ return h;
234
234
  });
235
- e.excelRecordsKey && (a.formData.value[e.excelRecordsKey] = x), e.excelRowsKey && (a.formData.value[e.excelRowsKey] = v);
235
+ e.excelRecordsKey && (l.formData.value[e.excelRecordsKey] = y), e.excelRowsKey && (l.formData.value[e.excelRowsKey] = v);
236
236
  }
237
- const o = e.fileField ?? "FileInfo";
238
- a.formData.value[o] = t;
239
- const r = {};
240
- a.primaryKey && a.formData.value[a.primaryKey] !== void 0 && (r[a.primaryKey] = a.formData.value[a.primaryKey]);
237
+ const n = e.fileField ?? "FileInfo";
238
+ l.formData.value[n] = t;
239
+ const s = {};
240
+ l.primaryKey && l.formData.value[l.primaryKey] !== void 0 && (s[l.primaryKey] = l.formData.value[l.primaryKey]);
241
241
  const u = {
242
242
  Data: {
243
- ...a.formData.value
243
+ ...l.formData.value
244
244
  },
245
- Query: r
245
+ Query: s
246
246
  };
247
- if (a.beforeSave && a.beforeSave(u) === !1)
247
+ if (l.beforeSave && l.beforeSave(u) === !1)
248
248
  return;
249
- a.isFormSaving.value = !0;
249
+ l.isFormSaving.value = !0;
250
250
  try {
251
- const i = await Ee(e.excelCtrl, {
251
+ const c = await Se(e.excelCtrl, {
252
252
  params: u,
253
253
  urlKey: "save",
254
254
  url: e.excelCtrl.saveUrl
255
255
  });
256
- (i == null ? void 0 : i.status) === fe.SUCCESS && (a.afterSave && a.afterSave(i), a.visible.value = !1);
257
- } catch (i) {
258
- console.error("保存错误:", i), p.error("数据保存失败,请稍后再试!");
256
+ (c == null ? void 0 : c.status) === pe.SUCCESS && (l.afterSave && l.afterSave(c), l.visible.value = !1);
257
+ } catch (c) {
258
+ console.error("保存错误:", c), m.error(o("webui.components.content.excelForm.dataSaveFailed"));
259
259
  } finally {
260
- a.isFormSaving.value = !1;
260
+ l.isFormSaving.value = !1;
261
261
  }
262
262
  }
263
- }, U = f(!1), k = f(!1), L = f(null), q = f(""), re = async (t) => {
264
- const o = e.gridCtrl;
265
- if (o) {
266
- F.value = e.uploadParams;
263
+ }, E = p(!1), L = p(!1), N = p(null), Q = p(""), se = async (t) => {
264
+ const n = e.gridCtrl;
265
+ if (n) {
266
+ T.value = e.uploadParams;
267
267
  try {
268
- D.value && (D.value.api || (D.value.api = o.page.api), D.value.authorize === void 0 && (D.value.authorize = o.page.authorize));
268
+ k.value && (k.value.api || (k.value.api = n.page.api), k.value.authorize === void 0 && (k.value.authorize = n.page.authorize));
269
269
  const {
270
- errBlob: r,
270
+ errBlob: s,
271
271
  validationMsg: u,
272
- duplicateMsg: i,
273
- hasFormatError: c,
272
+ duplicateMsg: c,
273
+ hasFormatError: d,
274
274
  hasDuplicateError: v
275
- } = await Ke(t, a.formRules.value, _.value, D.value);
276
- if (V.value = u, P.value = i, B.value = c ? "error" : a.formRules.value && Object.keys(a.formRules.value).length > 0 ? "success" : "warning", $.value = v ? "error" : _.value && _.value.length > 0 ? "success" : "warning", r) {
277
- U.value = c ?? !1, k.value = v ?? !1;
278
- const x = URL.createObjectURL(r);
279
- b.value = x;
275
+ } = await Ne(t, l.formRules.value, C.value, k.value);
276
+ if (B.value = u, z.value = c, M.value = d ? "error" : l.formRules.value && Object.keys(l.formRules.value).length > 0 ? "success" : "warning", V.value = v ? "error" : C.value && C.value.length > 0 ? "success" : "warning", s) {
277
+ E.value = d ?? !1, L.value = v ?? !1;
278
+ const y = URL.createObjectURL(s);
279
+ F.value = y;
280
280
  } else
281
- U.value = !1, k.value = !1;
281
+ E.value = !1, L.value = !1;
282
282
  } catch {
283
- V.value = "验证异常", P.value = "验证异常", B.value = "error", $.value = "error";
283
+ B.value = o("webui.components.content.dialog.validationException"), z.value = o("webui.components.content.dialog.validationException"), M.value = "error", V.value = "error";
284
284
  }
285
285
  }
286
- }, xe = async (t) => {
286
+ }, ye = async (t) => {
287
287
  if (!e.gridCtrl) {
288
- p.error("未配置表格控制器!");
288
+ m.error("未配置表格控制器!");
289
289
  return;
290
290
  }
291
- F.value = e.uploadParams;
292
- const r = t.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || t.type === "application/vnd.ms-excel", u = t.type === "text/csv" || t.name.toLowerCase().endsWith(".csv"), i = e.fileType || "both";
293
- let c = !1, v = "";
294
- switch (i) {
291
+ T.value = e.uploadParams;
292
+ const s = t.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || t.type === "application/vnd.ms-excel", u = t.type === "text/csv" || t.name.toLowerCase().endsWith(".csv"), c = e.fileType || "both";
293
+ let d = !1, v = "";
294
+ switch (c) {
295
295
  case "excel":
296
- c = r, v = "只能上传Excel文件!";
296
+ d = s, v = o("webui.components.content.excelForm.onlyExcelAllowed");
297
297
  break;
298
298
  case "csv":
299
- c = u, v = "只能上传CSV文件!";
299
+ d = u, v = o("webui.components.content.excelForm.onlyCsvAllowed");
300
300
  break;
301
301
  case "both":
302
302
  default:
303
- c = r || u, v = "只能上传Excel文件或CSV文件!";
303
+ d = s || u, v = o("webui.components.content.excelForm.onlyExcelOrCsvAllowed");
304
304
  break;
305
305
  }
306
- if (!c)
307
- return p.error(v), ue.LIST_IGNORE;
306
+ if (!d)
307
+ return m.error(v), ue.LIST_IGNORE;
308
308
  try {
309
- if (A(), y.value = t.name, q.value = u ? "text/csv" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", u) {
310
- const w = await t.arrayBuffer(), O = new TextDecoder("utf-8").decode(w), { csvToExcelView: G } = await import("../../assets/modules/index-BFxnKhwl.js").then((he) => he.j), M = await G(O, t.name);
311
- if (!M.success)
312
- throw new Error(M.error || "CSV文件处理失败");
313
- const oe = await (await fetch(M.blobUrl)).arrayBuffer();
314
- return L.value = oe, await re(oe), !U.value && !k.value && (b.value = M.blobUrl), y.value = M.fileName, a.isFormLoading.value = !1, !1;
309
+ if (O(), x.value = t.name, Q.value = u ? "text/csv" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", u) {
310
+ const h = await t.arrayBuffer(), q = new TextDecoder("utf-8").decode(h), { csvToExcelView: G } = await import("../../assets/modules/index-M1qERbea.js").then((be) => be.j), A = await G(q, t.name);
311
+ if (!A.success)
312
+ throw new Error(A.error || o("webui.components.content.excelForm.csvProcessingFailed"));
313
+ const ie = await (await fetch(A.blobUrl)).arrayBuffer();
314
+ return N.value = ie, await se(ie), !E.value && !L.value && (F.value = A.blobUrl), x.value = A.fileName, l.isFormLoading.value = !1, !1;
315
315
  }
316
- const x = await t.arrayBuffer();
317
- L.value = x;
318
- const N = new FileReader();
319
- N.readAsDataURL(t), N.onload = async (w) => {
320
- w.target ? (await re(x), !U.value && !k.value && (b.value = w.target.result), a.isFormLoading.value = !1) : p.error("加载文件失败,请检查文件格式!");
316
+ const y = await t.arrayBuffer();
317
+ N.value = y;
318
+ const K = new FileReader();
319
+ K.readAsDataURL(t), K.onload = async (h) => {
320
+ h.target ? (await se(y), !E.value && !L.value && (F.value = h.target.result), l.isFormLoading.value = !1) : m.error(o("webui.components.content.excelForm.loadFileFailed"));
321
321
  };
322
- } catch (x) {
323
- console.error("文件处理错误:", x), p.error("文件处理失败,请检查文件格式!"), a.isFormLoading.value = !1, V.value = "文件处理错误", B.value = "error";
322
+ } catch (y) {
323
+ console.error("文件处理错误:", y), m.error(o("webui.components.content.excelForm.fileProcessingFailed")), l.isFormLoading.value = !1, B.value = o("webui.components.content.excelForm.fileProcessingError"), M.value = "error";
324
324
  }
325
325
  return !1;
326
- }, j = Se(a.formRules.value);
327
- be(() => {
328
- var o;
329
- const t = (o = e.gridCtrl) == null ? void 0 : o.page;
330
- if (t && !z.value) {
331
- if (!R.value) {
332
- p.error("未配置文件上传地址!");
326
+ }, j = Re(l.formRules.value);
327
+ Fe(() => {
328
+ var n;
329
+ const t = (n = e.gridCtrl) == null ? void 0 : n.page;
330
+ if (t && !$.value) {
331
+ if (!D.value) {
332
+ m.error(o("webui.components.content.excelForm.uploadAddressNotConfigured"));
333
333
  return;
334
334
  }
335
- R.value.api || (R.value.api = t.api), R.value.authorize === void 0 && (R.value.authorize = t.authorize);
336
- for (const r in a.formData.value)
337
- e.gridCtrl.rowData.value && (a.formData.value[r] = e.gridCtrl.rowData.value[r]);
335
+ D.value.api || (D.value.api = t.api), D.value.authorize === void 0 && (D.value.authorize = t.authorize);
336
+ for (const s in l.formData.value)
337
+ e.gridCtrl.rowData.value && (l.formData.value[s] = e.gridCtrl.rowData.value[s]);
338
338
  }
339
- m.value = a.visible.value, m.value && e.previewUrl && I();
339
+ w.value = l.visible.value, w.value && e.previewUrl && I();
340
340
  });
341
- const A = () => {
342
- if (b.value = "", y.value = "", le.value = [], L.value = null, q.value = "", a.isFormLoading.value = !1, V.value = "待验证数据规则", B.value = "warning", P.value = "待验证重复数据", $.value = "warning", U.value = !1, k.value = !1, a.formData.value) {
343
- const t = e.fileField ?? "FileInfo", o = e.excelRecordsKey, r = e.excelRowsKey;
344
- delete a.formData.value[t], o && delete a.formData.value[o], r && delete a.formData.value[r];
341
+ const O = () => {
342
+ if (F.value = "", x.value = "", te.value = [], N.value = null, Q.value = "", l.isFormLoading.value = !1, B.value = o("webui.components.content.dialog.validationRules"), M.value = "warning", z.value = o("webui.components.content.dialog.duplicateData"), V.value = "warning", E.value = !1, L.value = !1, l.formData.value) {
343
+ const t = e.fileField ?? "FileInfo", n = e.excelRecordsKey, s = e.excelRowsKey;
344
+ delete l.formData.value[t], n && delete l.formData.value[n], s && delete l.formData.value[s];
345
345
  }
346
- }, se = () => {
347
- a.visible.value = !1;
346
+ }, re = () => {
347
+ l.visible.value = !1;
348
348
  }, ge = () => {
349
349
  };
350
- return s({
351
- clearAll: A
352
- }), (t, o) => (d(), W(n(Fe), {
353
- title: t.title ?? "文件上传",
354
- open: m.value,
355
- "onUpdate:open": o[0] || (o[0] = (r) => m.value = r),
350
+ return i({
351
+ clearAll: O
352
+ }), (t, n) => (f(), J(r(Ue), {
353
+ title: t.title ?? r(o)("webui.components.content.dialog.fileUpload"),
354
+ open: w.value,
355
+ "onUpdate:open": n[0] || (n[0] = (s) => w.value = s),
356
356
  wrapClassName: ["modal", "mx-auto", t.$attrs.width ? "w-[" + t.$attrs.width + "]" : ""].join(" "),
357
357
  width: 940,
358
- onClose: se
358
+ onClose: re
359
359
  }, {
360
360
  footer: S(() => [
361
- C(n(_e), null, {
361
+ U(r(_e), null, {
362
362
  default: S(() => {
363
- var r;
363
+ var s;
364
364
  return [
365
- C(n(Y), { onClick: se }, {
365
+ U(r(Z), { onClick: re }, {
366
366
  default: S(() => [
367
- X(E(t.cancelText ?? (z.value ? "关闭" : "取消")), 1)
367
+ Y(_(t.cancelText ?? ($.value ? r(o)("webui.components.content.dialog.close") : r(o)("webui.common.cancel"))), 1)
368
368
  ]),
369
369
  _: 1
370
370
  }),
371
- z.value ? K("", !0) : (d(), W(n(Y), {
371
+ $.value ? P("", !0) : (f(), J(r(Z), {
372
372
  key: 0,
373
- onClick: me,
373
+ onClick: we,
374
374
  type: "primary",
375
- loading: ((r = n(a)) == null ? void 0 : r.isFormSaving.value) ?? !1,
376
- disabled: !b.value || U.value || k.value || n(a).isFormLoading.value
375
+ loading: ((s = r(l)) == null ? void 0 : s.isFormSaving.value) ?? !1,
376
+ disabled: !F.value || E.value || L.value || r(l).isFormLoading.value
377
377
  }, {
378
378
  default: S(() => [
379
- X(E(t.saveText ?? "上传文件"), 1)
379
+ Y(_(t.saveText ?? r(o)("webui.components.content.dialog.uploadFile")), 1)
380
380
  ]),
381
381
  _: 1
382
382
  }, 8, ["loading", "disabled"]))
@@ -386,49 +386,49 @@ const Be = (l) => l.includes(",") || l.includes(`
386
386
  })
387
387
  ]),
388
388
  default: S(() => [
389
- J(t.$slots, "default"),
390
- z.value ? K("", !0) : (d(), g("div", $e, [
391
- J(t.$slots, "file-before"),
392
- C(n(ue), {
393
- "file-list": le.value,
394
- "before-upload": xe,
395
- accept: de.value,
389
+ X(t.$slots, "default"),
390
+ $.value ? P("", !0) : (f(), g("div", Ve, [
391
+ X(t.$slots, "file-before"),
392
+ U(r(ue), {
393
+ "file-list": te.value,
394
+ "before-upload": ye,
395
+ accept: fe.value,
396
396
  showUploadList: !0,
397
- disabled: !te.value
397
+ disabled: !oe.value
398
398
  }, {
399
399
  default: S(() => [
400
- C(n(Y), {
400
+ U(r(Z), {
401
401
  type: "primary",
402
- disabled: !te.value
402
+ disabled: !oe.value
403
403
  }, {
404
404
  default: S(() => [
405
- X(E(pe.value), 1)
405
+ Y(_(me.value), 1)
406
406
  ]),
407
407
  _: 1
408
408
  }, 8, ["disabled"])
409
409
  ]),
410
410
  _: 1
411
411
  }, 8, ["file-list", "accept", "disabled"]),
412
- b.value && y.value ? (d(), g("div", je, [
413
- C(n(Z), {
414
- message: y.value,
412
+ F.value && x.value ? (f(), g("div", je, [
413
+ U(r(ee), {
414
+ message: x.value,
415
415
  type: "info",
416
416
  "show-icon": !1
417
417
  }, null, 8, ["message"])
418
- ])) : K("", !0),
419
- J(t.$slots, "file-after")
418
+ ])) : P("", !0),
419
+ X(t.$slots, "file-after")
420
420
  ])),
421
- h("div", Ae, [
422
- n(a).isFormLoading.value ? (d(), W(n(Le), {
421
+ b("div", Oe, [
422
+ r(l).isFormLoading.value ? (f(), J(r(ke), {
423
423
  key: 0,
424
424
  size: "large"
425
- })) : K("", !0),
426
- h("div", {
427
- class: Ce(["flex-shrink-0 relative border border-gray-200 rounded-md overflow-hidden", [n(j).length === 0 ? "w-[100%]" : "w-[80%]"]]),
425
+ })) : P("", !0),
426
+ b("div", {
427
+ class: Ce(["flex-shrink-0 relative border border-gray-200 rounded-md overflow-hidden", [r(j).length === 0 ? "w-[100%]" : "w-[80%]"]]),
428
428
  style: { height: "430px" }
429
429
  }, [
430
- C(n(Ve), {
431
- src: b.value,
430
+ U(r(Be), {
431
+ src: F.value,
432
432
  onError: ge,
433
433
  style: { width: "100%", height: "100%" },
434
434
  options: {
@@ -441,46 +441,46 @@ const Be = (l) => l.includes(",") || l.includes(`
441
441
  }
442
442
  }, null, 8, ["src"])
443
443
  ], 2),
444
- n(j).length > 0 ? (d(), g("div", Oe, [
445
- h("div", Ge, [
446
- n(j).length === 0 ? (d(), g("div", Ie, "没有设置验证规则")) : (d(), g("div", qe, [
447
- C(n(Z), {
448
- message: V.value,
449
- type: B.value,
444
+ r(j).length > 0 ? (f(), g("div", qe, [
445
+ b("div", Ge, [
446
+ r(j).length === 0 ? (f(), g("div", Ie, _(r(o)("webui.components.content.dialog.noValidationRules")), 1)) : (f(), g("div", Qe, [
447
+ U(r(ee), {
448
+ message: B.value,
449
+ type: M.value,
450
450
  "show-icon": "",
451
451
  class: "mb-2"
452
452
  }, null, 8, ["message", "type"]),
453
- h("div", Qe, [
454
- (d(!0), g(ie, null, ne(n(j), (r, u) => (d(), g("div", {
453
+ b("div", He, [
454
+ (f(!0), g(ne, null, ce(r(j), (s, u) => (f(), g("div", {
455
455
  key: u,
456
456
  class: "border-b pb-0"
457
457
  }, [
458
- h("div", He, E(r.field), 1),
459
- h("ul", We, [
460
- (d(!0), g(ie, null, ne(r.rules, (i, c) => (d(), g("li", {
461
- key: c,
458
+ b("div", We, _(s.field), 1),
459
+ b("ul", Je, [
460
+ (f(!0), g(ne, null, ce(s.rules, (c, d) => (f(), g("li", {
461
+ key: d,
462
462
  class: "text-[12px] text-gray-600"
463
- }, E(i), 1))), 128))
463
+ }, _(c), 1))), 128))
464
464
  ])
465
465
  ]))), 128))
466
466
  ]),
467
- _.value && _.value.length > 0 ? (d(), g("div", Je, [
468
- C(n(Z), {
469
- message: P.value,
470
- type: $.value,
467
+ C.value && C.value.length > 0 ? (f(), g("div", Xe, [
468
+ U(r(ee), {
469
+ message: z.value,
470
+ type: V.value,
471
471
  "show-icon": "",
472
472
  class: "mt-2 mb-2"
473
473
  }, null, 8, ["message", "type"]),
474
- h("div", Xe, [
475
- h("div", Ye, " 以下" + E(_.value.length > 1 ? "组合" : "字段") + "必须唯一 ", 1),
476
- h("ul", Ze, [
477
- h("li", ea, E(_.value.join(", ")), 1)
474
+ b("div", Ye, [
475
+ b("div", Ze, _(C.value.length > 1 ? r(o)("webui.components.content.dialog.combinationMustBeUnique") : r(o)("webui.components.content.dialog.fieldMustBeUnique", [C.value.join(", ")])), 1),
476
+ b("ul", el, [
477
+ b("li", ll, _(C.value.join(", ")), 1)
478
478
  ])
479
479
  ])
480
- ])) : K("", !0)
480
+ ])) : P("", !0)
481
481
  ]))
482
482
  ])
483
- ])) : K("", !0)
483
+ ])) : P("", !0)
484
484
  ])
485
485
  ]),
486
486
  _: 3
@@ -488,5 +488,5 @@ const Be = (l) => l.includes(",") || l.includes(`
488
488
  }
489
489
  });
490
490
  export {
491
- ma as default
491
+ wl as default
492
492
  };