40882c095a3acdfddb9ae823d421e4d3844ab4dd.svn-base 4.1 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-581b2547"],{1:function(e,t){},2:function(e,t){},3:function(e,t){},"4bf8d":function(e,t,n){"use strict";n.r(t),n.d(t,"export_table_to_excel",function(){return u}),n.d(t,"export_json_to_excel",function(){return f}),n.d(t,"export_json_to_excel2",function(){return g});n("6b54"),n("ac6a");var r=n("75fc"),o=(n("34ef"),n("1146")),a=n.n(o);function c(e){for(var t=[],n=e.querySelectorAll("tr"),r=[],o=0;o<n.length;++o){for(var a=[],c=n[o],h=c.querySelectorAll("td"),i=0;i<h.length;++i){var s=h[i],l=s.getAttribute("colspan"),u=s.getAttribute("rowspan"),f=s.innerText;if(""!==f&&f==+f&&(f=+f),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)}),(u||l)&&(u=u||1,l=l||1,r.push({s:{r:o,c:a.length},e:{r:o+u-1,c:a.length+l-1}})),a.push(""!==f?f:null),l)for(var g=0;g<l-1;++g)a.push(null)}t.push(a)}return[t,r]}function h(e,t){t&&(e+=1462);var n=Date.parse(e);return(n-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 c=0;c!=e[o].length;++c){r.s.r>o&&(r.s.r=o),r.s.c>c&&(r.s.c=c),r.e.r<o&&(r.e.r=o),r.e.c<c&&(r.e.c=c);var i={v:e[o][c]};if(null!=i.v){var s=a.a.utils.encode_cell({c:c,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=a.a.SSF._table[14],i.v=h(i.v)):i.t="s",n[s]=i}}return r.s.c<1e7&&(n["!ref"]=a.a.utils.encode_range(r)),n}function s(){if(!(this instanceof s))return new s;this.SheetNames=[],this.Sheets={}}function l(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 u(e){var t=document.getElementById(e),n=c(t),r=n[1],o=n[0],h="SheetJS",u=new s,f=i(o);f["!merges"]=r,u.SheetNames.push(h),u.Sheets[h]=f;var g=a.a.write(u,{bookType:"xlsx",bookSST:!1,type:"binary"});saveAs(new Blob([l(g)],{type:"application/octet-stream"}),"test.xlsx")}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.multiHeader,n=void 0===t?[]:t,o=e.header,c=e.data,h=e.filename,u=e.merges,f=void 0===u?[]:u,g=e.autoWidth,v=void 0===g||g,p=e.bookType,d=void 0===p?"xlsx":p,w=e.ws_name;h=h||"excel-list",c=Object(r["a"])(c),c.unshift(o),w=w||"SheetJS";for(var m=n.length-1;m>-1;m--)c.unshift(n[m]);var b=new s,S=i(c);if(f.length>0&&(S["!merges"]||(S["!merges"]=[]),f.forEach(function(e){S["!merges"].push(a.a.utils.decode_range(e))})),v){for(var y=c.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}})}),x=y[0],_=1;_<y.length;_++)for(var A=0;A<y[_].length;A++)x[A]["wch"]<y[_][A]["wch"]&&(x[A]["wch"]=y[_][A]["wch"]);S["!cols"]=x}b.SheetNames.push(w),b.Sheets[w]=S;var k=a.a.write(b,{bookType:d,bookSST:!1,type:"binary"});saveAs(new Blob([l(k)],{type:"application/octet-stream"}),"".concat(h,".").concat(d))}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.multiHeader,n=void 0===t?[]:t,o=e.header,c=e.data,h=e.sheetname,u=e.filename,f=e.merges,g=void 0===f?[]:f,v=e.autoWidth,p=void 0===v||v,d=e.bookType,w=void 0===d?"xlsx":d;u=u||"excel-list",c=Object(r["a"])(c);for(var m=0;m<o.length;m++)c[m].unshift(o[m]);for(var b=n.length-1;b>-1;b--)c.unshift(n[b]);for(var S=h,y=new s,x=[],_=0;_<o.length;_++)x.push(i(c[_]));if(g.length>0&&(x["!merges"]||(x["!merges"]=[]),g.forEach(function(e){x["!merges"].push(a.a.utils.decode_range(e))})),p){for(var A=[],k=0;k<o.length;k++)A.push(c[k].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}})}));var T=[];for(k=0;k<A.length;k++){T[k]=A[k][0];for(var B=1;B<A[k].length;B++)for(var j=0;j<A[k][B].length;j++)T[k][j]["wch"]<A[k][B][j]["wch"]&&(T[k][j]["wch"]=A[k][B][j]["wch"])}for(var C=0;C<T.length;C++)x[C]["!cols"]=T[C]}for(k=0;k<o.length;k++)y.SheetNames.push(S[k]),y.Sheets[S[k]]=x[k];var D=a.a.write(y,{bookType:w,bookSST:!1,type:"binary"});saveAs(new Blob([l(D)],{type:"application/octet-stream"}),"".concat(u,".").concat(w))}n("0fd4")}}]);