mixdashboards 1.1.107 → 1.1.109
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/dist/equipmentManagement.import-D4sriuvt.js +321 -0
- package/dist/{index-CoeP8Uiy.js → index-8uKQFaHR.js} +133001 -124751
- package/dist/{lerc-BRTYPuQg.js → lerc-BRizGxLQ.js} +1 -1
- package/dist/mixdashboards.css +1 -1
- package/dist/mixdashboards.js +1 -1
- package/dist/xlsx-CwHzt_65.js +24728 -0
- package/package.json +1 -1
- package/dist/equipmentManagement.import-ClW0ZpK1.js +0 -21783
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { ElMessage as q } from "element-plus";
|
|
2
|
+
import { read as O, utils as u, SSF as P } from "./xlsx-CwHzt_65.js";
|
|
3
|
+
function x(n) {
|
|
4
|
+
if (!n)
|
|
5
|
+
throw new Error("缺少上传文件");
|
|
6
|
+
return n;
|
|
7
|
+
}
|
|
8
|
+
function re(n, e) {
|
|
9
|
+
return new Promise((c, r) => {
|
|
10
|
+
const a = () => {
|
|
11
|
+
q.error("无效的导入模式"), r(new Error("无效的导入模式"));
|
|
12
|
+
}, t = new FileReader();
|
|
13
|
+
t.onload = (o) => {
|
|
14
|
+
var i;
|
|
15
|
+
try {
|
|
16
|
+
const l = (i = o.target) == null ? void 0 : i.result;
|
|
17
|
+
if (!(l instanceof ArrayBuffer))
|
|
18
|
+
throw new Error("无法读取文件内容");
|
|
19
|
+
const s = new Uint8Array(l), d = O(s, { type: "array" });
|
|
20
|
+
switch (e) {
|
|
21
|
+
case "device":
|
|
22
|
+
c(V(d));
|
|
23
|
+
break;
|
|
24
|
+
case "timer":
|
|
25
|
+
c(A(d));
|
|
26
|
+
break;
|
|
27
|
+
case "inspect":
|
|
28
|
+
c(Z(d));
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
a();
|
|
32
|
+
}
|
|
33
|
+
} catch (l) {
|
|
34
|
+
console.error(l), q.error("解析Excel文件时出错"), r(new Error("解析Excel文件时出错"));
|
|
35
|
+
}
|
|
36
|
+
}, t.onerror = (o) => {
|
|
37
|
+
console.error(o), q.error("解析Excel文件时出错"), r(new Error("读取文件失败"));
|
|
38
|
+
}, t.readAsArrayBuffer(x(n));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function A(n) {
|
|
42
|
+
const e = [];
|
|
43
|
+
return Object.keys(n.Sheets).forEach((c) => {
|
|
44
|
+
var C, m;
|
|
45
|
+
const r = n.Sheets[c], a = r["!ref"];
|
|
46
|
+
if (!a) return;
|
|
47
|
+
const t = u.decode_range(a), o = 2, i = { std: 0, name: 1, priority: 2, operation: 3, cycle: 4, stats: 5, pNum: 6, pUnit: 7, nNum: 8, nUnit: 9 };
|
|
48
|
+
let l = "";
|
|
49
|
+
l || (l = c.trim() || "IMPORT");
|
|
50
|
+
let s = "", d = "", g = "";
|
|
51
|
+
const S = {};
|
|
52
|
+
for (let p = o; p <= t.e.r; p++) {
|
|
53
|
+
const E = r[u.encode_cell({ r: p, c: i.std })];
|
|
54
|
+
if (E && E.v && (l = String(E.v)), !l) continue;
|
|
55
|
+
const f = r[u.encode_cell({ r: p, c: i.name })], F = r[u.encode_cell({ r: p, c: i.priority })], b = r[u.encode_cell({ r: p, c: i.operation })], I = r[u.encode_cell({ r: p, c: i.cycle })], y = r[u.encode_cell({ r: p, c: i.stats })], h = r[u.encode_cell({ r: p, c: i.pNum })], v = r[u.encode_cell({ r: p, c: i.pUnit })], w = r[u.encode_cell({ r: p, c: i.nNum })], N = r[u.encode_cell({ r: p, c: i.nUnit })];
|
|
56
|
+
if ((f == null ? void 0 : f.v) != null && String(f.v) !== "" && (s = f.v, d = (C = F == null ? void 0 : F.v) != null ? C : "", g = (m = b == null ? void 0 : b.v) != null ? m : ""), !I || !I.v) continue;
|
|
57
|
+
const _ = !!h && h.v !== "" && !!v && v.v !== "", G = !!w && w.v !== "" && !!N && N.v !== "";
|
|
58
|
+
if (!_ && !G) continue;
|
|
59
|
+
const R = (f == null ? void 0 : f.v) != null && String(f.v) !== "" ? f.v : s;
|
|
60
|
+
if (R === "" || R == null) continue;
|
|
61
|
+
const M = {
|
|
62
|
+
name: R,
|
|
63
|
+
priority: d || null,
|
|
64
|
+
operation: g || "",
|
|
65
|
+
cycle_type: I.v,
|
|
66
|
+
statistics_id: y && y.v ? y.v : null,
|
|
67
|
+
period_num: h && h.v !== "" ? typeof h.v == "number" ? h.v : parseFloat(String(h.v)) : null,
|
|
68
|
+
period_unit: v && v.v !== "" ? v.v : null,
|
|
69
|
+
notice_num: w && w.v !== "" ? typeof w.v == "number" ? w.v : parseFloat(String(w.v)) : null,
|
|
70
|
+
notice_unit: N && N.v !== "" ? N.v : null
|
|
71
|
+
}, U = String(R);
|
|
72
|
+
S[U] || (S[U] = []), S[U].push(M);
|
|
73
|
+
}
|
|
74
|
+
Object.keys(S).length > 0 && e.push({
|
|
75
|
+
name: c,
|
|
76
|
+
serial_num: l,
|
|
77
|
+
data: S
|
|
78
|
+
});
|
|
79
|
+
}), e;
|
|
80
|
+
}
|
|
81
|
+
const j = {
|
|
82
|
+
设备编号: "serial_num",
|
|
83
|
+
设备名称: "name",
|
|
84
|
+
工厂编号: "factory_serial_num",
|
|
85
|
+
工厂名称: "factory_name",
|
|
86
|
+
制造商: "manufacturer_name",
|
|
87
|
+
设备类型编号: "equipment_type_serial_num",
|
|
88
|
+
设备类型: "equipment_type_name",
|
|
89
|
+
设备型号: "model",
|
|
90
|
+
所在车间: "workshop_name",
|
|
91
|
+
进厂时间: "enter_factory_time",
|
|
92
|
+
在用状态: "is_available",
|
|
93
|
+
关联对象: "object_id",
|
|
94
|
+
维保优先级: "timer_priority_name",
|
|
95
|
+
资产编码: "asset_code",
|
|
96
|
+
设备操作员: "equipment_operator",
|
|
97
|
+
维修责任人: "repairman",
|
|
98
|
+
供应商业务员: "supplier_salesman",
|
|
99
|
+
供应商电话: "supplier_phone"
|
|
100
|
+
}, $ = [
|
|
101
|
+
"serial_num",
|
|
102
|
+
"name",
|
|
103
|
+
"factory_serial_num",
|
|
104
|
+
"factory_name",
|
|
105
|
+
"manufacturer_name",
|
|
106
|
+
"equipment_type_serial_num",
|
|
107
|
+
"equipment_type_name",
|
|
108
|
+
"model",
|
|
109
|
+
"workshop_name",
|
|
110
|
+
"enter_factory_time",
|
|
111
|
+
"is_available",
|
|
112
|
+
"object_id",
|
|
113
|
+
"timer_priority_name",
|
|
114
|
+
"asset_code",
|
|
115
|
+
"equipment_operator",
|
|
116
|
+
"repairman",
|
|
117
|
+
"supplier_salesman",
|
|
118
|
+
"supplier_phone"
|
|
119
|
+
];
|
|
120
|
+
function k(n) {
|
|
121
|
+
return String(n).padStart(2, "0");
|
|
122
|
+
}
|
|
123
|
+
function D(n, e, c, r, a, t) {
|
|
124
|
+
return `${n}-${k(e)}-${k(c)} ${k(r)}:${k(a)}:${k(t)}`;
|
|
125
|
+
}
|
|
126
|
+
function L(n) {
|
|
127
|
+
var r, a, t;
|
|
128
|
+
if (n.v == null || n.v === "") return "";
|
|
129
|
+
if (n.t === "n" && typeof n.v == "number") {
|
|
130
|
+
const o = P.parse_date_code(n.v);
|
|
131
|
+
return D(o.y, o.m, o.d, o.H, o.M, o.S);
|
|
132
|
+
}
|
|
133
|
+
const e = String(n.v).trim(), c = e.match(/^(\d{4})[/-](\d{1,2})[/-](\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?/);
|
|
134
|
+
return c ? D(
|
|
135
|
+
Number(c[1]),
|
|
136
|
+
Number(c[2]),
|
|
137
|
+
Number(c[3]),
|
|
138
|
+
Number((r = c[4]) != null ? r : 0),
|
|
139
|
+
Number((a = c[5]) != null ? a : 0),
|
|
140
|
+
Number((t = c[6]) != null ? t : 0)
|
|
141
|
+
) : e;
|
|
142
|
+
}
|
|
143
|
+
function H() {
|
|
144
|
+
return Object.fromEntries($.map((n) => [n, ""]));
|
|
145
|
+
}
|
|
146
|
+
function B(n, e) {
|
|
147
|
+
return !n || n.v == null || n.v === "" ? "" : e === "enter_factory_time" ? L(n) : String(n.v).trim();
|
|
148
|
+
}
|
|
149
|
+
function V(n) {
|
|
150
|
+
var i;
|
|
151
|
+
const e = [], c = n.SheetNames[0];
|
|
152
|
+
if (!c) return e;
|
|
153
|
+
const r = n.Sheets[c], a = r["!ref"];
|
|
154
|
+
if (!a) return e;
|
|
155
|
+
const t = u.decode_range(a), o = [];
|
|
156
|
+
for (let l = 0; l <= t.e.c; l++) {
|
|
157
|
+
const s = r[u.encode_cell({ r: 0, c: l })];
|
|
158
|
+
if (!(s != null && s.v)) continue;
|
|
159
|
+
const d = j[String(s.v).trim()];
|
|
160
|
+
d && o.push({ col: l, field: d });
|
|
161
|
+
}
|
|
162
|
+
for (let l = 1; l <= t.e.r; l++) {
|
|
163
|
+
const s = H();
|
|
164
|
+
for (const { col: d, field: g } of o) {
|
|
165
|
+
const S = r[u.encode_cell({ r: l, c: d })];
|
|
166
|
+
s[g] = B(S, g);
|
|
167
|
+
}
|
|
168
|
+
(i = s.serial_num) != null && i.trim() && e.push(s);
|
|
169
|
+
}
|
|
170
|
+
return e;
|
|
171
|
+
}
|
|
172
|
+
function z(n) {
|
|
173
|
+
const e = n[u.encode_cell({ r: 0, c: 0 })], c = n[u.encode_cell({ r: 1, c: 0 })], r = (e == null ? void 0 : e.v) != null ? String(e.v).trim() : "", a = (c == null ? void 0 : c.v) != null ? String(c.v).trim() : "", t = (o) => o.includes("标准") && (o.includes("编号") || o.includes("类型")) || o.includes("设备类型编号") || o === "项目编号";
|
|
174
|
+
return t(a) && !t(r) ? 2 : (t(r), 1);
|
|
175
|
+
}
|
|
176
|
+
function K(n) {
|
|
177
|
+
return n != null ? String(n).replace(/\s+/g, "").trim() : "";
|
|
178
|
+
}
|
|
179
|
+
function W(n) {
|
|
180
|
+
const e = K(n);
|
|
181
|
+
return e ? e.includes("文本") || e.includes("数字") ? "文本" : e.includes("布尔") ? "布尔" : e.includes("单选") ? "单选" : e.includes("多选") ? "多选" : null : null;
|
|
182
|
+
}
|
|
183
|
+
function Y(n, e, c) {
|
|
184
|
+
const r = n[u.encode_cell({ r: e, c })];
|
|
185
|
+
return (r == null ? void 0 : r.v) != null ? String(r.v).replace(/\s+/g, "").trim() : "";
|
|
186
|
+
}
|
|
187
|
+
function J(n) {
|
|
188
|
+
const e = n.replace(/\s+/g, "").trim();
|
|
189
|
+
return e ? e.includes("标准编号") ? "std" : e.includes("巡检任务名称") ? "name" : e.includes("设备类型编号") || e.includes("标准") && (e.includes("编号") || e.includes("类型")) || e === "项目编号" ? "std" : e.includes("巡检操作指导") || e.includes("操作指导") ? "ruleGuide" : e.includes("周期单位") || e === "单位" ? "periodUnit" : e.includes("巡检频次") || e.includes("频次") || e.includes("频率") && !e.includes("周期") ? "periodFreq" : e.includes("周期数值") || e.includes("周期间隔") || e.includes("间隔数值") || e.includes("周期") && (e.includes("数") || e.includes("值")) || e === "数值" ? "periodNum" : e.includes("任务名称") || e.includes("规则名称") ? "name" : e.includes("录入类型") || e.includes("选项类型") || e === "类型" || e.endsWith("类型") ? "type" : null : null;
|
|
190
|
+
}
|
|
191
|
+
function Q(n, e) {
|
|
192
|
+
const c = Math.min(4, e.e.r), r = ["name", "ruleGuide", "periodNum", "periodUnit", "periodFreq", "type"];
|
|
193
|
+
function a(t, o) {
|
|
194
|
+
const i = {};
|
|
195
|
+
for (let l = 0; l <= e.e.c; l++)
|
|
196
|
+
for (let s = t; s <= o; s++) {
|
|
197
|
+
const d = J(Y(n, s, l));
|
|
198
|
+
if (d != null && i[d] === void 0) {
|
|
199
|
+
i[d] = l;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return i;
|
|
204
|
+
}
|
|
205
|
+
for (let t = 0; t <= c; t++) {
|
|
206
|
+
const o = a(t, t);
|
|
207
|
+
if (r.every((i) => o[i] != null))
|
|
208
|
+
return {
|
|
209
|
+
headerRow: t,
|
|
210
|
+
cols: T(o)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
for (let t = 0; t <= Math.min(c - 1, e.e.r - 1); t++) {
|
|
214
|
+
const o = a(t, t + 1);
|
|
215
|
+
if (r.every((i) => o[i] != null))
|
|
216
|
+
return {
|
|
217
|
+
headerRow: t + 1,
|
|
218
|
+
cols: T(o)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
function T(n) {
|
|
224
|
+
var e;
|
|
225
|
+
return {
|
|
226
|
+
std: (e = n.std) != null ? e : -1,
|
|
227
|
+
name: n.name,
|
|
228
|
+
ruleGuide: n.ruleGuide,
|
|
229
|
+
periodNum: n.periodNum,
|
|
230
|
+
periodUnit: n.periodUnit,
|
|
231
|
+
periodFreq: n.periodFreq,
|
|
232
|
+
type: n.type
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const X = {
|
|
236
|
+
std: 0,
|
|
237
|
+
name: 2,
|
|
238
|
+
ruleGuide: 3,
|
|
239
|
+
periodNum: 4,
|
|
240
|
+
periodUnit: 5,
|
|
241
|
+
periodFreq: 6,
|
|
242
|
+
type: 7
|
|
243
|
+
};
|
|
244
|
+
function Z(n) {
|
|
245
|
+
const e = [];
|
|
246
|
+
return Object.keys(n.Sheets).forEach((c) => {
|
|
247
|
+
var g, S, C;
|
|
248
|
+
const r = n.Sheets[c], a = r["!ref"];
|
|
249
|
+
if (!a) return;
|
|
250
|
+
const t = u.decode_range(a), o = Q(r, t), i = (g = o == null ? void 0 : o.cols) != null ? g : X, l = o != null ? o.headerRow + 1 : z(r);
|
|
251
|
+
let s = c.trim();
|
|
252
|
+
const d = [];
|
|
253
|
+
for (let m = l; m <= t.e.r; m++) {
|
|
254
|
+
if (i.std >= 0) {
|
|
255
|
+
const _ = r[u.encode_cell({ r: m, c: i.std })];
|
|
256
|
+
_ && _.v && (s = String(_.v));
|
|
257
|
+
}
|
|
258
|
+
if (!s) continue;
|
|
259
|
+
const p = r[u.encode_cell({ r: m, c: i.name })], E = r[u.encode_cell({ r: m, c: i.ruleGuide })], f = r[u.encode_cell({ r: m, c: i.periodNum })], F = r[u.encode_cell({ r: m, c: i.periodUnit })], b = r[u.encode_cell({ r: m, c: i.periodFreq })], I = r[u.encode_cell({ r: m, c: i.type })];
|
|
260
|
+
if (!p || !p.v || !E || !E.v || !f || !f.v || !F || !F.v || !b || !b.v || !I || !I.v)
|
|
261
|
+
continue;
|
|
262
|
+
const y = [];
|
|
263
|
+
let h = i.type + 1;
|
|
264
|
+
for (; h <= t.e.c; ) {
|
|
265
|
+
const _ = r[u.encode_cell({ r: m, c: h })];
|
|
266
|
+
if (_ && _.v)
|
|
267
|
+
y.push(_.v), h++;
|
|
268
|
+
else
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
let v = null;
|
|
272
|
+
switch (W(I.v)) {
|
|
273
|
+
case "文本":
|
|
274
|
+
v = {
|
|
275
|
+
type: "text",
|
|
276
|
+
value: []
|
|
277
|
+
};
|
|
278
|
+
break;
|
|
279
|
+
case "布尔":
|
|
280
|
+
v = {
|
|
281
|
+
type: "boolean",
|
|
282
|
+
value: {
|
|
283
|
+
true: (S = y[0]) != null ? S : "是",
|
|
284
|
+
false: (C = y[1]) != null ? C : "否"
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
break;
|
|
288
|
+
case "单选":
|
|
289
|
+
y.length >= 2 && (v = {
|
|
290
|
+
type: "radio",
|
|
291
|
+
value: y.map((_) => ({ value: _ }))
|
|
292
|
+
});
|
|
293
|
+
break;
|
|
294
|
+
case "多选":
|
|
295
|
+
y.length >= 2 && (v = {
|
|
296
|
+
type: "multi",
|
|
297
|
+
value: y.map((_) => ({ value: _ }))
|
|
298
|
+
});
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
if (!v) continue;
|
|
302
|
+
const N = {
|
|
303
|
+
name: p.v,
|
|
304
|
+
rule_guide: E.v,
|
|
305
|
+
period_num: typeof f.v == "number" ? f.v : parseFloat(String(f.v)),
|
|
306
|
+
period_unit: F.v,
|
|
307
|
+
period_frequency: typeof b.v == "number" ? b.v : parseFloat(String(b.v)),
|
|
308
|
+
option: v
|
|
309
|
+
};
|
|
310
|
+
d.push(N);
|
|
311
|
+
}
|
|
312
|
+
d.length > 0 && e.push({
|
|
313
|
+
name: c,
|
|
314
|
+
serial_num: s,
|
|
315
|
+
data: d
|
|
316
|
+
});
|
|
317
|
+
}), e;
|
|
318
|
+
}
|
|
319
|
+
export {
|
|
320
|
+
re as useImportExcellFromFrontend
|
|
321
|
+
};
|