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