(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"},[t._v("选择模版")]),t._v(" "),n("el-select",{staticClass:"handle-item-content",staticStyle:{width:"80px"},model:{value:t.perviewType,callback:function(e){t.perviewType=e},expression:"perviewType"}},t._l(t.previewOptions,function(t){return n("el-option",{key:t,attrs:{label:t,value:t}})})),t._v(" "),n("el-button",{staticClass:"preview-button",attrs:{type:"primary"},on:{click:t.printPreviewClick}},[t._v("打印预览")])]],2),t._v(" "),n("el-main",[n("div",{staticClass:"main-container"},[n("div",{staticClass:"main-content"},[n("iframe",{directives:[{name:"show",rawName:"v-show",value:t.isPreview,expression:"isPreview"}],staticStyle:{width:"100%","margin-top":"54px"},attrs:{id:"wkPrint",height:t.iframeHeight,src:t.iframeUrl,scrolling:"no",frameborder:"0"}})]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.isPreview,expression:"!isPreview"}],staticClass:"main-tips"},[t._v("您可以在当前页面对模版文字进行调整,确认无误后可进行打印")]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.isPreview,expression:"!isPreview"}],staticClass:"main-content"},[n("tinymce",{ref:"editor",staticClass:"rich-txt",attrs:{toolbar:[],init:{statusbar:!1,plugins:"print autoresize",extended_valid_elements:"span[class|title|wktag|style|contenteditable]",content_style:" body {padding: 60px !important;width: 595px; margin: 0 auto;} p { margin: 5px 0;}"}},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1)])])],1)},[],!1,null,"34e946b0",null);d.options.__file="index.vue";e.default=d.exports},"8/Qo":function(t,e,n){"use strict";var i=n("zsBY");n.n(i).a},FzPI:function(t,e,n){"use strict";var i=n("5e4S");n.n(i).a},glbJ:function(t,e,n){"use strict";var i,o=n("QbLZ"),a=n.n(o),r=n("KTTK"),s=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],c=function(t){return-1!==s.map(function(t){return t.toLowerCase()}).indexOf(t.toLowerCase())},l=function(t,e,n){var i=e.$props.value?e.$props.value:"",o=e.$props.initialValue?e.$props.initialValue:"";n.setContent(i||(e.initialized?e.cache:o)),e.$listeners.input&&function(t,e){var n=t.$props.modelEvents?t.$props.modelEvents:null,i=Array.isArray(n)?n.join(" "):n;t.$watch("value",function(n,i){e&&"string"==typeof n&&n!==i&&n!==e.getContent({format:t.$props.outputFormat})&&e.setContent(n)}),e.on(i||"change input undo redo",function(){t.$emit("input",e.getContent({format:t.$props.outputFormat}))})}(e,n),function(t,e,n){Object.keys(e).filter(c).forEach(function(i){var o=e[i];"function"==typeof o&&("onInit"===i?o(t,n):n.on(i.substring(2),function(t){return o(t,n)}))})}(t,e.$listeners,n),e.initialized=!0},d=0,u=function(t){var e=Date.now();return t+"_"+Math.floor(1e9*Math.random())+ ++d+String(e)},p=function(t){return void 0===t||""===t?[]:Array.isArray(t)?t:t.split(" ")},h=function(){return{listeners:[],scriptId:u("tiny-script"),scriptLoaded:!1}},m=(i=h(),{load:function(t,e,n){i.scriptLoaded?n():(i.listeners.push(n),t.getElementById(i.scriptId)||function(t,e,n,i){var o=e.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n;var a=function(){o.removeEventListener("load",a),i()};o.addEventListener("load",a),e.head&&e.head.appendChild(o)}(i.scriptId,t,e,function(){i.listeners.forEach(function(t){return t()}),i.scriptLoaded=!0}))},reinitialize:function(){i=h()}}),f=n("xKn5"),g=function(){return(g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n')})}}},b=(n("FzPI"),n("KHd+")),_=Object(b.a)(w,function(){var t=this,e=t.$createElement;return(t._self._c||e)("editor",t._g(t._b({ref:"mceEditor",attrs:{id:t.id,init:t.showInit,plugins:t.showPlugins,toolbar:t.showToolbar,"tinymce-script-src":"https://www.72crm.com/npm/tinymce/tinymce.min.js"},model:{value:t.dataValue,callback:function(e){t.dataValue=e},expression:"dataValue"}},"editor",t.$attrs,!1),t.$listeners))},[],!1,null,null,null);_.options.__file="index.vue";e.a=_.exports},xKn5:function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return o});var i=function(){return"undefined"!=typeof window?window:t},o=function(){var t=i();return t&&t.tinymce?t.tinymce:null}}).call(this,n("yLpj"))},zsBY:function(t,e,n){}}]);