(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7672d31c"],{"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("0643"),r("4e3e"),r("a573"),{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 s={title:i,children:a===e.length-1?t:[]};if(0===a)r.push(s),n.push(s);else{const e=n[n.length-1];e.children.push(s),n.push(s)}}),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(){}}),s=a,l=r("2877"),o=Object(l["a"])(s,n,i,!1,null,"57672be8",null);t["default"]=o.exports},a573:function(e,t,r){"use strict";r("ab43")},ab43:function(e,t,r){"use strict";var n=r("23e7"),i=r("d024"),a=r("c430");n({target:"Iterator",proto:!0,real:!0,forced:a},{map:i})},d024:function(e,t,r){"use strict";var n=r("c65b"),i=r("59ed"),a=r("825a"),s=r("46c4"),l=r("c5cc"),o=r("9bdd"),c=l((function(){var e=this.iterator,t=a(n(this.next,e)),r=this.done=!!t.done;if(!r)return o(e,this.mapper,[t.value,this.counter++],!0)}));e.exports=function(e){return a(this),i(e),new c(s(this),{mapper:e})}}}]);
//# sourceMappingURL=chunk-7672d31c.d75efd6d.js.map