@skyfox2000/webui 1.5.3 → 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 (65) hide show
  1. package/lib/assets/modules/{baseLayout-LU1ysAJM.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-C6RrxZBR.js → index-BwMaOrJT.js} +1 -1
  5. package/lib/assets/modules/{index-CHG5bbZG.js → index-M1qERbea.js} +99 -99
  6. package/lib/assets/modules/{menuTabs-Bk8A-zzL.js → menuTabs-DWaBSRNr.js} +42 -42
  7. package/lib/assets/modules/{toolIcon-ADz-Bt4_.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/locales/index.ts +12 -4
  48. package/src/stores/appInfo.ts +2 -1
  49. package/src/stores/userInfo.ts +6 -5
  50. package/src/utils/data.ts +9 -8
  51. package/src/utils/download.ts +5 -4
  52. package/src/utils/excel-preview.ts +4 -3
  53. package/src/utils/export-table.ts +7 -6
  54. package/src/utils/file-upload.ts +15 -14
  55. package/src/utils/form-csv.ts +4 -3
  56. package/src/utils/form-excel.ts +14 -13
  57. package/src/utils/form-validate.ts +18 -17
  58. package/src/utils/form.ts +6 -5
  59. package/src/utils/icon-loader.ts +3 -2
  60. package/src/utils/options.ts +2 -1
  61. package/src/utils/tools.ts +18 -17
  62. package/lib/assets/modules/file-upload-BvIYPDBD.js +0 -211
  63. package/lib/assets/modules/index-Bi3hR8Gf.js +0 -114
  64. package/lib/assets/modules/upload-template-mzLL4UUU.js +0 -6462
  65. package/lib/assets/modules/uploadList-DRGJEXDH.js +0 -466
@@ -1,10 +1,11 @@
1
- import { useSettingInfo } from '@/index';
1
+ import { useSettingInfo } from '@/stores/settingInfo';
2
2
  import { GridControl } from '@/typings/table.d';
3
3
  import { PageControl } from '@/typings/page.d';
4
4
  import { RowRecord, ButtonTool, IconTool } from '@/typings/tools';
5
5
 
6
6
  import message from 'vue-m-message';
7
7
  import { AnyData } from '@skyfox2000/fapi';
8
+ import { $t } from '@/locales/index';
8
9
 
9
10
  /**
10
11
  * 查找工具项
@@ -262,35 +263,35 @@ export const onColumnVisibleChanged = (column: any, checked: boolean) => {
262
263
  export const defaultTools: IconTool[] = [
263
264
  {
264
265
  key: 'Reload',
265
- label: '刷新表格',
266
+ label: $t('webui.utils.tools.refreshTable'),
266
267
  icon: 'icon-reload',
267
268
  click: onReloadClick,
268
269
  },
269
270
  {
270
271
  key: 'Query',
271
- label: '展开搜索栏',
272
- labels: ['展开搜索栏', '折叠搜索栏'],
272
+ label: $t('webui.utils.tools.expandSearch'),
273
+ labels: [$t('webui.utils.tools.expandSearch'), $t('webui.utils.tools.collapseSearch')],
273
274
  icon: 'icon-search',
274
275
  iconStatus: 0,
275
276
  click: onSearchClick,
276
277
  },
277
278
  {
278
279
  key: 'RowHeight',
279
- label: '行高调整',
280
+ label: $t('webui.utils.tools.rowHeight'),
280
281
  icon: 'icon-row-height',
281
282
  click: onRowHeightClick,
282
283
  },
283
284
  {
284
285
  key: 'tool.multiple.checkbox',
285
- label: '显示多选框',
286
- labels: ['显示多选框', '隐藏多选框'],
286
+ label: $t('webui.utils.tools.showCheckbox'),
287
+ labels: [$t('webui.utils.tools.showCheckbox'), $t('webui.utils.tools.hideCheckbox')],
287
288
  icon: 'icon-checkbox',
288
289
  click: onCheckboxClick,
289
290
  },
290
291
  {
291
292
  key: 'tool.expand.rows',
292
- label: '展开记录行',
293
- labels: ['展开记录行', '折叠记录行'],
293
+ label: $t('webui.utils.tools.expandRows'),
294
+ labels: [$t('webui.utils.tools.expandRows'), $t('webui.utils.tools.collapseRows')],
294
295
  icon: 'icon-row-collapse',
295
296
  iconStatus: 0,
296
297
  icons: ['icon-row-collapse', 'icon-row-expand'],
@@ -298,44 +299,44 @@ export const defaultTools: IconTool[] = [
298
299
  },
299
300
  {
300
301
  key: 'tool.export.excel',
301
- label: '导出Excel',
302
+ label: $t('webui.utils.tools.exportExcel'),
302
303
  icon: 'icon-export-excel',
303
304
  children: [
304
305
  {
305
306
  key: 'tool.export.excel.all',
306
- label: '全部记录',
307
+ label: $t('webui.utils.tools.exportAllRecords'),
307
308
  click: onExportExcelClick,
308
309
  },
309
310
  {
310
311
  key: 'tool.export.excel.selected',
311
- label: '选中的记录',
312
+ label: $t('webui.utils.tools.exportSelectedRecords'),
312
313
  click: onExportExcelClick,
313
314
  },
314
315
  ],
315
316
  },
316
317
  {
317
318
  key: 'tool.export.pdf',
318
- label: '导出PDF',
319
+ label: $t('webui.utils.tools.exportPDF'),
319
320
  icon: 'icon-export-pdf',
320
321
  children: [
321
322
  {
322
323
  key: 'tool.export.pdf.selected',
323
- label: '选中的记录',
324
+ label: $t('webui.utils.tools.exportSelectedRecords'),
324
325
  click: onExportPDFClick,
325
326
  },
326
327
  ],
327
328
  },
328
329
  {
329
330
  key: 'TableHeadset',
330
- label: '表头设置',
331
+ label: $t('webui.utils.tools.tableHeaderSettings'),
331
332
  icon: 'icon-headset',
332
333
  dropdown: 'headset',
333
334
  click: () => {}, // 不设置点击事件
334
335
  },
335
336
  {
336
337
  key: 'Fullscreen',
337
- label: '设置全屏',
338
- labels: ['设置全屏', '取消全屏'],
338
+ label: $t('webui.utils.tools.setFullscreen'),
339
+ labels: [$t('webui.utils.tools.setFullscreen'), $t('webui.utils.tools.exitFullscreen')],
339
340
  icon: 'icon-fullscreen',
340
341
  iconStatus: 0,
341
342
  icons: ['icon-fullscreen', 'icon-exitscreen'],
@@ -1,211 +0,0 @@
1
- var E = Object.defineProperty;
2
- var m = (n, r, s) => r in n ? E(n, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[r] = s;
3
- var d = (n, r, s) => m(n, typeof r != "symbol" ? r + "" : r, s);
4
- import { hostUrl as w } from "@skyfox2000/fapi";
5
- import y from "dayjs";
6
- import f from "vue-m-message";
7
- import { M as b, u as g } from "./upload-template-mzLL4UUU.js";
8
- import { isMicroApp as O } from "@skyfox2000/microbase";
9
- var i = /* @__PURE__ */ ((n) => (n.Pending = "pending", n.Uploading = "uploading", n.Success = "success", n.Error = "error", n.Online = "online", n.Offline = "offline", n))(i || {});
10
- class M {
11
- /**
12
- * 连接路径参数,已判断 undefined 或 null 值
13
- * @param args 路径参数数组
14
- * @returns 连接后的路径字符串
15
- */
16
- static join(...r) {
17
- return r.filter((a) => a != null).join("/").replace(/[\/]+/, "/");
18
- }
19
- }
20
- class S {
21
- /**
22
- * AsyncUploader 构造函数
23
- * @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
24
- * @param maxConcurrent 最大允许并发上传的文件数量
25
- */
26
- constructor(r, s = 3) {
27
- /**
28
- * 设置 API 端点和最大并发数,所有上传文件通过该类控制
29
- */
30
- d(this, "urlInfo");
31
- /**
32
- * 最大并发上传数
33
- */
34
- d(this, "maxConcurrent");
35
- /**
36
- * 控制上传任务的中断信号
37
- */
38
- d(this, "abortController");
39
- this.urlInfo = r, this.maxConcurrent = s;
40
- }
41
- /**
42
- * 执行上传
43
- * @param fileList 文件列表
44
- * @param loading 加载状态
45
- * @param continueOnError 错误时是否继续上传
46
- * @param onComplete 上传完成回调
47
- * @param onProgress 上传进度回调
48
- * @returns 上传结果
49
- */
50
- async doUpload(r, s, c, a, e) {
51
- if (r.length) {
52
- if (r.length === 0) {
53
- f.warning("请选择上传的文件!");
54
- return;
55
- }
56
- s.value = !0, await this.uploadFiles(r, e, (l) => {
57
- let t = !1, h = 0;
58
- for (const o of l)
59
- o.status === i.Error && h++;
60
- h ? h < l.length ? c ? (f.error("上传结束,部分文件上传失败!"), f.warning("保存上传成功的文件!"), t = !0) : f.error("上传结束,部分文件上传失败,取消保存!") : f.error("上传结束,所有文件上传失败!") : (f.success("全部文件上传成功!"), t = !0), s.value = !1, a == null || a(t, l);
61
- });
62
- }
63
- }
64
- /**
65
- * 上传多个文件,控制并发数量
66
- * @param files 文件列表(File[] 或 FileList)
67
- * @param onProgress 上传进度回调
68
- * @param onComplete 上传完成回调
69
- */
70
- async uploadFiles(r, s, c) {
71
- if (!r.length) return;
72
- const a = Math.min(this.maxConcurrent, r.length), e = [];
73
- for (const t of r)
74
- switch (t.status) {
75
- case i.Success:
76
- case i.Online:
77
- case i.Offline:
78
- break;
79
- default:
80
- t.status = i.Pending, e.push(t);
81
- break;
82
- }
83
- const l = [];
84
- this.abortController = new AbortController();
85
- try {
86
- for (; l.length < a && e.length > 0; ) {
87
- const t = e.shift();
88
- if (!t) break;
89
- l.push(this.handleFileStatus(t, l, e, s));
90
- }
91
- await Promise.all(l);
92
- } catch (t) {
93
- r.forEach((h) => {
94
- h.status = i.Error, h.error = t instanceof Error ? t : new Error("上传失败"), s == null || s(h);
95
- });
96
- } finally {
97
- c == null || c(r);
98
- }
99
- }
100
- /**
101
- * 处理单个文件的上传逻辑
102
- * @param file 当前上传的文件
103
- * @param activeUploads 当前正在上传的文件列表
104
- * @param pendingFiles 等待上传的文件列表
105
- * @param onProgress 上传进度回调
106
- */
107
- async handleFileStatus(r, s, c, a) {
108
- try {
109
- await this.uploadFile(r, this.abortController.signal, (e) => {
110
- r.percent = e, a == null || a(r);
111
- });
112
- } catch (e) {
113
- r.error = e instanceof Error ? e : new Error("上传失败");
114
- } finally {
115
- if (c.length > 0) {
116
- const e = c.shift();
117
- e && s.push(this.handleFileStatus(e, s, c, a));
118
- }
119
- }
120
- }
121
- /**
122
- * 使用 XMLHttpRequest 上传文件
123
- * @param file 文件对象
124
- * @param signal 中断信号
125
- * @param onProgress 上传进度回调
126
- */
127
- async uploadFile(r, s, c) {
128
- return r.status = i.Uploading, new Promise(async (a, e) => {
129
- const l = new FormData();
130
- if (l.append("file", r.originFileObj), r.params)
131
- for (const o in r.params)
132
- l.append(o, r.params[o]);
133
- const t = new XMLHttpRequest(), h = w(this.urlInfo);
134
- if (h === !1) return Promise.resolve(r);
135
- if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([o, u]) => {
136
- t.setRequestHeader(o, u);
137
- }), this.urlInfo.authorize) {
138
- const o = O() ? await b.getToken() : g().getToken();
139
- if (!o) {
140
- e(new Error("未授权或授权过期"));
141
- return;
142
- }
143
- t.setRequestHeader("Authorization", "Bearer " + o);
144
- }
145
- t.upload.addEventListener("progress", (o) => {
146
- if (o.lengthComputable && o.total > 0) {
147
- const u = Math.round(o.loaded / o.total * 100);
148
- c(u);
149
- }
150
- }), t.addEventListener("load", () => {
151
- if (t.status >= 200 && t.status < 300) {
152
- const o = t.getResponseHeader("Content-Type");
153
- if (!o || !o.includes("application/json")) {
154
- e(new Error("返回的结果不是 JSON 格式"));
155
- return;
156
- }
157
- try {
158
- const u = JSON.parse(t.response);
159
- if (u.status === "success")
160
- u.data && (r.minioFile = {
161
- ETag: u.data.ETag,
162
- Bucket: u.data.Bucket,
163
- FileName: r.fileName,
164
- Key: u.data.Key,
165
- Size: u.data.Size,
166
- Type: r.type,
167
- UpdateTime: y().format("YYYY-MM-DD HH:mm:ss"),
168
- Status: i.Success
169
- }), r.status = i.Success, a(r);
170
- else {
171
- const p = u.msg;
172
- r.status = i.Error, e(new Error(p));
173
- }
174
- } catch (u) {
175
- r.status = i.Error, e(new Error("无法解析返回的 JSON 数据: " + u));
176
- }
177
- } else
178
- r.status = i.Error, e(new Error(`上传失败,状态码:${t.status}`));
179
- }), t.addEventListener("error", () => {
180
- r.status = i.Error, e(new Error("上传失败,网络异常"));
181
- }), t.send(l), s.addEventListener("abort", () => {
182
- t.abort(), e(new Error("上传已取消"));
183
- });
184
- });
185
- }
186
- /**
187
- * 取消当前所有的上传任务
188
- */
189
- cancelUpload() {
190
- this.abortController && this.abortController.abort();
191
- }
192
- }
193
- const x = async (n, r) => {
194
- const s = new S(n, 1), c = [r];
195
- await s.uploadFiles(
196
- c,
197
- (a) => {
198
- r.percent = a.percent;
199
- },
200
- (a) => {
201
- const e = a[0];
202
- r.percent = e.percent, e.status === i.Success ? (r.status = i.Online, f.success("文件上传成功!")) : (r.status = i.Error, f.error("上传文件失败!"));
203
- }
204
- );
205
- };
206
- export {
207
- S as A,
208
- i as U,
209
- x as f,
210
- M as p
211
- };
@@ -1,114 +0,0 @@
1
- import { defineComponent as B, provide as N, ref as w, watch as p, onMounted as _, createBlock as n, openBlock as r, unref as a, withCtx as s, createElementVNode as b, renderSlot as C, createVNode as V, createCommentVNode as d, createTextVNode as u, toDisplayString as v } from "vue";
2
- import { _ as m } from "./index-C6RrxZBR.js";
3
- import { Modal as D, Space as $ } from "ant-design-vue";
4
- import "@skyfox2000/fapi";
5
- import { P as E, d as M, o as P, b as K } from "./upload-template-mzLL4UUU.js";
6
- import "@skyfox2000/microbase";
7
- import "vue-m-message";
8
- import "async-validator";
9
- import "dayjs";
10
- import "vue-draggable-next";
11
- const U = { class: "overflow-y-auto w-full h-full" }, R = /* @__PURE__ */ B({
12
- __name: "index",
13
- props: {
14
- saveText: {},
15
- saveAsText: {},
16
- cancelText: {},
17
- editorCtrl: {},
18
- dialogSave: { type: Function },
19
- dialogSaveAs: { type: Function },
20
- width: {},
21
- full: { type: Boolean },
22
- open: { type: Boolean }
23
- },
24
- emits: ["update:open"],
25
- setup(T, { emit: A }) {
26
- const l = T, e = l.editorCtrl;
27
- N(E.EditorControl, e);
28
- const t = w(l.open ?? !1), h = A, k = w(l.width ?? 430);
29
- p(
30
- () => e == null ? void 0 : e.visible.value,
31
- (o) => {
32
- t.value = o ?? !1;
33
- }
34
- ), p(
35
- () => l.open,
36
- (o) => {
37
- t.value = o;
38
- }
39
- ), p(
40
- () => t.value,
41
- (o) => {
42
- h("update:open", o), o || f();
43
- }
44
- ), _(() => {
45
- t.value = (e == null ? void 0 : e.visible.value) ?? !1;
46
- });
47
- const x = () => {
48
- l.dialogSave ? l.dialogSave() : e && P(e);
49
- }, F = () => {
50
- l.dialogSaveAs ? l.dialogSaveAs() : e && K(e);
51
- }, f = () => {
52
- e ? M(e) : t.value = !1;
53
- };
54
- return (o, c) => (r(), n(a(D), {
55
- open: t.value,
56
- "onUpdate:open": c[0] || (c[0] = (i) => t.value = i),
57
- wrapClassName: "modal mx-auto min-w-[430px] " + (o.full ? "full-modal w-full" : ""),
58
- width: k.value
59
- }, {
60
- footer: s(() => [
61
- C(o.$slots, "footer", {}, () => [
62
- V(a($), null, {
63
- default: s(() => {
64
- var i, g, S, y;
65
- return [
66
- o.cancelText !== "" ? (r(), n(a(m), {
67
- key: 0,
68
- onClick: f
69
- }, {
70
- default: s(() => [
71
- u(v(o.cancelText ?? "取消"), 1)
72
- ]),
73
- _: 1
74
- })) : d("", !0),
75
- o.saveAsText !== "" && ((i = a(e)) == null ? void 0 : i.saveAsBtnVisible) !== !1 ? (r(), n(a(m), {
76
- key: 1,
77
- onClick: F,
78
- type: "primary",
79
- loading: (g = a(e)) == null ? void 0 : g.isFormSaving.value
80
- }, {
81
- default: s(() => [
82
- u(v(o.saveAsText ?? "另存为"), 1)
83
- ]),
84
- _: 1
85
- }, 8, ["loading"])) : d("", !0),
86
- o.saveText !== "" && ((S = a(e)) == null ? void 0 : S.saveBtnVisible) !== !1 ? (r(), n(a(m), {
87
- key: 2,
88
- onClick: x,
89
- type: "primary",
90
- loading: (y = a(e)) == null ? void 0 : y.isFormSaving.value
91
- }, {
92
- default: s(() => [
93
- u(v(o.saveText ?? "保存"), 1)
94
- ]),
95
- _: 1
96
- }, 8, ["loading"])) : d("", !0)
97
- ];
98
- }),
99
- _: 1
100
- })
101
- ])
102
- ]),
103
- default: s(() => [
104
- b("div", U, [
105
- C(o.$slots, "default")
106
- ])
107
- ]),
108
- _: 3
109
- }, 8, ["open", "wrapClassName", "width"]));
110
- }
111
- });
112
- export {
113
- R as _
114
- };