1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";(self["webpackChunkwx_manage"]=self["webpackChunkwx_manage"]||[]).push([[4547,8752],{8752:function(e,t,a){a.r(t),a.d(t,{default:function(){return m}});var l=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-dialog",{attrs:{title:e.dataForm.id?"修改":"新增","close-on-click-modal":!1,visible:e.visible},on:{"update:visible":function(t){e.visible=t}}},[a("el-form",{ref:"dataForm",attrs:{model:e.dataForm,rules:e.dataRule,"label-width":"80px"}},[a("el-form-item",{attrs:{label:"规则名称",prop:"ruleName"}},[a("el-input",{attrs:{placeholder:"规则名称"},model:{value:e.dataForm.ruleName,callback:function(t){e.$set(e.dataForm,"ruleName",t)},expression:"dataForm.ruleName"}})],1),a("el-form-item",{attrs:{label:"匹配词",prop:"matchValue"}},[a("tags-editor",{model:{value:e.dataForm.matchValue,callback:function(t){e.$set(e.dataForm,"matchValue",t)},expression:"dataForm.matchValue"}})],1),a("el-row",[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"作用范围",prop:"appid"}},[a("el-select",{attrs:{placeholder:"作用范围"},model:{value:e.dataForm.appid,callback:function(t){e.$set(e.dataForm,"appid",t)},expression:"dataForm.appid"}},[a("el-option",{attrs:{label:"全部公众号",value:""}}),a("el-option",{attrs:{label:"当前公众号",value:e.selectedAppid}})],1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"精确匹配",prop:"exactMatch"}},[a("el-switch",{attrs:{"active-value":!0,"inactive-value":!1},model:{value:e.dataForm.exactMatch,callback:function(t){e.$set(e.dataForm,"exactMatch",t)},expression:"dataForm.exactMatch"}})],1)],1)],1),a("el-row",[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"回复类型",prop:"replyType"}},[a("el-select",{on:{change:e.onReplyTypeChange},model:{value:e.dataForm.replyType,callback:function(t){e.$set(e.dataForm,"replyType",t)},expression:"dataForm.replyType"}},e._l(e.KefuMsgType,(function(e,t){return a("el-option",{key:t,attrs:{value:t,label:e}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"是否启用",prop:"status"}},[a("el-switch",{attrs:{"active-value":!0,"inactive-value":!1},model:{value:e.dataForm.status,callback:function(t){e.$set(e.dataForm,"status",t)},expression:"dataForm.status"}})],1)],1)],1),a("el-row",[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"生效时间",prop:"effectTimeStart"}},[a("el-time-picker",{attrs:{"value-format":"HH:mm:ss"},model:{value:e.dataForm.effectTimeStart,callback:function(t){e.$set(e.dataForm,"effectTimeStart",t)},expression:"dataForm.effectTimeStart"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"失效时间",prop:"effectTimeEnd"}},[a("el-time-picker",{attrs:{"value-format":"HH:mm:ss"},model:{value:e.dataForm.effectTimeEnd,callback:function(t){e.$set(e.dataForm,"effectTimeEnd",t)},expression:"dataForm.effectTimeEnd"}})],1)],1)],1),a("el-form-item",{attrs:{label:"回复内容",prop:"replyContent"}},[a("el-input",{attrs:{type:"textarea",rows:5,placeholder:"文本、图文ID、media_id、json配置"},model:{value:e.dataForm.replyContent,callback:function(t){e.$set(e.dataForm,"replyContent",t)},expression:"dataForm.replyContent"}}),a("el-button",{directives:[{name:"show",rawName:"v-show",value:"text"==e.dataForm.replyType,expression:"'text'==dataForm.replyType"}],attrs:{type:"text"},on:{click:e.addLink}},[e._v("插入链接")]),a("el-button",{directives:[{name:"show",rawName:"v-show",value:e.assetsType,expression:"assetsType"}],attrs:{type:"text"},on:{click:function(t){e.assetsSelectorVisible=!0}}},[e._v(" 从素材库中选择"),"miniprogrampage"==e.dataForm.replyType||"music"==e.dataForm.replyType?a("span",[e._v("缩略图")]):e._e()])],1),a("el-form-item",{attrs:{label:"备注说明",prop:"desc"}},[a("el-input",{attrs:{placeholder:"备注说明"},model:{value:e.dataForm.desc,callback:function(t){e.$set(e.dataForm,"desc",t)},expression:"dataForm.desc"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.visible=!1}}},[e._v("取消")]),a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.dataFormSubmit()}}},[e._v("确定")])],1),e.assetsSelectorVisible&&e.assetsType?a("assets-selector",{attrs:{visible:e.assetsSelectorVisible,selectType:e.assetsType},on:{selected:e.onAssetsSelect,onClose:function(t){e.assetsSelectorVisible=!1}}}):e._e()],1)},r=[],s=a(20629),i={components:{tagsEditor:()=>a.e(9864).then(a.bind(a,39864)),AssetsSelector:()=>a.e(9863).then(a.bind(a,19863))},data(){return{visible:!1,assetsSelectorVisible:!1,dataForm:{ruleId:0,appid:"",ruleName:"",exactMatch:!1,matchValue:"",replyType:"text",replyContent:"",status:!0,desc:"",effectTimeStart:"00:00:00",effectTimeEnd:"23:59:59"},dataRule:{ruleName:[{required:!0,message:"规则名称不能为空",trigger:"blur"}],matchValue:[{required:!0,message:"匹配的关键词、事件等不能为空",trigger:"blur"}],replyType:[{required:!0,message:"回复类型(1:文本2:图文3媒体)不能为空",trigger:"blur"}],replyContent:[{required:!0,message:"回复内容不能为空",trigger:"blur"}],status:[{required:!0,message:"是否有效不能为空",trigger:"blur"}],effectTimeStart:[{required:!0,message:"生效起始时间不能为空",trigger:"blur"}],effectTimeEnd:[{required:!0,message:"生效结束时间不能为空",trigger:"blur"}]}}},computed:(0,s.rn)({KefuMsgType:e=>e.message.KefuMsgType,selectedAppid:e=>e.wxAccount.selectedAppid,assetsType(){const e={image:"image",voice:"voice",video:"video",mpnews:"news",miniprogrampage:"image",music:"image"};return e[this.dataForm.replyType]||""}}),methods:{init(e){this.dataForm.ruleId=e||0,this.visible=!0,this.$nextTick((()=>{this.$refs["dataForm"].resetFields(),this.dataForm.ruleId&&this.$http({url:this.$http.adornUrl(`/manage/msgReplyRule/info/${this.dataForm.ruleId}`),method:"get",params:this.$http.adornParams()}).then((({data:e})=>{e&&200===e.code&&(this.dataForm=e.msgReplyRule)}))}))},dataFormSubmit(){this.$refs["dataForm"].validate((e=>{e&&this.$http({url:this.$http.adornUrl("/manage/msgReplyRule/"+(this.dataForm.ruleId?"update":"save")),method:"post",data:this.$http.adornData(this.dataForm)}).then((({data:e})=>{e&&200===e.code?this.$message({message:"操作成功",type:"success",duration:1500,onClose:()=>{this.visible=!1,this.$emit("refreshDataList")}}):this.$message.error(e.msg)}))}))},addLink(){this.dataForm.replyContent+='<a href="链接地址">链接文字</a>'},onReplyTypeChange(e){if("miniprogrampage"==e){let e={title:"标题",appid:"小程序APPID",pagepath:"页面地址",thumb_media_id:"缩略图media_id"};this.dataForm.replyContent=JSON.stringify(e,null,4)}else if("music"==e){let e={musicurl:"音乐链接",hqmusicurl:"高品质链接",title:"标题",description:"描述",thumb_media_id:"缩略图media_id"};this.dataForm.replyContent=JSON.stringify(e,null,4)}else if("msgmenu"==e){let e={head_content:"开头文字",list:[{id:"菜单1ID",content:"菜单2内容"},{id:"菜单2ID",content:"菜单2内容"},{id:"菜单nID",content:"菜单n内容"}],tail_content:"结尾文字"};this.dataForm.replyContent=JSON.stringify(e,null,4)}else if("news"==e){let e={title:"文章标题",description:"文章简介",url:"链接URL",picUrl:"缩略图URL"};this.dataForm.replyContent=JSON.stringify(e,null,4)}else this.dataForm.replyContent="媒体素材media_id"},onAssetsSelect(e){if("miniprogrampage"==this.dataForm.replyType||"music"==this.dataForm.replyType){let t=JSON.parse(this.dataForm.replyContent);t&&t.thumb_media_id&&(t.thumb_media_id=e.mediaId),this.dataForm.replyContent=JSON.stringify(t,null,4)}else this.dataForm.replyContent=e.mediaId;this.assetsSelectorVisible=!1}}},o=i,n=a(1001),d=(0,n.Z)(o,l,r,!1,null,null,null),m=d.exports},44547:function(e,t,a){a.r(t),a.d(t,{default:function(){return p}});var l=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"mod-config"},[a("el-form",{attrs:{inline:!0,model:e.dataForm},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.getDataList()}}},[a("el-form-item",[a("el-input",{attrs:{placeholder:"匹配关键词",clearable:""},model:{value:e.dataForm.matchValue,callback:function(t){e.$set(e.dataForm,"matchValue",t)},expression:"dataForm.matchValue"}})],1),a("el-form-item",[a("el-button",{on:{click:function(t){return e.getDataList()}}},[e._v("查询")]),e.isAuth("wx:msgreplyrule:save")?a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.addOrUpdateHandle()}}},[e._v("新增")]):e._e(),e.isAuth("wx:msgreplyrule:delete")?a("el-button",{attrs:{type:"danger",disabled:e.dataListSelections.length<=0},on:{click:function(t){return e.deleteHandle()}}},[e._v("批量删除")]):e._e()],1)],1),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.dataListLoading,expression:"dataListLoading"}],staticStyle:{width:"100%"},attrs:{data:e.dataList,border:"",type:"expand"},on:{"selection-change":e.selectionChangeHandle}},[a("el-table-column",{attrs:{type:"expand"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-form",{staticClass:"demo-table-expand",attrs:{"label-position":"left",inline:""}},[a("el-form-item",{attrs:{label:"作用范围"}},[a("span",[e._v(e._s(t.row.appid?"当前公众号":"全部公众号"))])]),a("el-form-item",{attrs:{label:"精确匹配"}},[a("span",[e._v(e._s(t.row.exactMatch?"是":"否"))])]),a("el-form-item",{attrs:{label:"是否有效"}},[a("span",[e._v(e._s(t.row.status?"是":"否"))])]),a("el-form-item",{attrs:{label:"备注说明"}},[a("span",[e._v(e._s(t.row.desc))])]),a("el-form-item",{attrs:{label:"生效时间"}},[a("span",[e._v(e._s(t.row.effectTimeStart))])]),a("el-form-item",{attrs:{label:"失效时间"}},[a("span",[e._v(e._s(t.row.effectTimeEnd))])])],1)]}}])}),a("el-table-column",{attrs:{type:"selection","header-align":"center",align:"center",width:"50"}}),a("el-table-column",{attrs:{prop:"ruleName","header-align":"center",align:"center","show-overflow-tooltip":"",label:"规则名称"}}),a("el-table-column",{attrs:{prop:"matchValue","header-align":"center",align:"center","show-overflow-tooltip":"",label:"匹配关键词"}}),a("el-table-column",{attrs:{prop:"replyType","header-align":"center",align:"center",formatter:e.replyTypeFormat,label:"消息类型"}}),a("el-table-column",{attrs:{prop:"replyContent","header-align":"center",align:"center","show-overflow-tooltip":"",label:"回复内容"}}),a("el-table-column",{attrs:{fixed:"right","header-align":"center",align:"center",width:"150",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.addOrUpdateHandle(t.row.ruleId)}}},[e._v("修改")]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.deleteHandle(t.row.ruleId)}}},[e._v("删除")])]}}])})],1),a("el-pagination",{attrs:{"current-page":e.pageIndex,"page-sizes":[10,20,50,100],"page-size":e.pageSize,total:e.totalCount,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":e.sizeChangeHandle,"current-change":e.currentChangeHandle}}),e.addOrUpdateVisible?a("add-or-update",{ref:"addOrUpdate",on:{refreshDataList:e.getDataList}}):e._e()],1)},r=[],s=a(8752),i=a(20629),o={components:{AddOrUpdate:s["default"]},data(){return{dataForm:{matchValue:""},dataList:[],pageIndex:1,pageSize:10,totalCount:0,dataListLoading:!1,dataListSelections:[],addOrUpdateVisible:!1}},computed:(0,i.rn)({KefuMsgType:e=>e.message.KefuMsgType}),activated(){this.getDataList()},methods:{getDataList(){this.dataListLoading=!0,this.$http({url:this.$http.adornUrl("/manage/msgReplyRule/list"),method:"get",params:this.$http.adornParams({page:this.pageIndex,limit:this.pageSize,matchValue:this.dataForm.matchValue})}).then((({data:e})=>{e&&200===e.code?(this.dataList=e.page.list,this.totalCount=e.page.totalCount):(this.dataList=[],this.totalCount=0),this.dataListLoading=!1}))},sizeChangeHandle(e){this.pageSize=e,this.pageIndex=1,this.getDataList()},currentChangeHandle(e){this.pageIndex=e,this.getDataList()},selectionChangeHandle(e){this.dataListSelections=e},addOrUpdateHandle(e){this.addOrUpdateVisible=!0,this.$nextTick((()=>{this.$refs.addOrUpdate.init(e)}))},deleteHandle(e){var t=e?[e]:this.dataListSelections.map((e=>e.ruleId));this.$confirm(`确定对[id=${t.join(",")}]进行[${e?"删除":"批量删除"}]操作?`,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{this.$http({url:this.$http.adornUrl("/manage/msgReplyRule/delete"),method:"post",data:this.$http.adornData(t,!1)}).then((({data:e})=>{e&&200===e.code?this.$message({message:"操作成功",type:"success",duration:1500,onClose:()=>this.getDataList()}):this.$message.error(e.msg)}))}))},replyTypeFormat(e,t,a){return this.KefuMsgType[a]}}},n=o,d=a(1001),m=(0,d.Z)(n,l,r,!1,null,null,null),p=m.exports}}]); |