当前位置: 首页 > Web前端 > vue.js

element-admin自定义二级表头导出数据

时间:2023-04-01 01:21:33 vue.js

`//exportexcelconstlength=this.columnOptions.length-1;//一级表头的长度letsHeader=[];让h1=[];//类别项for(leti=0;ih.label).concat(sHeader);}constheader=Array(length).fill('').concat(sHeader);//二级表内容constfHeader=this.columnOptions.filter(h=>h.label).地图(我=>我。标签);constmultiHeader=[fHeader.concat(h1)];//多级表头constdata=[];//传入数据constfilterVal=this.columnOptions.filter(p=>p.prop).map(i=>i.prop);//headernamefor(leti=0;ih.prop),this.listData[i].customReportPoList));//副表个数数据[i]=this.formatJson(filterVal,this.listData)[i].concat(data1);}console.log(数据,'数据');//合并excel中的列表constmerges=[];for(vari=0;i{excel.export_json_to_excel({multiHeader,header,data,merges,filename:this.title});`