orion-design 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/_commonjsHelpers-BFTU3MAI.js +7 -0
  2. package/dist/bignumber-upqAL281.js +2907 -0
  3. package/dist/dayjs.min-CYqA_arp.js +12 -0
  4. package/dist/error/OrionError.d.ts +3 -0
  5. package/dist/error/OrionError.js +12 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +3 -0
  8. package/dist/print/LodopFuncs.d.ts +1 -0
  9. package/dist/print/LodopFuncs.js +159 -0
  10. package/dist/print/index.d.ts +25 -0
  11. package/dist/print/index.js +230 -0
  12. package/dist/request/ErrorHandlerChain.d.ts +9 -0
  13. package/dist/request/ErrorHandlerChain.js +18 -0
  14. package/dist/request/RequestFilterChain.d.ts +10 -0
  15. package/dist/request/RequestFilterChain.js +18 -0
  16. package/dist/request/ResponseParserChain.d.ts +10 -0
  17. package/dist/request/ResponseParserChain.js +18 -0
  18. package/dist/request/disivion/DateSerializer.d.ts +5 -0
  19. package/dist/request/disivion/DateSerializer.js +61 -0
  20. package/dist/request/disivion/DivisionErrorHandler.d.ts +6 -0
  21. package/dist/request/disivion/DivisionErrorHandler.js +59 -0
  22. package/dist/request/disivion/DivisionResponseParser.d.ts +5 -0
  23. package/dist/request/disivion/DivisionResponseParser.js +23 -0
  24. package/dist/request/disivion/index.d.ts +1 -0
  25. package/dist/request/disivion/index.js +28 -0
  26. package/dist/request/disivion/request.d.ts +21 -0
  27. package/dist/request/disivion/request.js +19345 -0
  28. package/dist/request/error/BizExceptionResponseError.d.ts +7 -0
  29. package/dist/request/error/BizExceptionResponseError.js +17 -0
  30. package/dist/request/error/ExceptionResponseError.d.ts +7 -0
  31. package/dist/request/error/ExceptionResponseError.js +17 -0
  32. package/dist/request/error/ResponseError.d.ts +5 -0
  33. package/dist/request/error/ResponseError.js +14 -0
  34. package/dist/request/error/SessionExceptionResponseError.d.ts +7 -0
  35. package/dist/request/error/SessionExceptionResponseError.js +17 -0
  36. package/dist/request/index.d.ts +1 -0
  37. package/dist/request/index.js +28 -0
  38. package/dist/request/postByOpenNewWindow.d.ts +1 -0
  39. package/dist/request/postByOpenNewWindow.js +41 -0
  40. package/dist/utils/DateUtil.d.ts +10 -0
  41. package/dist/utils/DateUtil.js +58 -0
  42. package/dist/utils/NumberUtil.d.ts +4 -0
  43. package/dist/utils/NumberUtil.js +10 -0
  44. package/dist/utils/cloneDeep.d.ts +1 -0
  45. package/dist/utils/cloneDeep.js +2255 -0
  46. package/dist/utils/delay.d.ts +1 -0
  47. package/dist/utils/delay.js +5 -0
  48. package/dist/utils/index.d.ts +6 -0
  49. package/dist/utils/index.js +10 -0
  50. package/dist/utils/md5.d.ts +1 -0
  51. package/dist/utils/md5.js +326 -0
  52. package/dist/utils/uuid.d.ts +1 -0
  53. package/dist/utils/uuid.js +63 -0
  54. package/package.json +45 -0
