@das-fed/utils 6.4.0-dev.37 → 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.
Files changed (67) hide show
  1. package/api-services/index.js +1691 -1374
  2. package/api-services/index.js.gz +0 -0
  3. package/api-services/modules/app-manage/index.js +1928 -1612
  4. package/api-services/modules/app-manage/index.js.gz +0 -0
  5. package/api-services/modules/authentication/index.js +1928 -1612
  6. package/api-services/modules/authentication/index.js.gz +0 -0
  7. package/api-services/modules/bems/index.js +1931 -1615
  8. package/api-services/modules/bems/index.js.gz +0 -0
  9. package/api-services/modules/contract/index.js +1928 -1612
  10. package/api-services/modules/contract/index.js.gz +0 -0
  11. package/api-services/modules/duty-manage/index.js +1917 -1601
  12. package/api-services/modules/duty-manage/index.js.gz +0 -0
  13. package/api-services/modules/enterpriseright/index.js +1928 -1612
  14. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  15. package/api-services/modules/file/index.d.ts +1 -0
  16. package/api-services/modules/file/index.js +121 -119
  17. package/api-services/modules/file/index.js.gz +0 -0
  18. package/api-services/modules/gateway-edge/index.js +1928 -1612
  19. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  20. package/api-services/modules/index.js +1678 -1361
  21. package/api-services/modules/index.js.gz +0 -0
  22. package/api-services/modules/iot/index.js +1940 -1624
  23. package/api-services/modules/iot/index.js.gz +0 -0
  24. package/api-services/modules/justauth/index.js +1914 -1598
  25. package/api-services/modules/justauth/index.js.gz +0 -0
  26. package/api-services/modules/knowledge/index.js +1928 -1612
  27. package/api-services/modules/knowledge/index.js.gz +0 -0
  28. package/api-services/modules/link/index.js +1928 -1612
  29. package/api-services/modules/link/index.js.gz +0 -0
  30. package/api-services/modules/permission/index.js +1928 -1612
  31. package/api-services/modules/permission/index.js.gz +0 -0
  32. package/api-services/modules/platformManage/index.js +1935 -1619
  33. package/api-services/modules/platformManage/index.js.gz +0 -0
  34. package/api-services/modules/portal/index.js +1928 -1612
  35. package/api-services/modules/portal/index.js.gz +0 -0
  36. package/api-services/modules/space-manage/index.js +1928 -1612
  37. package/api-services/modules/space-manage/index.js.gz +0 -0
  38. package/api-services/modules/super-admin/index.js +1916 -1600
  39. package/api-services/modules/super-admin/index.js.gz +0 -0
  40. package/api-services/modules/supplier/index.js +1930 -1614
  41. package/api-services/modules/supplier/index.js.gz +0 -0
  42. package/api-services/modules/supplychain-manage/index.js +1928 -1612
  43. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  44. package/api-services/modules/systemConfiguration/index.js +1928 -1612
  45. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  46. package/api-services/modules/tool/index.js +1928 -1612
  47. package/api-services/modules/tool/index.js.gz +0 -0
  48. package/api-services/src/create-service/index.js +1912 -1596
  49. package/api-services/src/create-service/index.js.gz +0 -0
  50. package/common-info/index.js +4 -3
  51. package/common-info/index.js.gz +0 -0
  52. package/common-info/set-personal-info/index.js +837 -570
  53. package/common-info/set-personal-info/index.js.gz +0 -0
  54. package/common-info/type.d.ts +2 -0
  55. package/common-tools/extract-file-name/index.js +922 -655
  56. package/common-tools/extract-file-name/index.js.gz +0 -0
  57. package/create-api-service/index.js +1912 -1596
  58. package/create-api-service/index.js.gz +0 -0
  59. package/create-api-service/sso/index.js +968 -701
  60. package/create-api-service/sso/index.js.gz +0 -0
  61. package/curring-http/index.js +1364 -1097
  62. package/curring-http/index.js.gz +0 -0
  63. package/package.json +4 -3
  64. package/pinyin-first-character/index.js +19799 -20879
  65. package/pinyin-first-character/index.js.gz +0 -0
  66. package/style/index.js +4 -2
  67. package/style/index.js.gz +0 -0
