You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
14 KiB
1 line
14 KiB
4 years ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-7a2f"],{"5e4S":function(t,e,n){t.exports={xrColorPrimary:"#2362FB"}},"67Ak":function(t,e,n){"use strict";n.r(e);var i=n("6iAj"),o=n("KTTK"),a=n("glbJ"),r=n("ZoMv"),s=n("7Qib"),c={name:"Print",components:{Tinymce:a.a},props:{},data:function(){return{loading:!1,isPreview:!1,templateOptions:[],templateId:"",typeId:"",previewOptions:["word","pdf"],perviewType:"word",content:"",historyData:null,iframeUrl:"",iframeHeight:document.documentElement.clientHeight-170,srcData:null}},computed:{perviewTypeName:function(){return{word:"Word",pdf:"PDF"}[this.perviewType]}},created:function(){"history"==this.$route.query.type?this.getRecordDetail():(this.typeId=this.$route.query.id,this.getTemplateOptions(r.a.convertKeyToType(this.$route.query.module))),window.addEventListener("resize",this.changeIframeHeight)},beforeRouteUpdate:function(t,e,n){this.content="",n()},beforeDestroy:function(){window.removeEventListener("resize",this.changeIframeHeight)},methods:{changeIframeHeight:function(){this.iframeHeight=document.documentElement.clientHeight-170},getTemplateOptions:function(t){var e=this;this.loading=!0,Object(i.H)({type:t,pageType:0}).then(function(t){e.templateOptions=t.data.list||[],"history"!=e.$route.query.type&&(e.templateOptions.length?(e.templateId=e.templateOptions[0].templateId,e.getDetail()):e.templateId=""),e.loading=!1}).catch(function(){e.loading=!1})},getDetail:function(){var t=this;this.loading=!0,Object(i.B)({templateId:this.templateId,id:this.typeId}).then(function(e){t.loading=!1,t.content=e.data}).catch(function(){t.loading=!1})},getRecordDetail:function(){var t=this;this.loading=!0,Object(i.E)({recordId:this.$route.query.recordId}).then(function(e){t.loading=!1;var n=e.data||{};t.historyData=n,t.templateId=n.templateId,t.typeId=n.typeId,t.getTemplateOptions(n.crmType),t.content=n.recordContent||""}).catch(function(){t.loading=!1})},compactPrint:function(){this.$refs.editor.editor.execCommand("mcePrint"),this.savePrintRecord()},printPreviewClick:function(){var t=this;this.loading=!0,Object(i.A)({type:this.perviewType,content:this.content}).then(function(e){t.loading=!1;var n=e.data,i="/crmPrint/preview.pdf?type=1&key="+n;Object(o.k)(i).then(function(e){t.iframeUrl=window.URL.createObjectURL(e.data)}).catch(function(){}),t.srcData=n,t.isPreview=!0}).catch(function(){t.loading=!1})},savePrintRecord:function(){this.templateId&&this.typeId&&Object(i.F)({templateId:this.templateId,typeId:this.typeId,recordContent:this.content}).then(function(t){}).catch(function(){})},hidenView:function(){this.$emit("close")},handleClick:function(t){if("goback"==t)this.isPreview=!1;else if("print"==t)document.getElementById("wkPrint").contentWindow.print(),this.savePrintRecord();else if("download"==t&&this.srcData){var e=this.perviewType,n={key:this.srcData,type:"word"===e?2:1};e="word"===e?"doc":"pdf",Object(o.d)(n).then(function(t){var n=new Blob([t.data],{type:""});Object(s.e)(n,"文档."+e)}).catch(function(){})}}}},l=(n("8/Qo"),n("KHd+")),d=Object(l.a)(c,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("el-container",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"wk-print-container",class:{"is-perview":t.isPreview}},[n("el-header",[t.isPreview?[n("el-button",{attrs:{type:"primary"},on:{click:function(e){t.handleClick("download")}}},[t._v(t._s(t.perviewTypeName+" 下载"))]),t._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(e){t.handleClick("print")}}},[t._v("打印")]),t._v(" "),n("el-button",{on:{click:function(e){t.handleClick("goback")}}},[t._v("取消")])]:[n("span",{staticClass:"select-label"},[t._v("选择模版")]),t._v(" "),n("el-select",{staticClass:"handle-item-content",staticStyle:{width:"170px"},on:{change:t.getDetail},model:{value:t.templateId,callback:function(e){t.templateId=e},expression:"templateId"}},t._l(t.templateOptions,function(t){return n("el-option",{key:t.templateId,attrs:{label:t.templateName,value:t.templateId}})})),t._v(" "),n("span",{staticClass:"select-label
|