@@ -0,0 +1,12 @@
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js';
2
+
3
+ var dayjs_min = {exports: {}};
4
+
5
+ (function (module, exports) {
6
+ !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}));
7
+ } (dayjs_min));
8
+
9
+ var dayjs_minExports = dayjs_min.exports;
10
+ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
11
+
12
+ export { dayjs as d };
@@ -0,0 +1,3 @@
1
+ export default class OrionError extends Error {
2
+ constructor(message: string, cause?: Error);
3
+ }
@@ -0,0 +1,12 @@
1
+ class OrionError extends Error {
2
+ constructor(message, cause) {
3
+ super(message, { cause });
4
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
5
+ if (Error.captureStackTrace) {
6
+ Error.captureStackTrace(this, OrionError);
7
+ }
8
+ this.name = 'OrionError';
9
+ }
10
+ }
11
+
12
+ export { OrionError as default };
@@ -0,0 +1 @@
1
+ export declare function helloworld(): void;
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ function helloworld() { }
2
+
3
+ export { helloworld };
@@ -0,0 +1 @@
1
+ export declare function getLodop(oOBJECT: any, oEMBED: any): any;
@@ -0,0 +1,159 @@
1
+ //@ts-nocheck
2
+ //==本JS是加载Lodop插件及CLodop服务的综合示例,可直接使用,建议看懂后融进自己页面程序==
3
+ var CreatedOKLodopObject, CLodopIsLocal;
4
+ //==判断是否需要CLodop(那些不支持插件的浏览器):==
5
+ function needCLodop() {
6
+ try {
7
+ var ua = navigator.userAgent;
8
+ if (ua.match(/Windows\sPhone/i))
9
+ return true;
10
+ if (ua.match(/iPhone|iPod|iPad/i))
11
+ return true;
12
+ if (ua.match(/Android/i))
13
+ return true;
14
+ if (ua.match(/Edge\D?\d+/i))
15
+ return true;
16
+ var verTrident = ua.match(/Trident\D?\d+/i);
17
+ var verIE = ua.match(/MSIE\D?\d+/i);
18
+ var verOPR = ua.match(/OPR\D?\d+/i);
19
+ var verFF = ua.match(/Firefox\D?\d+/i);
20
+ var x64 = ua.match(/x64/i);
21
+ if (!verTrident && !verIE && x64)
22
+ return true;
23
+ else if (verFF) {
24
+ verFF = verFF[0].match(/\d+/);
25
+ if (verFF[0] >= 41 || x64)
26
+ return true;
27
+ }
28
+ else if (verOPR) {
29
+ verOPR = verOPR[0].match(/\d+/);
30
+ if (verOPR[0] >= 32)
31
+ return true;
32
+ }
33
+ else if (!verTrident && !verIE) {
34
+ var verChrome = ua.match(/Chrome\D?\d+/i);
35
+ if (verChrome) {
36
+ verChrome = verChrome[0].match(/\d+/);
37
+ if (verChrome[0] >= 41)
38
+ return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ catch (err) {
44
+ return true;
45
+ }
46
+ }
47
+ //==引用CLodop的主JS,用双端口8000和18000(以防其中一个被占):==
48
+ if (needCLodop()) {
49
+ var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement;
50
+ var JS1 = document.createElement('script');
51
+ JS1.src = 'http://localhost:8000/CLodopfuncs.js?priority=1';
52
+ JS1.async = true;
53
+ JS1.defer = true;
54
+ head.insertBefore(JS1, head.firstChild);
55
+ var JS2 = document.createElement('script');
56
+ JS2.async = true;
57
+ JS2.defer = true;
58
+ JS2.src = 'http://localhost:18000/CLodopfuncs.js?priority=0';
59
+ head.insertBefore(JS2, head.firstChild);
60
+ CLodopIsLocal = !!(JS1.src + JS2.src).match(/\/\/localho|\/\/127.0.0./i);
61
+ if (JS1.attachEvent) {
62
+ var onChange = function () {
63
+ if (window.event.srcElement.readyState == 'loaded')
64
+ ;
65
+ };
66
+ JS1.attachEvent('onreadystatechange', onChange);
67
+ JS2.attachEvent('onreadystatechange', onChange);
68
+ }
69
+ }
70
+ //==获取LODOP对象主过程,判断是否安装、需否升级:==
71
+ function getLodop(oOBJECT, oEMBED) {
72
+ // dareway
73
+ var strHtmInstall = "<br><font color='#FF00FF'>打印控件未安装!安装后请刷新页面或重新进入。</font>";
74
+ var strHtmUpdate = "<br><font color='#FF00FF'>打印控件需要升级!升级后请重新进入。</font>";
75
+ var strHtm64_Install = "<br><font color='#FF00FF'>打印控件未安装!安装后请刷新页面或重新进入。</font>";
76
+ var strHtm64_Update = "<br><font color='#FF00FF'>打印控件需要升级!升级后请重新进入。</font>";
77
+ var strHtmFireFox = "<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
78
+ var strHtmChrome = "<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
79
+ var strCLodopInstall_1 = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动";
80
+ var strCLodopInstall_2 = '<br>(若此前已安装过,请确认是否打开)';
81
+ var strCLodopInstall_3 = ',成功后请刷新本页面。</font>';
82
+ var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!升级后请刷新页面。</font>";
83
+ // dareway
84
+ var LODOP;
85
+ try {
86
+ var ua = navigator.userAgent;
87
+ var isIE = !!ua.match(/MSIE/i) || !!ua.match(/Trident/i);
88
+ if (needCLodop()) {
89
+ try {
90
+ LODOP = getCLodop();
91
+ }
92
+ catch (err) { }
93
+ if (!LODOP /* && (document.readyState !== "complete" || (isIE && CLodopJsState == "loading"))*/) {
94
+ console.log('lodop控件加载失败,请检查lodop控件是否已经安装并启动,如未启动可以在系统托盘中【右键->启动智慧医院打印服务】手动启动。');
95
+ return;
96
+ }
97
+ if (!LODOP) {
98
+ document.body.innerHTML = strCLodopInstall_1 + (CLodopIsLocal ? strCLodopInstall_2 : '') + strCLodopInstall_3 + document.body.innerHTML;
99
+ return;
100
+ }
101
+ else {
102
+ if (CLODOP.CVERSION < '4.0.8.8') {
103
+ document.body.innerHTML = strCLodopUpdate + document.body.innerHTML;
104
+ }
105
+ if (oEMBED && oEMBED.parentNode)
106
+ oEMBED.parentNode.removeChild(oEMBED);
107
+ if (oOBJECT && oOBJECT.parentNode)
108
+ oOBJECT.parentNode.removeChild(oOBJECT);
109
+ }
110
+ }
111
+ else {
112
+ var is64IE = isIE && !!ua.match(/x64/i);
113
+ //==如果页面有Lodop就直接使用,否则新建:==
114
+ if (oOBJECT || oEMBED) {
115
+ if (isIE)
116
+ LODOP = oOBJECT;
117
+ else
118
+ LODOP = oEMBED;
119
+ }
120
+ else if (!CreatedOKLodopObject) {
121
+ LODOP = document.createElement('object');
122
+ LODOP.setAttribute('width', 0);
123
+ LODOP.setAttribute('height', 0);
124
+ LODOP.setAttribute('style', 'position:absolute;left:0px;top:-100px;width:0px;height:0px;');
125
+ if (isIE)
126
+ LODOP.setAttribute('classid', 'clsid:2105C259-1E0C-4534-8141-A753534CB4CA');
127
+ else
128
+ LODOP.setAttribute('type', 'application/x-print-lodop');
129
+ document.documentElement.appendChild(LODOP);
130
+ CreatedOKLodopObject = LODOP;
131
+ }
132
+ else
133
+ LODOP = CreatedOKLodopObject;
134
+ //==Lodop插件未安装时提示下载地址:==
135
+ if (!LODOP || !LODOP.VERSION) {
136
+ if (ua.indexOf('Chrome') >= 0)
137
+ document.body.innerHTML = strHtmChrome + document.body.innerHTML;
138
+ if (ua.indexOf('Firefox') >= 0)
139
+ document.body.innerHTML = strHtmFireFox + document.body.innerHTML;
140
+ document.body.innerHTML = (is64IE ? strHtm64_Install : strHtmInstall) + document.body.innerHTML;
141
+ return LODOP;
142
+ }
143
+ }
144
+ if (LODOP.VERSION < '6.2.2.6') {
145
+ if (!needCLodop())
146
+ document.body.innerHTML = (is64IE ? strHtm64_Update : strHtmUpdate) + document.body.innerHTML;
147
+ }
148
+ //===如下空白位置适合调用统一功能(如注册语句、语言选择等):==
149
+ LODOP.SET_LICENSES('山大地纬软件股份有限公司', 'CC9365E1BB34FA000175B357CD91F188454', '山大地緯軟件股份有限公司', '82F5D8E72ECF427F20ADD7E937E13D817E1');
150
+ LODOP.SET_LICENSES('THIRD LICENSE', '', 'Shanda DareWay Software Co., Ltd', '1485033B74404D944BEA7FFAFB213175AF4');
151
+ //=======================================================
152
+ return LODOP;
153
+ }
154
+ catch (err) {
155
+ alert('getLodop出错:' + err);
156
+ }
157
+ }
158
+
159
+ export { getLodop };
@@ -0,0 +1,25 @@
1
+ export declare function lodopInit(): Promise<unknown>;
2
+ export declare function getPrinterList(): any[];
3
+ export declare function getPrinterNameList(): any[];
4
+ export declare function getDefaultPrinter(): Promise<any>;
5
+ export interface PrintParaI {
6
+ direction?: 1 | 2 | 3 | 0;
7
+ page_width?: number;
8
+ page_height?: number;
9
+ page_type?: string;
10
+ print_duplex?: 0 | 1 | 2 | 3;
11
+ print_defaultsource?: 0 | 1 | 4 | 7;
12
+ print_mode_map?: {
13
+ PRINT_PAGE_PERCENT: string;
14
+ };
15
+ }
16
+ export declare function preview(params: {
17
+ pdfurl: string;
18
+ print_para?: PrintParaI;
19
+ }): Promise<unknown>;
20
+ export declare function print(params: {
21
+ pdfurl: string;
22
+ print_para?: PrintParaI;
23
+ printer?: string | -1;
24
+ }): Promise<unknown>;
25
+ export declare function printNeedSelectPrinter(url: string, print_para?: PrintParaI): Promise<unknown>;
@@ -0,0 +1,230 @@
1
+ import OrionError from '../error/OrionError.js';
2
+ import { getLodop } from './LodopFuncs.js';
3
+
4
+ // @ts-nocheck
5
+ function lodopInit() {
6
+ // 获取lodop
7
+ const LODOP = getLodop();
8
+ return new Promise((resolve) => {
9
+ resolve(LODOP);
10
+ });
11
+ }
12
+ // 获取打印机列表
13
+ function getPrinterList() {
14
+ lodopInit();
15
+ const printers = [];
16
+ const count = LODOP.GET_PRINTER_COUNT();
17
+ for (let i = 0; i < count; i++) {
18
+ printers.push({
19
+ value: i,
20
+ content: LODOP.GET_PRINTER_NAME(i),
21
+ });
22
+ }
23
+ return printers;
24
+ }
25
+ // 获取打印机名称列表
26
+ function getPrinterNameList() {
27
+ lodopInit();
28
+ const printers = [];
29
+ const count = LODOP.GET_PRINTER_COUNT();
30
+ for (let i = 0; i < count; i++) {
31
+ const prname = LODOP.GET_PRINTER_NAME(i);
32
+ printers.push({
33
+ value: prname,
34
+ content: prname,
35
+ });
36
+ }
37
+ return printers;
38
+ }
39
+ //////////////////////////////////// 接口
40
+ // 获取默认打印机名称
41
+ async function getDefaultPrinter() {
42
+ const LODOP = await lodopInit();
43
+ return LODOP.GET_PRINTER_NAME(-1); // 获取默认打印机名称(-1是指定默认打印机)
44
+ }
45
+ // 无打印模板,预览打印
46
+ async function preview(params) {
47
+ if (!params) {
48
+ throw new OrionError('打印异常:入参为空,请检查');
49
+ }
50
+ const { pdfurl, print_para = {} } = params;
51
+ if (!pdfurl) {
52
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
53
+ }
54
+ const LODOP = await lodopInit();
55
+ //获取传入的打印参数
56
+ let page_width = 0;
57
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
58
+ page_width = print_para.page_width;
59
+ }
60
+ let page_height = 0;
61
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
62
+ page_height = print_para.page_height;
63
+ }
64
+ let page_type = '';
65
+ if (print_para.page_type) {
66
+ page_type = print_para.page_type;
67
+ }
68
+ let direction = 1;
69
+ if (print_para.direction) {
70
+ direction = print_para.direction;
71
+ }
72
+ let print_duplex = 0;
73
+ if (print_para.print_duplex) {
74
+ print_duplex = print_para.print_duplex;
75
+ }
76
+ let print_defaultsource = 0;
77
+ if (print_para.print_defaultsource) {
78
+ print_defaultsource = print_para.print_defaultsource;
79
+ }
80
+ // 历史问题,防止重复打印的问题
81
+ LODOP.PRINT_INIT('');
82
+ if (print_para.print_mode_map) {
83
+ Object.keys(print_para.print_mode_map).map((item) => {
84
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
85
+ });
86
+ }
87
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
88
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
89
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
90
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
91
+ LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
92
+ LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
93
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
94
+ return new Promise((resolve) => {
95
+ LODOP.On_Return = function (TaskID, Value) {
96
+ resolve(Value);
97
+ };
98
+ LODOP.PREVIEW();
99
+ });
100
+ }
101
+ async function print(params) {
102
+ if (!params) {
103
+ throw new OrionError('打印异常:入参为空,请检查');
104
+ }
105
+ const { pdfurl, print_para = {}, printer } = params;
106
+ if (!pdfurl) {
107
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
108
+ }
109
+ if (printer) {
110
+ return await printWithCertainPrinter(pdfurl, print_para, printer);
111
+ }
112
+ else {
113
+ // 没设置打印机
114
+ return await printNeedSelectPrinter(pdfurl, print_para);
115
+ }
116
+ }
117
+ async function printWithCertainPrinter(pdfurl, print_para = {}, pr_name) {
118
+ if (!pdfurl) {
119
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
120
+ }
121
+ if (!pr_name) {
122
+ throw new OrionError('打印异常:未设置打印机,无法进行打印');
123
+ }
124
+ //获取传入的打印参数
125
+ let page_width = 0;
126
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
127
+ page_width = print_para.page_width;
128
+ }
129
+ let page_height = 0;
130
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
131
+ page_height = print_para.page_height;
132
+ }
133
+ let page_type = '';
134
+ if (print_para.page_type) {
135
+ page_type = print_para.page_type;
136
+ }
137
+ let direction = 1;
138
+ if (print_para.direction) {
139
+ direction = print_para.direction;
140
+ }
141
+ let print_duplex = 0;
142
+ if (print_para.print_duplex) {
143
+ print_duplex = print_para.print_duplex;
144
+ }
145
+ let print_defaultsource = 0;
146
+ if (print_para.print_defaultsource) {
147
+ print_defaultsource = print_para.print_defaultsource;
148
+ }
149
+ const LODOP = await lodopInit();
150
+ // 指定打印设备(打印机)
151
+ LODOP.PRINT_INIT('');
152
+ // 设置了打印机
153
+ if (pr_name === -1) {
154
+ LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1));
155
+ }
156
+ else {
157
+ LODOP.SET_PRINTER_INDEXA(pr_name);
158
+ }
159
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
160
+ if (print_para.print_mode_map) {
161
+ Object.keys(print_para.print_mode_map).map((item) => {
162
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
163
+ });
164
+ }
165
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
166
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
167
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
168
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
169
+ return new Promise((resolve) => {
170
+ LODOP.On_Return = function (TaskID, Value) {
171
+ resolve(Value);
172
+ };
173
+ LODOP.PRINT();
174
+ });
175
+ }
176
+ // 无打印模板,直接打印,需要选择打印机
177
+ async function printNeedSelectPrinter(url, print_para = {}) {
178
+ if (url === null || url === '' || typeof url === 'undefined') {
179
+ throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印');
180
+ }
181
+ const LODOP = await lodopInit();
182
+ //获取传入的打印参数
183
+ let page_width = 0;
184
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
185
+ page_width = print_para.page_width;
186
+ }
187
+ let page_height = 0;
188
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
189
+ page_height = print_para.page_height;
190
+ }
191
+ let page_type = '';
192
+ if (print_para.page_type) {
193
+ page_type = print_para.page_type;
194
+ }
195
+ let direction = 1;
196
+ if (print_para.direction) {
197
+ direction = print_para.direction;
198
+ }
199
+ let print_duplex = 0;
200
+ if (print_para.print_duplex) {
201
+ print_duplex = print_para.print_duplex;
202
+ }
203
+ let print_defaultsource = 0;
204
+ if (print_para.print_defaultsource) {
205
+ print_defaultsource = print_para.print_defaultsource;
206
+ }
207
+ // 历史问题,防止重复打印的问题
208
+ LODOP.PRINT_INIT('');
209
+ if (print_para.print_mode_map) {
210
+ Object.keys(print_para.print_mode_map).map((item) => {
211
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
212
+ });
213
+ }
214
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
215
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
216
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
217
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url);
218
+ LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
219
+ LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
220
+ //返回打印机状态
221
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true);
222
+ return new Promise((resolve) => {
223
+ LODOP.On_Return = function (TaskID, Value) {
224
+ resolve(Value);
225
+ };
226
+ LODOP.PRINTA();
227
+ });
228
+ }
229
+
230
+ export { getDefaultPrinter, getPrinterList, getPrinterNameList, lodopInit, preview, print, printNeedSelectPrinter };
@@ -0,0 +1,9 @@
1
+ export interface ErrorHandler<T = Error> {
2
+ handle: (error: T, chain: ErrorHandlerChain) => void;
3
+ }
4
+ export default class ErrorHandlerChain<T = Error> {
5
+ private handlers;
6
+ private index;
7
+ constructor(handlers: Array<ErrorHandler<T>>);
8
+ handle(error: T, chain: ErrorHandlerChain): Promise<void>;
9
+ }
@@ -0,0 +1,18 @@
1
+ class ErrorHandlerChain {
2
+ handlers;
3
+ index;
4
+ constructor(handlers) {
5
+ this.handlers = handlers ? handlers : [];
6
+ this.index = 0;
7
+ }
8
+ async handle(error, chain) {
9
+ if (this.index == this.handlers.length) {
10
+ throw error;
11
+ }
12
+ const handler = this.handlers[this.index];
13
+ this.index++;
14
+ return await handler.handle(error, chain);
15
+ }
16
+ }
17
+
18
+ export { ErrorHandlerChain as default };
@@ -0,0 +1,10 @@
1
+ import type { AxiosRequestConfig } from 'axios';
2
+ export interface RequestFilter<T = AxiosRequestConfig> {
3
+ doFilter(request: T, chain: RequestFilterChain): void;
4
+ }
5
+ export default class RequestFilterChain<T = AxiosRequestConfig> {
6
+ private filters;
7
+ private index;
8
+ constructor(filters: Array<RequestFilter<T>>);
9
+ doFilter(request: T, chain: RequestFilterChain): void;
10
+ }
@@ -0,0 +1,18 @@
1
+ class RequestFilterChain {
2
+ filters;
3
+ index;
4
+ constructor(filters) {
5
+ this.filters = filters ? filters : [];
6
+ this.index = 0;
7
+ }
8
+ doFilter(request, chain) {
9
+ if (this.index == this.filters.length) {
10
+ return;
11
+ }
12
+ const filter = this.filters[this.index];
13
+ this.index++;
14
+ filter.doFilter(request, chain);
15
+ }
16
+ }
17
+
18
+ export { RequestFilterChain as default };
@@ -0,0 +1,10 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ export interface ResponseParser<T = AxiosResponse> {
3
+ parse(response: T, chain: ResponseParserChain): T;
4
+ }
5
+ export default class ResponseParserChain<T = AxiosResponse> {
6
+ private parsers;
7
+ private index;
8
+ constructor(parsers: Array<ResponseParser<T>>);
9
+ doParse(response: T, chain: ResponseParserChain): T;
10
+ }
@@ -0,0 +1,18 @@
1
+ class ResponseParserChain {
2
+ parsers;
3
+ index;
4
+ constructor(parsers) {
5
+ this.parsers = parsers ? parsers : [];
6
+ this.index = 0;
7
+ }
8
+ doParse(response, chain) {
9
+ if (this.index == this.parsers.length) {
10
+ return response;
11
+ }
12
+ const parser = this.parsers[this.index];
13
+ this.index++;
14
+ return parser.parse(response, chain);
15
+ }
16
+ }
17
+
18
+ export { ResponseParserChain as default };
@@ -0,0 +1,5 @@
1
+ export default class DateSerializer {
2
+ private format;
3
+ constructor(format?: string);
4
+ serialize(data: Record<string, unknown>): void;
5
+ }
@@ -0,0 +1,61 @@
1
+ import { d as dayjs } from '../../dayjs.min-CYqA_arp.js';
2
+ import '../../_commonjsHelpers-BFTU3MAI.js';
3
+
4
+ class DateSerializer {
5
+ format;
6
+ constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {
7
+ this.format = format;
8
+ }
9
+ serialize(data) {
10
+ const format = this.format;
11
+ function objTransfer(data) {
12
+ const result = {};
13
+ Object.keys(data).forEach((key) => {
14
+ const value = data[key];
15
+ if (value instanceof Date || dayjs.isDayjs(value)) {
16
+ result[key] = dayjs(value).format(format);
17
+ }
18
+ else if (value && value instanceof Object && !Array.isArray(value)) {
19
+ result[key] = objTransfer(value);
20
+ }
21
+ else if (value && Array.isArray(value)) {
22
+ result[key] = arrayTransfer(value);
23
+ }
24
+ else {
25
+ result[key] = value;
26
+ }
27
+ });
28
+ return result;
29
+ }
30
+ function arrayTransfer(data) {
31
+ return data.map((value) => {
32
+ if (value instanceof Date || dayjs.isDayjs(value)) {
33
+ return dayjs(value).format(format);
34
+ }
35
+ else if (value && value instanceof Object && !Array.isArray(value)) {
36
+ return objTransfer(value);
37
+ }
38
+ else if (value && Array.isArray(value)) {
39
+ return arrayTransfer(value);
40
+ }
41
+ else {
42
+ return value;
43
+ }
44
+ });
45
+ }
46
+ Object.keys(data).forEach((key) => {
47
+ const value = data[key];
48
+ if (value instanceof Date || dayjs.isDayjs(value)) {
49
+ data[key] = dayjs(value).format(this.format);
50
+ }
51
+ else if (value && typeof value == 'object' && !Array.isArray(value)) {
52
+ data[key] = objTransfer(value);
53
+ }
54
+ else if (value && Array.isArray(value)) {
55
+ data[key] = arrayTransfer(value);
56
+ }
57
+ });
58
+ }
59
+ }
60
+
61
+ export { DateSerializer as default };
@@ -0,0 +1,6 @@
1
+ import type ErrorHandlerChain from '../ErrorHandlerChain';
2
+ export declare function readBlob(blob: Blob): Promise<string>;
3
+ export default class DivisionErrorHandler {
4
+ constructor();
5
+ handle(error: Error, chain: ErrorHandlerChain): Promise<void>;
6
+ }