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-291c.a3a38162.js

1 line
11 KiB

(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'<table data-wk-table-tag="table" style="border-collapse: collapse; width: 100%;" border="1" >\n <tbody>\n <tr data-wk-table-tr-tag="header"><td data-wk-table-td-tag="name">'+t.name+'</td></tr>\n <tr data-wk-table-tr-tag="value"><td data-wk-table-td-tag="value">'+this.getSpanNode(t,"table-value")+"</td></tr>\n </tbody>\n </table>"},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"<span data-wk"+(e?"-"+e:"")+'-tag="'+n+"."+t.field+'" class="wk-print-tag-wukong '+this.getSpanColorClass()+'" contenteditable="false">{'+t.name+"}</span>"},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<t.children.length;n++){var a=t.children[n];a.children?this.setSpanEditAttr(a,e):a.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")!=e&&a.setAttribute("contenteditable",e)}}}},l=(n("x9VO"),n("KHd+")),d=Object(l.a)(c,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"print-template-detail"},[n("xr-header",{attrs:{"icon-class":"wk wk-print","icon-color":"#26d4da",label:"新建打印模板"}},[n("template",{slot:"ft"},[n("el-button",{attrs:{type:"text"},on:{click:t.perviewClick}},[t._v("预览")]),t._v(" "),n("el-button",{directives:[{name:"debounce",rawName:"v-debounce",value:t.saveClick,expression:"saveClick"}],attrs:{type:"primary"}},[t._v("保存")]),t._v(" "),n("el-button",{on:{click:t.goBackClick}},[t._v("返回")])],1)],2),t._v(" "),n("div",{staticClass:"print-template-detail__body"},[n("div",{staticClass:"system-view-nav"},[n("el-tabs",{on:{"tab-click":t.tabsClick},model:{value:t.activeTab,callback:function(e){t.activeTab=e},expression:"activeTab"}},t._l(t.tabs,function(t,e){return n("el-tab-pane",{key:e,attrs:{label:t.label,name:t.key}})})),t._v(" "),n("reminder",{staticClass:"xr-reminder",attrs:{content:"点击字段插入值(光标所在位置)"}}),t._v(" "),n("div",{staticClass:"menus"},t._l(t.menuList,function(e,a){return n("div",{key:a,staticClass:"menu-item",class:{"is-select":e.field==t.menuIndex},on:{click:function(n){t.menuSelect(e,a)}}},[t._v("\n "+t._s(e.name)+"\n ")])}))],1),t._v(" "),n("div",{staticClass:"system-view-content"},[n("tinymce",{ref:"createTinymce",staticClass:"rich-txt",attrs:{height:t.richHeight,init:t.getEditConfig()},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1)])],1)},[],!1,null,"50d5aec9",null);d.options.__file="PrintTemplateDetail.vue";e.default=d.exports},x9VO:function(t,e,n){"use strict";var a=n("XgEC");n.n(a).a}}]);