(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-50006a76"],{"0f50":function(e,t,a){},"57ef":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"template-wrap"},[a("el-card",{staticClass:"top-card-wrap"},[a("el-form",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryForm",attrs:{model:e.queryParams,size:"small",inline:!0,"label-width":"68px"}},[a("el-form-item",{attrs:{label:"模版名称",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入模版名称",clearable:""},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleQuery(t)}},model:{value:e.queryParams.name,callback:function(t){e.$set(e.queryParams,"name",t)},expression:"queryParams.name"}})],1),a("el-form-item",{attrs:{label:"渠道类型",prop:"channelType"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择渠道类型",clearable:"",size:"small"},model:{value:e.queryParams.channelType,callback:function(t){e.$set(e.queryParams,"channelType",t)},expression:"queryParams.channelType"}},e._l(e.channelTypeList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-form-item",{attrs:{label:"业务编码",prop:"serviceCode"}},[a("el-select",{staticStyle:{width:"100%",display:"inline-block"},attrs:{placeholder:"请选择通知业务",clearable:""},model:{value:e.queryParams.serviceCode,callback:function(t){e.$set(e.queryParams,"serviceCode",t)},expression:"queryParams.serviceCode"}},e._l(e.dict.type.notify_service_code,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:e.handleQuery}},[e._v("搜索")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini"},on:{click:e.resetQuery}},[e._v("重置")])],1)],1),a("el-row",{staticClass:"mb8",attrs:{gutter:10}},[a("el-col",{attrs:{span:1.5}},[a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["notify:template:add"],expression:"['notify:template:add']"}],attrs:{type:"primary",plain:"",icon:"el-icon-plus",size:"mini"},on:{click:e.handleAdd}},[e._v("新增模板")])],1),a("right-toolbar",{attrs:{showSearch:e.showSearch},on:{"update:showSearch":function(t){e.showSearch=t},"update:show-search":function(t){e.showSearch=t},queryTable:e.getList}})],1)],1),a("el-card",{staticClass:"card-wrap"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.templateList}},[a("el-table-column",{attrs:{label:"模板名称",align:"left",prop:"name","min-width":"100"}}),a("el-table-column",{attrs:{label:"渠道类型",align:"left",prop:"channelType"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.notify_channel_type,value:t.row.channelType}})]}}])}),a("el-table-column",{attrs:{label:"渠道账号",align:"left",prop:"channelName"}}),a("el-table-column",{attrs:{label:"服务商",align:"left",prop:"provider"}}),a("el-table-column",{attrs:{label:"业务编码",align:"left",prop:"serviceCode"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.notify_service_code,value:t.row.serviceCode}})]}}])}),a("el-table-column",{attrs:{label:"是否启用",align:"center",prop:"status"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(a){return e.handleStatus(t.row)}},model:{value:t.row.status,callback:function(a){e.$set(t.row,"status",a)},expression:"scope.row.status"}})]}}])}),a("el-table-column",{attrs:{label:"创建时间",align:"left",prop:"createTime"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",[e._v(e._s(e.parseTime(t.row.createTime,"{y}-{m}-{d} {h}:{m}:{s}")))])]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center","class-name":"small-padding fixed-width",width:"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{size:"mini",type:"text",icon:"el-icon-s-promotion"},on:{click:function(a){return e.getVariablesList(t.row)}}},[e._v("测试")]),a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["notify:template:query"],expression:"['notify:template:query']"}],attrs:{size:"mini",type:"text",icon:"el-icon-view"},on:{click:function(a){return e.handleUpdate(t.row)}}},[e._v("详情")]),a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["notify:template:remove"],expression:"['notify:template:remove']"}],attrs:{size:"mini",type:"text",icon:"el-icon-delete"},on:{click:function(a){return e.handleDelete(t.row)}}},[e._v("删除")])]}}])})],1),a("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],attrs:{total:e.total,page:e.queryParams.pageNum,limit:e.queryParams.pageSize},on:{"update:page":function(t){return e.$set(e.queryParams,"pageNum",t)},"update:limit":function(t){return e.$set(e.queryParams,"pageSize",t)},pagination:e.getList}}),a("el-dialog",{attrs:{title:e.title,visible:e.open,width:"50%","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[a("div",{staticStyle:{"margin-top":"-55px"}},[a("el-divider",{staticStyle:{"margin-top":"-30px"}}),a("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"90px"}},[a("el-form-item",{attrs:{label:"模板名称",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入模板名称"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"业务编码",prop:"serviceCode"}},[a("el-select",{staticStyle:{width:"100%",display:"inline-block"},attrs:{placeholder:"请选择通知业务"},model:{value:e.form.serviceCode,callback:function(t){e.$set(e.form,"serviceCode",t)},expression:"form.serviceCode"}},e._l(e.dict.type.notify_service_code,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-row",[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"渠道类型",prop:"channelType"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择渠道类型",clearable:"",size:"small"},on:{change:e.changeChannel},model:{value:e.form.channelType,callback:function(t){e.$set(e.form,"channelType",t)},expression:"form.channelType"}},e._l(e.channelTypeList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"服务商",prop:"provider"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择服务商",clearable:"",size:"small",disabled:null==e.form.channelType},on:{change:e.changeService},model:{value:e.form.provider,callback:function(t){e.$set(e.form,"provider",t)},expression:"form.provider"}},e._l(e.providersList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),a("el-form-item",{attrs:{label:"渠道账号",prop:"channelId"}},[a("el-select",{staticStyle:{width:"100%",display:"inline-block"},attrs:{placeholder:"请选择渠道账号",disabled:null==this.form.provider},on:{change:e.getTemplateMsg},model:{value:e.form.channelId,callback:function(t){e.$set(e.form,"channelId",t)},expression:"form.channelId"}},e._l(e.channelIdList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),"wechat"==this.form.channelType&&"mini_program"!=this.form.provider&&"public_account"!=this.form.provider&&null!=this.form.channelId?a("el-form-item",{attrs:{label:"选择类型",prop:"msgType"}},[a("el-select",{staticStyle:{width:"100%",display:"inline-block"},attrs:{placeholder:"请选择发送类型"},on:{change:e.getTemplateMsg},model:{value:e.form.msgType,callback:function(t){e.$set(e.form,"msgType",t)},expression:"form.msgType"}},e._l(e.dict.type.wecom_msg_type,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1):e._e(),"dingtalk"==this.form.channelType&&null!=this.form.channelId?a("el-form-item",{attrs:{label:"选择类型",prop:"msgType"}},[a("el-select",{staticStyle:{width:"100%",display:"inline-block"},attrs:{placeholder:"请选择钉钉通知发送类型"},on:{change:e.getTemplateMsg},model:{value:e.form.msgType,callback:function(t){e.$set(e.form,"msgType",t)},expression:"form.msgType"}},e._l(e.dict.type.dingtalk_msg_type,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1):e._e(),a("div"),e._l(e.configList,(function(t,n){return a("el-form-item",{key:n,attrs:{label:t.label}},["string"==t.type?a("el-input",{attrs:{placeholder:"请输入配置内容"},model:{value:t.value,callback:function(a){e.$set(t,"value",a)},expression:"item.value"}}):e._e(),"int"==t.type?a("el-input",{attrs:{placeholder:"请输入配置内容",type:"number"},model:{value:t.value,callback:function(a){e.$set(t,"value",a)},expression:"item.value"}}):e._e(),"text"==t.type?a("editor",{attrs:{"min-height":192,url_type:e.url_type},model:{value:t.value,callback:function(a){e.$set(t,"value",a)},expression:"item.value"}}):e._e(),"boolean"==t.type?a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#c0c0c0"},model:{value:t.value,callback:function(a){e.$set(t,"value",a)},expression:"item.value"}}):e._e(),"file"==t.type&&"attachment"==t.attribute?a("fileUpload",{ref:"upload",refInFor:!0,attrs:{value:e.form.filePath,limit:1,fileSize:10,uploadFileUrl:e.uploadUrl,fileType:["docx","xlsx","ppt","txt","pdf","zip","jpg","png"]},on:{input:function(t){return e.getFilePath(t)}}}):e._e(),"file"==t.type&&"picUrl"==t.attribute?a("fileUpload",{ref:"upload",refInFor:!0,attrs:{value:e.form.filePath,limit:1,fileSize:10,uploadFileUrl:e.uploadUrl,fileType:["jpg","png"]},on:{input:function(t){return e.getFilePath(t)}}}):e._e()],1)}))],2)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["notify:template:edit"],expression:"['notify:template:edit']"},{name:"show",rawName:"v-show",value:e.form.id,expression:"form.id"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("修 改")]),a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["notify:template:add"],expression:"['notify:template:add']"},{name:"show",rawName:"v-show",value:!e.form.id,expression:"!form.id"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("新 增")]),a("el-button",{on:{click:e.cancel}},[e._v("取 消")])],1)]),a("el-dialog",{attrs:{title:e.title,visible:e.testModel,width:"700px","append-to-body":""},on:{"update:visible":function(t){e.testModel=t}}},[a("div",{staticStyle:{"margin-top":"-55px"}},[a("el-divider",{staticStyle:{"margin-top":"-30px"}}),a("el-form",{ref:"testForm",attrs:{model:e.testForm,rules:e.testRules,"label-width":"120px"}},[null!=this.testForm.account?a("el-form-item",{attrs:{label:"发送账号",prop:"account"}},[a("el-input",{attrs:{placeholder:"请输入电话号码或者邮箱或者用户id"},model:{value:e.testForm.account,callback:function(t){e.$set(e.testForm,"account",t)},expression:"testForm.account"}})],1):e._e(),e._l(e.variablesList,(function(t,n){return a("div",{key:n},[a("el-form-item",{attrs:{label:n}},[a("el-input",{staticStyle:{width:"100%"},attrs:{placeholder:"请输入变量信息",clearable:""},model:{value:e.variablesList[n],callback:function(t){e.$set(e.variablesList,n,t)},expression:"variablesList[index]"}})],1)],1)}))],2)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:e.submitTest}},[e._v("确 定")]),a("el-button",{on:{click:e.cancelTest}},[e._v("取 消")])],1)])],1)],1)},i=[],l=a("5530"),r=(a("4de4"),a("caad"),a("d81d"),a("b0c0"),a("e9c4"),a("c1f9"),a("b64b"),a("d3b7"),a("2532"),a("6491")),s=a("8e63"),o={name:"Template",dicts:["notify_channel_type","notify_message_type","iot_yes_no","notify_service_code","dingtalk_msg_type","wecom_msg_type"],data:function(){return{loading:!0,ids:[],single:!0,multiple:!0,showSearch:!0,total:0,templateList:[],variablesList:[],variable:"",channelIdList:[],modelList:[],channelMsgList:[],channelChildren:[],providersList:[],url_type:1,title:"",open:!1,testModel:!1,value:"",uploadUrl:"/prod-api/common/upload",newContent:"",queryParams:{pageNum:1,pageSize:10,name:null,serviceCode:null,channelType:null,msgContent:null,redirectUri:null,ptovider:null},configList:[],notifyTestId:"",form:{status:1,filePath:""},channelTypeList:[],newSrc:"",testForm:{account:""},rules:{name:[{required:!0,message:"渠道名称不能为空",trigger:"blur"}],serviceCode:[{required:!0,message:"通知渠道(短信,微信服务号,邮箱 等)不能为空",trigger:"blur"}],msgContent:[{required:!0,message:"模版内容,配置渠道参数不能为空",trigger:"blur"}],msgParams:[{required:!0,message:"模版内容不能为空",trigger:"blur"}],channelType:[{required:!0,message:"渠道来源不能为空",trigger:"blur"}],channelId:[{required:!0,message:"渠道账号不能为空",trigger:"blur"}],provider:[{required:!0,message:"服务商不能为空",trigger:"blur"}]},testRules:{account:[{required:!0,message:"账号信息不能为空",trigger:"blur"}]}}},created:function(){this.getList(),this.getInfo()},methods:{getList:function(){var e=this;this.loading=!0,Object(r["f"])(this.queryParams).then((function(t){e.templateList=t.rows,e.total=t.total,e.loading=!1}))},getInfo:function(){var e=this;this.loading=!0,Object(s["d"])().then((function(t){e.channelMsgList=t.data,e.channelTypeList=t.data.map((function(e){return{value:e.channelType,label:e.channelName}}))})),this.loading=!1},changeService:function(){this.getServiceList(),this.getTemplateParams(!0)},changeChannel:function(){this.getServiceList(),this.form.provider="",this.configList=[]},getServiceList:function(){var e=this.form.channelType;this.channelChildren=this.channelMsgList.filter((function(t){return e.includes(t.channelType)})).map((function(e){return e.providerList}));for(var t=0;t0?t.$confirm("当前模板已经有相同启用条件的模板启用了(启用条件:同一业务编码的模板短信、语音、邮箱渠道分别可以启用一个,微信、钉钉渠道下不同服务商分别可以启用一个),是否继续启用当前模板?",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(r["i"])(e).then((function(e){200==e.code?(t.getList(),t.$message({type:"success",message:"启用成功"})):t.$message({type:"warning",message:"启用失败"})}))})).catch((function(){e.status=!1,t.$message({type:"info",message:"已取消启用"})})):Object(r["i"])(e).then((function(e){200==e.code?(t.getList(),t.$message({type:"success",message:"启用成功"})):t.$message({type:"warning",message:"启用失败"})}))}));else{var a={channelType:e.channelType,serviceCode:e.serviceCode,id:e.id,status:e.status};Object(r["j"])(a).then((function(e){200==e.code?(t.getList(),t.$message({type:"success",message:"操作成功"})):t.$message({type:"warning",message:"操作失败"})}))}},getTemplateParams:function(e){var t=this,a={channelType:this.form.channelType,provider:this.form.provider};Object(s["f"])(a).then((function(e){t.channelIdList=e.rows.map((function(e){return{value:e.id,label:e.name,provider:e.provider}}))})),1==e&&(this.form.channelId="",this.configList=[],this.form.filePath="")},getTemplateMsg:function(){var e=this;if(this.form.filePath="",("dingtalk"==this.form.channelType||"dingtalk"==this.form.channelType&&"mini_program"!=this.form.provider)&&null==this.form.msgType);else{var t={channelId:this.form.channelId,msgType:this.form.msgType};Object(r["h"])(t).then((function(t){e.configList=t.data.map((function(e){return{value:e.value,label:e.name,attribute:e.attribute,type:e.type}}))}))}},getVariablesList:function(e){var t=this;this.testForm.account="";var a=e.channelType,n=e.provider;this.notifyTestId=e.id||this.ids,Object(r["e"])(this.notifyTestId,a,n).then((function(e){200==e.code?""==e.data?(t.submitTest(),t.testModel=!1):(t.testForm.account=e.data.sendAccount,""!==e.data.variables?t.variablesList=JSON.parse(e.data.variables):t.variablesList="",t.testModel=!0,t.title="测试"):t.$message.error(e.msg)}))},submitTest:function(){var e=this;""==this.variablesList?console.log(this.variablesList):this.variable=JSON.stringify(this.variablesList);var t={sendAccount:this.testForm.account,id:this.notifyTestId,variables:this.variable};Object(r["g"])(t).then((function(t){200==t.code?(e.$message.success("发送成功!"),e.testModel=!1):(e.$message.error(t.msg),e.testModel=!1)}))}}},c=o,u=(a("9e1d"),a("2877")),m=Object(u["a"])(c,n,i,!1,null,"c4d4a1ae",null);t["default"]=m.exports},6491:function(e,t,a){"use strict";a.d(t,"f",(function(){return i})),a.d(t,"c",(function(){return l})),a.d(t,"a",(function(){return r})),a.d(t,"j",(function(){return s})),a.d(t,"b",(function(){return o})),a.d(t,"d",(function(){return c})),a.d(t,"i",(function(){return u})),a.d(t,"g",(function(){return m})),a.d(t,"h",(function(){return p})),a.d(t,"e",(function(){return d}));var n=a("b775");function i(e){return Object(n["a"])({url:"/notify/template/list",method:"get",params:e})}function l(e){return Object(n["a"])({url:"/notify/template/"+e,method:"get"})}function r(e){return Object(n["a"])({url:"/notify/template",method:"post",data:e})}function s(e){return Object(n["a"])({url:"/notify/template",method:"put",data:e})}function o(e){return Object(n["a"])({url:"/notify/template/"+e,method:"delete"})}function c(e){return Object(n["a"])({url:"/notify/template/getUsable",method:"get",params:e})}function u(e){return Object(n["a"])({url:"/notify/template/updateState",method:"post",data:e})}function m(e){return Object(n["a"])({url:"/notify/send",method:"post",data:e})}function p(e){return Object(n["a"])({url:"/notify/template/msgParams",method:"get",params:e})}function d(e,t,a){return Object(n["a"])({url:"/notify/template/listVariables?id="+e+"&channelType="+t+"&provider="+a,method:"get"})}},"8e63":function(e,t,a){"use strict";a.d(t,"f",(function(){return i})),a.d(t,"c",(function(){return l})),a.d(t,"d",(function(){return r})),a.d(t,"e",(function(){return s})),a.d(t,"a",(function(){return o})),a.d(t,"g",(function(){return c})),a.d(t,"b",(function(){return u}));var n=a("b775");function i(e){return Object(n["a"])({url:"/notify/channel/list",method:"get",params:e})}function l(e){return Object(n["a"])({url:"/notify/channel/"+e,method:"get"})}function r(e){return Object(n["a"])({url:"/notify/channel/listChannel",method:"get",params:e})}function s(e,t){return Object(n["a"])({url:"/notify/channel/getConfigContent?channelType="+t+"&provider="+e,method:"get"})}function o(e){return Object(n["a"])({url:"/notify/channel",method:"post",data:e})}function c(e){return Object(n["a"])({url:"/notify/channel",method:"put",data:e})}function u(e){return Object(n["a"])({url:"/notify/channel/"+e,method:"delete"})}},"9e1d":function(e,t,a){"use strict";a("0f50")},c1f9:function(e,t,a){var n=a("23e7"),i=a("2266"),l=a("8418");n({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,a){l(t,e,a)}),{AS_ENTRIES:!0}),t}})}}]);