(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-26fe"],{"2f65":function(t,e,n){},"5e4S":function(t,e,n){t.exports={xrColorPrimary:"#2362FB"}},"7mY3":function(t,e,n){"use strict";var i=n("2f65");n.n(i).a},"9GgJ":function(t,e,n){"use strict";var i={name:"XrHeader",components:{},props:{iconClass:[String,Array],iconColor:String,label:String,showSearch:{type:Boolean,default:!1},searchIconType:{type:String,default:"text"},placeholder:{type:String,default:"请输入内容"},ftTop:{type:String,default:"15px"},content:[String,Number],inputAttr:{type:Object,default:function(){}}},data:function(){return{search:""}},computed:{},watch:{content:{handler:function(){this.search!=this.content&&(this.search=this.content)},immediate:!0}},mounted:function(){},beforeDestroy:function(){},methods:{inputChange:function(){this.$emit("update:content",this.search)},searchClick:function(){this.$emit("search",this.search)}}},a=(n("7mY3"),n("KHd+")),o=Object(a.a)(i,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("flexbox",{staticClass:"xr-header"},[t.iconClass?n("div",{staticClass:"xr-header__icon",style:{backgroundColor:t.iconColor}},[n("i",{class:t.iconClass})]):t._e(),t._v(" "),n("div",{staticClass:"xr-header__label"},[t.$slots.label?t._t("label"):[t._v(t._s(t.label))]],2),t._v(" "),t.showSearch?n("el-input",t._b({staticClass:"xr-header__search",class:{"is-text":"text"===t.searchIconType},style:{"margin-top":t.ftTop},attrs:{placeholder:t.placeholder},on:{input:t.inputChange},nativeOn:{keyup:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.searchClick(e):null}},model:{value:t.search,callback:function(e){t.search=e},expression:"search"}},"el-input",t.inputAttr,!1),["text"===t.searchIconType?n("el-button",{attrs:{slot:"append",type:"primary"},nativeOn:{click:function(e){return t.searchClick(e)}},slot:"append"},[t._v("搜索")]):n("el-button",{attrs:{slot:"append",icon:"el-icon-search"},nativeOn:{click:function(e){return t.searchClick(e)}},slot:"append"})],1):t._e(),t._v(" "),n("div",{staticClass:"xr-header__ft",style:{top:t.ftTop}},[t._t("ft")],2)],1)},[],!1,null,"acb6d756",null);o.options.__file="index.vue";e.a=o.exports},FzPI:function(t,e,n){"use strict";var i=n("5e4S");n.n(i).a},KWCB:function(t,e,n){"use strict";var i=n("n9M2");n.n(i).a},XgEC:function(t,e,n){},glbJ:function(t,e,n){"use strict";var i,a=n("QbLZ"),o=n.n(a),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:"",a=e.$props.initialValue?e.$props.initialValue:"";n.setContent(i||(e.initialized?e.cache:a)),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 a=e[i];"function"==typeof a&&("onInit"===i?a(t,n):n.on(i.substring(2),function(t){return a(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}},f=(i=h(),{load:function(t,e,n){i.scriptLoaded?n():(i.listeners.push(n),t.getElementById(i.scriptId)||function(t,e,n,i){var a=e.createElement("script");a.referrerPolicy="origin",a.type="application/javascript",a.id=t,a.src=n;var o=function(){a.removeEventListener("load",o),i()};a.addEventListener("load",o),e.head&&e.head.appendChild(a)}(i.scriptId,t,e,function(){i.listeners.forEach(function(t){return t()}),i.scriptLoaded=!0}))},reinitialize:function(){i=h()}}),m=n("xKn5"),g=function(){return(g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n')})}}},C=(n("FzPI"),n("KHd+")),_=Object(C.a)(y,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},jzeO:function(t,e,n){"use strict";var i={name:"Reminder",components:{},props:{closeShow:{type:Boolean,default:!1},content:{type:String,default:"内容"},fontSize:{type:String,default:"13"}},data:function(){return{}},computed:{},mounted:function(){},destroyed:function(){},methods:{close:function(){this.$emit("close")}}},a=(n("KWCB"),n("KHd+")),o=Object(a.a)(i,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("flexbox",{staticClass:"reminder-wrapper"},[n("flexbox",{staticClass:"reminder-body",attrs:{align:"stretch"}},[n("i",{staticClass:"wk wk-warning reminder-icon"}),t._v(" "),n("div",{staticClass:"reminder-content",style:{"font-size":t.fontSize+"px"},domProps:{innerHTML:t._s(t.content)}}),t._v(" "),t._t("default"),t._v(" "),t.closeShow?n("i",{staticClass:"el-icon-close close",on:{click:t.close}}):t._e()],2)],1)},[],!1,null,"36522fcc",null);o.options.__file="Reminder.vue";e.a=o.exports},n9M2:function(t,e,n){},sJZQ:function(t,e,n){"use strict";n.r(e);var i=n("6iAj"),a=n("9GgJ"),o=n("jzeO"),r=n("glbJ"),s=n("ZoMv"),c={name:"PrintTemplateDetail",components:{XrHeader:a.a,Reminder:o.a,Tinymce:r.a},data:function(){return{loading:!1,activeTab:"",tabs:[],tabData:{},menuIndex:"",richHeight:document.documentElement.clientHeight-135,content:"",selectNodes:null}},computed:{menuList:function(){return this.tabData[this.activeTab]||[]},type:function(){return this.$route.query.type},isCreate:function(){return"create"==this.$route.query.handle},editor:function(){return this.$refs.createTinymce.editor}},created:function(){this.getFields(this.type),this.isCreate||this.getDetail()},methods:{getDetail:function(){var t=this;this.loading=!0,Object(i.G)({id:this.$route.query.templateId}).then(function(e){var n=e.data||{};t.content=n.content,t.loading=!1}).catch(function(){t.loading=!1})},getFields:function(t){var e=this;this.loading=!0,Object(i.C)({type:t}).then(function(n){var i=n.data||{};e.tabData=i;var a=[],o=s.a.convertTypeToKey(t);a.push({key:o,label:s.a.convertKeyToName(o)});["customer","contacts","product","business","contract","receivables"].forEach(function(t){if(t!=o&&i[t]){var e={key:t};e.label=s.a.convertKeyToName(t),a.push(e)}}),e.tabs=a,a.length>0?e.activeTab=a[0].key:e.activeTab="",e.loading=!1}).catch(function(){e.loading=!1})},tabsClick:function(){this.menuIndex=""},menuSelect:function(t,e){if(this.menuIndex=t.field,"product"==this.activeTab&&"discount_rate"!=t.field&&"total_price"!=t.field){var n=this.getCurrentParentByTag('table[data-wk-table-tag="table"]');if(n){var i=this.editor.dom.select('tr[data-wk-table-tr-tag="header"]',n),a=this.editor.dom.select('tr[data-wk-table-tr-tag="value"]',n);i&&a&&(this.editor.dom.add(i,"td",{"data-wk-table-td-tag":"name"},t.name),this.editor.dom.add(a,"td",{"data-wk-table-td-tag":"value"},this.getSpanNode(t,"table-value")),this.content=this.editor.getContent({format:"html"}))}else this.getCurrentParentByTag("table")||this.editor.insertContent(this.getProuctTable(t))}else{this.getCurrentParentByTag('table[data-wk-table-tag="table"]')||("product"!=this.activeTab||"discount_rate"!=t.field&&"total_price"!=t.field?this.editor.insertContent(this.getSpanNode(t)):this.editor.insertContent(this.getSpanNode(t,"",s.a.convertTypeToKey(this.type))),this.content=this.editor.getContent({format:"html"}))}},getCurrentParentByTag:function(t){return this.editor.dom.getParent(this.editor.selection.getNode(),t)},getProuctTable:function(t){return'\n \n \n \n \n
'+t.name+'
'+this.getSpanNode(t,"table-value")+"
"},getSpanNodeAttrs:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.getSpanNodeAttrsByType(t,e,this.activeTab)},getSpanNodeAttrsByType:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments[2],i={},a="data-wk"+(e?"-"+e:"")+"-tag",o=n+"."+t.field;return i[a]=o,i.class="wk-print-tag-wukong "+this.getSpanColorClass(),i.contenteditable=!1,i},getSpanNode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.activeTab;return"{'+t.name+"}"},getSpanColorClass:function(){return"wk-tiny-color--"+(["customer","contacts","business","contract","receivables","product"].includes(this.activeTab)?this.activeTab:"common")},perviewClick:function(){this.editor.execCommand("mcePreview")},saveClick:function(){var t=this;this.loading=!0;var e=this.isCreate?i.x:i.I,n=this.$route.query,a={name:n.name,type:n.type,content:this.content};this.isCreate||(a.id=n.templateId),e(a).then(function(e){t.loading=!1,t.isCreate?(t.$message({type:"success",message:"新建成功"}),t.$router.go(-1)):t.$message({type:"success",message:"保存成功"})}).catch(function(){t.loading=!1})},goBackClick:function(){this.$router.go(-1)},getEditConfig:function(){var t=this;return{menubar:!1,toolbar_sticky:!0,statusbar:!1,content_style:"p { margin: 5px 0; line-height: 1.5;}",content_css:["./static/tinymce/css/tiny-wk-colors.css","./static/tinymce/css/tiny-wk-word.css"],table_advtab:!1,table_cell_advtab:!1,table_row_advtab:!1,setup:function(e){e.on("init",function(t){e.execCommand("mceFocus")}),e.on("keydown",function(n){if(t.selectNodes=null,8===n.keyCode||46==n.keyCode){var i=e.selection.getNode();if("value"===i.getAttribute("data-wk-table-td-tag"))return n.preventDefault(),!1;if("SPAN"==i.nodeName){if(i.hasAttribute("contenteditable"))return n.preventDefault(),e.dom.remove(i),!1;var a=t.getCurrentParentByTag("span[contenteditable]");if(a)return n.preventDefault(),e.dom.remove(a),!1}}else if("65"==n.keyCode&&(n.metaKey||n.ctrlKey))t.selectNodes=e.selection.getNode(),t.setSpanEditAttr(t.selectNodes,!0);else{var o=e.selection.getNode();if("value"===o.getAttribute("data-wk-table-td-tag")){if(37!==n.keyCode&&38!==n.keyCode&&39!==n.keyCode&&40!==n.keyCode)return n.preventDefault(),!1}else if("SPAN"==o.nodeName){if(o.hasAttribute("contenteditable"))return!!o.getAttribute("contenteditable")&&(n.preventDefault(),o.setAttribute("contenteditable",!1),!1);var r=t.getCurrentParentByTag("span[contenteditable]");if(r)return!!r.getAttribute("contenteditable")&&(n.preventDefault(),r.setAttribute("contenteditable",!1),!1)}37==n.keyCode&&38==n.keyCode&&39==n.keyCode&&40==n.keyCode&&t.cancelSpanEdit()}}),e.on("mousedown",function(e){t.cancelSpanEdit()}),e.on("mouseup",function(n){var i=e.selection.getSel();n.target.hasAttribute("contenteditable")&&1==i.anchorOffset&&1==i.anchorOffset||(n.target.hasAttribute("contenteditable")&&i.isCollapsed?t.cancelSpanEdit():i.isCollapsed?t.cancelSpanEdit():(t.selectNodes=e.selection.getNode(),t.setSpanEditAttr(t.selectNodes,!0)))})}}},cancelSpanEdit:function(){var t=this;this.selectNodes&&setTimeout(function(){t.editor.selection.getSel().isCollapsed||(t.setSpanEditAttr(t.selectNodes,!1),t.selectNodes=null)},300)},setSpanEditAttr:function(t,e){if(t&&t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")!=e&&t.setAttribute("contenteditable",e),t&&t.children)for(var n=0;n