(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a0d44bc4"],{"2e91":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}]},[t("vxe-grid",e._b({ref:"gridRef"},"vxe-grid",e.gridOptions,!1))],1)},i=[],a=(r("14d9"),r("e9f5"),r("7d54"),r("ab43"),r("1236"),r("e9c4"),{name:"demo2",props:{tableData:{type:Object,default:()=>({})},loading:{type:Boolean,default:!1}},data(){return{gridOptions:{align:"center",border:!0,"header-align":"center",showOverflow:!0,height:500,columnConfig:{resizable:!0},scrollY:{enabled:!0,gt:0},mergeCells:[],columns:[],data:[],exportConfig:{type:"xlsx",isHeader:!0,isMerge:!0,isColgroup:!0},printConfig:{isHeader:!0,isMerge:!0}}}},watch:{tableData:{handler(e,t){e&&Object.keys(e).length&&e!=t&&this.formateData(e)},immediate:!0,deep:!0}},methods:{async formateData(e){let t=this.transformHeaderColumn(e.table),r=e.list.map(e=>{"合计"==e[0]&&(e=["合计",0,0,0,...e]);let t={};return e.map((e,r)=>{t["id_"+r]=e}),t});const n=JSON.parse(JSON.stringify(this.gridOptions));n.columns=t,n.data=r,r.length>20&&(n.height=window.innerHeight),this.$nextTick(()=>{n.mergeCells=[{row:e.list.length-1,col:0,colspan:5}]}),this.gridOptions=n,console.log({header:t,data:r,gridOptions:n})},setHeight(){window.innerHeight;return he},transformHeaderColumn(e){let t=[],r=[];e.map(e=>{console.log(e.length),e.length>1?r.push(e):t.push(e[0].value)});let n=this.transformToTreeStructure(r);console.log({fieldsTree:n,fields:r});let i=this.arrayToTree(t,n);return i},transformToTreeStructure(e){if(1==e.length){let t=e[0].map((e,t)=>({field:"id_"+t,title:e.value}));return t}if(2==e.length){let t=e,r=t.pop().map((e,t)=>({title:e.value})),n=t.pop(),i=0;return n.map((e,t)=>{e.colspan>1?(e.children=r.slice(i,e.colspan),e.children.map((e,r)=>{e.field="id_"+(r+t)}),e.title=e.value,i=e.colspan,delete e.type):(e.field="id_"+(t+i),e.title=e.value,delete e.type)}),n}return[]},arrayToTree(e,t){if(0==e.length)return t;const r=[],n=[];return e.forEach((i,a)=>{const l={title:i,children:a===e.length-1?t:[]};if(0===a)r.push(l),n.push(l);else{const e=n[n.length-1];e.children.push(l),n.push(l)}}),r},mergeCells(e){const t=[],r=Object.keys(e[0]);return r.forEach((r,n)=>{for(let i=0;i<e.length;i++)if(0===i||e[i][r]!==e[i-1][r]){let a=i;while(a+1<e.length&&e[a][r]===e[a+1][r])a++;a>i&&(t.push({row:i,col:n,rowspan:a-i+1,colspan:1}),i=a)}}),t},printEvent(){try{const e=this.$refs.gridRef;e&&e.print()}catch(e){this.$message.error("打印失败")}},exportEvent(){try{const e=this.$refs.gridRef;e&&e.exportData()}catch(e){this.$message.error("导出失败")}}},created(){}}),l=a,o=r("2877"),s=Object(o["a"])(l,n,i,!1,null,"57672be8",null);t["default"]=s.exports},ab43:function(e,t,r){"use strict";var n=r("23e7"),i=r("c65b"),a=r("59ed"),l=r("825a"),o=r("46c4"),s=r("c5cc"),c=r("9bdd"),h=r("2a62"),d=r("2baa"),p=r("f99f"),u=r("c430"),g=!u&&!d("map",(function(){})),f=!u&&!g&&p("map",TypeError),m=u||g||f,b=s((function(){var e=this.iterator,t=l(i(this.next,e)),r=this.done=!!t.done;if(!r)return c(e,this.mapper,[t.value,this.counter++],!0)}));n({target:"Iterator",proto:!0,real:!0,forced:m},{map:function(e){l(this);try{a(e)}catch(t){h(this,"throw",t)}return f?i(f,this,e):new b(o(this),{mapper:e})}})}}]);
//# sourceMappingURL=chunk-a0d44bc4.e9febac6.js.map