@das-fed/utils 6.4.0-dev.40 → 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.
Files changed (61) hide show
  1. package/api-services/index.js +1009 -1010
  2. package/api-services/index.js.gz +0 -0
  3. package/api-services/modules/app-manage/index.js +724 -725
  4. package/api-services/modules/app-manage/index.js.gz +0 -0
  5. package/api-services/modules/authentication/index.js +724 -725
  6. package/api-services/modules/authentication/index.js.gz +0 -0
  7. package/api-services/modules/bems/index.js +727 -728
  8. package/api-services/modules/bems/index.js.gz +0 -0
  9. package/api-services/modules/contract/index.js +724 -725
  10. package/api-services/modules/contract/index.js.gz +0 -0
  11. package/api-services/modules/duty-manage/index.js +728 -729
  12. package/api-services/modules/duty-manage/index.js.gz +0 -0
  13. package/api-services/modules/enterpriseright/index.js +724 -725
  14. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  15. package/api-services/modules/file/index.js +119 -120
  16. package/api-services/modules/file/index.js.gz +0 -0
  17. package/api-services/modules/gateway-edge/index.js +724 -725
  18. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  19. package/api-services/modules/index.js +1009 -1010
  20. package/api-services/modules/index.js.gz +0 -0
  21. package/api-services/modules/iot/index.js +729 -730
  22. package/api-services/modules/iot/index.js.gz +0 -0
  23. package/api-services/modules/justauth/index.js +725 -726
  24. package/api-services/modules/justauth/index.js.gz +0 -0
  25. package/api-services/modules/knowledge/index.js +724 -725
  26. package/api-services/modules/knowledge/index.js.gz +0 -0
  27. package/api-services/modules/link/index.js +724 -725
  28. package/api-services/modules/link/index.js.gz +0 -0
  29. package/api-services/modules/permission/index.js +724 -725
  30. package/api-services/modules/permission/index.js.gz +0 -0
  31. package/api-services/modules/platformManage/index.js +727 -728
  32. package/api-services/modules/platformManage/index.js.gz +0 -0
  33. package/api-services/modules/portal/index.js +724 -725
  34. package/api-services/modules/portal/index.js.gz +0 -0
  35. package/api-services/modules/space-manage/index.js +724 -725
  36. package/api-services/modules/space-manage/index.js.gz +0 -0
  37. package/api-services/modules/super-admin/index.js +727 -728
  38. package/api-services/modules/super-admin/index.js.gz +0 -0
  39. package/api-services/modules/supplier/index.js +726 -727
  40. package/api-services/modules/supplier/index.js.gz +0 -0
  41. package/api-services/modules/supplychain-manage/index.js +724 -725
  42. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  43. package/api-services/modules/systemConfiguration/index.js +724 -725
  44. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  45. package/api-services/modules/tool/index.js +724 -725
  46. package/api-services/modules/tool/index.js.gz +0 -0
  47. package/api-services/src/create-service/index.js +723 -724
  48. package/api-services/src/create-service/index.js.gz +0 -0
  49. package/common-tools/index.d.ts +1 -0
  50. package/common-tools/index.js +1 -0
  51. package/common-tools/update-browser-title/index.d.ts +1 -0
  52. package/common-tools/update-browser-title/index.js +12 -0
  53. package/create-api-service/index.js +723 -724
  54. package/create-api-service/index.js.gz +0 -0
  55. package/create-api-service/sso/index.js +783 -690
  56. package/create-api-service/sso/index.js.gz +0 -0
  57. package/esm-map.json +2 -2
  58. package/package.json +3 -4
  59. package/token-tools/index.d.ts +0 -5
  60. package/token-tools/index.js +8 -84
  61. package/token-tools/index.js.gz +0 -0
