1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-17d1"],{19:function(e,t){},38:function(e,t){},39:function(e,t){},"S/jZ":function(e,t,n){"use strict";n.r(t),n.d(t,"export_table_to_excel",function(){return h}),n.d(t,"export_json_to_excel",function(){return f}),n.d(t,"export_json_to_excel2",function(){return p});var r=n("m1cH"),o=n.n(r),a=n("EUZL"),c=n.n(a);function u(e,t){return t&&(e+=1462),(Date.parse(e)-new Date(Date.UTC(1899,11,30)))/864e5}function i(e,t){for(var n={},r={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=0;o!=e.length;++o)for(var a=0;a!=e[o].length;++a){r.s.r>o&&(r.s.r=o),r.s.c>a&&(r.s.c=a),r.e.r<o&&(r.e.r=o),r.e.c<a&&(r.e.c=a);var i={v:e[o][a]};if(null!=i.v){var l=c.a.utils.encode_cell({c:a,r:o});"number"==typeof i.v?i.t="n":"boolean"==typeof i.v?i.t="b":i.v instanceof Date?(i.t="n",i.z=c.a.SSF._table[14],i.v=u(i.v)):i.t="s",n[l]=i}}return r.s.c<1e7&&(n["!ref"]=c.a.utils.encode_range(r)),n}function l(){if(!(this instanceof l))return new l;this.SheetNames=[],this.Sheets={}}function s(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r!=e.length;++r)n[r]=255&e.charCodeAt(r);return t}function h(e){var t=function(e){for(var t=[],n=e.querySelectorAll("tr"),r=[],o=0;o<n.length;++o){for(var a=[],c=n[o].querySelectorAll("td"),u=0;u<c.length;++u){var i=c[u],l=i.getAttribute("colspan"),s=i.getAttribute("rowspan"),h=i.innerText;if(""!==h&&h==+h&&(h=+h),r.forEach(function(e){if(o>=e.s.r&&o<=e.e.r&&a.length>=e.s.c&&a.length<=e.e.c)for(var t=0;t<=e.e.c-e.s.c;++t)a.push(null)}),(s||l)&&(s=s||1,l=l||1,r.push({s:{r:o,c:a.length},e:{r:o+s-1,c:a.length+l-1}})),a.push(""!==h?h:null),l)for(var f=0;f<l-1;++f)a.push(null)}t.push(a)}return[t,r]}(document.getElementById(e)),n=t[1],r=t[0],o=new l,a=i(r);a["!merges"]=n,o.SheetNames.push("SheetJS"),o.Sheets.SheetJS=a;var u=c.a.write(o,{bookType:"xlsx",bookSST:!1,type:"binary"});saveAs(new Blob([s(u)],{type:"application/octet-stream"}),"test.xlsx")}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.header,n=e.data,r=e.filename,a=e.autoWidth,u=void 0===a||a,h=e.bookType,f=void 0===h?"xlsx":h;r=r||"excel-list",(n=[].concat(o()(n))).unshift(t);var p=new l,v=i(n);if(u){for(var S=n.map(function(e){return e.map(function(e){return null==e?{wch:10}:e.toString().charCodeAt(0)>255?{wch:2*e.toString().length}:{wch:e.toString().length}})}),w=S[0],g=1;g<S.length;g++)for(var d=0;d<S[g].length;d++)w[d].wch<S[g][d].wch&&(w[d].wch=S[g][d].wch);v["!cols"]=w}p.SheetNames.push("SheetJS"),p.Sheets.SheetJS=v;var b=c.a.write(p,{bookType:f,bookSST:!1,type:"binary"});saveAs(new Blob([s(b)],{type:"application/octet-stream"}),r+"."+f)}function p(e,t,n,r){f({header:e,data:function(e,t){return e.map(function(e){return t.map(function(t){return e[t]})})}(t,n),filename:r})}n("MnM9")}}]);
|