@das-fed/utils 1.0.1 → 1.0.3

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 (131) hide show
  1. package/api-services/index.d.ts +1 -0
  2. package/api-services/index.js +3 -19845
  3. package/api-services/modules/app-manage.d.ts +2 -0
  4. package/api-services/modules/app-manage.js +5 -6
  5. package/api-services/modules/authentication.d.ts +2 -0
  6. package/api-services/modules/authentication.js +5 -6
  7. package/api-services/modules/bems.d.ts +6 -0
  8. package/api-services/modules/bems.js +8 -10
  9. package/api-services/modules/contract.d.ts +2 -0
  10. package/api-services/modules/contract.js +5 -6
  11. package/api-services/modules/duty-manage.d.ts +7 -0
  12. package/api-services/modules/duty-manage.js +9 -10
  13. package/api-services/modules/enterpriseright.d.ts +2 -0
  14. package/api-services/modules/enterpriseright.js +5 -6
  15. package/api-services/modules/file.d.ts +36 -0
  16. package/api-services/modules/file.js +449 -354
  17. package/api-services/modules/gateway-edge.d.ts +2 -0
  18. package/api-services/modules/gateway-edge.js +5 -6
  19. package/api-services/modules/index.d.ts +21 -0
  20. package/api-services/modules/index.js +501 -435
  21. package/api-services/modules/iot.d.ts +15 -0
  22. package/api-services/modules/iot.js +17 -18
  23. package/api-services/modules/justauth.d.ts +3 -0
  24. package/api-services/modules/justauth.js +6 -7
  25. package/api-services/modules/knowledge.d.ts +2 -0
  26. package/api-services/modules/knowledge.js +5 -6
  27. package/api-services/modules/link.d.ts +2 -0
  28. package/api-services/modules/link.js +5 -6
  29. package/api-services/modules/permission.d.ts +2 -0
  30. package/api-services/modules/permission.js +5 -6
  31. package/api-services/modules/platformManage.d.ts +14 -0
  32. package/api-services/modules/platformManage.js +12 -13
  33. package/api-services/modules/portal.d.ts +2 -0
  34. package/api-services/modules/portal.js +5 -6
  35. package/api-services/modules/space-manage.d.ts +2 -0
  36. package/api-services/modules/space-manage.js +5 -6
  37. package/api-services/modules/super-admin.d.ts +8 -0
  38. package/api-services/modules/super-admin.js +8 -9
  39. package/api-services/modules/supplier.d.ts +6 -0
  40. package/api-services/modules/supplier.js +7 -8
  41. package/api-services/modules/supplychain-manage.d.ts +2 -0
  42. package/api-services/modules/supplychain-manage.js +5 -6
  43. package/api-services/modules/systemConfiguration.d.ts +2 -0
  44. package/api-services/modules/systemConfiguration.js +5 -6
  45. package/api-services/modules/tool.d.ts +2 -0
  46. package/api-services/modules/tool.js +5 -6
  47. package/api-services/src/create-service.d.ts +2 -0
  48. package/api-services/src/create-service.js +3119 -19726
  49. package/api-services/src/sso.d.ts +29 -0
  50. package/api-services/src/sso.js +1547 -156
  51. package/api-services/src/util.d.ts +1 -0
  52. package/api-services/src/util.js +1462 -19
  53. package/atob/index.d.ts +2 -0
  54. package/atob/index.js +9 -10
  55. package/common-info/getIframeUrl.d.ts +9 -0
  56. package/common-info/getIframeUrl.js +9 -11
  57. package/common-info/index.d.ts +42 -0
  58. package/common-info/index.js +138 -272
  59. package/common-info/setInfoFromUrl.d.ts +8 -0
  60. package/common-info/setInfoFromUrl.js +60 -128
  61. package/common-tools/arr-tools.d.ts +15 -0
  62. package/common-tools/arr-tools.js +6 -13
  63. package/common-tools/date-format.d.ts +7 -0
  64. package/common-tools/date-format.js +18 -21
  65. package/common-tools/get-url-params.d.ts +33 -0
  66. package/common-tools/get-url-params.js +48 -88
  67. package/common-tools/handle-data.d.ts +6 -0
  68. package/common-tools/handle-data.js +3 -4
  69. package/common-tools/index.d.ts +7 -0
  70. package/common-tools/index.js +7 -213
  71. package/common-tools/nest-tree-format.d.ts +30 -0
  72. package/common-tools/nest-tree-format.js +22 -49
  73. package/common-tools/obj-tools.d.ts +7 -0
  74. package/common-tools/obj-tools.js +17 -18
  75. package/common-tools/setHtmlMinWH.d.ts +5 -0
  76. package/common-tools/setHtmlMinWH.js +6 -10
  77. package/common-tools/throttled.d.ts +7 -0
  78. package/common-tools/throttled.js +7 -16
  79. package/config/index.d.ts +2 -0
  80. package/config/index.js +8 -25
  81. package/curring-http/index.d.ts +11 -0
  82. package/curring-http/index.js +5150 -17289
  83. package/directive/auth.d.ts +8 -0
  84. package/directive/auth.js +54 -104
  85. package/directive/clickOutside.d.ts +5 -0
  86. package/directive/clickOutside.js +23 -49
  87. package/directive/hoverInside.d.ts +5 -0
  88. package/directive/hoverInside.js +16 -35
  89. package/directive/index.d.ts +3 -0
  90. package/directive/index.js +7 -182
  91. package/directive/utils.d.ts +7 -0
  92. package/directive/utils.js +6 -11
  93. package/dom-check-in/index.d.ts +6 -0
  94. package/dom-check-in/index.js +7 -15
  95. package/dom-watcher/index.d.ts +25 -0
  96. package/dom-watcher/index.js +7 -8
  97. package/hooks/popup-manager/use-zindex.d.ts +5 -0
  98. package/hooks/popup-manager/use-zindex.js +17 -36
  99. package/index.d.ts +2 -0
  100. package/index.js +2 -215
  101. package/load-js/index.d.ts +3 -0
  102. package/load-js/index.js +10 -20
  103. package/oss/index.d.ts +2 -0
  104. package/oss/index.js +11 -15
  105. package/package.json +8 -13
  106. package/pinyin-first-character/index.d.ts +2 -0
  107. package/pinyin-first-character/index.js +25011 -12217
  108. package/process-engine-info/index.d.ts +10 -0
  109. package/process-engine-info/index.js +8 -10
  110. package/pure-image-src/index.d.ts +2 -0
  111. package/pure-image-src/index.js +3 -29
  112. package/set-personal-info/index.d.ts +5 -0
  113. package/set-personal-info/index.js +1460 -16
  114. package/size-watcher/index.d.ts +6 -0
  115. package/size-watcher/index.js +17 -24
  116. package/style/index.d.ts +2 -0
  117. package/style/index.js +62 -103
  118. package/style/math.d.ts +9 -0
  119. package/style/math.js +16 -31
  120. package/style/style.d.ts +30 -0
  121. package/style/style.js +49 -72
  122. package/token-tools/index.d.ts +18 -0
  123. package/token-tools/index.js +72 -149
  124. package/vue/hooks/use-model-value.d.ts +3 -0
  125. package/vue/hooks/use-model-value.js +9 -10
  126. package/vue/index.d.ts +1 -0
  127. package/vue/index.js +3 -10
  128. package/webSocket-service/index.d.ts +40 -0
  129. package/webSocket-service/index.js +62 -138
  130. package/with-install/index.d.ts +10 -0
  131. package/with-install/index.js +5 -7
