(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["certificate"],{"11f3":function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"print-view",attrs:{id:"print_view"}},["listView"==t.simpleClassName?e("div",{staticClass:"print-view-wrap"},[t.viewPrintData?e("view_listview",{attrs:{openParams:t.openParams,view:t.viewPrintData,isFormPrint:t.isFormPrint}}):t._e()],1):"gridview"==t.simpleClassName?e("div",{staticClass:"print-view-wrap"},[t.viewPrintData?e("view_gridview",{attrs:{openParams:t.openParams,view:t.viewPrintData,isFormPrint:t.isFormPrint}}):t._e()],1):t._e(),e("div",{staticClass:"print-btn"},[e("div",{staticClass:"page-con"},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.isHide,expression:"isHide"}],staticClass:"btn no-print",on:{click:t.printView}},[t._v("\n "+t._s(t.$t("report.print"))+"\n ")])])])])},a=[],o=n("8203"),r=n("35a6"),s={name:"",props:[""],components:{view_listview:o["a"],view_gridview:r["a"]},computed:{},created:function(){var t=this.$route.query;"ListView"==t.simpleClassName&&"288"==t.openType&&(this.simpleClassName="gridview")},mounted:function(){this.getViewData()},data:function(){return{viewPrintData:"",openParams:"",isFormPrint:5,simpleClassName:"listView",isHide:!0}},methods:{printView:function(){this.isHide=!1,setTimeout((function(){window.print()}),100);var t=this;window.onafterprint=function(){t.$nextTick((function(){t.isHide=!0}))}},getViewData:function(){var t=this,e=this.$root.appid,n=this.$route.query.viewId,i=this.$route.query.isPrint;this.openParams={appId:e,viewId:n,isPrint:i,isRelate:this.$route.query.isRelate,parentId:this.$route.query.parentId},this.$api.getPrintViewTemplate(e,n,i,{onSucess:function(e){t.viewPrintData=e.data.data;for(var n=t.viewPrintData.columns,i=0;im&&(u=m/f,f=m,C*=u),f*=g,C*=g,v=f/C,h=d.toDataURL("image/jpeg",1),x=window.jspdf.jsPDF,b=new x({orientation:v>1?"l":"p",unit:"mm",format:[f,C],compress:!0,hotfixes:["px_scaling"]}),b.addImage(h,"JPEG",0,0,f,C,void 0,"FAST"),b.save("证书_".concat(this.trainCertificateInfo.personName||"未命名",".pdf")),t.next=65;break;case 62:t.prev=62,t.t1=t["catch"](3),alert("下载证书失败,请稍后重试。错误详情: "+t.t1.message);case 65:return t.prev=65,this.isDownloading=!1,t.finish(65);case 68:case"end":return t.stop()}}),t,this,[[3,62,65,68],[11,19]])})));function e(){return t.apply(this,arguments)}return e}(),saveAsImage:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){var e,n,i,a,o,r,s,d,l,p;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!this.isDownloading){t.next=2;break}return t.abrupt("return");case 2:return this.isDownloading=!0,t.prev=3,this.$message?this.$message({message:"正在生成图片,请稍候...",type:"info",duration:5e3,showClose:!1}):alert("正在生成图片,请稍候..."),t.next=7,this.loadHtml2Canvas();case 7:return e=document.getElementById("certificate-content"),n=this.backgroundImageUrl,t.prev=9,t.next=12,this.preloadImage(n);case 12:if(!this.trainCertificateInfo.certificatePhoto){t.next=15;break}return t.next=15,this.preloadImage(this.trainCertificateInfo.certificatePhoto);case 15:t.next=19;break;case 17:t.prev=17,t.t0=t["catch"](9);case 19:return i=document.createElement("div"),i.style.position="absolute",i.style.left="-9999px",i.style.top="-9999px",document.body.appendChild(i),a=e.cloneNode(!0),i.appendChild(a),this.copyComputedStyles(e,a),a.style.backgroundImage="url(".concat(n,")"),a.style.backgroundSize="cover",a.style.backgroundPosition="center",a.style.backgroundRepeat="no-repeat",a.style.width=e.offsetWidth+"px",a.style.height=e.offsetHeight+"px",o=a.querySelector(".headphoto"),o&&(o.style.display="flex",o.style.justifyContent="center",o.style.alignItems="center",o.style.margin="0 auto 80px",r=o.querySelector("img"),r&&(r.style.width="100%",r.style.height="100%",r.style.objectFit="fill",r.style.display="block")),s=a.querySelectorAll("span, div"),s.forEach((function(t){var e=window.getComputedStyle(t);"rgba(0, 0, 0, 0)"!==e.color&&"transparent"!==e.color||(t.style.color="#000000"),e.fontFamily&&(t.style.fontFamily=e.fontFamily)})),t.next=39,html2canvas(a,{scale:3,useCORS:!0,backgroundColor:null,logging:!1,allowTaint:!0,imageTimeout:0,onclone:function(t,e){var n=e.querySelector(".headphoto");if(n){n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.margin="0 auto 80px";var i=n.querySelector("img");i&&(i.style.width="100%",i.style.height="100%",i.style.objectFit="fill",i.style.display="block")}}});case 39:d=t.sent,document.body.removeChild(i),l=d.toDataURL("image/png",1),p=document.createElement("a"),p.href=l,p.download="证书_".concat(this.trainCertificateInfo.personName||"未命名",".png"),document.body.appendChild(p),p.click(),document.body.removeChild(p),this.$message?this.$message({message:"图片已保存",type:"success",duration:3e3}):alert("图片已保存"),t.next=54;break;case 51:t.prev=51,t.t1=t["catch"](3),alert("保存图片失败,请稍后重试。错误详情: "+t.t1.message);case 54:return t.prev=54,this.isDownloading=!1,t.finish(54);case 57:case"end":return t.stop()}}),t,this,[[3,51,54,57],[9,17]])})));function e(){return t.apply(this,arguments)}return e}(),copyComputedStyles:function(t,e){var n=function t(e,n){for(var i=window.getComputedStyle(e),a=0;a