mirror of
https://github.com/shawncai/ERP.git
synced 2024-11-10 09:13:08 +08:00
1 line
No EOL
4.2 KiB
JavaScript
1 line
No EOL
4.2 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-commons"],{BBc3:function(e,t,a){"use strict";var n=a("d1yk");a.n(n).a},LROu:function(e,t,a){"use strict";var n=a("Qvsb");a.n(n).a},Mz3J:function(e,t,a){"use strict";var n=a("Y5bG"),r={name:"Pagination",props:{total:{required:!0,type:Number},page:{type:Number,default:1},limit:{type:Number,default:20},pageSizes:{type:Array,default:function(){return[10,20,30,50]}},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"},background:{type:Boolean,default:!0},autoScroll:{type:Boolean,default:!0},hidden:{type:Boolean,default:!1}},computed:{currentPage:{get:function(){return this.page},set:function(e){this.$emit("update:page",e)}},pageSize:{get:function(){return this.limit},set:function(e){this.$emit("update:limit",e)}}},methods:{handleSizeChange:function(e){this.$emit("pagination",{page:this.currentPage,limit:e}),this.autoScroll&&Object(n.a)(0,800)},handleCurrentChange:function(e){this.$emit("pagination",{page:e,limit:this.pageSize}),this.autoScroll&&Object(n.a)(0,800)}}},i=(a("LROu"),a("KHd+")),o=Object(i.a)(r,function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[a("el-pagination",e._b({attrs:{background:e.background,"current-page":e.currentPage,"page-size":e.pageSize,layout:e.layout,total:e.total},on:{"update:currentPage":function(t){e.currentPage=t},"update:pageSize":function(t){e.pageSize=t},"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}},"el-pagination",e.$attrs,!1))],1)},[],!1,null,"2fc659d3",null);o.options.__file="index.vue";t.a=o.exports},N5aa:function(e,t,a){"use strict";var n=a("4d7F"),r=a.n(n),i=a("EUZL"),o=a.n(i),l={props:{beforeUpload:Function,onSuccess:Function},data:function(){return{loading:!1,excelData:{header:null,results:null}}},methods:{generateData:function(e){var t=e.header,a=e.results;this.excelData.header=t,this.excelData.results=a,this.onSuccess&&this.onSuccess(this.excelData)},handleDrop:function(e){if(e.stopPropagation(),e.preventDefault(),!this.loading){var t=e.dataTransfer.files;if(1===t.length){var a=t[0];if(!this.isExcel(a))return this.$message.error("Only supports upload .xlsx, .xls, .csv suffix files"),!1;this.upload(a),e.stopPropagation(),e.preventDefault()}else this.$message.error("Only support uploading one file!")}},handleDragover:function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"},handleUpload:function(){this.$refs["excel-upload-input"].click()},handleClick:function(e){var t=e.target.files[0];t&&this.upload(t)},upload:function(e){(this.$refs["excel-upload-input"].value=null,this.beforeUpload)?this.beforeUpload(e)&&this.readerData(e):this.readerData(e)},readerData:function(e){var t=this;return this.loading=!0,new r.a(function(a,n){var r=new FileReader;r.onload=function(e){var n=e.target.result,r=t.fixData(n),i=o.a.read(btoa(r),{type:"base64"}),l=i.SheetNames[0],s=i.Sheets[l],u=t.getHeaderRow(s),c=o.a.utils.sheet_to_json(s);t.generateData({header:u,results:c}),t.loading=!1,a()},r.readAsArrayBuffer(e)})},fixData:function(e){for(var t="",a=0,n=10240;a<e.byteLength/n;++a)t+=String.fromCharCode.apply(null,new Uint8Array(e.slice(a*n,a*n+n)));return t+=String.fromCharCode.apply(null,new Uint8Array(e.slice(a*n)))},getHeaderRow:function(e){var t=[],a=o.a.utils.decode_range(e["!ref"]),n=void 0,r=a.s.r;for(n=a.s.c;n<=a.e.c;++n){var i=e[o.a.utils.encode_cell({c:n,r:r})],l="UNKNOWN "+n;i&&i.t&&(l=o.a.utils.format_cell(i)),t.push(l)}return t},isExcel:function(e){return/\.(xlsx|xls|csv)$/.test(e.name)}}},s=(a("BBc3"),a("KHd+")),u=Object(s.a)(l,function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("input",{ref:"excel-upload-input",staticClass:"excel-upload-input",attrs:{type:"file",accept:".xlsx, .xls"},on:{change:e.handleClick}}),e._v(" "),a("div",{staticClass:"drop",on:{drop:e.handleDrop,dragover:e.handleDragover,dragenter:e.handleDragover}},[e._v("\n Drop excel file here or\n "),a("el-button",{staticStyle:{"margin-left":"16px"},attrs:{loading:e.loading,size:"mini",type:"primary"},on:{click:e.handleUpload}},[e._v("Browse")])],1)])},[],!1,null,"23e4dd60",null);u.options.__file="index.vue";t.a=u.exports},Qvsb:function(e,t,a){},d1yk:function(e,t,a){}}]); |