@@ -1,379 +1,475 @@
1
- import { createService } from '@das-fed/utils/api-services';
2
- import crypto from 'crypto';
3
- import { ref } from 'vue';
4
-
5
- const version$j = "v1";
6
- const appManage = createService(`/api/app-manager/application/${version$j}`);
7
-
8
- const version$i = "v1";
9
- const authentication = createService(`/api/license/admin/${version$i}`);
10
-
11
- const version$h = "v1";
12
- const bemsBase = `/api/bems/data-manage/${version$h}`;
13
- const bemsModules = {
14
- energyType: createService(`${bemsBase}/energy-type`),
15
- energyObject: createService(`${bemsBase}/energy-object`),
16
- energyDimension: createService(`${bemsBase}/energy-dimension`)
17
- };
18
-
19
- const version$g = "v1";
20
- const contract = createService(`/api/supply/contract/${version$g}`);
21
-
22
- const version$f = "v1";
23
- const dutyModules = {
24
- classes: createService(`/api/duty-manage/classes/${version$f}`),
1
+ import { createService as o } from "@das-fed/utils/api-services";
2
+ import { ref as U } from "vue";
3
+ const ue = "v1", Be = o(`/api/app-manager/application/${ue}`), le = "v1", He = o(`/api/license/admin/${le}`), pe = "v1", se = `/api/bems/data-manage/${pe}`, Ye = {
4
+ energyType: o(`${se}/energy-type`),
5
+ energyObject: o(`${se}/energy-object`),
6
+ energyDimension: o(`${se}/energy-dimension`)
7
+ }, de = "v1", Ie = o(`/api/supply/contract/${de}`), Q = "v1", Ne = {
8
+ classes: o(`/api/duty-manage/classes/${Q}`),
25
9
  // 班次管理
26
- group: createService(`/api/duty-manage/group/${version$f}`),
10
+ group: o(`/api/duty-manage/group/${Q}`),
27
11
  // 分组管理
28
- scheduling: createService(`/api/duty-manage/scheduling/${version$f}`),
12
+ scheduling: o(`/api/duty-manage/scheduling/${Q}`),
29
13
  // 排班管理
30
- shift: createService(`/api/duty-manage/shift/${version$f}`)
14
+ shift: o(`/api/duty-manage/shift/${Q}`)
31
15
  // 交接班管理
32
- };
33
-
34
- const version$e = "v1";
35
- const enterpriseright = createService(`/api/enterpriseright/permission/${version$e}`);
36
-
37
- const version$d = "v1";
38
- const iot = createService(`/api/iot/${version$d}`);
39
- const iotModules = {
40
- thingmodel: createService(`/api/iot-device/thingmodel/${version$d}`),
41
- deviceManage: createService(`/api/iot-device/devicemanage/${version$d}`),
42
- product: createService(`/api/iot-device/product/${version$d}`),
43
- productStorage: createService(`/api/iot-device/product-storage/${version$d}`)
44
- };
45
- const iotRelationModules = {
46
- projectDevice: createService(`/api/device-relation/deviceproject/${version$d}`),
47
- deviceRules: createService(`/api/device-relation/devicerule/${version$d}`),
48
- project: createService(`/api/device-relation/project/${version$d}`)
49
- };
50
- const iotMinio = createService(`/api/oss/minio/${version$d}`);
51
- const iotProgress = createService(`/api/progress/accessor/${version$d}`);
52
-
53
- let urlAlphabet =
54
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
55
-
56
- const POOL_SIZE_MULTIPLIER = 128;
57
- let pool, poolOffset;
58
- let fillPool = bytes => {
59
- if (!pool || pool.length < bytes) {
60
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
61
- crypto.randomFillSync(pool);
62
- poolOffset = 0;
63
- } else if (poolOffset + bytes > pool.length) {
64
- crypto.randomFillSync(pool);
65
- poolOffset = 0;
66
- }
67
- poolOffset += bytes;
68
- };
69
- let nanoid = (size = 21) => {
70
- fillPool((size -= 0));
71
- let id = '';
72
- for (let i = poolOffset - size; i < poolOffset; i++) {
73
- id += urlAlphabet[pool[i] & 63];
16
+ }, fe = "v1", Ee = o(`/api/enterpriseright/permission/${fe}`), C = "v1", We = o(`/api/iot/${C}`), ze = {
17
+ thingmodel: o(`/api/iot-device/thingmodel/${C}`),
18
+ deviceManage: o(`/api/iot-device/devicemanage/${C}`),
19
+ product: o(`/api/iot-device/product/${C}`),
20
+ productStorage: o(`/api/iot-device/product-storage/${C}`)
21
+ }, Ke = {
22
+ projectDevice: o(`/api/device-relation/deviceproject/${C}`),
23
+ deviceRules: o(`/api/device-relation/devicerule/${C}`),
24
+ project: o(`/api/device-relation/project/${C}`)
25
+ }, ne = o(`/api/oss/minio/${C}`), me = o(`/api/progress/accessor/${C}`);
26
+ let he = (p = 21) => {
27
+ let d = "", v = crypto.getRandomValues(new Uint8Array(p));
28
+ for (; p--; ) {
29
+ let l = v[p] & 63;
30
+ l < 36 ? d += l.toString(36) : l < 62 ? d += (l - 26).toString(36).toUpperCase() : l < 63 ? d += "_" : d += "-";
74
31
  }
75
- return id
32
+ return d;
76
33
  };
77
-
78
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
79
-
80
- function getDefaultExportFromCjs (x) {
81
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
34
+ var ve = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
35
+ function $e(p) {
36
+ return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
82
37
  }
83
-
84
- var dayjs_min = {exports: {}};
85
-
86
- (function (module, exports) {
87
- !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
88
- } (dayjs_min));
89
-
90
- var dayjs_minExports = dayjs_min.exports;
91
- var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
92
-
93
- const getConfig = () => {
94
- let windowConfig = window?.config || {};
95
- let config = { ...windowConfig };
96
- if (!config.rootContainer)
97
- config.rootContainer = "#app";
98
- if (!config.baseURL)
99
- config.baseURL = location.origin;
100
- if (!config.ossBaseURL)
101
- config.ossBaseURL = "/oss";
102
- if (config.ossBaseURL.startsWith("/"))
103
- config.ossBaseURL = `${config.baseURL}/oss`;
104
- if (!config.ssoBaseURL)
105
- config.ssoBaseURL = config.baseURL;
106
- let { microAppName, publicPath, mainAppName } = config;
107
- const isPro = import.meta.env.PROD;
108
- if (microAppName && isPro && !publicPath)
109
- publicPath = `/${microAppName}/`.replace(/\/\//g, "/");
110
- if (!publicPath)
111
- publicPath = "/";
112
- config.publicPath = publicPath;
113
- if (!config.autoOssBucket)
114
- config.autoOssBucket = mainAppName || microAppName;
115
- return config;
116
- };
117
-
118
- const getMinioToken = iotMinio.get(`token`);
119
- const importMinio = iotMinio.post(`putObject`, (config) => {
120
- if (!config.headers)
121
- config.headers = {};
122
- config.headers["Content-Type"] = "multipart/form-data";
123
- config.responseType = "blob";
124
- return config;
125
- });
126
- const importMultiMinio = iotMinio.post(`upload-objects`, (config) => {
127
- if (!config.headers)
128
- config.headers = {};
129
- config.headers["Content-Type"] = "multipart/form-data";
130
- config.responseType = "blob";
131
- return config;
132
- });
133
- const getTaskProgress = iotProgress.get(`progress`);
134
- const useFile = () => {
135
- let showProgressDialog = ref(false);
136
- let progressTitle = ref("");
137
- let percent = ref(0);
138
- let progressStatus = ref("normal");
139
- let progressLoading = ref(false);
140
- let progressTimer;
141
- let progressResult = ref("");
142
- let errorFileName = ref("");
143
- let errorFileSize = ref("");
144
- let errorMessage = ref("");
145
- let errorImport = ref(false);
146
- let errorFilePath = ref("");
147
- let tempErrPathName = "";
148
- let fileInfo;
149
- const resetStataus = () => {
150
- errorFileName.value = "";
151
- errorFileSize.value = "";
152
- errorMessage.value = "";
153
- errorImport.value = false;
154
- errorFilePath.value = "";
155
- };
156
- const getMinioConfig = async () => {
157
- const [error, data] = await getMinioToken().run();
158
- if (error) {
159
- return { stauts: false };
160
- }
161
- return { status: true, data };
162
- };
163
- const readFileAndAddToMap = (file) => {
164
- return new Promise((resolve, reject) => {
165
- const chunkSize = 1024 * 1024;
166
- const chunks = [];
167
- let offset = 0;
168
- while (offset < file.size) {
169
- const chunk = file.slice(offset, offset + chunkSize);
170
- chunks.push(chunk);
171
- offset += chunkSize;
38
+ var oe = { exports: {} };
39
+ (function(p, d) {
40
+ (function(v, l) {
41
+ p.exports = l();
42
+ })(ve, function() {
43
+ var v = 1e3, l = 6e4, T = 36e5, w = "millisecond", j = "second", S = "minute", L = "hour", b = "day", P = "week", D = "month", W = "quarter", x = "year", H = "date", V = "Invalid Date", Z = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, ee = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, te = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(s) {
44
+ var t = ["th", "st", "nd", "rd"], e = s % 100;
45
+ return "[" + s + (t[(e - 20) % 10] || t[e] || t[0]) + "]";
46
+ } }, K = function(s, t, e) {
47
+ var r = String(s);
48
+ return !r || r.length >= t ? s : "" + Array(t + 1 - r.length).join(e) + s;
49
+ }, z = { s: K, z: function(s) {
50
+ var t = -s.utcOffset(), e = Math.abs(t), r = Math.floor(e / 60), n = e % 60;
51
+ return (t <= 0 ? "+" : "-") + K(r, 2, "0") + ":" + K(n, 2, "0");
52
+ }, m: function s(t, e) {
53
+ if (t.date() < e.date())
54
+ return -s(e, t);
55
+ var r = 12 * (e.year() - t.year()) + (e.month() - t.month()), n = t.clone().add(r, D), a = e - n < 0, i = t.clone().add(r + (a ? -1 : 1), D);
56
+ return +(-(r + (e - n) / (a ? n - i : i - n)) || 0);
57
+ }, a: function(s) {
58
+ return s < 0 ? Math.ceil(s) || 0 : Math.floor(s);
59
+ }, p: function(s) {
60
+ return { M: D, y: x, w: P, d: b, D: H, h: L, m: S, s: j, ms: w, Q: W }[s] || String(s || "").toLowerCase().replace(/s$/, "");
61
+ }, u: function(s) {
62
+ return s === void 0;
63
+ } }, Y = "en", _ = {};
64
+ _[Y] = te;
65
+ var q = "$isDayjsObject", F = function(s) {
66
+ return s instanceof $ || !(!s || !s[q]);
67
+ }, f = function s(t, e, r) {
68
+ var n;
69
+ if (!t)
70
+ return Y;
71
+ if (typeof t == "string") {
72
+ var a = t.toLowerCase();
73
+ _[a] && (n = a), e && (_[a] = e, n = a);
74
+ var i = t.split("-");
75
+ if (!n && i.length > 1)
76
+ return s(i[0]);
77
+ } else {
78
+ var m = t.name;
79
+ _[m] = t, n = m;
172
80
  }
173
- const mergedBlob = new Blob(chunks, { type: file.type });
174
- resolve(mergedBlob);
175
- });
176
- };
177
- const fileImport = async (importFunc, file, options, needProgress = true, errPathName = "", isBatch = false) => {
178
- tempErrPathName = errPathName;
179
- if (needProgress) {
180
- progressStatus.value = "normal";
181
- percent.value = 0;
182
- progressTitle.value = "\u5BFC\u5165\u8FDB\u5EA6";
183
- showProgressDialog.value = true;
184
- progressResult.value = "";
81
+ return !r && n && (Y = n), n || !r && Y;
82
+ }, c = function(s, t) {
83
+ if (F(s))
84
+ return s.clone();
85
+ var e = typeof t == "object" ? t : {};
86
+ return e.date = s, e.args = arguments, new $(e);
87
+ }, u = z;
88
+ u.l = f, u.i = F, u.w = function(s, t) {
89
+ return c(s, { locale: t.$L, utc: t.$u, x: t.$x, $offset: t.$offset });
90
+ };
91
+ var $ = function() {
92
+ function s(e) {
93
+ this.$L = f(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[q] = !0;
94
+ }
95
+ var t = s.prototype;
96
+ return t.parse = function(e) {
97
+ this.$d = function(r) {
98
+ var n = r.date, a = r.utc;
99
+ if (n === null)
100
+ return /* @__PURE__ */ new Date(NaN);
101
+ if (u.u(n))
102
+ return /* @__PURE__ */ new Date();
103
+ if (n instanceof Date)
104
+ return new Date(n);
105
+ if (typeof n == "string" && !/Z$/i.test(n)) {
106
+ var i = n.match(Z);
107
+ if (i) {
108
+ var m = i[2] - 1 || 0, h = (i[7] || "0").substring(0, 3);
109
+ return a ? new Date(Date.UTC(i[1], m, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, h)) : new Date(i[1], m, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, h);
110
+ }
111
+ }
112
+ return new Date(n);
113
+ }(e), this.init();
114
+ }, t.init = function() {
115
+ var e = this.$d;
116
+ this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
117
+ }, t.$utils = function() {
118
+ return u;
119
+ }, t.isValid = function() {
120
+ return this.$d.toString() !== V;
121
+ }, t.isSame = function(e, r) {
122
+ var n = c(e);
123
+ return this.startOf(r) <= n && n <= this.endOf(r);
124
+ }, t.isAfter = function(e, r) {
125
+ return c(e) < this.startOf(r);
126
+ }, t.isBefore = function(e, r) {
127
+ return this.endOf(r) < c(e);
128
+ }, t.$g = function(e, r, n) {
129
+ return u.u(e) ? this[r] : this.set(n, e);
130
+ }, t.unix = function() {
131
+ return Math.floor(this.valueOf() / 1e3);
132
+ }, t.valueOf = function() {
133
+ return this.$d.getTime();
134
+ }, t.startOf = function(e, r) {
135
+ var n = this, a = !!u.u(r) || r, i = u.p(e), m = function(N, k) {
136
+ var I = u.w(n.$u ? Date.UTC(n.$y, k, N) : new Date(n.$y, k, N), n);
137
+ return a ? I : I.endOf(b);
138
+ }, h = function(N, k) {
139
+ return u.w(n.toDate()[N].apply(n.toDate("s"), (a ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(k)), n);
140
+ }, g = this.$W, y = this.$M, M = this.$D, R = "set" + (this.$u ? "UTC" : "");
141
+ switch (i) {
142
+ case x:
143
+ return a ? m(1, 0) : m(31, 11);
144
+ case D:
145
+ return a ? m(1, y) : m(0, y + 1);
146
+ case P:
147
+ var O = this.$locale().weekStart || 0, B = (g < O ? g + 7 : g) - O;
148
+ return m(a ? M - B : M + (6 - B), y);
149
+ case b:
150
+ case H:
151
+ return h(R + "Hours", 0);
152
+ case L:
153
+ return h(R + "Minutes", 1);
154
+ case S:
155
+ return h(R + "Seconds", 2);
156
+ case j:
157
+ return h(R + "Milliseconds", 3);
158
+ default:
159
+ return this.clone();
160
+ }
161
+ }, t.endOf = function(e) {
162
+ return this.startOf(e, !1);
163
+ }, t.$set = function(e, r) {
164
+ var n, a = u.p(e), i = "set" + (this.$u ? "UTC" : ""), m = (n = {}, n[b] = i + "Date", n[H] = i + "Date", n[D] = i + "Month", n[x] = i + "FullYear", n[L] = i + "Hours", n[S] = i + "Minutes", n[j] = i + "Seconds", n[w] = i + "Milliseconds", n)[a], h = a === b ? this.$D + (r - this.$W) : r;
165
+ if (a === D || a === x) {
166
+ var g = this.clone().set(H, 1);
167
+ g.$d[m](h), g.init(), this.$d = g.set(H, Math.min(this.$D, g.daysInMonth())).$d;
168
+ } else
169
+ m && this.$d[m](h);
170
+ return this.init(), this;
171
+ }, t.set = function(e, r) {
172
+ return this.clone().$set(e, r);
173
+ }, t.get = function(e) {
174
+ return this[u.p(e)]();
175
+ }, t.add = function(e, r) {
176
+ var n, a = this;
177
+ e = Number(e);
178
+ var i = u.p(r), m = function(y) {
179
+ var M = c(a);
180
+ return u.w(M.date(M.date() + Math.round(y * e)), a);
181
+ };
182
+ if (i === D)
183
+ return this.set(D, this.$M + e);
184
+ if (i === x)
185
+ return this.set(x, this.$y + e);
186
+ if (i === b)
187
+ return m(1);
188
+ if (i === P)
189
+ return m(7);
190
+ var h = (n = {}, n[S] = l, n[L] = T, n[j] = v, n)[i] || 1, g = this.$d.getTime() + e * h;
191
+ return u.w(g, this);
192
+ }, t.subtract = function(e, r) {
193
+ return this.add(-1 * e, r);
194
+ }, t.format = function(e) {
195
+ var r = this, n = this.$locale();
196
+ if (!this.isValid())
197
+ return n.invalidDate || V;
198
+ var a = e || "YYYY-MM-DDTHH:mm:ssZ", i = u.z(this), m = this.$H, h = this.$m, g = this.$M, y = n.weekdays, M = n.months, R = n.meridiem, O = function(k, I, J, G) {
199
+ return k && (k[I] || k(r, a)) || J[I].slice(0, G);
200
+ }, B = function(k) {
201
+ return u.s(m % 12 || 12, k, "0");
202
+ }, N = R || function(k, I, J) {
203
+ var G = k < 12 ? "AM" : "PM";
204
+ return J ? G.toLowerCase() : G;
205
+ };
206
+ return a.replace(ee, function(k, I) {
207
+ return I || function(J) {
208
+ switch (J) {
209
+ case "YY":
210
+ return String(r.$y).slice(-2);
211
+ case "YYYY":
212
+ return u.s(r.$y, 4, "0");
213
+ case "M":
214
+ return g + 1;
215
+ case "MM":
216
+ return u.s(g + 1, 2, "0");
217
+ case "MMM":
218
+ return O(n.monthsShort, g, M, 3);
219
+ case "MMMM":
220
+ return O(M, g);
221
+ case "D":
222
+ return r.$D;
223
+ case "DD":
224
+ return u.s(r.$D, 2, "0");
225
+ case "d":
226
+ return String(r.$W);
227
+ case "dd":
228
+ return O(n.weekdaysMin, r.$W, y, 2);
229
+ case "ddd":
230
+ return O(n.weekdaysShort, r.$W, y, 3);
231
+ case "dddd":
232
+ return y[r.$W];
233
+ case "H":
234
+ return String(m);
235
+ case "HH":
236
+ return u.s(m, 2, "0");
237
+ case "h":
238
+ return B(1);
239
+ case "hh":
240
+ return B(2);
241
+ case "a":
242
+ return N(m, h, !0);
243
+ case "A":
244
+ return N(m, h, !1);
245
+ case "m":
246
+ return String(h);
247
+ case "mm":
248
+ return u.s(h, 2, "0");
249
+ case "s":
250
+ return String(r.$s);
251
+ case "ss":
252
+ return u.s(r.$s, 2, "0");
253
+ case "SSS":
254
+ return u.s(r.$ms, 3, "0");
255
+ case "Z":
256
+ return i;
257
+ }
258
+ return null;
259
+ }(k) || i.replace(":", "");
260
+ });
261
+ }, t.utcOffset = function() {
262
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
263
+ }, t.diff = function(e, r, n) {
264
+ var a, i = this, m = u.p(r), h = c(e), g = (h.utcOffset() - this.utcOffset()) * l, y = this - h, M = function() {
265
+ return u.m(i, h);
266
+ };
267
+ switch (m) {
268
+ case x:
269
+ a = M() / 12;
270
+ break;
271
+ case D:
272
+ a = M();
273
+ break;
274
+ case W:
275
+ a = M() / 3;
276
+ break;
277
+ case P:
278
+ a = (y - g) / 6048e5;
279
+ break;
280
+ case b:
281
+ a = (y - g) / 864e5;
282
+ break;
283
+ case L:
284
+ a = y / T;
285
+ break;
286
+ case S:
287
+ a = y / l;
288
+ break;
289
+ case j:
290
+ a = y / v;
291
+ break;
292
+ default:
293
+ a = y;
294
+ }
295
+ return n ? a : u.a(a);
296
+ }, t.daysInMonth = function() {
297
+ return this.endOf(D).$D;
298
+ }, t.$locale = function() {
299
+ return _[this.$L];
300
+ }, t.locale = function(e, r) {
301
+ if (!e)
302
+ return this.$L;
303
+ var n = this.clone(), a = f(e, r, !0);
304
+ return a && (n.$L = a), n;
305
+ }, t.clone = function() {
306
+ return u.w(this.$d, this);
307
+ }, t.toDate = function() {
308
+ return new Date(this.valueOf());
309
+ }, t.toJSON = function() {
310
+ return this.isValid() ? this.toISOString() : null;
311
+ }, t.toISOString = function() {
312
+ return this.$d.toISOString();
313
+ }, t.toString = function() {
314
+ return this.$d.toUTCString();
315
+ }, s;
316
+ }(), A = $.prototype;
317
+ return c.prototype = A, [["$ms", w], ["$s", j], ["$m", S], ["$H", L], ["$W", b], ["$M", D], ["$y", x], ["$D", H]].forEach(function(s) {
318
+ A[s[1]] = function(t) {
319
+ return this.$g(t, s[0], s[1]);
320
+ };
321
+ }), c.extend = function(s, t) {
322
+ return s.$i || (s(t, $, c), s.$i = !0), c;
323
+ }, c.locale = f, c.isDayjs = F, c.unix = function(s) {
324
+ return c(1e3 * s);
325
+ }, c.en = _[Y], c.Ls = _, c.p = {}, c;
326
+ });
327
+ })(oe);
328
+ var ge = oe.exports;
329
+ const ye = /* @__PURE__ */ $e(ge), ae = () => {
330
+ let d = { ...(window == null ? void 0 : window.config) || {} };
331
+ d.rootContainer || (d.rootContainer = "#app"), d.baseURL || (d.baseURL = location.origin), d.ossBaseURL || (d.ossBaseURL = "/oss"), d.ossBaseURL.startsWith("/") && (d.ossBaseURL = `${d.baseURL}/oss`), d.ssoBaseURL || (d.ssoBaseURL = d.baseURL);
332
+ let { microAppName: v, publicPath: l, mainAppName: T } = d;
333
+ return v && !0 && !l && (l = `/${v}/`.replace(/\/\//g, "/")), l || (l = "/"), d.publicPath = l, d.autoOssBucket || (d.autoOssBucket = T || v), d;
334
+ }, we = ne.get("token"), be = ne.post("putObject", (p) => (p.headers || (p.headers = {}), p.headers["Content-Type"] = "multipart/form-data", p.responseType = "blob", p)), Me = ne.post("upload-objects", (p) => (p.headers || (p.headers = {}), p.headers["Content-Type"] = "multipart/form-data", p.responseType = "blob", p)), Se = me.get("progress"), qe = () => {
335
+ let p = U(!1), d = U(""), v = U(0), l = U("normal"), T = U(!1), w, j = U(""), S = U(""), L = U(""), b = U(""), P = U(!1), D = U(""), W = "", x;
336
+ const H = () => {
337
+ S.value = "", L.value = "", b.value = "", P.value = !1, D.value = "";
338
+ }, V = async () => {
339
+ const [f, c] = await we().run();
340
+ return f ? { stauts: !1 } : { status: !0, data: c };
341
+ }, Z = (f) => new Promise((c, u) => {
342
+ const A = [];
343
+ let s = 0;
344
+ for (; s < f.size; ) {
345
+ const e = f.slice(s, s + 1048576);
346
+ A.push(e), s += 1048576;
185
347
  }
186
- fileInfo = file;
187
- const tokenResult = await getMinioConfig();
188
- if (!tokenResult.status)
348
+ const t = new Blob(A, { type: f.type });
349
+ c(t);
350
+ }), ee = async (f, c, u, $ = !0, A = "", s = !1) => {
351
+ W = A, $ && (l.value = "normal", v.value = 0, d.value = "导入进度", p.value = !0, j.value = ""), x = c;
352
+ const t = await V();
353
+ if (!t.status)
189
354
  return;
190
- let minioConfig = tokenResult.data;
191
- let params = null;
192
- let { autoContentType, bucketName, importFileName } = options;
193
- const fn = isBatch ? importMultiMinio : importMinio;
194
- if (isBatch) {
195
- let blobList = [];
196
- await file.forEach(async (ele) => {
197
- let blob = await readFileAndAddToMap(ele);
198
- blobList.push(blob);
199
- });
200
- params = new FormData();
201
- params.append("accessKeyId", minioConfig.accessKeyId);
202
- params.append("secretAccessKey", minioConfig.secretAccessKey);
203
- params.append("sessionToken", minioConfig.sessionToken);
204
- params.append("bucketName", bucketName);
205
- file.forEach((v, i) => {
206
- params.append("file", blobList[i]);
207
- });
208
- importFileName.forEach((v) => {
209
- params.append("filePaths", v);
355
+ let e = t.data, r = null, { autoContentType: n, bucketName: a, importFileName: i } = u;
356
+ const m = s ? Me : be;
357
+ if (s) {
358
+ let R = [];
359
+ await c.forEach(async (O) => {
360
+ let B = await Z(O);
361
+ R.push(B);
362
+ }), r = new FormData(), r.append("accessKeyId", e.accessKeyId), r.append("secretAccessKey", e.secretAccessKey), r.append("sessionToken", e.sessionToken), r.append("bucketName", a), c.forEach((O, B) => {
363
+ r.append("file", R[B]);
364
+ }), i.forEach((O) => {
365
+ r.append("filePaths", O);
210
366
  });
211
367
  } else {
212
- const blob = await readFileAndAddToMap(file);
213
- params = {
214
- accessKeyId: minioConfig.accessKeyId,
215
- secretAccessKey: minioConfig.secretAccessKey,
216
- sessionToken: minioConfig.sessionToken,
217
- file: blob,
218
- bucketName,
219
- filePath: importFileName,
220
- autoContentType
368
+ const R = await Z(c);
369
+ r = {
370
+ accessKeyId: e.accessKeyId,
371
+ secretAccessKey: e.secretAccessKey,
372
+ sessionToken: e.sessionToken,
373
+ file: R,
374
+ bucketName: a,
375
+ filePath: i,
376
+ autoContentType: n
221
377
  };
222
378
  }
223
- const [error, data] = await fn(params).run();
224
- if (error)
379
+ const [h, g] = await m(r).run();
380
+ if (h)
225
381
  return;
226
- const toStringData = await toStringObject(data.data);
227
- const importResult = await importFunc?.(toStringData);
228
- if (needProgress) {
229
- if (!importResult.status) {
230
- showProgressDialog.value = false;
231
- progressStatus.value = "error";
382
+ const y = await je(g.data), M = await (f == null ? void 0 : f(y));
383
+ if ($) {
384
+ if (!M.status) {
385
+ p.value = !1, l.value = "error";
232
386
  return;
233
387
  }
234
- progressTitle.value = "\u5BFC\u5165\u8FDB\u5EA6";
235
- showProgressDialog.value = true;
236
- checkProgress(importResult.taskId, "import", "");
388
+ d.value = "导入进度", p.value = !0, z(M.taskId, "import", "");
237
389
  } else {
238
- if (!importResult.status)
390
+ if (!M.status)
239
391
  return;
240
- progressStatus.value = "success";
392
+ l.value = "success";
241
393
  }
242
- };
243
- const fileAction = async (exportFunc, fileName = "", actionTitle = "") => {
244
- progressStatus.value = "normal";
245
- percent.value = 0;
246
- progressTitle.value = actionTitle || "\u5BFC\u51FA\u8FDB\u5EA6";
247
- showProgressDialog.value = true;
248
- const importResult = await exportFunc?.();
249
- if (!importResult.status) {
250
- showProgressDialog.value = false;
251
- progressStatus.value = "error";
394
+ }, te = async (f, c = "", u = "") => {
395
+ l.value = "normal", v.value = 0, d.value = u || "导出进度", p.value = !0;
396
+ const $ = await (f == null ? void 0 : f());
397
+ if (!$.status) {
398
+ p.value = !1, l.value = "error";
252
399
  return;
253
400
  }
254
- checkProgress(importResult.taskId, "action", "");
255
- };
256
- const fileExport = async (exportFunc, fileName = "", fileSuffix = "") => {
257
- progressStatus.value = "normal";
258
- percent.value = 0;
259
- progressTitle.value = "\u5BFC\u51FA\u8FDB\u5EA6";
260
- showProgressDialog.value = true;
261
- const importResult = await exportFunc?.();
262
- if (!importResult.status) {
263
- showProgressDialog.value = false;
264
- progressStatus.value = "error";
401
+ z($.taskId, "action", "");
402
+ }, K = async (f, c = "", u = "") => {
403
+ l.value = "normal", v.value = 0, d.value = "导出进度", p.value = !0;
404
+ const $ = await (f == null ? void 0 : f());
405
+ if (!$.status) {
406
+ p.value = !1, l.value = "error";
265
407
  return;
266
408
  }
267
- dayjs().format("YYYYMMDDHHmmss") + ".xlsx";
268
- checkProgress(importResult.taskId, "export", fileName ? fileName : "", fileSuffix);
269
- };
270
- const checkProgress = async (taskId, type, fileName, fileSuffix = "") => {
271
- progressLoading.value = true;
272
- getProgress(taskId, type, fileName, fileSuffix);
273
- progressTimer = setTimeout(() => {
409
+ ye().format("YYYYMMDDHHmmss") + "", z($.taskId, "export", c || "", u);
410
+ }, z = async (f, c, u, $ = "") => {
411
+ T.value = !0, _(f, c, u, $), w = setTimeout(() => {
274
412
  }, 50);
275
- };
276
- const clearTimer = () => {
277
- clearTimeout(progressTimer);
278
- progressTimer = null;
279
- showProgressDialog.value = false;
280
- };
281
- const getProgress = async (taskId, type = "export", fileName, fileSuffix = "") => {
282
- const [error, data] = await getTaskProgress("", {
283
- url: `progress/${taskId}`
413
+ }, Y = () => {
414
+ clearTimeout(w), w = null, p.value = !1;
415
+ }, _ = async (f, c = "export", u, $ = "") => {
416
+ var e, r;
417
+ const [A, s] = await Se("", {
418
+ url: `progress/${f}`
284
419
  }).run();
285
- if (error) {
286
- progressLoading.value = false;
420
+ if (A) {
421
+ T.value = !1;
287
422
  return;
288
423
  }
289
- percent.value = data.percentage;
290
- const tip = type == "export" ? "\u5BFC\u51FA" : "\u5BFC\u5165";
291
- if (percent.value == 100) {
292
- progressResult.value = data;
293
- progressLoading.value = false;
294
- clearTimer();
295
- if (type == "export") {
296
- if (data.status == 1) {
297
- progressStatus.value = "success";
298
- downloadFile(`${getConfig().baseURL}/oss${data.filePath}`, fileName, fileSuffix);
299
- progressLoading.value = false;
300
- } else if (data.status == 2) {
301
- errorMessage.value = data.message || `${tip}\u5931\u8D25`;
302
- }
303
- } else if (type == "import") {
304
- if (!!data.filePath) {
305
- progressStatus.value = "error";
306
- const matchName = fileInfo.name?.match(/(.*?)(\.[^.]*$|$)/);
307
- const suffix = matchName.length ? matchName[2] : "";
308
- errorImport.value = true;
309
- const pathName = data.filePath?.replace(/(.*\/)*([^.]+).*/gi, "$2");
310
- errorFileName.value = tempErrPathName ? tempErrPathName : `${pathName}${suffix}`;
311
- errorFileSize.value = fileInfo.sizeText;
312
- errorMessage.value = "\u90E8\u5206\u6570\u636E\u6821\u9A8C\u4E0D\u901A\u8FC7\uFF0C\u8BF7\u4E0B\u8F7D\u9644\u4EF6\u5E76\u4FEE\u6539\uFF0C\u91CD\u65B0\u5BFC\u5165\uFF01";
313
- errorFilePath.value = `${getConfig().baseURL}/oss${data.filePath}`;
424
+ v.value = s.percentage;
425
+ const t = c == "export" ? "导出" : "导入";
426
+ if (v.value == 100)
427
+ if (j.value = s, T.value = !1, Y(), c == "export")
428
+ s.status == 1 ? (l.value = "success", ie(`${ae().baseURL}/oss${s.filePath}`, u, $), T.value = !1) : s.status == 2 && (b.value = s.message || `${t}失败`);
429
+ else if (c == "import") {
430
+ if (s.filePath) {
431
+ l.value = "error";
432
+ const n = (e = x.name) == null ? void 0 : e.match(/(.*?)(\.[^.]*$|$)/), a = n.length ? n[2] : "";
433
+ P.value = !0;
434
+ const i = (r = s.filePath) == null ? void 0 : r.replace(/(.*\/)*([^.]+).*/gi, "$2");
435
+ S.value = W || `${i}${a}`, L.value = x.sizeText, b.value = "部分数据校验不通过,请下载附件并修改,重新导入!", D.value = `${ae().baseURL}/oss${s.filePath}`;
314
436
  }
315
- tipHandle(data.status, tip, data.message);
316
- } else if (type == "action") {
317
- progressStatus.value = "success";
318
- }
319
- } else {
320
- if (progressTimer && data.status != 2) {
321
- progressTimer = setTimeout(() => {
322
- getProgress(taskId, type, fileName, fileSuffix);
323
- }, 50);
324
- } else {
325
- progressResult.value = data;
326
- progressLoading.value = false;
327
- tipHandle(data.status, tip, data.message);
328
- clearTimer();
329
- errorImport.value = true;
330
- errorMessage.value = data?.message || "";
331
- }
332
- }
333
- };
334
- const tipHandle = (status, tip, message) => {
335
- if (status == 1) {
336
- progressStatus.value = "success";
337
- errorFileName.value = "";
338
- errorFileSize.value = "";
339
- errorMessage.value = "";
340
- } else if (status == 2) {
341
- progressStatus.value = "error";
342
- errorMessage.value = message ? message : "\u90E8\u5206\u6570\u636E\u6821\u9A8C\u4E0D\u901A\u8FC7\uFF0C\u8BF7\u4E0B\u8F7D\u9644\u4EF6\u5E76\u4FEE\u6539\uFF0C\u91CD\u65B0\u5BFC\u5165\uFF01";
343
- } else if (status == 3) {
344
- progressStatus.value = "error";
345
- }
346
- };
347
- const generateUniqueName = (fileName) => {
348
- const matchName = fileName?.match(/(.*?)(\.[^.]*$|$)/);
349
- const suffix = matchName.length ? matchName[2] : "";
350
- const name = matchName.length ? matchName[1] : fileName;
351
- return `${name}${nanoid()}${suffix}`;
437
+ q(s.status, t, s.message);
438
+ } else
439
+ c == "action" && (l.value = "success");
440
+ else
441
+ w && s.status != 2 ? w = setTimeout(() => {
442
+ _(f, c, u, $);
443
+ }, 50) : (j.value = s, T.value = !1, q(s.status, t, s.message), Y(), P.value = !0, b.value = (s == null ? void 0 : s.message) || "");
444
+ }, q = (f, c, u) => {
445
+ f == 1 ? (l.value = "success", S.value = "", L.value = "", b.value = "") : f == 2 ? (l.value = "error", b.value = u || "部分数据校验不通过,请下载附件并修改,重新导入!") : f == 3 && (l.value = "error");
352
446
  };
353
447
  return {
354
- showProgressDialog,
355
- progressTitle,
356
- percent,
357
- progressStatus,
358
- progressLoading,
359
- progressResult,
360
- errorFileName,
361
- errorFileSize,
362
- errorMessage,
363
- errorImport,
364
- errorFilePath,
365
- fileImport,
366
- fileExport,
367
- fileAction,
368
- generateUniqueName,
369
- downloadFile,
370
- resetStataus,
371
- checkProgress
448
+ showProgressDialog: p,
449
+ progressTitle: d,
450
+ percent: v,
451
+ progressStatus: l,
452
+ progressLoading: T,
453
+ progressResult: j,
454
+ errorFileName: S,
455
+ errorFileSize: L,
456
+ errorMessage: b,
457
+ errorImport: P,
458
+ errorFilePath: D,
459
+ fileImport: ee,
460
+ fileExport: K,
461
+ fileAction: te,
462
+ generateUniqueName: (f) => {
463
+ const c = f == null ? void 0 : f.match(/(.*?)(\.[^.]*$|$)/), u = c.length ? c[2] : "";
464
+ return `${c.length ? c[1] : f}${he()}${u}`;
465
+ },
466
+ downloadFile: ie,
467
+ resetStataus: H,
468
+ checkProgress: z
372
469
  };
373
- };
374
- const fileBobType = (type) => {
375
- let tempType = type?.toLocaleLowerCase();
376
- let typeList = {
470
+ }, De = (p) => {
471
+ let d = p == null ? void 0 : p.toLocaleLowerCase();
472
+ return {
377
473
  excel: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
378
474
  pdf: "application/pdf",
379
475
  doc: "application/msword",
@@ -399,96 +495,66 @@ const fileBobType = (type) => {
399
495
  crt: "application/x-x509-ca-cert",
400
496
  der: "application/x-x509-ca-cert",
401
497
  cer: "application/pkix-cert"
402
- };
403
- return typeList[tempType];
404
- };
405
- const downloadFile = (path, filename, fileSuffix = "excel") => {
406
- const xhr = new XMLHttpRequest();
407
- xhr.open("get", path);
408
- xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
409
- xhr.responseType = "blob";
410
- xhr.onload = function(e) {
411
- const blob = new Blob([this.response], {
412
- type: fileBobType(fileSuffix)
413
- });
414
- const objectUrl = URL.createObjectURL(blob);
415
- if (window.navigator.msSaveOrOpenBlob) {
416
- navigator.msSaveBlob(blob, filename);
417
- } else {
418
- const element = document.createElement("a");
419
- element.href = objectUrl;
420
- element.download = filename;
421
- element.click();
422
- window.URL.revokeObjectURL(objectUrl);
498
+ }[d];
499
+ }, ie = (p, d, v = "excel") => {
500
+ const l = new XMLHttpRequest();
501
+ l.open("get", p), l.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), l.responseType = "blob", l.onload = function(T) {
502
+ const w = new Blob([this.response], {
503
+ type: De(v)
504
+ }), j = URL.createObjectURL(w);
505
+ if (window.navigator.msSaveOrOpenBlob)
506
+ navigator.msSaveBlob(w, d);
507
+ else {
508
+ const S = document.createElement("a");
509
+ S.href = j, S.download = d, S.click(), window.URL.revokeObjectURL(j);
423
510
  }
424
- };
425
- xhr.send();
426
- };
427
- const toStringObject = (blob) => {
428
- return new Promise((resolve, reject) => {
429
- var reader = new FileReader();
430
- reader.onload = function(event) {
431
- let data = "";
432
- if (typeof reader.result == "string") {
433
- data = JSON.parse(reader.result);
434
- }
435
- resolve(data);
436
- };
437
- reader.readAsText(blob);
438
- });
439
- };
440
-
441
- const version$c = "v2";
442
- const gatewayEdge = createService(`/api/edge/${version$c}`);
443
-
444
- const version$b = "v1";
445
- const justauth = createService(`/api/justauth/oauth-server/${version$b}/visitor`);
446
- const oauthServer = createService(`/api/justauth/oauth-server/${version$b}`);
447
-
448
- const version$a = "v1";
449
- const knowledgeBase = createService(`/api/knowledge-base/knowledge/${version$a}`);
450
-
451
- const version$9 = "v1";
452
- const daslink = createService(`/api/custom-datasource/custom/${version$9}`);
453
-
454
- const version$8 = "v1";
455
- const permission = createService(`/api/permission/${version$8}`);
456
-
457
- const version$7 = "v1";
458
- const customer = createService(`/api/customer/customer/${version$7}`);
459
- const company = createService(`/api/customer/company/${version$7}`);
460
- const customerGrade = createService(`/api/customer/customer-grade/${version$7}`);
461
- const customerType = createService(`/api/customer/customer-type/${version$7}`);
462
- const projectManage = {
463
- list: createService(`/api/project/${version$7}/list`),
464
- app: createService(`/api/project/${version$7}/app`),
465
- people: createService(`/api/project/${version$7}/people`)
511
+ }, l.send();
512
+ }, je = (p) => new Promise((d, v) => {
513
+ var l = new FileReader();
514
+ l.onload = function(T) {
515
+ let w = "";
516
+ typeof l.result == "string" && (w = JSON.parse(l.result)), d(w);
517
+ }, l.readAsText(p);
518
+ }), ke = "v2", Je = o(`/api/edge/${ke}`), ce = "v1", Ve = o(`/api/justauth/oauth-server/${ce}/visitor`), Ze = o(`/api/justauth/oauth-server/${ce}`), Te = "v1", Fe = o(`/api/knowledge-base/knowledge/${Te}`), xe = "v1", Ge = o(`/api/custom-datasource/custom/${xe}`), Oe = "v1", Qe = o(`/api/permission/${Oe}`), E = "v1", Xe = o(`/api/customer/customer/${E}`), et = o(`/api/customer/company/${E}`), tt = o(`/api/customer/customer-grade/${E}`), st = o(`/api/customer/customer-type/${E}`), nt = {
519
+ list: o(`/api/project/${E}/list`),
520
+ app: o(`/api/project/${E}/app`),
521
+ people: o(`/api/project/${E}/people`)
522
+ }, Le = "v1", rt = o(`/api/portal/user/${Le}`), Re = "v1", at = o(`/api/space-manage/space-tree/${Re}`), X = "v1", it = o(`/api/superadmin/portal/${X}`), ot = o(`/api/superadmin/permission/${X}`), ct = o(`/api/superadmin/resource/${X}`), ut = o(`/api/superadmin/license/${X}`), re = "v1", lt = o(`/api/supply/supplier/${re}`), pt = o(`/api/supplier/${re}`), dt = o(`/api/supplier/${re}/classification`), Ue = "v1", ft = o(`/api/supply/brand/${Ue}`), _e = "v2", mt = o(`/api/tool/${_e}`), Ce = "v1", ht = o(`/api/system-config/${Ce}`);
523
+ export {
524
+ Be as appManage,
525
+ He as authentication,
526
+ Ye as bemsModules,
527
+ et as company,
528
+ Ie as contract,
529
+ Xe as customer,
530
+ tt as customerGrade,
531
+ st as customerType,
532
+ Ge as daslink,
533
+ ie as downloadFile,
534
+ Ne as dutyModules,
535
+ ft as enterpriseadminBrandModel,
536
+ Ee as enterpriseright,
537
+ Je as gatewayEdge,
538
+ We as iot,
539
+ ne as iotMinio,
540
+ ze as iotModules,
541
+ me as iotProgress,
542
+ Ke as iotRelationModules,
543
+ Ve as justauth,
544
+ Fe as knowledgeBase,
545
+ Ze as oauthServer,
546
+ Qe as permission,
547
+ rt as portal,
548
+ nt as projectManage,
549
+ at as spaceManage,
550
+ ut as superadminLicense,
551
+ ot as superadminPermission,
552
+ it as superadminPortal,
553
+ ct as superadminResource,
554
+ lt as supplier,
555
+ dt as supplierClassification,
556
+ pt as supplierManage,
557
+ ht as systemConfiguration,
558
+ mt as tool,
559
+ qe as useFile
466
560
  };
467
-
468
- const version$6 = "v1";
469
- const portal = createService(`/api/portal/user/${version$6}`);
470
-
471
- const version$5 = "v1";
472
- const spaceManage = createService(`/api/space-manage/space-tree/${version$5}`);
473
-
474
- const version$4 = "v1";
475
- const superadminPortal = createService(`/api/superadmin/portal/${version$4}`);
476
- const superadminPermission = createService(`/api/superadmin/permission/${version$4}`);
477
- const superadminResource = createService(`/api/superadmin/resource/${version$4}`);
478
- const superadminLicense = createService(`/api/superadmin/license/${version$4}`);
479
-
480
- const version$3 = "v1";
481
- const supplier = createService(`/api/supply/supplier/${version$3}`);
482
- const supplierManage = createService(`/api/supplier/${version$3}`);
483
- const supplierClassification = createService(`/api/supplier/${version$3}/classification`);
484
-
485
- const version$2 = "v1";
486
- const enterpriseadminBrandModel = createService(`/api/supply/brand/${version$2}`);
487
-
488
- const version$1 = "v2";
489
- const tool = createService(`/api/tool/${version$1}`);
490
-
491
- const version = "v1";
492
- const systemConfiguration = createService(`/api/system-config/${version}`);
493
-
494
- export { appManage, authentication, bemsModules, company, contract, customer, customerGrade, customerType, daslink, downloadFile, dutyModules, enterpriseadminBrandModel, enterpriseright, gatewayEdge, iot, iotMinio, iotModules, iotProgress, iotRelationModules, justauth, knowledgeBase, oauthServer, permission, portal, projectManage, spaceManage, superadminLicense, superadminPermission, superadminPortal, superadminResource, supplier, supplierClassification, supplierManage, systemConfiguration, tool, useFile };