@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.
- package/lib/assets/modules/{baseLayout-BEy-FjcZ.js → baseLayout-DfTxHOFc.js} +7 -7
- package/lib/assets/modules/file-upload-DTOdV5vM.js +211 -0
- package/lib/assets/modules/index-BDoBUrYA.js +114 -0
- package/lib/assets/modules/{index-BTD6d1d_.js → index-BwMaOrJT.js} +1 -1
- package/lib/assets/modules/{index-BFxnKhwl.js → index-M1qERbea.js} +99 -99
- package/lib/assets/modules/{menuTabs-DUBWuf7t.js → menuTabs-DWaBSRNr.js} +42 -42
- package/lib/assets/modules/{toolIcon-DQLIuud3.js → toolIcon-BYnHhAy-.js} +1 -1
- package/lib/assets/modules/upload-template-BKm9mFq8.js +6764 -0
- package/lib/assets/modules/uploadList-CHvr6Hp1.js +472 -0
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +2 -2
- package/lib/es/Error403/index.js +14 -15
- package/lib/es/Error404/index.js +16 -17
- package/lib/es/ExcelForm/index.js +244 -244
- package/lib/es/MenuLayout/index.js +5 -5
- package/lib/es/TemplateFile/index.js +53 -54
- package/lib/es/UploadForm/index.js +61 -63
- package/lib/locales/default.d.ts +287 -103
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +1440 -1586
- package/package.json +1 -1
- package/src/components/common/icon/fullscreen.vue +1 -1
- package/src/components/content/dialog/excelForm.vue +32 -28
- package/src/components/content/dialog/index.vue +3 -3
- package/src/components/content/dialog/templateFile.vue +3 -2
- package/src/components/content/dialog/uploadForm.vue +5 -4
- package/src/components/content/drawer/index.vue +5 -3
- package/src/components/content/list/index.vue +2 -1
- package/src/components/content/list/listOperate.vue +6 -7
- package/src/components/content/search/index.vue +2 -2
- package/src/components/content/table/index.vue +2 -1
- package/src/components/content/table/tableOperate.vue +8 -9
- package/src/components/content/toolbar/icontool.vue +1 -5
- package/src/components/content/toolbar/index.vue +4 -5
- package/src/components/content/toolpanel/index.vue +20 -20
- package/src/components/error/error403.vue +2 -2
- package/src/components/error/error404.vue +2 -2
- package/src/components/form/input/index.vue +3 -1
- package/src/components/form/select/index.vue +3 -2
- package/src/components/form/textarea/index.vue +3 -1
- package/src/components/form/transfer/index.vue +2 -1
- package/src/components/form/upload/uploadList.vue +23 -19
- package/src/components/layout/header/headerExits.vue +5 -5
- package/src/components/layout/menu/menuTabs.vue +1 -1
- package/src/const/options.ts +17 -16
- package/src/locales/default.ts +297 -176
- package/src/stores/appInfo.ts +2 -1
- package/src/stores/userInfo.ts +6 -5
- package/src/utils/data.ts +9 -8
- package/src/utils/download.ts +5 -4
- package/src/utils/excel-preview.ts +4 -3
- package/src/utils/export-table.ts +7 -6
- package/src/utils/file-upload.ts +15 -14
- package/src/utils/form-csv.ts +4 -3
- package/src/utils/form-excel.ts +14 -13
- package/src/utils/form-validate.ts +18 -17
- package/src/utils/form.ts +6 -5
- package/src/utils/icon-loader.ts +3 -2
- package/src/utils/options.ts +2 -1
- package/src/utils/tools.ts +18 -17
- package/lib/assets/modules/file-upload-_mcZy7EK.js +0 -211
- package/lib/assets/modules/index-DyE2ppxB.js +0 -114
- package/lib/assets/modules/upload-template-DZuy1BOF.js +0 -6465
- package/lib/assets/modules/uploadList-CCquj3c_.js +0 -466
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { httpGet as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
|
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
|
|
14
|
-
const
|
|
15
|
-
`),
|
|
16
|
-
const e = await
|
|
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 = (
|
|
24
|
+
}, ae = (a, i, e = "预览文件.xlsx") => ({
|
|
25
25
|
success: !0,
|
|
26
|
-
blobUrl: `data:${
|
|
26
|
+
blobUrl: `data:${i || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};base64,${a}`,
|
|
27
27
|
fileName: e
|
|
28
|
-
}), ve = async (
|
|
29
|
-
if (
|
|
30
|
-
if (typeof
|
|
31
|
-
return
|
|
32
|
-
if (
|
|
33
|
-
const e = new Blob([
|
|
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 (
|
|
45
|
-
return
|
|
46
|
-
if (
|
|
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:
|
|
50
|
-
fileName:
|
|
49
|
+
blobUrl: a.url,
|
|
50
|
+
fileName: a.fileName || "预览文件.xlsx"
|
|
51
51
|
};
|
|
52
|
-
if (typeof
|
|
53
|
-
return await
|
|
52
|
+
if (typeof a == "string")
|
|
53
|
+
return await le(a);
|
|
54
54
|
throw new Error("不支持的文件格式");
|
|
55
|
-
},
|
|
56
|
-
if (!
|
|
57
|
-
return
|
|
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 (
|
|
61
|
-
const
|
|
62
|
-
...
|
|
60
|
+
if (a.method === "GET") {
|
|
61
|
+
const l = {
|
|
62
|
+
...a,
|
|
63
63
|
method: "GET",
|
|
64
|
-
api:
|
|
65
|
-
authorize:
|
|
64
|
+
api: a.api || i.page.api,
|
|
65
|
+
authorize: a.authorize ?? i.page.authorize
|
|
66
66
|
};
|
|
67
|
-
e = await
|
|
67
|
+
e = await Te(l);
|
|
68
68
|
} else {
|
|
69
|
-
const
|
|
70
|
-
e = await
|
|
71
|
-
url:
|
|
69
|
+
const l = a.params;
|
|
70
|
+
e = await Ee(i, {
|
|
71
|
+
url: a,
|
|
72
72
|
urlKey: "preview",
|
|
73
|
-
params:
|
|
73
|
+
params: l,
|
|
74
74
|
hideErrorToast: !0
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
if (
|
|
77
|
+
if (a.raw)
|
|
78
78
|
return await ve(e, !0);
|
|
79
|
-
if ((e == null ? void 0 : e.status) ===
|
|
80
|
-
const
|
|
81
|
-
return await ve(
|
|
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),
|
|
85
|
+
throw console.error("预览文件加载错误:", e), m.error(o("webui.utils.excelPreview.fileLoadFailed") + ":" + ((e == null ? void 0 : e.message) || "未知错误")), e;
|
|
86
86
|
}
|
|
87
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
99
|
+
}, Qe = {
|
|
100
100
|
key: 1,
|
|
101
101
|
class: "flex flex-col"
|
|
102
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
124
|
-
const e =
|
|
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
|
-
}),
|
|
134
|
+
}), me = R(() => {
|
|
135
135
|
switch (e.fileType || "both") {
|
|
136
136
|
case "excel":
|
|
137
|
-
return "
|
|
137
|
+
return o("webui.components.content.dialog.chooseExcelFile");
|
|
138
138
|
case "csv":
|
|
139
|
-
return "
|
|
139
|
+
return o("webui.components.content.dialog.chooseCsvFile");
|
|
140
140
|
case "both":
|
|
141
141
|
default:
|
|
142
|
-
return "
|
|
142
|
+
return o("webui.components.content.dialog.chooseExcelOrCsvFile");
|
|
143
143
|
}
|
|
144
|
-
}),
|
|
145
|
-
|
|
146
|
-
() =>
|
|
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
|
-
|
|
148
|
+
w.value = l.visible.value, w.value && (O(), e.previewUrl && I());
|
|
149
149
|
}
|
|
150
|
-
),
|
|
151
|
-
() =>
|
|
150
|
+
), W(
|
|
151
|
+
() => w.value,
|
|
152
152
|
() => {
|
|
153
|
-
|
|
153
|
+
l.visible.value = w.value, w.value || O();
|
|
154
154
|
}
|
|
155
|
-
),
|
|
155
|
+
), W(
|
|
156
156
|
() => e.previewUrl,
|
|
157
157
|
() => {
|
|
158
|
-
|
|
158
|
+
w.value && e.previewUrl && I();
|
|
159
159
|
},
|
|
160
160
|
{ deep: !0 }
|
|
161
161
|
);
|
|
162
|
-
const
|
|
162
|
+
const T = p(e.uploadParams), D = R(() => {
|
|
163
163
|
var t;
|
|
164
|
-
return (t =
|
|
165
|
-
}),
|
|
164
|
+
return (t = T.value) == null ? void 0 : t.uploadUrl;
|
|
165
|
+
}), C = R(() => {
|
|
166
166
|
var t;
|
|
167
|
-
return (t =
|
|
168
|
-
}),
|
|
167
|
+
return (t = T.value) == null ? void 0 : t.duplicateRules;
|
|
168
|
+
}), k = R(() => {
|
|
169
169
|
var t;
|
|
170
|
-
return (t =
|
|
170
|
+
return (t = T.value) == null ? void 0 : t.duplicateUrl;
|
|
171
171
|
}), I = async () => {
|
|
172
|
-
if (!(!e.previewUrl || !
|
|
173
|
-
|
|
172
|
+
if (!(!e.previewUrl || !l)) {
|
|
173
|
+
l.isFormLoading.value = !0;
|
|
174
174
|
try {
|
|
175
|
-
const t = await
|
|
176
|
-
t.success && (
|
|
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
|
-
|
|
179
|
+
l.isFormLoading.value = !1;
|
|
180
180
|
}, 1e3);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
},
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
const t =
|
|
183
|
+
}, we = async () => {
|
|
184
|
+
var n;
|
|
185
|
+
T.value = e.uploadParams;
|
|
186
|
+
const t = D.value;
|
|
187
187
|
if (!t) {
|
|
188
|
-
|
|
188
|
+
m.error(o("webui.components.content.excelForm.uploadAddressNotConfigured"));
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
if (
|
|
192
|
-
|
|
191
|
+
if (E.value) {
|
|
192
|
+
m.error(o("webui.components.content.excelForm.validationError"));
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
l.isFormSaving.value = !0;
|
|
196
196
|
try {
|
|
197
|
-
if (!
|
|
198
|
-
|
|
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
|
|
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
|
-
}),
|
|
203
|
+
}), d = Pe.join(((n = T.value) == null ? void 0 : n.basePath) ?? "", x.value), v = {
|
|
204
204
|
uid: "1",
|
|
205
|
-
name:
|
|
206
|
-
originFileObj:
|
|
207
|
-
status:
|
|
205
|
+
name: x.value,
|
|
206
|
+
originFileObj: c,
|
|
207
|
+
status: de.Uploading,
|
|
208
208
|
percent: 0,
|
|
209
209
|
params: {
|
|
210
|
-
FileKey:
|
|
210
|
+
FileKey: d
|
|
211
211
|
}
|
|
212
|
-
},
|
|
213
|
-
(await
|
|
214
|
-
v.percent =
|
|
215
|
-
})).status ===
|
|
216
|
-
} catch (
|
|
217
|
-
console.error("上传处理错误:",
|
|
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
|
-
|
|
219
|
+
l.isFormSaving.value = !1;
|
|
220
220
|
}
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
221
|
+
}, xe = async (t) => {
|
|
222
|
+
if (l.formData.value) {
|
|
223
223
|
if (e.excelRecordsKey || e.excelRowsKey) {
|
|
224
|
-
const
|
|
225
|
-
if (!
|
|
226
|
-
const { excelData:
|
|
227
|
-
var
|
|
228
|
-
const
|
|
229
|
-
for (const
|
|
230
|
-
const G = (
|
|
231
|
-
G && (
|
|
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
|
|
233
|
+
return h;
|
|
234
234
|
});
|
|
235
|
-
e.excelRecordsKey && (
|
|
235
|
+
e.excelRecordsKey && (l.formData.value[e.excelRecordsKey] = y), e.excelRowsKey && (l.formData.value[e.excelRowsKey] = v);
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
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
|
-
...
|
|
243
|
+
...l.formData.value
|
|
244
244
|
},
|
|
245
|
-
Query:
|
|
245
|
+
Query: s
|
|
246
246
|
};
|
|
247
|
-
if (
|
|
247
|
+
if (l.beforeSave && l.beforeSave(u) === !1)
|
|
248
248
|
return;
|
|
249
|
-
|
|
249
|
+
l.isFormSaving.value = !0;
|
|
250
250
|
try {
|
|
251
|
-
const
|
|
251
|
+
const c = await Se(e.excelCtrl, {
|
|
252
252
|
params: u,
|
|
253
253
|
urlKey: "save",
|
|
254
254
|
url: e.excelCtrl.saveUrl
|
|
255
255
|
});
|
|
256
|
-
(
|
|
257
|
-
} catch (
|
|
258
|
-
console.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
|
-
|
|
260
|
+
l.isFormSaving.value = !1;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
},
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
|
|
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
|
-
|
|
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:
|
|
270
|
+
errBlob: s,
|
|
271
271
|
validationMsg: u,
|
|
272
|
-
duplicateMsg:
|
|
273
|
-
hasFormatError:
|
|
272
|
+
duplicateMsg: c,
|
|
273
|
+
hasFormatError: d,
|
|
274
274
|
hasDuplicateError: v
|
|
275
|
-
} = await
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
|
|
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
|
-
|
|
281
|
+
E.value = !1, L.value = !1;
|
|
282
282
|
} catch {
|
|
283
|
-
|
|
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
|
-
},
|
|
286
|
+
}, ye = async (t) => {
|
|
287
287
|
if (!e.gridCtrl) {
|
|
288
|
-
|
|
288
|
+
m.error("未配置表格控制器!");
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
let
|
|
294
|
-
switch (
|
|
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
|
-
|
|
296
|
+
d = s, v = o("webui.components.content.excelForm.onlyExcelAllowed");
|
|
297
297
|
break;
|
|
298
298
|
case "csv":
|
|
299
|
-
|
|
299
|
+
d = u, v = o("webui.components.content.excelForm.onlyCsvAllowed");
|
|
300
300
|
break;
|
|
301
301
|
case "both":
|
|
302
302
|
default:
|
|
303
|
-
|
|
303
|
+
d = s || u, v = o("webui.components.content.excelForm.onlyExcelOrCsvAllowed");
|
|
304
304
|
break;
|
|
305
305
|
}
|
|
306
|
-
if (!
|
|
307
|
-
return
|
|
306
|
+
if (!d)
|
|
307
|
+
return m.error(v), ue.LIST_IGNORE;
|
|
308
308
|
try {
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
312
|
-
throw new Error(
|
|
313
|
-
const
|
|
314
|
-
return
|
|
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
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
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 (
|
|
323
|
-
console.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 =
|
|
327
|
-
|
|
328
|
-
var
|
|
329
|
-
const t = (
|
|
330
|
-
if (t &&
|
|
331
|
-
if (!
|
|
332
|
-
|
|
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
|
-
|
|
336
|
-
for (const
|
|
337
|
-
e.gridCtrl.rowData.value && (
|
|
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
|
-
|
|
339
|
+
w.value = l.visible.value, w.value && e.previewUrl && I();
|
|
340
340
|
});
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
const t = e.fileField ?? "FileInfo",
|
|
344
|
-
delete
|
|
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
|
-
},
|
|
347
|
-
|
|
346
|
+
}, re = () => {
|
|
347
|
+
l.visible.value = !1;
|
|
348
348
|
}, ge = () => {
|
|
349
349
|
};
|
|
350
|
-
return
|
|
351
|
-
clearAll:
|
|
352
|
-
}), (t,
|
|
353
|
-
title: t.title ?? "
|
|
354
|
-
open:
|
|
355
|
-
"onUpdate:open":
|
|
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:
|
|
358
|
+
onClose: re
|
|
359
359
|
}, {
|
|
360
360
|
footer: S(() => [
|
|
361
|
-
|
|
361
|
+
U(r(_e), null, {
|
|
362
362
|
default: S(() => {
|
|
363
|
-
var
|
|
363
|
+
var s;
|
|
364
364
|
return [
|
|
365
|
-
|
|
365
|
+
U(r(Z), { onClick: re }, {
|
|
366
366
|
default: S(() => [
|
|
367
|
-
|
|
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
|
-
|
|
371
|
+
$.value ? P("", !0) : (f(), J(r(Z), {
|
|
372
372
|
key: 0,
|
|
373
|
-
onClick:
|
|
373
|
+
onClick: we,
|
|
374
374
|
type: "primary",
|
|
375
|
-
loading: ((
|
|
376
|
-
disabled: !
|
|
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
|
-
|
|
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
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
"file-list":
|
|
394
|
-
"before-upload":
|
|
395
|
-
accept:
|
|
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: !
|
|
397
|
+
disabled: !oe.value
|
|
398
398
|
}, {
|
|
399
399
|
default: S(() => [
|
|
400
|
-
|
|
400
|
+
U(r(Z), {
|
|
401
401
|
type: "primary",
|
|
402
|
-
disabled: !
|
|
402
|
+
disabled: !oe.value
|
|
403
403
|
}, {
|
|
404
404
|
default: S(() => [
|
|
405
|
-
|
|
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
|
-
|
|
413
|
-
|
|
414
|
-
message:
|
|
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
|
-
])) :
|
|
419
|
-
|
|
418
|
+
])) : P("", !0),
|
|
419
|
+
X(t.$slots, "file-after")
|
|
420
420
|
])),
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
b("div", Oe, [
|
|
422
|
+
r(l).isFormLoading.value ? (f(), J(r(ke), {
|
|
423
423
|
key: 0,
|
|
424
424
|
size: "large"
|
|
425
|
-
})) :
|
|
426
|
-
|
|
427
|
-
class: Ce(["flex-shrink-0 relative border border-gray-200 rounded-md overflow-hidden", [
|
|
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
|
-
|
|
431
|
-
src:
|
|
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
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
message:
|
|
449
|
-
type:
|
|
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
|
-
|
|
454
|
-
(
|
|
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
|
-
|
|
459
|
-
|
|
460
|
-
(
|
|
461
|
-
key:
|
|
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
|
-
},
|
|
463
|
+
}, _(c), 1))), 128))
|
|
464
464
|
])
|
|
465
465
|
]))), 128))
|
|
466
466
|
]),
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
message:
|
|
470
|
-
type:
|
|
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
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
-
])) :
|
|
480
|
+
])) : P("", !0)
|
|
481
481
|
]))
|
|
482
482
|
])
|
|
483
|
-
])) :
|
|
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
|
-
|
|
491
|
+
wl as default
|
|
492
492
|
};
|