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