@das-fed/utils 6.4.0-dev.41 → 6.4.0-dev.42
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/api-services/index.js +1009 -1010
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/index.js +724 -725
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/index.js +724 -725
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/index.js +727 -728
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/index.js +724 -725
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/index.js +728 -729
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/index.js +724 -725
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/file/index.js +119 -120
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/index.js +724 -725
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +1009 -1010
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/index.js +729 -730
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/index.js +725 -726
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/index.js +724 -725
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/index.js +724 -725
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/index.js +724 -725
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/index.js +727 -728
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/index.js +724 -725
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/index.js +724 -725
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/index.js +727 -728
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/index.js +726 -727
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/index.js +724 -725
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/index.js +724 -725
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/index.js +724 -725
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/index.js +723 -724
- package/api-services/src/create-service/index.js.gz +0 -0
- package/create-api-service/index.js +723 -724
- package/create-api-service/index.js.gz +0 -0
- package/package.json +3 -4
|
Binary file
|
|
@@ -1,152 +1,151 @@
|
|
|
1
|
-
import { iotMinio as
|
|
2
|
-
import { extractFilename as
|
|
3
|
-
import { ref as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
let
|
|
8
|
-
let o = "", u = crypto.getRandomValues(new Uint8Array(e));
|
|
1
|
+
import { iotMinio as N, iotProgress as W } from "@das-fed/utils/api-services/modules/iot";
|
|
2
|
+
import { extractFilename as Z } from "@das-fed/utils/common-tools";
|
|
3
|
+
import { ref as p } from "vue";
|
|
4
|
+
import F from "dayjs";
|
|
5
|
+
import { getConfig as O } from "@das-fed/utils/config";
|
|
6
|
+
let ee = (e = 21) => {
|
|
7
|
+
let o = "", i = crypto.getRandomValues(new Uint8Array(e));
|
|
9
8
|
for (; e--; ) {
|
|
10
|
-
let s =
|
|
9
|
+
let s = i[e] & 63;
|
|
11
10
|
s < 36 ? o += s.toString(36) : s < 62 ? o += (s - 26).toString(36).toUpperCase() : s < 63 ? o += "_" : o += "-";
|
|
12
11
|
}
|
|
13
12
|
return o;
|
|
14
13
|
};
|
|
15
|
-
const
|
|
16
|
-
let e =
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
const [a, r] = await
|
|
14
|
+
const te = N.get("token"), se = N.post("put-object", (e) => (e.headers || (e.headers = {}), e.headers["Content-Type"] = "multipart/form-data", e.responseType = "blob", e)), ae = N.post("upload-objects", (e) => (e.headers || (e.headers = {}), e.headers["Content-Type"] = "multipart/form-data", e.responseType = "blob", e)), re = W.get("progress"), fe = () => {
|
|
15
|
+
let e = p(!1), o = p(""), i = p(0), s = p("normal"), d = p(!1), m, w = p(""), g = p(""), y = p(""), h = p(""), T = p(!1), R = p(""), L = "", P = p(""), A;
|
|
16
|
+
const q = () => {
|
|
17
|
+
g.value = "", y.value = "", h.value = "", T.value = !1, R.value = "";
|
|
18
|
+
}, Y = async () => {
|
|
19
|
+
const [a, r] = await te().run();
|
|
21
20
|
return a ? { stauts: !1 } : { status: !0, data: r };
|
|
22
|
-
},
|
|
23
|
-
const
|
|
21
|
+
}, I = (a) => new Promise((r, l) => {
|
|
22
|
+
const u = [];
|
|
24
23
|
let t = 0;
|
|
25
24
|
for (; t < a.size; ) {
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
const f = a.slice(t, t + 1048576);
|
|
26
|
+
u.push(f), t += 1048576;
|
|
28
27
|
}
|
|
29
|
-
const
|
|
30
|
-
r(
|
|
31
|
-
}),
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
let
|
|
37
|
-
const
|
|
28
|
+
const v = new Blob(u, { type: a.type });
|
|
29
|
+
r(v);
|
|
30
|
+
}), J = async (a, r, l, n = !0, u = "", t = !1) => {
|
|
31
|
+
var E, H;
|
|
32
|
+
L = u, P.value = "import", n && (s.value = "normal", i.value = 0, o.value = "导入进度", e.value = !0, w.value = ""), A = r;
|
|
33
|
+
const v = await Y();
|
|
34
|
+
if (!v.status) return;
|
|
35
|
+
let f = v.data, c = null, { autoContentType: x, bucketName: j, importFileName: z } = l;
|
|
36
|
+
const _ = t ? ae : se;
|
|
38
37
|
if (t) {
|
|
39
38
|
let M = [];
|
|
40
|
-
await r.forEach(async (
|
|
41
|
-
let
|
|
42
|
-
M.push(
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
|
|
39
|
+
await r.forEach(async ($) => {
|
|
40
|
+
let C = await I($);
|
|
41
|
+
M.push(C);
|
|
42
|
+
}), c = new FormData(), c.append("accessKeyId", f.accessKeyId), c.append("secretAccessKey", f.secretAccessKey), c.append("sessionToken", f.sessionToken), c.append("bucketName", j), r.forEach(($, C) => {
|
|
43
|
+
c.append("file", M[C]);
|
|
44
|
+
}), z.forEach(($) => {
|
|
45
|
+
c.append("filePaths", $);
|
|
47
46
|
});
|
|
48
47
|
} else {
|
|
49
|
-
const M = await
|
|
50
|
-
|
|
51
|
-
accessKeyId:
|
|
52
|
-
secretAccessKey:
|
|
53
|
-
sessionToken:
|
|
48
|
+
const M = await I(r);
|
|
49
|
+
c = {
|
|
50
|
+
accessKeyId: f.accessKeyId,
|
|
51
|
+
secretAccessKey: f.secretAccessKey,
|
|
52
|
+
sessionToken: f.sessionToken,
|
|
54
53
|
file: M,
|
|
55
54
|
bucketName: j,
|
|
56
|
-
filePath:
|
|
57
|
-
autoContentType:
|
|
55
|
+
filePath: z,
|
|
56
|
+
autoContentType: x
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
|
-
const [
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
if ((
|
|
64
|
-
e.value = !1, (
|
|
65
|
-
message: (
|
|
59
|
+
const [G, Q] = await _(c).run();
|
|
60
|
+
if (G) return e.value = !1;
|
|
61
|
+
const b = await le(Q.data);
|
|
62
|
+
if ((b == null ? void 0 : b.statusCode) != 200) {
|
|
63
|
+
e.value = !1, (E = window.DasMessage) == null || E.error({
|
|
64
|
+
message: (b == null ? void 0 : b.errorMsg) || "上传失败",
|
|
66
65
|
grouping: !0,
|
|
67
66
|
repeatNum: 1
|
|
68
67
|
});
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
|
-
const
|
|
70
|
+
const U = await (a == null ? void 0 : a(b));
|
|
72
71
|
if (n) {
|
|
73
|
-
if (!
|
|
72
|
+
if (!U.status) {
|
|
74
73
|
e.value = !1, s.value = "error";
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
o.value =
|
|
76
|
+
o.value = "导入进度", e.value = !0, k(U.taskId, "import", "");
|
|
78
77
|
} else {
|
|
79
|
-
if (!
|
|
80
|
-
s.value = "success", (
|
|
81
|
-
message:
|
|
78
|
+
if (!U.status) return;
|
|
79
|
+
s.value = "success", (H = window.DasMessage) == null || H.success({
|
|
80
|
+
message: "导入成功",
|
|
82
81
|
grouping: !0,
|
|
83
82
|
repeatNum: 1
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
|
-
},
|
|
87
|
-
s.value = "normal",
|
|
85
|
+
}, V = async (a, r = "", l = "") => {
|
|
86
|
+
s.value = "normal", i.value = 0, o.value = l || "导出进度", e.value = !0;
|
|
88
87
|
const n = await (a == null ? void 0 : a());
|
|
89
88
|
if (!n.status) {
|
|
90
89
|
e.value = !1, s.value = "error";
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
92
|
k(n.taskId, "action", "");
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
93
|
+
}, X = async (a, r = "", l = "", n = !0) => {
|
|
94
|
+
P.value = "export", n && (s.value = "normal", i.value = 0, o.value = "导出进度", e.value = !0);
|
|
95
|
+
const u = await (a == null ? void 0 : a());
|
|
96
|
+
if (!u.status) {
|
|
98
97
|
e.value = !1, s.value = "error";
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
F().format("YYYYMMDDHHmmss") + "", k(u.taskId, "export", r || "", l);
|
|
102
101
|
}, k = async (a, r, l, n = "") => {
|
|
103
|
-
|
|
102
|
+
d.value = !0, S(a, r, l, n), m = setTimeout(() => {
|
|
104
103
|
}, 50);
|
|
105
|
-
},
|
|
106
|
-
clearTimeout(
|
|
107
|
-
},
|
|
108
|
-
var
|
|
109
|
-
const [
|
|
104
|
+
}, K = () => {
|
|
105
|
+
clearTimeout(m), m = null, e.value = !1;
|
|
106
|
+
}, S = async (a, r = "export", l, n = "") => {
|
|
107
|
+
var f, c;
|
|
108
|
+
const [u, t] = await re("", {
|
|
110
109
|
url: `progress/${a}`
|
|
111
110
|
}).run();
|
|
112
|
-
if (
|
|
113
|
-
|
|
111
|
+
if (u) {
|
|
112
|
+
d.value = !1;
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
120
|
-
t.status == 1 ? (s.value = "success",
|
|
121
|
-
message: t.message || `${
|
|
115
|
+
i.value = t.percentage;
|
|
116
|
+
const v = r == "export" ? "导出" : "导入";
|
|
117
|
+
if (i.value == 100)
|
|
118
|
+
if (w.value = t, d.value = !1, K(), r == "export")
|
|
119
|
+
t.status == 1 ? (s.value = "success", B(`${O().baseURL}/oss${t.filePath}`, l, n), d.value = !1) : t.status == 2 && (h.value = t.message || `${v}失败`, (f = window.DasMessage) == null || f.error({
|
|
120
|
+
message: t.message || `${v}失败`,
|
|
122
121
|
grouping: !0,
|
|
123
122
|
repeatNum: 1
|
|
124
123
|
}));
|
|
125
124
|
else if (r == "import") {
|
|
126
125
|
if (t.filePath) {
|
|
127
|
-
s.value = "error",
|
|
128
|
-
let
|
|
129
|
-
const j = ((
|
|
130
|
-
|
|
126
|
+
s.value = "error", T.value = !0;
|
|
127
|
+
let x = await Z(`/oss/${t == null ? void 0 : t.filePath}`);
|
|
128
|
+
const j = ((c = x == null ? void 0 : x.split("/")) == null ? void 0 : c.pop()) || "";
|
|
129
|
+
g.value = L || j, y.value = A.sizeText, h.value = "部分数据校验不通过,请下载附件并修改,重新导入!", R.value = `${O().baseURL}/oss/${t == null ? void 0 : t.filePath}`;
|
|
131
130
|
}
|
|
132
|
-
|
|
131
|
+
D(t.status, v, t.message);
|
|
133
132
|
} else r == "action" && (s.value = "success");
|
|
134
133
|
else
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}, 50) : (
|
|
138
|
-
},
|
|
139
|
-
var n,
|
|
134
|
+
m && t.status != 2 ? m = setTimeout(() => {
|
|
135
|
+
S(a, r, l, n);
|
|
136
|
+
}, 50) : (w.value = t, d.value = !1, D(t.status, v, t.message), K(), T.value = !0, h.value = (t == null ? void 0 : t.message) || "");
|
|
137
|
+
}, D = (a, r, l) => {
|
|
138
|
+
var n, u, t;
|
|
140
139
|
a == 1 ? (s.value = "success", (n = window.DasMessage) == null || n.success({
|
|
141
|
-
message: `${r}
|
|
140
|
+
message: `${r}成功`,
|
|
142
141
|
grouping: !0,
|
|
143
142
|
repeatNum: 1
|
|
144
|
-
}),
|
|
145
|
-
message: l || `${r}
|
|
143
|
+
}), g.value = "", y.value = "", h.value = "") : a == 2 ? (s.value = "error", (u = window.DasMessage) == null || u.error({
|
|
144
|
+
message: l || `${r}失败`,
|
|
146
145
|
grouping: !0,
|
|
147
146
|
repeatNum: 1
|
|
148
|
-
}),
|
|
149
|
-
message:
|
|
147
|
+
}), h.value = l || "部分数据校验不通过,请下载附件并修改,重新导入!") : a == 3 && (s.value = "error", (t = window.DasMessage) == null || t.error({
|
|
148
|
+
message: `部分${r}失败`,
|
|
150
149
|
grouping: !0,
|
|
151
150
|
repeatNum: 1
|
|
152
151
|
}));
|
|
@@ -154,28 +153,28 @@ const se = A.get("token"), ae = A.post("put-object", (e) => (e.headers || (e.hea
|
|
|
154
153
|
return {
|
|
155
154
|
showProgressDialog: e,
|
|
156
155
|
progressTitle: o,
|
|
157
|
-
percent:
|
|
156
|
+
percent: i,
|
|
158
157
|
progressStatus: s,
|
|
159
|
-
progressLoading:
|
|
160
|
-
progressResult:
|
|
161
|
-
errorFileName:
|
|
162
|
-
errorFileSize:
|
|
163
|
-
errorMessage:
|
|
164
|
-
errorImport:
|
|
165
|
-
errorFilePath:
|
|
166
|
-
fileImport:
|
|
167
|
-
fileExport:
|
|
168
|
-
fileAction:
|
|
158
|
+
progressLoading: d,
|
|
159
|
+
progressResult: w,
|
|
160
|
+
errorFileName: g,
|
|
161
|
+
errorFileSize: y,
|
|
162
|
+
errorMessage: h,
|
|
163
|
+
errorImport: T,
|
|
164
|
+
errorFilePath: R,
|
|
165
|
+
fileImport: J,
|
|
166
|
+
fileExport: X,
|
|
167
|
+
fileAction: V,
|
|
169
168
|
generateUniqueName: (a) => {
|
|
170
169
|
const r = a == null ? void 0 : a.match(/(.*?)(\.[^.]*$|$)/), l = r.length ? r[2] : "";
|
|
171
|
-
return `${r.length ? r[1] : a}${
|
|
170
|
+
return `${r.length ? r[1] : a}${ee()}${l}`;
|
|
172
171
|
},
|
|
173
|
-
downloadFile:
|
|
174
|
-
resetStataus:
|
|
172
|
+
downloadFile: B,
|
|
173
|
+
resetStataus: q,
|
|
175
174
|
checkProgress: k,
|
|
176
|
-
fileHandleType:
|
|
175
|
+
fileHandleType: P
|
|
177
176
|
};
|
|
178
|
-
},
|
|
177
|
+
}, oe = (e) => {
|
|
179
178
|
let o = e == null ? void 0 : e.toLocaleLowerCase();
|
|
180
179
|
return {
|
|
181
180
|
excel: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -204,27 +203,27 @@ const se = A.get("token"), ae = A.post("put-object", (e) => (e.headers || (e.hea
|
|
|
204
203
|
der: "application/x-x509-ca-cert",
|
|
205
204
|
cer: "application/pkix-cert"
|
|
206
205
|
}[o];
|
|
207
|
-
},
|
|
206
|
+
}, B = (e, o, i = "excel") => {
|
|
208
207
|
const s = new XMLHttpRequest();
|
|
209
|
-
s.open("get", e), s.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), s.responseType = "blob", s.onload = function(
|
|
210
|
-
const
|
|
211
|
-
type:
|
|
212
|
-
}),
|
|
208
|
+
s.open("get", e), s.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), s.responseType = "blob", s.onload = function(d) {
|
|
209
|
+
const m = new Blob([this.response], {
|
|
210
|
+
type: oe(i)
|
|
211
|
+
}), w = URL.createObjectURL(m);
|
|
213
212
|
if (window.navigator.msSaveOrOpenBlob)
|
|
214
|
-
navigator.msSaveBlob(
|
|
213
|
+
navigator.msSaveBlob(m, o);
|
|
215
214
|
else {
|
|
216
|
-
const
|
|
217
|
-
|
|
215
|
+
const g = document.createElement("a");
|
|
216
|
+
g.href = w, g.download = o, g.click(), window.URL.revokeObjectURL(w);
|
|
218
217
|
}
|
|
219
218
|
}, s.send();
|
|
220
|
-
},
|
|
219
|
+
}, le = (e) => new Promise((o, i) => {
|
|
221
220
|
var s = new FileReader();
|
|
222
|
-
s.onload = function(
|
|
223
|
-
let
|
|
224
|
-
typeof s.result == "string" && (
|
|
221
|
+
s.onload = function(d) {
|
|
222
|
+
let m = "";
|
|
223
|
+
typeof s.result == "string" && (m = JSON.parse(s.result)), o(m);
|
|
225
224
|
}, s.readAsText(e);
|
|
226
225
|
});
|
|
227
226
|
export {
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
B as downloadFile,
|
|
228
|
+
fe as useFile
|
|
230
229
|
};
|
|
Binary file
|