@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,347 +1,457 @@
1
- import { createService } from '@das-fed/utils/api-services';
2
- import crypto from 'crypto';
3
- import { ref } from 'vue';
4
-
5
- const version = "v1";
6
- createService(`/api/iot/${version}`);
7
- ({
8
- thingmodel: createService(`/api/iot-device/thingmodel/${version}`),
9
- deviceManage: createService(`/api/iot-device/devicemanage/${version}`),
10
- product: createService(`/api/iot-device/product/${version}`),
11
- productStorage: createService(`/api/iot-device/product-storage/${version}`)
12
- });
13
- ({
14
- projectDevice: createService(`/api/device-relation/deviceproject/${version}`),
15
- deviceRules: createService(`/api/device-relation/devicerule/${version}`),
16
- project: createService(`/api/device-relation/project/${version}`)
17
- });
18
- const iotMinio = createService(`/api/oss/minio/${version}`);
19
- const iotProgress = createService(`/api/progress/accessor/${version}`);
20
-
21
- let urlAlphabet =
22
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
23
-
24
- const POOL_SIZE_MULTIPLIER = 128;
25
- let pool, poolOffset;
26
- let fillPool = bytes => {
27
- if (!pool || pool.length < bytes) {
28
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
29
- crypto.randomFillSync(pool);
30
- poolOffset = 0;
31
- } else if (poolOffset + bytes > pool.length) {
32
- crypto.randomFillSync(pool);
33
- poolOffset = 0;
34
- }
35
- poolOffset += bytes;
36
- };
37
- let nanoid = (size = 21) => {
38
- fillPool((size -= 0));
39
- let id = '';
40
- for (let i = poolOffset - size; i < poolOffset; i++) {
41
- id += urlAlphabet[pool[i] & 63];
1
+ import { createService as _ } from "@das-fed/utils/api-services";
2
+ import { ref as U } from "vue";
3
+ const C = "v1";
4
+ _(`/api/iot/${C}`);
5
+ _(`/api/iot-device/thingmodel/${C}`), _(`/api/iot-device/devicemanage/${C}`), _(`/api/iot-device/product/${C}`), _(`/api/iot-device/product-storage/${C}`);
6
+ _(`/api/device-relation/deviceproject/${C}`), _(`/api/device-relation/devicerule/${C}`), _(`/api/device-relation/project/${C}`);
7
+ const X = _(`/api/oss/minio/${C}`), re = _(`/api/progress/accessor/${C}`);
8
+ let ne = (l = 21) => {
9
+ let f = "", m = crypto.getRandomValues(new Uint8Array(l));
10
+ for (; l--; ) {
11
+ let c = m[l] & 63;
12
+ c < 36 ? f += c.toString(36) : c < 62 ? f += (c - 26).toString(36).toUpperCase() : c < 63 ? f += "_" : f += "-";
42
13
  }
43
- return id
14
+ return f;
44
15
  };
45
-
46
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
47
-
48
- function getDefaultExportFromCjs (x) {
49
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
16
+ var ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
17
+ function ie(l) {
18
+ return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
50
19
  }
51
-
52
- var dayjs_min = {exports: {}};
53
-
54
- (function (module, exports) {
55
- !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}));
56
- } (dayjs_min));
57
-
58
- var dayjs_minExports = dayjs_min.exports;
59
- var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
60
-
61
- const getConfig = () => {
62
- let windowConfig = window?.config || {};
63
- let config = { ...windowConfig };
64
- if (!config.rootContainer)
65
- config.rootContainer = "#app";
66
- if (!config.baseURL)
67
- config.baseURL = location.origin;
68
- if (!config.ossBaseURL)
69
- config.ossBaseURL = "/oss";
70
- if (config.ossBaseURL.startsWith("/"))
71
- config.ossBaseURL = `${config.baseURL}/oss`;
72
- if (!config.ssoBaseURL)
73
- config.ssoBaseURL = config.baseURL;
74
- let { microAppName, publicPath, mainAppName } = config;
75
- const isPro = import.meta.env.PROD;
76
- if (microAppName && isPro && !publicPath)
77
- publicPath = `/${microAppName}/`.replace(/\/\//g, "/");
78
- if (!publicPath)
79
- publicPath = "/";
80
- config.publicPath = publicPath;
81
- if (!config.autoOssBucket)
82
- config.autoOssBucket = mainAppName || microAppName;
83
- return config;
84
- };
85
-
86
- const getMinioToken = iotMinio.get(`token`);
87
- const importMinio = iotMinio.post(`putObject`, (config) => {
88
- if (!config.headers)
89
- config.headers = {};
90
- config.headers["Content-Type"] = "multipart/form-data";
91
- config.responseType = "blob";
92
- return config;
93
- });
94
- const importMultiMinio = iotMinio.post(`upload-objects`, (config) => {
95
- if (!config.headers)
96
- config.headers = {};
97
- config.headers["Content-Type"] = "multipart/form-data";
98
- config.responseType = "blob";
99
- return config;
100
- });
101
- const getTaskProgress = iotProgress.get(`progress`);
102
- const useFile = () => {
103
- let showProgressDialog = ref(false);
104
- let progressTitle = ref("");
105
- let percent = ref(0);
106
- let progressStatus = ref("normal");
107
- let progressLoading = ref(false);
108
- let progressTimer;
109
- let progressResult = ref("");
110
- let errorFileName = ref("");
111
- let errorFileSize = ref("");
112
- let errorMessage = ref("");
113
- let errorImport = ref(false);
114
- let errorFilePath = ref("");
115
- let tempErrPathName = "";
116
- let fileInfo;
117
- const resetStataus = () => {
118
- errorFileName.value = "";
119
- errorFileSize.value = "";
120
- errorMessage.value = "";
121
- errorImport.value = false;
122
- errorFilePath.value = "";
123
- };
124
- const getMinioConfig = async () => {
125
- const [error, data] = await getMinioToken().run();
126
- if (error) {
127
- return { stauts: false };
128
- }
129
- return { status: true, data };
130
- };
131
- const readFileAndAddToMap = (file) => {
132
- return new Promise((resolve, reject) => {
133
- const chunkSize = 1024 * 1024;
134
- const chunks = [];
135
- let offset = 0;
136
- while (offset < file.size) {
137
- const chunk = file.slice(offset, offset + chunkSize);
138
- chunks.push(chunk);
139
- offset += chunkSize;
20
+ var se = { exports: {} };
21
+ (function(l, f) {
22
+ (function(m, c) {
23
+ l.exports = c();
24
+ })(ae, function() {
25
+ var m = 1e3, c = 6e4, k = 36e5, y = "millisecond", D = "second", M = "minute", j = "hour", w = "day", P = "week", S = "month", W = "quarter", x = "year", Y = "date", J = "Invalid Date", V = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, G = /\[([^\]]+)]|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, Q = { 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) {
26
+ var t = ["th", "st", "nd", "rd"], e = s % 100;
27
+ return "[" + s + (t[(e - 20) % 10] || t[e] || t[0]) + "]";
28
+ } }, E = function(s, t, e) {
29
+ var n = String(s);
30
+ return !n || n.length >= t ? s : "" + Array(t + 1 - n.length).join(e) + s;
31
+ }, z = { s: E, z: function(s) {
32
+ var t = -s.utcOffset(), e = Math.abs(t), n = Math.floor(e / 60), r = e % 60;
33
+ return (t <= 0 ? "+" : "-") + E(n, 2, "0") + ":" + E(r, 2, "0");
34
+ }, m: function s(t, e) {
35
+ if (t.date() < e.date())
36
+ return -s(e, t);
37
+ var n = 12 * (e.year() - t.year()) + (e.month() - t.month()), r = t.clone().add(n, S), a = e - r < 0, i = t.clone().add(n + (a ? -1 : 1), S);
38
+ return +(-(n + (e - r) / (a ? r - i : i - r)) || 0);
39
+ }, a: function(s) {
40
+ return s < 0 ? Math.ceil(s) || 0 : Math.floor(s);
41
+ }, p: function(s) {
42
+ return { M: S, y: x, w: P, d: w, D: Y, h: j, m: M, s: D, ms: y, Q: W }[s] || String(s || "").toLowerCase().replace(/s$/, "");
43
+ }, u: function(s) {
44
+ return s === void 0;
45
+ } }, I = "en", R = {};
46
+ R[I] = Q;
47
+ var K = "$isDayjsObject", Z = function(s) {
48
+ return s instanceof v || !(!s || !s[K]);
49
+ }, d = function s(t, e, n) {
50
+ var r;
51
+ if (!t)
52
+ return I;
53
+ if (typeof t == "string") {
54
+ var a = t.toLowerCase();
55
+ R[a] && (r = a), e && (R[a] = e, r = a);
56
+ var i = t.split("-");
57
+ if (!r && i.length > 1)
58
+ return s(i[0]);
59
+ } else {
60
+ var p = t.name;
61
+ R[p] = t, r = p;
140
62
  }
141
- const mergedBlob = new Blob(chunks, { type: file.type });
142
- resolve(mergedBlob);
143
- });
144
- };
145
- const fileImport = async (importFunc, file, options, needProgress = true, errPathName = "", isBatch = false) => {
146
- tempErrPathName = errPathName;
147
- if (needProgress) {
148
- progressStatus.value = "normal";
149
- percent.value = 0;
150
- progressTitle.value = "\u5BFC\u5165\u8FDB\u5EA6";
151
- showProgressDialog.value = true;
152
- progressResult.value = "";
63
+ return !n && r && (I = r), r || !n && I;
64
+ }, o = function(s, t) {
65
+ if (Z(s))
66
+ return s.clone();
67
+ var e = typeof t == "object" ? t : {};
68
+ return e.date = s, e.args = arguments, new v(e);
69
+ }, u = z;
70
+ u.l = d, u.i = Z, u.w = function(s, t) {
71
+ return o(s, { locale: t.$L, utc: t.$u, x: t.$x, $offset: t.$offset });
72
+ };
73
+ var v = function() {
74
+ function s(e) {
75
+ this.$L = d(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[K] = !0;
76
+ }
77
+ var t = s.prototype;
78
+ return t.parse = function(e) {
79
+ this.$d = function(n) {
80
+ var r = n.date, a = n.utc;
81
+ if (r === null)
82
+ return /* @__PURE__ */ new Date(NaN);
83
+ if (u.u(r))
84
+ return /* @__PURE__ */ new Date();
85
+ if (r instanceof Date)
86
+ return new Date(r);
87
+ if (typeof r == "string" && !/Z$/i.test(r)) {
88
+ var i = r.match(V);
89
+ if (i) {
90
+ var p = i[2] - 1 || 0, h = (i[7] || "0").substring(0, 3);
91
+ return a ? new Date(Date.UTC(i[1], p, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, h)) : new Date(i[1], p, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, h);
92
+ }
93
+ }
94
+ return new Date(r);
95
+ }(e), this.init();
96
+ }, t.init = function() {
97
+ var e = this.$d;
98
+ 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();
99
+ }, t.$utils = function() {
100
+ return u;
101
+ }, t.isValid = function() {
102
+ return this.$d.toString() !== J;
103
+ }, t.isSame = function(e, n) {
104
+ var r = o(e);
105
+ return this.startOf(n) <= r && r <= this.endOf(n);
106
+ }, t.isAfter = function(e, n) {
107
+ return o(e) < this.startOf(n);
108
+ }, t.isBefore = function(e, n) {
109
+ return this.endOf(n) < o(e);
110
+ }, t.$g = function(e, n, r) {
111
+ return u.u(e) ? this[n] : this.set(r, e);
112
+ }, t.unix = function() {
113
+ return Math.floor(this.valueOf() / 1e3);
114
+ }, t.valueOf = function() {
115
+ return this.$d.getTime();
116
+ }, t.startOf = function(e, n) {
117
+ var r = this, a = !!u.u(n) || n, i = u.p(e), p = function(N, T) {
118
+ var B = u.w(r.$u ? Date.UTC(r.$y, T, N) : new Date(r.$y, T, N), r);
119
+ return a ? B : B.endOf(w);
120
+ }, h = function(N, T) {
121
+ return u.w(r.toDate()[N].apply(r.toDate("s"), (a ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(T)), r);
122
+ }, $ = this.$W, g = this.$M, b = this.$D, L = "set" + (this.$u ? "UTC" : "");
123
+ switch (i) {
124
+ case x:
125
+ return a ? p(1, 0) : p(31, 11);
126
+ case S:
127
+ return a ? p(1, g) : p(0, g + 1);
128
+ case P:
129
+ var O = this.$locale().weekStart || 0, H = ($ < O ? $ + 7 : $) - O;
130
+ return p(a ? b - H : b + (6 - H), g);
131
+ case w:
132
+ case Y:
133
+ return h(L + "Hours", 0);
134
+ case j:
135
+ return h(L + "Minutes", 1);
136
+ case M:
137
+ return h(L + "Seconds", 2);
138
+ case D:
139
+ return h(L + "Milliseconds", 3);
140
+ default:
141
+ return this.clone();
142
+ }
143
+ }, t.endOf = function(e) {
144
+ return this.startOf(e, !1);
145
+ }, t.$set = function(e, n) {
146
+ var r, a = u.p(e), i = "set" + (this.$u ? "UTC" : ""), p = (r = {}, r[w] = i + "Date", r[Y] = i + "Date", r[S] = i + "Month", r[x] = i + "FullYear", r[j] = i + "Hours", r[M] = i + "Minutes", r[D] = i + "Seconds", r[y] = i + "Milliseconds", r)[a], h = a === w ? this.$D + (n - this.$W) : n;
147
+ if (a === S || a === x) {
148
+ var $ = this.clone().set(Y, 1);
149
+ $.$d[p](h), $.init(), this.$d = $.set(Y, Math.min(this.$D, $.daysInMonth())).$d;
150
+ } else
151
+ p && this.$d[p](h);
152
+ return this.init(), this;
153
+ }, t.set = function(e, n) {
154
+ return this.clone().$set(e, n);
155
+ }, t.get = function(e) {
156
+ return this[u.p(e)]();
157
+ }, t.add = function(e, n) {
158
+ var r, a = this;
159
+ e = Number(e);
160
+ var i = u.p(n), p = function(g) {
161
+ var b = o(a);
162
+ return u.w(b.date(b.date() + Math.round(g * e)), a);
163
+ };
164
+ if (i === S)
165
+ return this.set(S, this.$M + e);
166
+ if (i === x)
167
+ return this.set(x, this.$y + e);
168
+ if (i === w)
169
+ return p(1);
170
+ if (i === P)
171
+ return p(7);
172
+ var h = (r = {}, r[M] = c, r[j] = k, r[D] = m, r)[i] || 1, $ = this.$d.getTime() + e * h;
173
+ return u.w($, this);
174
+ }, t.subtract = function(e, n) {
175
+ return this.add(-1 * e, n);
176
+ }, t.format = function(e) {
177
+ var n = this, r = this.$locale();
178
+ if (!this.isValid())
179
+ return r.invalidDate || J;
180
+ var a = e || "YYYY-MM-DDTHH:mm:ssZ", i = u.z(this), p = this.$H, h = this.$m, $ = this.$M, g = r.weekdays, b = r.months, L = r.meridiem, O = function(T, B, q, F) {
181
+ return T && (T[B] || T(n, a)) || q[B].slice(0, F);
182
+ }, H = function(T) {
183
+ return u.s(p % 12 || 12, T, "0");
184
+ }, N = L || function(T, B, q) {
185
+ var F = T < 12 ? "AM" : "PM";
186
+ return q ? F.toLowerCase() : F;
187
+ };
188
+ return a.replace(G, function(T, B) {
189
+ return B || function(q) {
190
+ switch (q) {
191
+ case "YY":
192
+ return String(n.$y).slice(-2);
193
+ case "YYYY":
194
+ return u.s(n.$y, 4, "0");
195
+ case "M":
196
+ return $ + 1;
197
+ case "MM":
198
+ return u.s($ + 1, 2, "0");
199
+ case "MMM":
200
+ return O(r.monthsShort, $, b, 3);
201
+ case "MMMM":
202
+ return O(b, $);
203
+ case "D":
204
+ return n.$D;
205
+ case "DD":
206
+ return u.s(n.$D, 2, "0");
207
+ case "d":
208
+ return String(n.$W);
209
+ case "dd":
210
+ return O(r.weekdaysMin, n.$W, g, 2);
211
+ case "ddd":
212
+ return O(r.weekdaysShort, n.$W, g, 3);
213
+ case "dddd":
214
+ return g[n.$W];
215
+ case "H":
216
+ return String(p);
217
+ case "HH":
218
+ return u.s(p, 2, "0");
219
+ case "h":
220
+ return H(1);
221
+ case "hh":
222
+ return H(2);
223
+ case "a":
224
+ return N(p, h, !0);
225
+ case "A":
226
+ return N(p, h, !1);
227
+ case "m":
228
+ return String(h);
229
+ case "mm":
230
+ return u.s(h, 2, "0");
231
+ case "s":
232
+ return String(n.$s);
233
+ case "ss":
234
+ return u.s(n.$s, 2, "0");
235
+ case "SSS":
236
+ return u.s(n.$ms, 3, "0");
237
+ case "Z":
238
+ return i;
239
+ }
240
+ return null;
241
+ }(T) || i.replace(":", "");
242
+ });
243
+ }, t.utcOffset = function() {
244
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
245
+ }, t.diff = function(e, n, r) {
246
+ var a, i = this, p = u.p(n), h = o(e), $ = (h.utcOffset() - this.utcOffset()) * c, g = this - h, b = function() {
247
+ return u.m(i, h);
248
+ };
249
+ switch (p) {
250
+ case x:
251
+ a = b() / 12;
252
+ break;
253
+ case S:
254
+ a = b();
255
+ break;
256
+ case W:
257
+ a = b() / 3;
258
+ break;
259
+ case P:
260
+ a = (g - $) / 6048e5;
261
+ break;
262
+ case w:
263
+ a = (g - $) / 864e5;
264
+ break;
265
+ case j:
266
+ a = g / k;
267
+ break;
268
+ case M:
269
+ a = g / c;
270
+ break;
271
+ case D:
272
+ a = g / m;
273
+ break;
274
+ default:
275
+ a = g;
276
+ }
277
+ return r ? a : u.a(a);
278
+ }, t.daysInMonth = function() {
279
+ return this.endOf(S).$D;
280
+ }, t.$locale = function() {
281
+ return R[this.$L];
282
+ }, t.locale = function(e, n) {
283
+ if (!e)
284
+ return this.$L;
285
+ var r = this.clone(), a = d(e, n, !0);
286
+ return a && (r.$L = a), r;
287
+ }, t.clone = function() {
288
+ return u.w(this.$d, this);
289
+ }, t.toDate = function() {
290
+ return new Date(this.valueOf());
291
+ }, t.toJSON = function() {
292
+ return this.isValid() ? this.toISOString() : null;
293
+ }, t.toISOString = function() {
294
+ return this.$d.toISOString();
295
+ }, t.toString = function() {
296
+ return this.$d.toUTCString();
297
+ }, s;
298
+ }(), A = v.prototype;
299
+ return o.prototype = A, [["$ms", y], ["$s", D], ["$m", M], ["$H", j], ["$W", w], ["$M", S], ["$y", x], ["$D", Y]].forEach(function(s) {
300
+ A[s[1]] = function(t) {
301
+ return this.$g(t, s[0], s[1]);
302
+ };
303
+ }), o.extend = function(s, t) {
304
+ return s.$i || (s(t, v, o), s.$i = !0), o;
305
+ }, o.locale = d, o.isDayjs = Z, o.unix = function(s) {
306
+ return o(1e3 * s);
307
+ }, o.en = R[I], o.Ls = R, o.p = {}, o;
308
+ });
309
+ })(se);
310
+ var oe = se.exports;
311
+ const ue = /* @__PURE__ */ ie(oe), ee = () => {
312
+ let f = { ...(window == null ? void 0 : window.config) || {} };
313
+ f.rootContainer || (f.rootContainer = "#app"), f.baseURL || (f.baseURL = location.origin), f.ossBaseURL || (f.ossBaseURL = "/oss"), f.ossBaseURL.startsWith("/") && (f.ossBaseURL = `${f.baseURL}/oss`), f.ssoBaseURL || (f.ssoBaseURL = f.baseURL);
314
+ let { microAppName: m, publicPath: c, mainAppName: k } = f;
315
+ return m && !0 && !c && (c = `/${m}/`.replace(/\/\//g, "/")), c || (c = "/"), f.publicPath = c, f.autoOssBucket || (f.autoOssBucket = k || m), f;
316
+ }, ce = X.get("token"), le = X.post("putObject", (l) => (l.headers || (l.headers = {}), l.headers["Content-Type"] = "multipart/form-data", l.responseType = "blob", l)), fe = X.post("upload-objects", (l) => (l.headers || (l.headers = {}), l.headers["Content-Type"] = "multipart/form-data", l.responseType = "blob", l)), de = re.get("progress"), $e = () => {
317
+ let l = U(!1), f = U(""), m = U(0), c = U("normal"), k = U(!1), y, D = U(""), M = U(""), j = U(""), w = U(""), P = U(!1), S = U(""), W = "", x;
318
+ const Y = () => {
319
+ M.value = "", j.value = "", w.value = "", P.value = !1, S.value = "";
320
+ }, J = async () => {
321
+ const [d, o] = await ce().run();
322
+ return d ? { stauts: !1 } : { status: !0, data: o };
323
+ }, V = (d) => new Promise((o, u) => {
324
+ const A = [];
325
+ let s = 0;
326
+ for (; s < d.size; ) {
327
+ const e = d.slice(s, s + 1048576);
328
+ A.push(e), s += 1048576;
153
329
  }
154
- fileInfo = file;
155
- const tokenResult = await getMinioConfig();
156
- if (!tokenResult.status)
330
+ const t = new Blob(A, { type: d.type });
331
+ o(t);
332
+ }), G = async (d, o, u, v = !0, A = "", s = !1) => {
333
+ W = A, v && (c.value = "normal", m.value = 0, f.value = "导入进度", l.value = !0, D.value = ""), x = o;
334
+ const t = await J();
335
+ if (!t.status)
157
336
  return;
158
- let minioConfig = tokenResult.data;
159
- let params = null;
160
- let { autoContentType, bucketName, importFileName } = options;
161
- const fn = isBatch ? importMultiMinio : importMinio;
162
- if (isBatch) {
163
- let blobList = [];
164
- await file.forEach(async (ele) => {
165
- let blob = await readFileAndAddToMap(ele);
166
- blobList.push(blob);
167
- });
168
- params = new FormData();
169
- params.append("accessKeyId", minioConfig.accessKeyId);
170
- params.append("secretAccessKey", minioConfig.secretAccessKey);
171
- params.append("sessionToken", minioConfig.sessionToken);
172
- params.append("bucketName", bucketName);
173
- file.forEach((v, i) => {
174
- params.append("file", blobList[i]);
175
- });
176
- importFileName.forEach((v) => {
177
- params.append("filePaths", v);
337
+ let e = t.data, n = null, { autoContentType: r, bucketName: a, importFileName: i } = u;
338
+ const p = s ? fe : le;
339
+ if (s) {
340
+ let L = [];
341
+ await o.forEach(async (O) => {
342
+ let H = await V(O);
343
+ L.push(H);
344
+ }), n = new FormData(), n.append("accessKeyId", e.accessKeyId), n.append("secretAccessKey", e.secretAccessKey), n.append("sessionToken", e.sessionToken), n.append("bucketName", a), o.forEach((O, H) => {
345
+ n.append("file", L[H]);
346
+ }), i.forEach((O) => {
347
+ n.append("filePaths", O);
178
348
  });
179
349
  } else {
180
- const blob = await readFileAndAddToMap(file);
181
- params = {
182
- accessKeyId: minioConfig.accessKeyId,
183
- secretAccessKey: minioConfig.secretAccessKey,
184
- sessionToken: minioConfig.sessionToken,
185
- file: blob,
186
- bucketName,
187
- filePath: importFileName,
188
- autoContentType
350
+ const L = await V(o);
351
+ n = {
352
+ accessKeyId: e.accessKeyId,
353
+ secretAccessKey: e.secretAccessKey,
354
+ sessionToken: e.sessionToken,
355
+ file: L,
356
+ bucketName: a,
357
+ filePath: i,
358
+ autoContentType: r
189
359
  };
190
360
  }
191
- const [error, data] = await fn(params).run();
192
- if (error)
361
+ const [h, $] = await p(n).run();
362
+ if (h)
193
363
  return;
194
- const toStringData = await toStringObject(data.data);
195
- const importResult = await importFunc?.(toStringData);
196
- if (needProgress) {
197
- if (!importResult.status) {
198
- showProgressDialog.value = false;
199
- progressStatus.value = "error";
364
+ const g = await he($.data), b = await (d == null ? void 0 : d(g));
365
+ if (v) {
366
+ if (!b.status) {
367
+ l.value = !1, c.value = "error";
200
368
  return;
201
369
  }
202
- progressTitle.value = "\u5BFC\u5165\u8FDB\u5EA6";
203
- showProgressDialog.value = true;
204
- checkProgress(importResult.taskId, "import", "");
370
+ f.value = "导入进度", l.value = !0, z(b.taskId, "import", "");
205
371
  } else {
206
- if (!importResult.status)
372
+ if (!b.status)
207
373
  return;
208
- progressStatus.value = "success";
374
+ c.value = "success";
209
375
  }
210
- };
211
- const fileAction = async (exportFunc, fileName = "", actionTitle = "") => {
212
- progressStatus.value = "normal";
213
- percent.value = 0;
214
- progressTitle.value = actionTitle || "\u5BFC\u51FA\u8FDB\u5EA6";
215
- showProgressDialog.value = true;
216
- const importResult = await exportFunc?.();
217
- if (!importResult.status) {
218
- showProgressDialog.value = false;
219
- progressStatus.value = "error";
376
+ }, Q = async (d, o = "", u = "") => {
377
+ c.value = "normal", m.value = 0, f.value = u || "导出进度", l.value = !0;
378
+ const v = await (d == null ? void 0 : d());
379
+ if (!v.status) {
380
+ l.value = !1, c.value = "error";
220
381
  return;
221
382
  }
222
- checkProgress(importResult.taskId, "action", "");
223
- };
224
- const fileExport = async (exportFunc, fileName = "", fileSuffix = "") => {
225
- progressStatus.value = "normal";
226
- percent.value = 0;
227
- progressTitle.value = "\u5BFC\u51FA\u8FDB\u5EA6";
228
- showProgressDialog.value = true;
229
- const importResult = await exportFunc?.();
230
- if (!importResult.status) {
231
- showProgressDialog.value = false;
232
- progressStatus.value = "error";
383
+ z(v.taskId, "action", "");
384
+ }, E = async (d, o = "", u = "") => {
385
+ c.value = "normal", m.value = 0, f.value = "导出进度", l.value = !0;
386
+ const v = await (d == null ? void 0 : d());
387
+ if (!v.status) {
388
+ l.value = !1, c.value = "error";
233
389
  return;
234
390
  }
235
- dayjs().format("YYYYMMDDHHmmss") + ".xlsx";
236
- checkProgress(importResult.taskId, "export", fileName ? fileName : "", fileSuffix);
237
- };
238
- const checkProgress = async (taskId, type, fileName, fileSuffix = "") => {
239
- progressLoading.value = true;
240
- getProgress(taskId, type, fileName, fileSuffix);
241
- progressTimer = setTimeout(() => {
391
+ ue().format("YYYYMMDDHHmmss") + "", z(v.taskId, "export", o || "", u);
392
+ }, z = async (d, o, u, v = "") => {
393
+ k.value = !0, R(d, o, u, v), y = setTimeout(() => {
242
394
  }, 50);
243
- };
244
- const clearTimer = () => {
245
- clearTimeout(progressTimer);
246
- progressTimer = null;
247
- showProgressDialog.value = false;
248
- };
249
- const getProgress = async (taskId, type = "export", fileName, fileSuffix = "") => {
250
- const [error, data] = await getTaskProgress("", {
251
- url: `progress/${taskId}`
395
+ }, I = () => {
396
+ clearTimeout(y), y = null, l.value = !1;
397
+ }, R = async (d, o = "export", u, v = "") => {
398
+ var e, n;
399
+ const [A, s] = await de("", {
400
+ url: `progress/${d}`
252
401
  }).run();
253
- if (error) {
254
- progressLoading.value = false;
402
+ if (A) {
403
+ k.value = !1;
255
404
  return;
256
405
  }
257
- percent.value = data.percentage;
258
- const tip = type == "export" ? "\u5BFC\u51FA" : "\u5BFC\u5165";
259
- if (percent.value == 100) {
260
- progressResult.value = data;
261
- progressLoading.value = false;
262
- clearTimer();
263
- if (type == "export") {
264
- if (data.status == 1) {
265
- progressStatus.value = "success";
266
- downloadFile(`${getConfig().baseURL}/oss${data.filePath}`, fileName, fileSuffix);
267
- progressLoading.value = false;
268
- } else if (data.status == 2) {
269
- errorMessage.value = data.message || `${tip}\u5931\u8D25`;
270
- }
271
- } else if (type == "import") {
272
- if (!!data.filePath) {
273
- progressStatus.value = "error";
274
- const matchName = fileInfo.name?.match(/(.*?)(\.[^.]*$|$)/);
275
- const suffix = matchName.length ? matchName[2] : "";
276
- errorImport.value = true;
277
- const pathName = data.filePath?.replace(/(.*\/)*([^.]+).*/gi, "$2");
278
- errorFileName.value = tempErrPathName ? tempErrPathName : `${pathName}${suffix}`;
279
- errorFileSize.value = fileInfo.sizeText;
280
- 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";
281
- errorFilePath.value = `${getConfig().baseURL}/oss${data.filePath}`;
406
+ m.value = s.percentage;
407
+ const t = o == "export" ? "导出" : "导入";
408
+ if (m.value == 100)
409
+ if (D.value = s, k.value = !1, I(), o == "export")
410
+ s.status == 1 ? (c.value = "success", te(`${ee().baseURL}/oss${s.filePath}`, u, v), k.value = !1) : s.status == 2 && (w.value = s.message || `${t}失败`);
411
+ else if (o == "import") {
412
+ if (s.filePath) {
413
+ c.value = "error";
414
+ const r = (e = x.name) == null ? void 0 : e.match(/(.*?)(\.[^.]*$|$)/), a = r.length ? r[2] : "";
415
+ P.value = !0;
416
+ const i = (n = s.filePath) == null ? void 0 : n.replace(/(.*\/)*([^.]+).*/gi, "$2");
417
+ M.value = W || `${i}${a}`, j.value = x.sizeText, w.value = "部分数据校验不通过,请下载附件并修改,重新导入!", S.value = `${ee().baseURL}/oss${s.filePath}`;
282
418
  }
283
- tipHandle(data.status, tip, data.message);
284
- } else if (type == "action") {
285
- progressStatus.value = "success";
286
- }
287
- } else {
288
- if (progressTimer && data.status != 2) {
289
- progressTimer = setTimeout(() => {
290
- getProgress(taskId, type, fileName, fileSuffix);
291
- }, 50);
292
- } else {
293
- progressResult.value = data;
294
- progressLoading.value = false;
295
- tipHandle(data.status, tip, data.message);
296
- clearTimer();
297
- errorImport.value = true;
298
- errorMessage.value = data?.message || "";
299
- }
300
- }
301
- };
302
- const tipHandle = (status, tip, message) => {
303
- if (status == 1) {
304
- progressStatus.value = "success";
305
- errorFileName.value = "";
306
- errorFileSize.value = "";
307
- errorMessage.value = "";
308
- } else if (status == 2) {
309
- progressStatus.value = "error";
310
- 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";
311
- } else if (status == 3) {
312
- progressStatus.value = "error";
313
- }
314
- };
315
- const generateUniqueName = (fileName) => {
316
- const matchName = fileName?.match(/(.*?)(\.[^.]*$|$)/);
317
- const suffix = matchName.length ? matchName[2] : "";
318
- const name = matchName.length ? matchName[1] : fileName;
319
- return `${name}${nanoid()}${suffix}`;
419
+ K(s.status, t, s.message);
420
+ } else
421
+ o == "action" && (c.value = "success");
422
+ else
423
+ y && s.status != 2 ? y = setTimeout(() => {
424
+ R(d, o, u, v);
425
+ }, 50) : (D.value = s, k.value = !1, K(s.status, t, s.message), I(), P.value = !0, w.value = (s == null ? void 0 : s.message) || "");
426
+ }, K = (d, o, u) => {
427
+ d == 1 ? (c.value = "success", M.value = "", j.value = "", w.value = "") : d == 2 ? (c.value = "error", w.value = u || "部分数据校验不通过,请下载附件并修改,重新导入!") : d == 3 && (c.value = "error");
320
428
  };
321
429
  return {
322
- showProgressDialog,
323
- progressTitle,
324
- percent,
325
- progressStatus,
326
- progressLoading,
327
- progressResult,
328
- errorFileName,
329
- errorFileSize,
330
- errorMessage,
331
- errorImport,
332
- errorFilePath,
333
- fileImport,
334
- fileExport,
335
- fileAction,
336
- generateUniqueName,
337
- downloadFile,
338
- resetStataus,
339
- checkProgress
430
+ showProgressDialog: l,
431
+ progressTitle: f,
432
+ percent: m,
433
+ progressStatus: c,
434
+ progressLoading: k,
435
+ progressResult: D,
436
+ errorFileName: M,
437
+ errorFileSize: j,
438
+ errorMessage: w,
439
+ errorImport: P,
440
+ errorFilePath: S,
441
+ fileImport: G,
442
+ fileExport: E,
443
+ fileAction: Q,
444
+ generateUniqueName: (d) => {
445
+ const o = d == null ? void 0 : d.match(/(.*?)(\.[^.]*$|$)/), u = o.length ? o[2] : "";
446
+ return `${o.length ? o[1] : d}${ne()}${u}`;
447
+ },
448
+ downloadFile: te,
449
+ resetStataus: Y,
450
+ checkProgress: z
340
451
  };
341
- };
342
- const fileBobType = (type) => {
343
- let tempType = type?.toLocaleLowerCase();
344
- let typeList = {
452
+ }, pe = (l) => {
453
+ let f = l == null ? void 0 : l.toLocaleLowerCase();
454
+ return {
345
455
  excel: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
346
456
  pdf: "application/pdf",
347
457
  doc: "application/msword",
@@ -367,43 +477,28 @@ const fileBobType = (type) => {
367
477
  crt: "application/x-x509-ca-cert",
368
478
  der: "application/x-x509-ca-cert",
369
479
  cer: "application/pkix-cert"
370
- };
371
- return typeList[tempType];
372
- };
373
- const downloadFile = (path, filename, fileSuffix = "excel") => {
374
- const xhr = new XMLHttpRequest();
375
- xhr.open("get", path);
376
- xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
377
- xhr.responseType = "blob";
378
- xhr.onload = function(e) {
379
- const blob = new Blob([this.response], {
380
- type: fileBobType(fileSuffix)
381
- });
382
- const objectUrl = URL.createObjectURL(blob);
383
- if (window.navigator.msSaveOrOpenBlob) {
384
- navigator.msSaveBlob(blob, filename);
385
- } else {
386
- const element = document.createElement("a");
387
- element.href = objectUrl;
388
- element.download = filename;
389
- element.click();
390
- window.URL.revokeObjectURL(objectUrl);
480
+ }[f];
481
+ }, te = (l, f, m = "excel") => {
482
+ const c = new XMLHttpRequest();
483
+ c.open("get", l), c.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), c.responseType = "blob", c.onload = function(k) {
484
+ const y = new Blob([this.response], {
485
+ type: pe(m)
486
+ }), D = URL.createObjectURL(y);
487
+ if (window.navigator.msSaveOrOpenBlob)
488
+ navigator.msSaveBlob(y, f);
489
+ else {
490
+ const M = document.createElement("a");
491
+ M.href = D, M.download = f, M.click(), window.URL.revokeObjectURL(D);
391
492
  }
392
- };
393
- xhr.send();
394
- };
395
- const toStringObject = (blob) => {
396
- return new Promise((resolve, reject) => {
397
- var reader = new FileReader();
398
- reader.onload = function(event) {
399
- let data = "";
400
- if (typeof reader.result == "string") {
401
- data = JSON.parse(reader.result);
402
- }
403
- resolve(data);
404
- };
405
- reader.readAsText(blob);
406
- });
493
+ }, c.send();
494
+ }, he = (l) => new Promise((f, m) => {
495
+ var c = new FileReader();
496
+ c.onload = function(k) {
497
+ let y = "";
498
+ typeof c.result == "string" && (y = JSON.parse(c.result)), f(y);
499
+ }, c.readAsText(l);
500
+ });
501
+ export {
502
+ te as downloadFile,
503
+ $e as useFile
407
504
  };
408
-
409
- export { downloadFile, useFile };