chunk-179281af.82c51ee9.js 3.2 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-179281af","chunk-29531240","chunk-58293907"],{1:function(e,t){},2:function(e,t){},3:function(e,t){},"36bd":function(e,t,n){"use strict";var r=n("4bf8"),o=n("77f1"),a=n("9def");e.exports=function(e){var t=r(this),n=a(t.length),c=arguments.length,i=o(c>1?arguments[1]:void 0,n),s=c>2?arguments[2]:void 0,l=void 0===s?n:o(s,n);while(l>i)t[i++]=e;return t}},"4bf8d":function(e,t,n){"use strict";n.r(t),n.d(t,"export_table_to_excel",(function(){return f})),n.d(t,"export_json_to_excel",(function(){return v}));n("6b54"),n("ac6a");var r=n("2909"),o=(n("34ef"),n("21a6")),a=n("1146"),c=n.n(a);function i(e){for(var t=[],n=e.querySelectorAll("tr"),r=[],o=0;o<n.length;++o){for(var a=[],c=n[o],i=c.querySelectorAll("td"),s=0;s<i.length;++s){var l=i[s],u=l.getAttribute("colspan"),h=l.getAttribute("rowspan"),f=l.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)})),(h||u)&&(h=h||1,u=u||1,r.push({s:{r:o,c:a.length},e:{r:o+h-1,c:a.length+u-1}})),a.push(""!==f?f:null),u)for(var v=0;v<u-1;++v)a.push(null)}t.push(a)}return[t,r]}function s(e,t){t&&(e+=1462);var n=Date.parse(e);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function l(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=s(i.v)):i.t="s",n[l]=i}}return r.s.c<1e7&&(n["!ref"]=c.a.utils.encode_range(r)),n}function u(){if(!(this instanceof u))return new u;this.SheetNames=[],this.Sheets={}}function h(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 f(e){var t=document.getElementById(e),n=i(t),r=n[1],a=n[0],s="SheetJS",f=new u,v=l(a);v["!merges"]=r,f.SheetNames.push(s),f.Sheets[s]=v;var p=c.a.write(f,{bookType:"xlsx",bookSST:!1,type:"binary"});Object(o["saveAs"])(new Blob([h(p)],{type:"application/octet-stream"}),"test.xlsx")}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.multiHeader,n=void 0===t?[]:t,a=e.header,i=e.data,s=e.filename,f=e.merges,v=void 0===f?[]:f,p=e.autoWidth,g=void 0===p||p,d=e.bookType,b=void 0===d?"xlsx":d;s=s||"excel-list",i=Object(r["a"])(i),i.unshift(a);for(var w=n.length-1;w>-1;w--)i.unshift(n[w]);var S="SheetJS",m=new u,y=l(i);if(v.length>0&&(y["!merges"]||(y["!merges"]=[]),v.forEach((function(e){y["!merges"].push(c.a.utils.decode_range(e))}))),g){var x=i.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}}))})),k=x[0];try{for(var A=1;A<x.length;A++)for(var _=0;_<x[A].length;_++)k[_]["wch"]<x[A][_]["wch"]&&(k[_]["wch"]=x[A][_]["wch"])}catch(j){console.log(j)}y["!cols"]=k}m.SheetNames.push(S),m.Sheets[S]=y;var T=c.a.write(m,{bookType:b,bookSST:!1,type:"binary"});Object(o["saveAs"])(new Blob([h(T)],{type:"application/octet-stream"}),"".concat(s,".").concat(b))}}}]);