(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-291c"],{"2f65":function(t,e,n){},"7mY3":function(t,e,n){"use strict";var a=n("2f65");n.n(a).a},"9GgJ":function(t,e,n){"use strict";var a={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)}}},i=(n("7mY3"),n("KHd+")),s=Object(i.a)(a,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);s.options.__file="index.vue";e.a=s.exports},KWCB:function(t,e,n){"use strict";var a=n("n9M2");n.n(a).a},XgEC:function(t,e,n){},jzeO:function(t,e,n){"use strict";var a={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")}}},i=(n("KWCB"),n("KHd+")),s=Object(i.a)(a,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);s.options.__file="Reminder.vue";e.a=s.exports},n9M2:function(t,e,n){},sJZQ:function(t,e,n){"use strict";n.r(e);var a=n("6iAj"),i=n("9GgJ"),s=n("jzeO"),o=n("glbJ"),r=n("ZoMv"),c={name:"PrintTemplateDetail",components:{XrHeader:i.a,Reminder:s.a,Tinymce:o.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(a.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(a.C)({type:t}).then(function(n){var a=n.data||{};e.tabData=a;var i=[],s=r.a.convertTypeToKey(t);i.push({key:s,label:r.a.convertKeyToName(s)});["customer","contacts","product","business","contract","receivables"].forEach(function(t){if(t!=s&&a[t]){var e={key:t};e.label=r.a.convertKeyToName(t),i.push(e)}}),e.tabs=i,i.length>0?e.activeTab=i[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 a=this.editor.dom.select('tr[data-wk-table-tr-tag="header"]',n),i=this.editor.dom.select('tr[data-wk-table-tr-tag="value"]',n);a&&i&&(this.editor.dom.add(a,"td",{"data-wk-table-td-tag":"name"},t.name),this.editor.dom.add(i,"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,"",r.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],a={},i="data-wk"+(e?"-"+e:"")+"-tag",s=n+"."+t.field;return a[i]=s,a.class="wk-print-tag-wukong "+this.getSpanColorClass(),a.contenteditable=!1,a},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?a.x:a.I,n=this.$route.query,i={name:n.name,type:n.type,content:this.content};this.isCreate||(i.id=n.templateId),e(i).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 a=e.selection.getNode();if("value"===a.getAttribute("data-wk-table-td-tag"))return n.preventDefault(),!1;if("SPAN"==a.nodeName){if(a.hasAttribute("contenteditable"))return n.preventDefault(),e.dom.remove(a),!1;var i=t.getCurrentParentByTag("span[contenteditable]");if(i)return n.preventDefault(),e.dom.remove(i),!1}}else if("65"==n.keyCode&&(n.metaKey||n.ctrlKey))t.selectNodes=e.selection.getNode(),t.setSpanEditAttr(t.selectNodes,!0);else{var s=e.selection.getNode();if("value"===s.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"==s.nodeName){if(s.hasAttribute("contenteditable"))return!!s.getAttribute("contenteditable")&&(n.preventDefault(),s.setAttribute("contenteditable",!1),!1);var o=t.getCurrentParentByTag("span[contenteditable]");if(o)return!!o.getAttribute("contenteditable")&&(n.preventDefault(),o.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 a=e.selection.getSel();n.target.hasAttribute("contenteditable")&&1==a.anchorOffset&&1==a.anchorOffset||(n.target.hasAttribute("contenteditable")&&a.isCollapsed?t.cancelSpanEdit():a.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