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