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.
 
 
 
 

1 lines
13 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-dd515e78"],{"14f8":function(e,t,s){"use strict";s.r(t);var a=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"app-container"},[s("el-form",{ref:"form",attrs:{model:e.smsTask,rules:e.rules,"label-position":"right","label-width":"100px","status-icon":""}},[s("el-row",[s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},[s("el-form-item",{attrs:{label:e.$t("table.smsTask.templateId"),prop:"templateId"}},[s("el-select",{staticStyle:{width:"300px"},attrs:{disabled:"view"===e.type,multiple:!1,filterable:"",placeholder:"请输入关键词"},on:{change:e.changeTemplate},model:{value:e.smsTask.templateId,callback:function(t){e.$set(e.smsTask,"templateId",t)},expression:"smsTask.templateId"}},e._l(e.smsTemplateList,(function(e){return s("el-option",{key:e.id,attrs:{label:e.name+"("+e.customCode+")",value:e.id}})})),1)],1)],1),s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},[s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:"view"===e.type,expression:"type==='view'"}],attrs:{label:e.$t("table.smsTask.status"),prop:"status"}},[s("el-tag",{attrs:{disabled:"view"===e.type,type:e._f("statusFilter")(e.smsTask.status)}},[e._v(e._s(e.smsTask.status.desc))])],1)],1)],1),s("el-form-item",{attrs:{label:e.$t("table.smsTask.receiver"),prop:"receiver"}},[e._l(e.receiverList,(function(t){return s("el-tag",{key:t,attrs:{closable:"view"!==e.type,"disable-transitions":!1},on:{close:function(s){return e.handleClose(t)}}},[e._v(e._s(t))])})),e.receiverVisible?s("el-input",{ref:"saveTagInput",staticClass:"input-new-tag",attrs:{disabled:"view"===e.type},on:{blur:e.handleInputConfirm},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleInputConfirm(t)}},model:{value:e.receiver,callback:function(t){e.receiver=t},expression:"receiver"}}):s("el-button",{staticClass:"button-new-tag",attrs:{disabled:"view"===e.type},on:{click:e.showInput}},[e._v("添加")])],2),s("el-form-item",{attrs:{label:e.$t("table.smsTask.topic"),prop:"topic"}},[s("el-input",{attrs:{disabled:"view"===e.type},model:{value:e.smsTask.topic,callback:function(t){e.$set(e.smsTask,"topic",t)},expression:"smsTask.topic"}})],1),s("el-form-item",{attrs:{label:e.$t("table.smsTask.content"),prop:"content2"}},[s("el-row",{staticClass:"message"},[s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},e._l(e.smsTask.templateParam,(function(t,a,i){return s("el-form-item",{key:i,attrs:{label:a,prop:"content"}},[s("el-input",{attrs:{disabled:"view"===e.type,value:t,maxlength:"255"},on:{input:function(t){e.templateCode(t,a,i)}}})],1)})),1),s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},[s("el-form-item",{attrs:{label:"预览:"}},[s("div",{staticClass:"article",domProps:{innerHTML:e._s(e.smsTask.content)}})])],1)],1)],1),s("el-row",[s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},[s("el-form-item",{attrs:{label:"定时发送",prop:"sendTime"}},[s("el-radio-group",{attrs:{disabled:"view"===e.type,size:"medium"},model:{value:e.timing,callback:function(t){e.timing=t},expression:"timing"}},[s("el-radio-button",{attrs:{label:!1}},[e._v("否")]),s("el-radio-button",{attrs:{label:!0}},[e._v("是")])],1),s("el-date-picker",{directives:[{name:"show",rawName:"v-show",value:e.timing,expression:"timing"}],staticStyle:{"margin-left":"20px"},attrs:{disabled:"view"===e.type,"picker-options":e.pickerOptions,align:"right",format:"yyyy-MM-dd HH:mm:ss",placeholder:"选择发送时间",type:"datetime","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:e.smsTask.sendTime,callback:function(t){e.$set(e.smsTask,"sendTime",t)},expression:"smsTask.sendTime"}})],1)],1),s("el-col",{staticStyle:{"margin-top":"10px"},attrs:{sm:12,xs:24}},[s("el-form-item",{directives:[{name:"show",rawName:"v-show",value:"view"===e.type,expression:"type==='view'"}],attrs:{label:"是否草稿",prop:"draft"}},[s("el-radio-group",{attrs:{disabled:"view"===e.type,size:"medium"},model:{value:e.smsTask.draft,callback:function(t){e.$set(e.smsTask,"draft",t)},expression:"smsTask.draft"}},[s("el-radio-button",{attrs:{label:!1}},[e._v("否")]),s("el-radio-button",{attrs:{label:!0}},[e._v("是")])],1)],1)],1)],1)],1),s("div",{staticClass:"dialog-footer"},[s("el-button",{directives:[{name:"show",rawName:"v-show",value:"view"!==e.type,expression:"type!=='view'"}],attrs:{disabled:e.disabled,plain:"",type:"primary"},on:{click:function(t){return e.submitForm(!1)}}},[e._v("立即发送")]),s("el-button",{directives:[{name:"show",rawName:"v-show",value:"view"!==e.type,expression:"type!=='view'"}],attrs:{disabled:e.disabled,plain:"",type:"warning"},on:{click:function(t){return e.submitForm(!0)}}},[e._v("存草稿")])],1),s("aside",{directives:[{name:"show",rawName:"v-show",value:"view"!==e.type,expression:"type!=='view'"}],staticClass:"tips"},[e._v(" 模板提示: "),s("p",[e._v("1.长度不超过500字,单条短信超过70字后,按67字/条分多条计费;")]),s("p",[e._v("2.短信模板内容不能包含【】符号。")])]),s("div",{directives:[{name:"show",rawName:"v-show",value:"view"===e.type,expression:"type==='view'"}]},[s("send-status-index",{ref:"statusList",attrs:{"dialog-visible":e.dialog.isVisible}})],1)],1)},i=[],r=(s("7db0"),s("c975"),s("a15b"),s("a434"),s("b64b"),s("ac1f"),s("5319"),s("1276"),s("b85c")),n=s("5530"),m=(s("96cf"),s("1da1")),o=s("b92b"),l=s("c189"),c=s("b170"),u=s("8454"),p={name:"SmsTaskEdit",components:{SendStatusIndex:u["default"]},filters:{statusFilter:function(e){var t={WAITING:"danger",SUCCESS:"success",FAIL:"error"};return t[e]||"success"}},props:{},data:function(){var e=this;return{dialog:{isVisible:!1},type:"add",smsTask:this.initSmsTask(),smsTemplateList:[],receiverList:[],receiverVisible:!1,receiver:"",timing:!1,disabled:!1,smsTemplate:"",content:"",rules:{topic:[{required:!0,message:this.$t("rules.require"),trigger:"blur"},{min:1,max:255,message:this.$t("rules.range4to10"),trigger:"blur"}],templateId:{required:!0,message:this.$t("rules.require"),trigger:"blur"},sendTime:{validator:function(t,s,a){var i=e;i.timing?i.smsTask.sendTime?a():a("请选择发送日期"):a()},trigger:"change"}},pickerOptions:{shortcuts:[{text:"一小时后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+36e5),e.$emit("pick",t)}},{text:"明天",onClick:function(e){var t=new Date;t.setTime(t.getTime()+864e5),e.$emit("pick",t)}},{text:"一周后",onClick:function(e){var t=new Date;t.setTime(t.getTime()+6048e5),e.$emit("pick",t)}}]}}},computed:{},watch:{$route:function(){"/sms/manage/edit"===this.$route.path&&(this.initSmsTemplateList(),this.loadSendStatus())}},mounted:function(){this.initSmsTemplateList(),this.loadSendStatus()},methods:{loadSendStatus:function(){var e=this.$route.query.type,t=this.$route.query.id;"view"===e&&this.$refs.statusList.setTaskId(t)},loadSmsTask:function(){var e=this;return Object(m["a"])(regeneratorRuntime.mark((function t(){var s,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(s=e.$route.query.type,a=e.$route.query.id,e.type=s,s&&e.reset(),e.disabled="view"===s,!a){t.next=8;break}return t.next=8,l["a"].get(a).then((function(t){var a=t.data;e.smsTask=Object(n["a"])(Object(n["a"])({},e.smsTask),a.data),"edit"!==s&&(e.smsTask.id=""),e.changeTemplate(e.smsTask.templateId),e.receiverList=e.smsTask.receiver.split(","),e.smsTask.templateParams&&(e.smsTask.templateParam=JSON.parse(e.smsTask.templateParams)),e.smsTask.content=a.data.content,console.log("查询"),e.smsTask.sendTime?e.timing=!0:e.timing=!1,e.smsTemplate=e.smsTemplateList.find((function(t){return t.id===e.smsTask.templateId}))}));case 8:case"end":return t.stop()}}),t)})))()},changeTemplate:function(e){var t=this;if(e){var s,a=Object(r["a"])(t.smsTemplateList);try{for(a.s();!(s=a.n()).done;){var i=s.value;if(i.id===e){var n={};for(var m in n="string"===typeof i.templateParams?JSON.parse(i.templateParams):i.templateParams,n)n[m]="";t.smsTemplate=i,"view"!==t.type&&(console.log("赋值"),t.smsTask.templateParam=n,this.content=i.content);break}}}catch(o){a.e(o)}finally{a.f()}t.changeContent()}},templateCode:function(e,t){var s=this;s.smsTask.templateParam[t]=e,s.changeContent()},changeContent:function(){var e=this;if(e.smsTemplate){var t=e.smsTemplate.providerType.code,s=e.smsTemplate.content;for(var a in e.smsTask.templateParam){var i="";i="TENCENT"==t?"{"+a+"}":"${"+a+"}",e.smsTask.templateParam[a]&&(s=s.replace(i,e.smsTask.templateParam[a]))}"view"!==e.type&&(console.log("赋值"),e.smsTask.content=s)}},initSmsTemplateList:function(){var e=this;return Object(m["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,o["a"].page({current:1,size:1e4,model:{}}).then((function(t){var s=t.data;s.isSuccess&&(e.smsTemplateList=s.data.records)}));case 2:return t.next=4,e.loadSmsTask();case 4:case"end":return t.stop()}}),t)})))()},initSmsTask:function(){return{templateId:"",receiver:"",topic:"",templateParam:{},sendTime:null,content:"",draft:!1,status:{code:"",desc:""}}},reset:function(){this.$refs.form.clearValidate(),this.$refs.form.resetFields(),this.smsTask=this.initSmsTask(),this.receiverList=[]},submitForm:function(e){var t=this;if(t.smsTask.templateParam&&Object.keys(t.smsTask.templateParam).length>0){var s=!1;for(var a in t.smsTask.templateParam)if(!t.smsTask.templateParam[a]){s=!0;break}s?t.$message({message:"发送内容不能为空",type:"error"}):this.$refs.form.validate((function(s){if(!s)return!1;t.editSubmit(e)}))}else t.$message({message:"发送内容不能为空",type:"error"})},editSubmit:function(e){var t=this;t.smsTask.draft=e,t.smsTask.receiver=t.receiverList.join(","),t.timing||(t.smsTask.sendTime=null),"edit"===t.type?t.update():t.save()},save:function(){var e=this;e.disabled=!0,l["a"].save(e.smsTask).then((function(t){e.disabled=!1;var s=t.data;s.isSuccess&&(e.$message({message:e.$t("tips.createSuccess"),type:"success"}),e.reset(),e.$router.push("/sms/manage"))}))},update:function(){var e=this;e.disabled=!0,l["a"].update(e.smsTask).then((function(t){e.disabled=!1;var s=t.data;s.isSuccess&&(e.$message({message:e.$t("tips.createSuccess"),type:"success"}),e.reset(),e.$router.push("/sms/manage"))}))},handleClose:function(e){this.receiverList.splice(this.receiverList.indexOf(e),1)},showInput:function(){var e=this;this.receiverVisible=!0,this.$nextTick((function(){e.$refs.saveTagInput.$refs.input.focus()}))},handleInputConfirm:function(){var e=this,t=e.receiver;if(t){if(!Object(c["d"])(t))return this.$message({message:"该手机号不合法",type:"error"}),void e.$refs.saveTagInput.focus();-1===this.receiverList.indexOf(t)?(e.receiverList.push(t),e.receiverVisible=!1,e.receiver=""):(this.$message({message:"该账号已经存在",type:"error"}),e.$refs.saveTagInput.focus())}else this.receiverVisible=!1}}},d=p,v=(s("b72e"),s("2877")),b=Object(v["a"])(d,a,i,!1,null,"551c3c53",null);t["default"]=b.exports},"88a1":function(e,t,s){},b72e:function(e,t,s){"use strict";var a=s("88a1"),i=s.n(a);i.a},b92b:function(e,t,s){"use strict";var a=s("5530"),i=s("9256"),r={page:{url:"/smsTemplate/page",method:"POST"},save:{url:"/smsTemplate",method:"POST"},update:{url:"/smsTemplate",method:"PUT"},delete:{url:"/smsTemplate",method:"DELETE"},check:{url:"/smsTemplate/check",method:"GET"},preview:{method:"POST",url:"/smsTemplate/preview"},export:{method:"POST",url:"/smsTemplate/export"},import:{method:"POST",url:"/smsTemplate/import"}};t["a"]={page:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.page),{},{data:e}))},save:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.save),{},{data:e}))},update:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.update),{},{data:e}))},delete:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.delete),{},{data:e}))},check:function(e){var t={customCode:e};return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.check),{},{data:t}))},preview:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.preview),{},{data:e}))},export:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.export),{},{responseType:"blob",data:e}))},import:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.import),{},{data:e}))}}},c189:function(e,t,s){"use strict";var a=s("5530"),i=s("9256"),r={page:{url:"/smsTask/page",method:"POST"},save:{url:"/smsTask",method:"POST"},update:{url:"/smsTask",method:"PUT"},delete:{url:"/smsTask",method:"DELETE"},preview:{method:"POST",url:"/smsTask/preview"},export:{method:"POST",url:"/smsTask/export"},import:{method:"POST",url:"/smsTask/import"}};t["a"]={page:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.page),{},{data:e}))},save:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.save),{},{data:e}))},update:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.update),{},{data:e}))},delete:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.delete),{},{data:e}))},get:function(e){return Object(i["a"])({url:"/smsTask/".concat(e),method:"GET"})},preview:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.preview),{},{data:e}))},export:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.export),{},{responseType:"blob",data:e}))},import:function(e){return Object(i["a"])(Object(a["a"])(Object(a["a"])({},r.import),{},{data:e}))}}}}]);