@skyfox2000/webui 1.2.8 → 1.2.9
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/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/lib/assets/modules/file-upload-BYIvmkmy.js +204 -0
- package/lib/assets/modules/form-excel-BUX2QW11.js +235 -0
- package/lib/assets/modules/{index-CTVMLeDF.js → index-DcRkhkn2.js} +1 -1
- package/lib/assets/modules/index-jl5Ie2tZ.js +112 -0
- package/lib/assets/modules/{menuTabs-BtOiocOC.js → menuTabs-DY1XBq16.js} +134 -139
- package/lib/assets/modules/{toolIcon-B9Mw9Ktm.js → toolIcon-BDIOj_3l.js} +1 -1
- package/lib/assets/modules/uploadList-BPG5whz7.js +369 -0
- package/lib/assets/modules/{index-D9kzQ23e.js → uploadList-D2Ux4h1N.js} +553 -513
- package/lib/components/common/index.d.ts +2 -0
- package/lib/components/common/loading/index.vue.d.ts +3 -0
- package/lib/components/content/dialog/index.vue.d.ts +1 -0
- package/lib/components/content/drawer/index.vue.d.ts +2 -0
- package/lib/components/content/form/formItem.vue.d.ts +2 -0
- package/lib/components/form/autoComplete/index.vue.d.ts +41 -4
- package/lib/components/form/cascader/index.vue.d.ts +13 -2
- package/lib/components/form/checkbox/index.vue.d.ts +13 -2
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/form/propEditor/index.vue.d.ts +10 -1
- package/lib/components/form/radio/index.vue.d.ts +13 -2
- package/lib/components/form/select/index.vue.d.ts +13 -2
- package/lib/components/form/upload/uploadList.vue.d.ts +14 -3
- package/lib/components/index.d.ts +2 -2
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +15 -15
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +4 -4
- package/lib/es/UploadForm/index.js +60 -87
- package/lib/index.d.ts +2 -2
- package/lib/typings/form.d.ts +18 -2
- package/lib/typings/option.d.ts +16 -2
- package/lib/typings/page.d.ts +1 -0
- package/lib/utils/file-upload.d.ts +4 -2
- package/lib/utils/form-excel.d.ts +3 -0
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +1085 -1063
- package/package.json +1 -1
- package/scripts/userInput.py +2 -0
- package/src/components/common/index.ts +3 -0
- package/src/components/common/loading/index.vue +11 -0
- package/src/components/content/dialog/index.vue +15 -8
- package/src/components/content/dialog/uploadForm.vue +38 -79
- package/src/components/content/drawer/index.vue +26 -6
- package/src/components/content/form/formItem.vue +21 -5
- package/src/components/content/form/index.vue +4 -2
- package/src/components/content/search/searchItem.vue +1 -1
- package/src/components/form/autoComplete/index.vue +12 -4
- package/src/components/form/cascader/index.vue +1 -1
- package/src/components/form/datePicker/index.vue +1 -1
- package/src/components/form/index.ts +1 -0
- package/src/components/form/input/inputIcon.vue +1 -1
- package/src/components/form/propEditor/index.vue +113 -33
- package/src/components/form/select/index.vue +27 -17
- package/src/components/form/upload/uploadList.vue +174 -34
- package/src/components/index.ts +13 -1
- package/src/directives/permission.ts +2 -2
- package/src/index.ts +3 -1
- package/src/typings/form.d.ts +18 -2
- package/src/typings/option.d.ts +16 -2
- package/src/typings/page.d.ts +1 -0
- package/src/utils/download.ts +1 -1
- package/src/utils/eventbus.ts +1 -1
- package/src/utils/file-upload.ts +75 -14
- package/src/utils/form-excel.ts +50 -1
- package/src/utils/form-validate.ts +18 -1
- package/src/utils/form.ts +3 -1
- package/src/utils/options.ts +38 -12
- package/lib/assets/modules/file-upload-CZO-pMJd.js +0 -176
- package/lib/assets/modules/form-excel-N-2OYqKv.js +0 -211
- package/lib/assets/modules/index-BnHnS9ug.js +0 -111
- package/lib/assets/modules/uploadList-B4LxzsC6.js +0 -210
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
var g = Object.defineProperty;
|
|
2
|
-
var v = (e, r, o) => r in e ? g(e, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[r] = o;
|
|
3
|
-
var p = (e, r, o) => v(e, typeof r != "symbol" ? r + "" : r, o);
|
|
4
|
-
import { hostUrl as E } from "@skyfox2000/fapi";
|
|
5
|
-
import { ac as m, ab as S, u as d } from "./index-D9kzQ23e.js";
|
|
6
|
-
import { mainAppApis as s } from "@skyfox2000/microbase";
|
|
7
|
-
import b from "dayjs";
|
|
8
|
-
var l = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Uploading = "uploading", e.Success = "success", e.Error = "error", e.Online = "online", e.Offline = "offline", e))(l || {});
|
|
9
|
-
const F = () => s.value ? s.value.getHostInfo() : m().hostInfo, H = () => s.value && s.value.getAppInfo ? s.value.getAppInfo() : S().appInfo, x = (e) => s.value && s.value.userLogin ? s.value.userLogin(e) : d().login(e, !0), U = () => s.value && s.value.userLogout ? s.value.userLogout() : d().logout(), w = () => s.value && s.value.getToken ? s.value.getToken() : d().getToken(), L = () => s.value && s.value.getUserInfo ? s.value.getUserInfo() : d().getUserInfo();
|
|
10
|
-
class M {
|
|
11
|
-
/**
|
|
12
|
-
* 连接路径参数,已判断 undefined 或 null 值
|
|
13
|
-
* @param args 路径参数数组
|
|
14
|
-
* @returns 连接后的路径字符串
|
|
15
|
-
*/
|
|
16
|
-
static join(...r) {
|
|
17
|
-
return r.filter((c) => c != null).join("/").replace(/[\/]+/, "/");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
class z {
|
|
21
|
-
/**
|
|
22
|
-
* AsyncUploader 构造函数
|
|
23
|
-
* @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
|
|
24
|
-
* @param maxConcurrent 最大允许并发上传的文件数量
|
|
25
|
-
*/
|
|
26
|
-
constructor(r, o) {
|
|
27
|
-
/**
|
|
28
|
-
* 设置 API 端点和最大并发数,所有上传文件通过该类控制
|
|
29
|
-
*/
|
|
30
|
-
p(this, "urlInfo");
|
|
31
|
-
/**
|
|
32
|
-
* 最大并发上传数
|
|
33
|
-
*/
|
|
34
|
-
p(this, "maxConcurrent");
|
|
35
|
-
/**
|
|
36
|
-
* 控制上传任务的中断信号
|
|
37
|
-
*/
|
|
38
|
-
p(this, "abortController");
|
|
39
|
-
this.urlInfo = r, this.maxConcurrent = o;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* 上传多个文件,控制并发数量
|
|
43
|
-
* @param files 文件列表(File[] 或 FileList)
|
|
44
|
-
* @param onProgress 上传进度回调
|
|
45
|
-
* @param onComplete 上传完成回调
|
|
46
|
-
*/
|
|
47
|
-
async uploadFiles(r, o, u) {
|
|
48
|
-
if (!r.length) return;
|
|
49
|
-
const c = Math.min(this.maxConcurrent, r.length), n = [];
|
|
50
|
-
for (const t of r)
|
|
51
|
-
switch (t.status) {
|
|
52
|
-
case l.Success:
|
|
53
|
-
case l.Online:
|
|
54
|
-
case l.Offline:
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
t.status = l.Pending, n.push(t);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
const f = [];
|
|
61
|
-
this.abortController = new AbortController();
|
|
62
|
-
try {
|
|
63
|
-
for (; f.length < c && n.length > 0; ) {
|
|
64
|
-
const t = n.shift();
|
|
65
|
-
if (!t) break;
|
|
66
|
-
f.push(this.handleFileStatus(t, f, n, o));
|
|
67
|
-
}
|
|
68
|
-
await Promise.all(f), u == null || u(r);
|
|
69
|
-
} catch (t) {
|
|
70
|
-
console.error("上传失败:", t), r.forEach((h) => {
|
|
71
|
-
h.status = l.Error, h.error = t instanceof Error ? t : new Error("上传失败"), o == null || o(h);
|
|
72
|
-
}), u == null || u(r);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 处理单个文件的上传逻辑
|
|
77
|
-
* @param file 当前上传的文件
|
|
78
|
-
* @param activeUploads 当前正在上传的文件列表
|
|
79
|
-
* @param pendingFiles 等待上传的文件列表
|
|
80
|
-
* @param onProgress 上传进度回调
|
|
81
|
-
*/
|
|
82
|
-
async handleFileStatus(r, o, u, c) {
|
|
83
|
-
try {
|
|
84
|
-
r.status = l.Uploading, await this.uploadFile(r, this.abortController.signal, (n) => {
|
|
85
|
-
r.percent = n, c == null || c(r);
|
|
86
|
-
}), r.status = l.Success;
|
|
87
|
-
} catch (n) {
|
|
88
|
-
r.status = l.Error, r.error = n instanceof Error ? n : new Error("上传失败"), console.error(r.error);
|
|
89
|
-
} finally {
|
|
90
|
-
if (u.length > 0) {
|
|
91
|
-
const n = u.shift();
|
|
92
|
-
n && o.push(this.handleFileStatus(n, o, u, c));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* 使用 XMLHttpRequest 上传文件
|
|
98
|
-
* @param file 文件对象
|
|
99
|
-
* @param signal 中断信号
|
|
100
|
-
* @param onProgress 上传进度回调
|
|
101
|
-
*/
|
|
102
|
-
async uploadFile(r, o, u) {
|
|
103
|
-
return new Promise((c, n) => {
|
|
104
|
-
const f = new FormData();
|
|
105
|
-
if (f.append("file", r.originFileObj), r.params)
|
|
106
|
-
for (const a in r.params)
|
|
107
|
-
f.append(a, r.params[a]);
|
|
108
|
-
const t = new XMLHttpRequest(), h = E(this.urlInfo);
|
|
109
|
-
if (h === !1) return Promise.resolve(null);
|
|
110
|
-
if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([a, i]) => {
|
|
111
|
-
t.setRequestHeader(a, i);
|
|
112
|
-
}), this.urlInfo.authorize) {
|
|
113
|
-
const a = w();
|
|
114
|
-
if (!a) {
|
|
115
|
-
n(new Error("未授权或授权过期"));
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
t.setRequestHeader("Authorization", "Bearer " + a);
|
|
119
|
-
}
|
|
120
|
-
t.upload.addEventListener("progress", (a) => {
|
|
121
|
-
if (a.lengthComputable && a.total > 0) {
|
|
122
|
-
const i = Math.round(a.loaded / a.total * 100);
|
|
123
|
-
u(i);
|
|
124
|
-
}
|
|
125
|
-
}), t.addEventListener("load", () => {
|
|
126
|
-
if (t.status >= 200 && t.status < 300) {
|
|
127
|
-
const a = t.getResponseHeader("Content-Type");
|
|
128
|
-
if (!a || !a.includes("application/json")) {
|
|
129
|
-
n(new Error("返回的结果不是 JSON 格式"));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
try {
|
|
133
|
-
const i = JSON.parse(t.response);
|
|
134
|
-
if (i.status === "success")
|
|
135
|
-
i.data && (r.minioFile = {
|
|
136
|
-
ETag: i.data.ETag,
|
|
137
|
-
Bucket: i.data.Bucket,
|
|
138
|
-
Key: i.data.Key,
|
|
139
|
-
Size: i.data.Size,
|
|
140
|
-
UpdateTime: b().format("YYYY-MM-DD HH:mm:ss"),
|
|
141
|
-
Status: l.Online
|
|
142
|
-
}), c(r);
|
|
143
|
-
else {
|
|
144
|
-
const I = i.msg;
|
|
145
|
-
n(new Error(I));
|
|
146
|
-
}
|
|
147
|
-
} catch (i) {
|
|
148
|
-
n(new Error("无法解析返回的 JSON 数据: " + i));
|
|
149
|
-
}
|
|
150
|
-
} else
|
|
151
|
-
n(new Error(`上传失败,状态码:${t.status}`));
|
|
152
|
-
}), t.addEventListener("error", () => {
|
|
153
|
-
n(new Error("上传失败,网络异常"));
|
|
154
|
-
}), t.send(f), o.addEventListener("abort", () => {
|
|
155
|
-
t.abort(), n(new Error("上传已取消"));
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* 取消当前所有的上传任务
|
|
161
|
-
*/
|
|
162
|
-
cancelUpload() {
|
|
163
|
-
this.abortController && this.abortController.abort();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
export {
|
|
167
|
-
z as A,
|
|
168
|
-
l as U,
|
|
169
|
-
H as a,
|
|
170
|
-
U as b,
|
|
171
|
-
w as c,
|
|
172
|
-
L as d,
|
|
173
|
-
F as g,
|
|
174
|
-
M as p,
|
|
175
|
-
x as u
|
|
176
|
-
};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import k from "async-validator";
|
|
2
|
-
import { httpPost as J, ResStatus as b } from "@skyfox2000/fapi";
|
|
3
|
-
import { i as C, ae as N } from "./index-D9kzQ23e.js";
|
|
4
|
-
import w from "vue-m-message";
|
|
5
|
-
const E = async (v) => {
|
|
6
|
-
const f = await import("exceljs"), m = new f.Workbook();
|
|
7
|
-
await m.xlsx.load(v);
|
|
8
|
-
const u = m.worksheets[0];
|
|
9
|
-
if (!u)
|
|
10
|
-
return w.error("Excel文件不包含工作表"), null;
|
|
11
|
-
const s = [], h = [];
|
|
12
|
-
return u.getRow(1).eachCell((t) => {
|
|
13
|
-
let a = "";
|
|
14
|
-
if (t.value !== null && t.value !== void 0)
|
|
15
|
-
if (typeof t.value == "object")
|
|
16
|
-
if ("richText" in t.value && Array.isArray(t.value.richText))
|
|
17
|
-
a = t.value.richText.map((r) => r.text || "").join("");
|
|
18
|
-
else if ("text" in t.value && typeof t.value.text == "string")
|
|
19
|
-
a = t.value.text;
|
|
20
|
-
else if (t.value instanceof Date)
|
|
21
|
-
a = t.value.toLocaleDateString();
|
|
22
|
-
else
|
|
23
|
-
try {
|
|
24
|
-
a = JSON.stringify(t.value);
|
|
25
|
-
} catch {
|
|
26
|
-
a = String(t.value);
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
a = String(t.value);
|
|
30
|
-
s.push(a);
|
|
31
|
-
}), u.eachRow((t, a) => {
|
|
32
|
-
if (a > 1) {
|
|
33
|
-
const r = {};
|
|
34
|
-
s.forEach((i, n) => {
|
|
35
|
-
if (i) {
|
|
36
|
-
const o = t.getCell(n + 1).value;
|
|
37
|
-
o != null ? typeof o == "object" ? "richText" in o && Array.isArray(o.richText) ? r[i] = o.richText.map((x) => x.text || "").join("") : "text" in o && typeof o.text == "string" ? r[i] = o.text : (o instanceof Date, r[i] = o) : r[i] = o : r[i] = null;
|
|
38
|
-
}
|
|
39
|
-
}), h.push(r);
|
|
40
|
-
}
|
|
41
|
-
}), { workbook: m, worksheet: u, headers: s, excelData: h };
|
|
42
|
-
}, S = async (v, f) => {
|
|
43
|
-
const m = await import("exceljs"), u = await E(v);
|
|
44
|
-
if (!u) return { hasError: !0 };
|
|
45
|
-
const { worksheet: s, headers: h } = u, { markCells: t, markHeaders: a } = f;
|
|
46
|
-
if (t.length === 0 && (!a || a.length === 0))
|
|
47
|
-
return { hasError: !1 };
|
|
48
|
-
const r = [...h];
|
|
49
|
-
a && a.length > 0 && a.forEach((l) => {
|
|
50
|
-
r.includes(l) || r.push(l);
|
|
51
|
-
});
|
|
52
|
-
const i = new m.Workbook(), n = i.addWorksheet("Sheet1"), p = 15, o = /* @__PURE__ */ new Map();
|
|
53
|
-
t.forEach(({ row: l, col: g, color: c }) => {
|
|
54
|
-
const y = `${l}-${g}`;
|
|
55
|
-
o.set(y, c || "FFFF0000");
|
|
56
|
-
});
|
|
57
|
-
for (let l = 0; l < r.length; l++) {
|
|
58
|
-
const g = n.getColumn(l + 1);
|
|
59
|
-
if (l < s.columnCount && l < h.length) {
|
|
60
|
-
const c = s.getColumn(l + 1);
|
|
61
|
-
c && c.width ? g.width = c.width : g.width = p;
|
|
62
|
-
} else
|
|
63
|
-
g.width = p;
|
|
64
|
-
}
|
|
65
|
-
const x = n.getRow(1);
|
|
66
|
-
r.forEach((l, g) => {
|
|
67
|
-
const c = x.getCell(g + 1);
|
|
68
|
-
c.value = l;
|
|
69
|
-
const y = g < h.length;
|
|
70
|
-
if (y && g < s.columnCount) {
|
|
71
|
-
const e = s.getRow(1).getCell(g + 1);
|
|
72
|
-
e.style && (c.style = JSON.parse(JSON.stringify(e.style))), e.font && (c.font = JSON.parse(JSON.stringify(e.font))), e.alignment && (c.alignment = JSON.parse(JSON.stringify(e.alignment))), e.border && (c.border = JSON.parse(JSON.stringify(e.border))), e.numFmt && (c.numFmt = e.numFmt), e.fill && (c.fill = JSON.parse(JSON.stringify(e.fill)));
|
|
73
|
-
}
|
|
74
|
-
a && a.includes(l) && !y && (c.fill = {
|
|
75
|
-
type: "pattern",
|
|
76
|
-
pattern: "solid",
|
|
77
|
-
fgColor: { argb: "FFFF0000" }
|
|
78
|
-
// 红色背景
|
|
79
|
-
}, c.font = {
|
|
80
|
-
name: "Arial",
|
|
81
|
-
size: 10,
|
|
82
|
-
bold: !0,
|
|
83
|
-
color: { argb: "FFFFFFFF" }
|
|
84
|
-
// 白色文字
|
|
85
|
-
});
|
|
86
|
-
}), x.commit(), s.eachRow((l, g) => {
|
|
87
|
-
if (g > 1) {
|
|
88
|
-
const c = n.getRow(g);
|
|
89
|
-
for (let y = 0; y < r.length; y++) {
|
|
90
|
-
const e = c.getCell(y + 1);
|
|
91
|
-
if (y < h.length && y < s.columnCount) {
|
|
92
|
-
const d = l.getCell(y + 1);
|
|
93
|
-
if (e.value = d.value, e.value !== null && e.value !== void 0 && typeof e.value == "object" && !("richText" in e.value) && !("formula" in e.value) && !("hyperlink" in e.value) && !(e.value instanceof Date))
|
|
94
|
-
try {
|
|
95
|
-
"text" in e.value && typeof e.value.text == "string" ? e.value = e.value.text : e.value = JSON.stringify(e.value);
|
|
96
|
-
} catch {
|
|
97
|
-
e.value = String(e.value);
|
|
98
|
-
}
|
|
99
|
-
d.style && (e.style = JSON.parse(JSON.stringify(d.style))), d.font && (e.font = JSON.parse(JSON.stringify(d.font))), d.alignment && (e.alignment = JSON.parse(JSON.stringify(d.alignment))), d.border && (e.border = JSON.parse(JSON.stringify(d.border))), d.numFmt && (e.numFmt = d.numFmt), d.fill && (e.fill = JSON.parse(JSON.stringify(d.fill)));
|
|
100
|
-
const F = `${g}-${y + 1}`;
|
|
101
|
-
o.has(F) && (e.fill = {
|
|
102
|
-
type: "pattern",
|
|
103
|
-
pattern: "solid",
|
|
104
|
-
fgColor: { argb: o.get(F) }
|
|
105
|
-
});
|
|
106
|
-
} else
|
|
107
|
-
e.value = null;
|
|
108
|
-
}
|
|
109
|
-
l.height && (c.height = l.height), l.outlineLevel && (c.outlineLevel = l.outlineLevel), c.commit();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const O = await i.xlsx.writeBuffer();
|
|
113
|
-
return { hasError: !0, errBlob: new Blob([O], {
|
|
114
|
-
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
115
|
-
}) };
|
|
116
|
-
}, $ = async (v, f) => {
|
|
117
|
-
if (!f || C(f))
|
|
118
|
-
return { hasError: !1 };
|
|
119
|
-
const m = await E(v);
|
|
120
|
-
if (!m) return { hasError: !0 };
|
|
121
|
-
const { headers: u, excelData: s } = m, h = [];
|
|
122
|
-
if (Object.keys(f).forEach((r) => {
|
|
123
|
-
u.includes(r) || h.push(r);
|
|
124
|
-
}), u.length === 0 || s.length === 0)
|
|
125
|
-
return w.error("Excel文件不包含足够的数据"), { hasError: !0 };
|
|
126
|
-
const t = new k({});
|
|
127
|
-
t.messages(N.messages()), t.define(f);
|
|
128
|
-
const a = await D(u, s, t);
|
|
129
|
-
if (a.length > 0 || h.length > 0) {
|
|
130
|
-
const r = a.map((i) => ({
|
|
131
|
-
row: i.row + 2,
|
|
132
|
-
// 转为Excel行号(+2是因为表头占一行,且是1-based索引)
|
|
133
|
-
col: i.col + 1,
|
|
134
|
-
// 转为Excel列号(+1是因为是1-based索引)
|
|
135
|
-
color: "FFFF0000"
|
|
136
|
-
// 红色
|
|
137
|
-
}));
|
|
138
|
-
return S(v, {
|
|
139
|
-
markCells: r,
|
|
140
|
-
markHeaders: h
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return { hasError: !1 };
|
|
144
|
-
}, D = async (v, f, m) => {
|
|
145
|
-
const u = [];
|
|
146
|
-
for (let s = 0; s < f.length; s++) {
|
|
147
|
-
const h = f[s];
|
|
148
|
-
try {
|
|
149
|
-
await m.validate(h).catch(({ errors: t }) => {
|
|
150
|
-
const a = [];
|
|
151
|
-
t.forEach((r) => {
|
|
152
|
-
const i = v.indexOf(r.field);
|
|
153
|
-
i >= 0 && (a.some((p) => p.row === s && p.col === i) || a.push({
|
|
154
|
-
row: s,
|
|
155
|
-
col: i,
|
|
156
|
-
header: r.field,
|
|
157
|
-
message: r.message.replace("${label}", v[i])
|
|
158
|
-
}));
|
|
159
|
-
}), u.push(...a);
|
|
160
|
-
});
|
|
161
|
-
} catch (t) {
|
|
162
|
-
console.error("验证表格数据时发生错误:", t), w.error("验证表格数据时发生错误:" + t);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return u;
|
|
166
|
-
}, R = async (v, f, m) => {
|
|
167
|
-
if (!f || f.length === 0)
|
|
168
|
-
return { hasError: !1 };
|
|
169
|
-
const u = await E(v);
|
|
170
|
-
if (!u) return { hasError: !0 };
|
|
171
|
-
const { headers: s, excelData: h } = u, t = [];
|
|
172
|
-
if (f.forEach((n) => {
|
|
173
|
-
s.includes(n) || t.push(n);
|
|
174
|
-
}), t.length > 0)
|
|
175
|
-
return w.error(`表头缺少重复检测所需字段: ${t.join(", ")}`), { hasError: !0 };
|
|
176
|
-
const a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = new Array();
|
|
177
|
-
if (h.forEach((n, p) => {
|
|
178
|
-
const o = f.map((x) => n[x]).join("|");
|
|
179
|
-
i.push(o), a.has(o) ? (r.add(p), r.add(a.get(o))) : a.set(o, p);
|
|
180
|
-
}), m) {
|
|
181
|
-
const n = await J(m, {
|
|
182
|
-
Data: i
|
|
183
|
-
});
|
|
184
|
-
if (n != null && n.data && n.data.forEach((p) => {
|
|
185
|
-
r.add(p);
|
|
186
|
-
}), (n == null ? void 0 : n.status) === b.ERROR)
|
|
187
|
-
throw new Error(n.msg);
|
|
188
|
-
}
|
|
189
|
-
if (r.size > 0) {
|
|
190
|
-
const n = [];
|
|
191
|
-
return r.forEach((p) => {
|
|
192
|
-
f.forEach((o) => {
|
|
193
|
-
const x = s.indexOf(o);
|
|
194
|
-
x >= 0 && n.push({
|
|
195
|
-
row: p + 2,
|
|
196
|
-
// Excel行号 = 数组索引 + 2(表头和1-based索引)
|
|
197
|
-
col: x + 1,
|
|
198
|
-
// Excel列号 = 数组索引 + 1(1-based索引)
|
|
199
|
-
color: "FFFF0000"
|
|
200
|
-
// 红色
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}), S(v, { markCells: n, markHeaders: t });
|
|
204
|
-
}
|
|
205
|
-
return { hasError: !1 };
|
|
206
|
-
};
|
|
207
|
-
export {
|
|
208
|
-
R as c,
|
|
209
|
-
E as p,
|
|
210
|
-
$ as v
|
|
211
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { defineComponent as A, provide as B, ref as S, watch as p, onMounted as F, createBlock as n, openBlock as r, unref as a, withCtx as t, createElementVNode as N, renderSlot as b, createVNode as V, createCommentVNode as d, createTextVNode as u, toDisplayString as m } from "vue";
|
|
2
|
-
import { _ as f } from "./index-CTVMLeDF.js";
|
|
3
|
-
import { Modal as E, Space as M } from "ant-design-vue";
|
|
4
|
-
import "@skyfox2000/fapi";
|
|
5
|
-
import { P, o as $, d as D, b as K } from "./index-D9kzQ23e.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__ */ A({
|
|
12
|
-
__name: "index",
|
|
13
|
-
props: {
|
|
14
|
-
saveText: {},
|
|
15
|
-
saveAsText: {},
|
|
16
|
-
cancelText: {},
|
|
17
|
-
editorCtrl: {},
|
|
18
|
-
dialogSave: { type: Function },
|
|
19
|
-
width: {},
|
|
20
|
-
full: { type: Boolean },
|
|
21
|
-
open: { type: Boolean }
|
|
22
|
-
},
|
|
23
|
-
emits: ["update:open"],
|
|
24
|
-
setup(C, { emit: T }) {
|
|
25
|
-
const s = C, e = s.editorCtrl;
|
|
26
|
-
B(P.EditorControl, e);
|
|
27
|
-
const l = S(s.open ?? !1), h = T, k = S(s.width ?? 430);
|
|
28
|
-
p(
|
|
29
|
-
() => e == null ? void 0 : e.visible.value,
|
|
30
|
-
(o) => {
|
|
31
|
-
l.value = o ?? !1;
|
|
32
|
-
}
|
|
33
|
-
), p(
|
|
34
|
-
() => s.open,
|
|
35
|
-
(o) => {
|
|
36
|
-
l.value = o;
|
|
37
|
-
}
|
|
38
|
-
), p(
|
|
39
|
-
() => l.value,
|
|
40
|
-
(o) => {
|
|
41
|
-
h("update:open", o), o || v();
|
|
42
|
-
}
|
|
43
|
-
), F(() => {
|
|
44
|
-
l.value = (e == null ? void 0 : e.visible.value) ?? !1;
|
|
45
|
-
});
|
|
46
|
-
const x = () => {
|
|
47
|
-
s.dialogSave || e && D(e);
|
|
48
|
-
}, _ = () => {
|
|
49
|
-
e && K(e);
|
|
50
|
-
}, v = () => {
|
|
51
|
-
e ? $(e) : l.value = !1;
|
|
52
|
-
};
|
|
53
|
-
return (o, c) => (r(), n(a(E), {
|
|
54
|
-
open: l.value,
|
|
55
|
-
"onUpdate:open": c[0] || (c[0] = (i) => l.value = i),
|
|
56
|
-
wrapClassName: "modal mx-auto min-w-[430px] " + (o.full ? "full-modal w-full" : ""),
|
|
57
|
-
width: k.value
|
|
58
|
-
}, {
|
|
59
|
-
footer: t(() => [
|
|
60
|
-
V(a(M), null, {
|
|
61
|
-
default: t(() => {
|
|
62
|
-
var i, y, g, w;
|
|
63
|
-
return [
|
|
64
|
-
o.cancelText !== "" ? (r(), n(a(f), {
|
|
65
|
-
key: 0,
|
|
66
|
-
onClick: v
|
|
67
|
-
}, {
|
|
68
|
-
default: t(() => [
|
|
69
|
-
u(m(o.cancelText ?? "取消"), 1)
|
|
70
|
-
]),
|
|
71
|
-
_: 1
|
|
72
|
-
})) : d("", !0),
|
|
73
|
-
o.saveAsText !== "" && ((i = a(e)) == null ? void 0 : i.saveAsBtnVisible) !== !1 ? (r(), n(a(f), {
|
|
74
|
-
key: 1,
|
|
75
|
-
onClick: _,
|
|
76
|
-
type: "primary",
|
|
77
|
-
loading: (y = a(e)) == null ? void 0 : y.isFormSaving.value
|
|
78
|
-
}, {
|
|
79
|
-
default: t(() => [
|
|
80
|
-
u(m(o.saveAsText ?? "另存为"), 1)
|
|
81
|
-
]),
|
|
82
|
-
_: 1
|
|
83
|
-
}, 8, ["loading"])) : d("", !0),
|
|
84
|
-
o.saveText !== "" && ((g = a(e)) == null ? void 0 : g.saveBtnVisible) !== !1 ? (r(), n(a(f), {
|
|
85
|
-
key: 2,
|
|
86
|
-
onClick: x,
|
|
87
|
-
type: "primary",
|
|
88
|
-
loading: (w = a(e)) == null ? void 0 : w.isFormSaving.value
|
|
89
|
-
}, {
|
|
90
|
-
default: t(() => [
|
|
91
|
-
u(m(o.saveText ?? "保存"), 1)
|
|
92
|
-
]),
|
|
93
|
-
_: 1
|
|
94
|
-
}, 8, ["loading"])) : d("", !0)
|
|
95
|
-
];
|
|
96
|
-
}),
|
|
97
|
-
_: 1
|
|
98
|
-
})
|
|
99
|
-
]),
|
|
100
|
-
default: t(() => [
|
|
101
|
-
N("div", U, [
|
|
102
|
-
b(o.$slots, "default")
|
|
103
|
-
])
|
|
104
|
-
]),
|
|
105
|
-
_: 3
|
|
106
|
-
}, 8, ["open", "wrapClassName", "width"]));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
export {
|
|
110
|
-
R as _
|
|
111
|
-
};
|