@@ -1,152 +1,151 @@
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));
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 = u[e] & 63;
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 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();
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
- }, K = (a) => new Promise((r, l) => {
23
- const c = [];
21
+ }, I = (a) => new Promise((r, l) => {
22
+ const u = [];
24
23
  let t = 0;
25
24
  for (; t < a.size; ) {
26
- const v = a.slice(t, t + 1048576);
27
- c.push(v), t += 1048576;
25
+ const f = a.slice(t, t + 1048576);
26
+ u.push(f), t += 1048576;
28
27
  }
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;
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 (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);
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 K(r);
50
- p = {
51
- accessKeyId: v.accessKeyId,
52
- secretAccessKey: v.secretAccessKey,
53
- sessionToken: v.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: E,
57
- autoContentType: y
55
+ filePath: z,
56
+ autoContentType: x
58
57
  };
59
58
  }
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("上传失败"),
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 C = await (a == null ? void 0 : a(x));
70
+ const U = await (a == null ? void 0 : a(b));
72
71
  if (n) {
73
- if (!C.status) {
72
+ if (!U.status) {
74
73
  e.value = !1, s.value = "error";
75
74
  return;
76
75
  }
77
- o.value = i("导入进度"), e.value = !0, k(C.taskId, "import", "");
76
+ o.value = "导入进度", e.value = !0, k(U.taskId, "import", "");
78
77
  } else {
79
- if (!C.status) return;
80
- s.value = "success", (O = window.DasMessage) == null || O.success({
81
- message: i("导入成功"),
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
- }, X = async (a, r = "", l = "") => {
87
- s.value = "normal", u.value = 0, o.value = l || i("导出进度"), e.value = !0;
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
- }, _ = 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) {
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
- ee().format("YYYYMMDDHHmmss") + "", k(c.taskId, "export", r || "", l);
100
+ F().format("YYYYMMDDHHmmss") + "", k(u.taskId, "export", r || "", l);
102
101
  }, k = async (a, r, l, n = "") => {
103
- g.value = !0, D(a, r, l, n), f = setTimeout(() => {
102
+ d.value = !0, S(a, r, l, n), m = setTimeout(() => {
104
103
  }, 50);
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("", {
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 (c) {
113
- g.value = !1;
111
+ if (u) {
112
+ d.value = !1;
114
113
  return;
115
114
  }
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("失败")}`,
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", $.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}`;
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
- z(t.status, d, t.message);
131
+ D(t.status, v, t.message);
133
132
  } else r == "action" && (s.value = "success");
134
133
  else
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;
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}${i("成功")}`,
140
+ message: `${r}成功`,
142
141
  grouping: !0,
143
142
  repeatNum: 1
144
- }), w.value = "", T.value = "", b.value = "") : a == 2 ? (s.value = "error", (c = window.DasMessage) == null || c.error({
145
- message: l || `${r}${i("失败")}`,
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
- }), b.value = l || i("部分数据校验不通过,请下载附件并修改,重新导入!")) : a == 3 && (s.value = "error", (t = window.DasMessage) == null || t.error({
149
- message: `${i("部分")}${r}${i("失败")}`,
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: u,
156
+ percent: i,
158
157
  progressStatus: s,
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,
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}${te()}${l}`;
170
+ return `${r.length ? r[1] : a}${ee()}${l}`;
172
171
  },
173
- downloadFile: q,
174
- resetStataus: Y,
172
+ downloadFile: B,
173
+ resetStataus: q,
175
174
  checkProgress: k,
176
- fileHandleType: U
175
+ fileHandleType: P
177
176
  };
178
- }, le = (e) => {
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
- }, q = (e, o, u = "excel") => {
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(g) {
210
- const f = new Blob([this.response], {
211
- type: le(u)
212
- }), h = URL.createObjectURL(f);
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(f, o);
213
+ navigator.msSaveBlob(m, o);
215
214
  else {
216
- const w = document.createElement("a");
217
- w.href = h, w.download = o, w.click(), window.URL.revokeObjectURL(h);
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
- }, ne = (e) => new Promise((o, u) => {
219
+ }, le = (e) => new Promise((o, i) => {
221
220
  var s = new FileReader();
222
- s.onload = function(g) {
223
- let f = "";
224
- typeof s.result == "string" && (f = JSON.parse(s.result)), o(f);
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
- q as downloadFile,
229
- de as useFile
227
+ B as downloadFile,
228
+ fe as useFile
230
229
  };