"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[51981],{51981:function(t,e,i){i.r(e),i.d(e,{default:function(){return p}});var l=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{visible:t.dialogVisible,title:t.dialogTitle,width:"720px","close-on-click-modal":!1,"destroy-on-close":!0,"custom-class":"email-template-before-edit"},on:{"update:visible":function(e){t.dialogVisible=e},close:t.handleCancel}},[e("el-form",{ref:"form",staticClass:"g-mt-md",attrs:{model:t.form,"label-width":"120px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name",rules:[{required:!0,message:"请输入名称",trigger:"blur"}]}},[e("el-input",{attrs:{maxlength:"200","show-word-limit":"",placeholder:"请输入"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}}),e("div",{staticClass:"tip"},[t._v("内部备注识别用，不对外展示")])],1),e("el-form-item",{attrs:{label:"主题",prop:"subject",rules:[{required:!0,message:"请输入主题",trigger:"blur"}]}},[e("el-input",{attrs:{type:"textarea",rows:{minRows:2,maxRows:10},maxlength:"500","show-word-limit":"",placeholder:"请输入"},model:{value:t.form.subject,callback:function(e){t.$set(t.form,"subject",e)},expression:"form.subject"}}),e("div",{staticClass:"tip"},[t._v("面向受众的邮件主题")])],1),e("el-form-item",{staticClass:"type-item",attrs:{label:"模板类型",prop:"type",rules:[{required:!0,message:"请选择模板类型",trigger:"change"}]}},[e("div",{staticClass:"type-label",attrs:{slot:"label"},slot:"label"},[e("span",[t._v("模板类型")]),e("div",{staticClass:"tip"},[t._v("此字段无法修改")])]),e("el-radio-group",{model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},t._l(t.emailTemplateTypes,(function([i,l]){return e("div",{key:i,staticClass:"g-mb-lg"},[e("el-radio",{attrs:{label:i}},[t._v(" "+t._s(l)+" ")]),"0"===i?e("div",{staticClass:"tip"},[t._v("批量给受众发送一个相同的邮件内容，不支持参数")]):t._e(),"1"===i?e("div",{staticClass:"tip"},[t._v("可配置基于算法给每个受众推送个性化商品组件、用户变量等")]):t._e(),"2"===i?e("div",{staticClass:"tip"},[t._v("业务触达的消息请选择此类型模板")]):t._e()],1)})),0)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.handleCancel}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary",loading:t.saving},on:{click:t.handleOk}},[t._v("编辑邮件")])],1)],1)},s=[],a=(i(44114),i(12170)),o={props:{visible:{type:Boolean,default:!1},template:{type:Object,default:()=>({})}},data(){return{loading:!1,saving:!1,form:{},emailTemplateTypes:a.g}},computed:{dialogVisible:{get(){return this.visible},set(t){this.$emit("update:visible",t)}},templateId(){return this.template&&this.template.id},isCopy(){return this.template&&"copy"===this.template.__mode},dialogTitle(){return this.isCopy?"复制邮件模版":this.templateId?"编辑邮件模版":"新增邮件模版"},emailTemplateTypeOptions(){return Array.from(a.g.entries())}},watch:{visible(t){t&&this.initFormFromTemplate()}},mounted(){this.visible&&this.initFormFromTemplate()},methods:{initFormFromTemplate(){this.template&&this.template.id?this.form={name:this.template.name,subject:this.template.subject,type:this.template.type}:this.form={}},handleCancel(){this.dialogVisible=!1},handleOk(){this.$refs.form.validate((t=>{t&&(this.saving=!0,this.isCopy&&this.templateId?this.$router.push({path:"/pushNotification/emailTemplate/edit",query:{copyId:this.templateId}}):this.templateId?this.$router.push(`/pushNotification/emailTemplate/edit/${this.templateId}`):this.$router.push("/pushNotification/emailTemplate/edit"),localStorage.setItem("emailTemplateForm",JSON.stringify(this.form)),this.saving=!1,this.dialogVisible=!1)}))}}},r=o,m=i(81656),n=(0,m.A)(r,l,s,!1,null,null,null),p=n.exports},12170:function(t,e,i){i.d(e,{g:function(){return l}});const l=new Map([["2","业务触发型模板"],["0","通用群发模板"],["1","千人千面模板"]])}}]);