@@ -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 C, iotProgress as Q } from "@das-fed/utils/api-services/modules/iot";
2
- import { extractFilename as W } from "@das-fed/utils/common-tools";
3
- import { ref as f } from "vue";
4
- import Z from "dayjs";
5
- import { getConfig as O } from "@das-fed/utils/config";
6
- let F = (e = 21) => {
7
- let o = "", i = crypto.getRandomValues(new Uint8Array(e));
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 = i[e] & 63;
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 ee = C.get("token"), te = C.post("put-object", (e) => (e.headers || (e.headers = {}), e.headers["Content-Type"] = "multipart/form-data", e.responseType = "blob", e)), se = C.post("upload-objects", (e) => (e.headers || (e.headers = {}), e.headers["Content-Type"] = "multipart/form-data", e.responseType = "blob", e)), ae = Q.get("progress"), me = () => {
15
- let e = f(!1), o = f(""), i = f(0), s = f("normal"), d = f(!1), p, w = f(""), g = f(""), y = f(""), h = f(""), T = f(!1), R = f(""), L = "", N;
16
- const H = () => {
17
- g.value = "", y.value = "", h.value = "", T.value = !1, R.value = "";
18
- }, q = async () => {
19
- const [a, r] = await ee().run();
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
- }, A = (a) => new Promise((r, l) => {
22
- const u = [];
22
+ }, K = (a) => new Promise((r, l) => {
23
+ const c = [];
23
24
  let t = 0;
24
25
  for (; t < a.size; ) {
25
- const m = a.slice(t, t + 1048576);
26
- u.push(m), t += 1048576;
26
+ const v = a.slice(t, t + 1048576);
27
+ c.push(v), t += 1048576;
27
28
  }
28
- const v = new Blob(u, { type: a.type });
29
- r(v);
30
- }), Y = async (a, r, l, n = !0, u = "", t = !1) => {
31
- var z, E;
32
- L = u, n && (s.value = "normal", i.value = 0, o.value = "导入进度", e.value = !0, w.value = ""), N = r;
33
- const v = await q();
34
- if (!v.status) return;
35
- let m = v.data, c = null, { autoContentType: x, bucketName: j, importFileName: D } = l;
36
- const X = t ? se : te;
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 U = await A($);
41
- M.push(U);
42
- }), c = new FormData(), c.append("accessKeyId", m.accessKeyId), c.append("secretAccessKey", m.secretAccessKey), c.append("sessionToken", m.sessionToken), c.append("bucketName", j), r.forEach(($, U) => {
43
- c.append("file", M[U]);
44
- }), D.forEach(($) => {
45
- c.append("filePaths", $);
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 A(r);
49
- c = {
50
- accessKeyId: m.accessKeyId,
51
- secretAccessKey: m.secretAccessKey,
52
- sessionToken: m.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: D,
56
- autoContentType: x
56
+ filePath: E,
57
+ autoContentType: y
57
58
  };
58
59
  }
59
- const [_, G] = await X(c).run();
60
- if (_) return e.value = !1;
61
- const b = await oe(G.data);
62
- if ((b == null ? void 0 : b.statusCode) != 200) {
63
- e.value = !1, (z = window.DasMessage) == null || z.error({
64
- message: (b == null ? void 0 : b.errorMsg) || "上传失败",
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 P = await (a == null ? void 0 : a(b));
71
+ const C = await (a == null ? void 0 : a(x));
71
72
  if (n) {
72
- if (!P.status) {
73
+ if (!C.status) {
73
74
  e.value = !1, s.value = "error";
74
75
  return;
75
76
  }
76
- o.value = "导入进度", e.value = !0, k(P.taskId, "import", "");
77
+ o.value = i("导入进度"), e.value = !0, k(C.taskId, "import", "");
77
78
  } else {
78
- if (!P.status) return;
79
- s.value = "success", (E = window.DasMessage) == null || E.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
- }, J = async (a, r = "", l = "") => {
86
- s.value = "normal", i.value = 0, o.value = l || "导出进度", e.value = !0;
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
- }, V = async (a, r = "", l = "", n = !0) => {
94
- 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) {
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
- Z().format("YYYYMMDDHHmmss") + "", k(u.taskId, "export", r || "", l);
101
+ ee().format("YYYYMMDDHHmmss") + "", k(c.taskId, "export", r || "", l);
101
102
  }, k = async (a, r, l, n = "") => {
102
- d.value = !0, K(a, r, l, n), p = setTimeout(() => {
103
+ g.value = !0, D(a, r, l, n), f = setTimeout(() => {
103
104
  }, 50);
104
- }, I = () => {
105
- clearTimeout(p), p = null, e.value = !1;
106
- }, K = async (a, r = "export", l, n = "") => {
107
- var m, c;
108
- const [u, t] = await ae("", {
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 (u) {
112
- d.value = !1;
112
+ if (c) {
113
+ g.value = !1;
113
114
  return;
114
115
  }
115
- i.value = t.percentage;
116
- const v = r == "export" ? "导出" : "导入";
117
- if (i.value == 100)
118
- if (w.value = t, d.value = !1, I(), 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}失败`, (m = window.DasMessage) == null || m.error({
120
- message: t.message || `${v}失败`,
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", T.value = !0;
127
- let x = await W(`/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 = N.sizeText, h.value = "部分数据校验不通过,请下载附件并修改,重新导入!", R.value = `${O().baseURL}/oss/${t == null ? void 0 : 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}`;
130
131
  }
131
- S(t.status, v, t.message);
132
+ z(t.status, d, t.message);
132
133
  } else r == "action" && (s.value = "success");
133
134
  else
134
- p && t.status != 2 ? p = setTimeout(() => {
135
- K(a, r, l, n);
136
- }, 50) : (w.value = t, d.value = !1, S(t.status, v, t.message), I(), T.value = !0, h.value = (t == null ? void 0 : t.message) || "");
137
- }, S = (a, r, l) => {
138
- var n, u, t;
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
- }), g.value = "", y.value = "", h.value = "") : a == 2 ? (s.value = "error", (u = window.DasMessage) == null || u.error({
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
- }), h.value = l || "部分数据校验不通过,请下载附件并修改,重新导入!") : a == 3 && (s.value = "error", (t = window.DasMessage) == null || t.error({
148
- message: `部分${r}失败`,
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: i,
157
+ percent: u,
157
158
  progressStatus: s,
158
- progressLoading: d,
159
- progressResult: w,
160
- errorFileName: g,
161
- errorFileSize: y,
162
- errorMessage: h,
163
- errorImport: T,
164
- errorFilePath: R,
165
- fileImport: Y,
166
- fileExport: V,
167
- fileAction: J,
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}${F()}${l}`;
171
+ return `${r.length ? r[1] : a}${te()}${l}`;
171
172
  },
172
- downloadFile: B,
173
- resetStataus: H,
174
- checkProgress: k
173
+ downloadFile: q,
174
+ resetStataus: Y,
175
+ checkProgress: k,
176
+ fileHandleType: U
175
177
  };
176
- }, re = (e) => {
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
- }, B = (e, o, i = "excel") => {
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(d) {
208
- const p = new Blob([this.response], {
209
- type: re(i)
210
- }), w = URL.createObjectURL(p);
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(p, o);
214
+ navigator.msSaveBlob(f, o);
213
215
  else {
214
- const g = document.createElement("a");
215
- g.href = w, g.download = o, g.click(), window.URL.revokeObjectURL(w);
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
- }, oe = (e) => new Promise((o, i) => {
220
+ }, ne = (e) => new Promise((o, u) => {
219
221
  var s = new FileReader();
220
- s.onload = function(d) {
221
- let p = "";
222
- typeof s.result == "string" && (p = JSON.parse(s.result)), o(p);
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
- B as downloadFile,
227
- me as useFile
228
+ q as downloadFile,
229
+ de as useFile
228
230
  };