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.
wkcrm/static/js/chunk-79bb.c2374ba0.js

1 line
5.7 KiB

3 years ago
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-79bb"],{"2xBc":function(e,t,i){"use strict";var n=i("Mb4B");i.n(n).a},"67Ak":function(e,t,i){"use strict";i.r(t);var n=i("6iAj"),a=i("KTTK"),o=i("glbJ"),s=i("ZoMv"),r=i("7Qib"),c={name:"Print",components:{Tinymce:o.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(s.a.convertKeyToType(this.$route.query.module))),window.addEventListener("resize",this.changeIframeHeight)},beforeRouteUpdate:function(e,t,i){this.content="",i()},beforeDestroy:function(){window.removeEventListener("resize",this.changeIframeHeight)},methods:{changeIframeHeight:function(){this.iframeHeight=document.documentElement.clientHeight-170},getTemplateOptions:function(e){var t=this;this.loading=!0,Object(n.H)({type:e,pageType:0}).then(function(e){t.templateOptions=e.data.list||[],"history"!=t.$route.query.type&&(t.templateOptions.length?(t.templateId=t.templateOptions[0].id,t.getDetail()):t.templateId=""),t.loading=!1}).catch(function(){t.loading=!1})},getDetail:function(){var e=this;this.loading=!0,Object(n.B)({template_id:this.templateId,action_id:this.typeId,type:s.a.convertKeyToType(this.$route.query.module)}).then(function(t){e.loading=!1,e.content=t.data}).catch(function(){e.loading=!1})},getRecordDetail:function(){var e=this;this.loading=!0,Object(n.E)({record_id:this.$route.query.id,type:20}).then(function(t){e.loading=!1;var i=t.data||{};e.historyData=i,e.templateId=i.template_id,e.typeId=i.typeId,e.getTemplateOptions(i.type),e.content=i.content||""}).catch(function(){e.loading=!1})},compactPrint:function(){this.$refs.editor.editor.execCommand("mcePrint"),this.savePrintRecord()},printPreviewClick:function(){var e=this;this.loading=!0,Object(n.A)({type:this.perviewType,content:this.content}).then(function(t){e.loading=!1;var i=t.data,n="/crm/preview/previewPDF?key="+i;Object(a.l)({key:i},n).then(function(t){e.iframeUrl=window.URL.createObjectURL(t.data)}).catch(function(){}),e.srcData=i,e.isPreview=!0}).catch(function(){e.loading=!1})},savePrintRecord:function(){this.templateId&&this.typeId&&Object(n.F)({template_id:this.templateId,action_id:this.typeId,recordContent:this.content,type:s.a.convertKeyToType(this.$route.query.module)}).then(function(e){}).catch(function(){})},hidenView:function(){this.$emit("close")},handleClick:function(e){if("goback"==e)this.isPreview=!1;else if("print"==e)document.getElementById("wkPrint").contentWindow.print(),this.savePrintRecord();else if("download"==e&&this.srcData){var t=this.perviewType,i={key:this.srcData,type:"word"===t?2:1};t="word"===t?"doc":"pdf",Object(a.d)(i).then(function(e){var i=new Blob([e.data],{type:""});Object(r.e)(i,"文档."+t)}).catch(function(){})}}}},l=(i("2xBc"),i("KHd+")),d=Object(l.a)(c,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-container",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"wk-print-container",class:{"is-perview":e.isPreview}},[i("el-header",[e.isPreview?[i("el-button",{attrs:{type:"primary"},on:{click:function(t){e.handleClick("download")}}},[e._v(e._s(e.perviewTypeName+" 下载"))]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){e.handleClick("print")}}},[e._v("打印")]),e._v(" "),i("el-button",{on:{click:function(t){e.handleClick("goback")}}},[e._v("取消")])]:[i("span",{staticClass:"select-label"},[e._v("选择模版")]),e._v(" "),i("el-select",{staticClass:"handle-item-content",staticStyle:{width:"170px"},on:{change:e.getDetail},model:{value:e.templateId,callback:function(t){e.templateId=t},expression:"templateId"}},e._l(e.templateOptions,function(e){return i("el-option",{key:e.id