1 |
- webpackJsonp([50],{"9QQI":function(t,e){},OOxu:function(t,e){},"Q+BU":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n("Xxa5"),a=n.n(i),r=n("exGp"),s=n.n(r),o=n("u2KI"),l=n.n(o),c=n("Gu7T"),u=n.n(c),m=n("Dd8w"),p=n.n(m),_=n("mvHQ"),d=n.n(_),f=n("//Fk"),v=n.n(f),g=n("sOQl"),h=n("2Uyi"),w=n("ifoU"),y=[{label:"小于等于",value:1},{label:"大于等于",value:2}],b={USER:1,GROUP:2},C={ENABLE:1,DISABLE:2},k=[{label:"分钟",value:1},{label:"小时",value:2},{label:"天",value:3}],x=new(n.n(w).a)([[1,"分钟"],[2,"小时"],[3,"天"]]),S={name:"newFansWarnDialog",components:{customerServiceCorp:g.a},props:{dialogVisible:{type:Boolean,default:function(){return!1}},confId:{type:[String,Number],default:function(){return""}}},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",loading:!1,contrastOptions:l()(y),noticeTypes:l()(b),timeIntervalUnitOptions:l()(k),warnUserOptions:[],warnGroupOptions:[],form:{afferent_djuser_list:[],monitor_user_list:[],notice_type:b.USER,warnUserList:[],warnGroup:"",rules:[{minute:"",check_type:1,num:""}],time_interval:"",time_interval_unit:1,warn_type:1}}},computed:{isEdit:function(){return!!this.confId},title:function(){return(this.isEdit?"编辑":"新建")+"预警"}},watch:{dialogVisible:function(t){t&&(this.handleGetWarnUserOptions(),this.handleGetWarnGroupOptions(),this.handleGetFormData())}},methods:{handleGetWarnUserOptions:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.$axios.get(t.URL.BASEURL+t.URL.warn_userList,{params:{sys_group_id:t.sys_group_id,page:1,page_size:500}});case 3:n=e.sent,i=n.data,(r=void 0===i?{}:i)&&0==r.errno?t.warnUserOptions=r.rst.data:4002!=r.errno&&(t.warnUserOptions=[],t.$message.warning(r.err)),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),t.warnUserOptions=[],console.log("error => ",e.t0);case 13:case"end":return e.stop()}},e,t,[[0,9]])}))()},handleGetWarnGroupOptions:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.$axios.get(t.URL.BASEURL+t.URL.warn_groupList,{params:{sys_group_id:t.sys_group_id,is_select:1}});case 3:n=e.sent,i=n.data,(r=void 0===i?{}:i)&&0==r.errno?t.warnGroupOptions=r.rst:4002!=r.errno&&(t.warnGroupOptions=[],t.$message.warning(r.err)),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),t.warnGroupOptions=[],console.log("error => ",e.t0);case 13:case"end":return e.stop()}},e,t,[[0,9]])}))()},handleConfirm:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.handleFormValidate();case 3:return n=""+t.URL.BASEURL+t.URL.customerAlerts_setConf,i=t.handleGetParams(),t.loading=!0,e.next=8,t.$axios.post(n,i);case 8:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno?(t.$message.success("操作成功"),t.handleClearFormData(),t.$emit("confirm",{isEdit:t.isEdit})):4002!=o.errno&&t.$message.warning(o.err||"操作失败"),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.log("error => ",e.t0);case 17:return e.prev=17,t.loading=!1,e.finish(17);case 20:case"end":return e.stop()}},e,t,[[0,14,17,20]])}))()},handleCancel:function(){this.handleClearFormData(),this.$emit("cancel")},handleFormValidate:function(){var t=this;return new v.a(function(e,n){var i=t.form,a=i.monitor_user_list,r=i.notice_type,s=i.warnUserList,o=i.warnGroup,l=i.rules,c=i.time_interval,u=l.some(function(t){return!t.minute||""===t.num});a&&a.length?r!=b.USER||s.length?r!=b.GROUP||o?u?(t.$message.warning('请完善"预警规则"'),n("表单校验未通过")):""!==c&&0===Number(c)?(t.$message.warning("预警间隔时间不能为0"),n("表单校验未通过")):c?e("表单校验通过"):(t.$message.warning("请输入预警间隔时间"),n("表单校验未通过")):(t.$message.warning("请选择预警组"),n("表单校验未通过")):(t.$message.warning("请选择预警人"),n("表单校验未通过")):(t.$message.warning("请选择预警客服"),n("表单校验未通过"))})},handleGetParams:function(){var t={monitor_user_list:d()(this.form.monitor_user_list),notice_type:this.form.notice_type,sys_group_id:this.sys_group_id,content:d()(this.form.rules),time_interval:Number(this.form.time_interval),time_interval_unit:Number(this.form.time_interval_unit),conf_id:this.isEdit?this.confId:"",warn_type:this.form.warn_type};return this.form.notice_type==b.USER?t.notice_list=this.form.warnUserList.join(","):this.form.notice_type==b.GROUP&&(t.notice_list=String(this.form.warnGroup)),p()({},t)},handleGetFormData:function(){this.handleClearFormData(),this.isEdit&&this.handleGetRuleDetail()},handleGetRuleDetail:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o,l;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=""+t.URL.BASEURL+t.URL.customerAlerts_confDetail,i={sys_group_id:t.sys_group_id,conf_id:t.confId},t.loading=!0,e.next=6,t.$axios.get(n,{params:i});case 6:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno?((l=o.rst).monitor_user_list&&l.monitor_user_list.length&&(t.form.afferent_djuser_list=l.monitor_user_list.map(function(t){return{user_id:t.user_id,corpid:t.corpid}}),t.form.monitor_user_list=[].concat(u()(t.form.afferent_djuser_list))),t.form.notice_type=Number(l.notice_type),t.form.notice_type==b.USER?t.form.warnUserList=l.notice_list.map(function(t){return t.id}):t.form.notice_type==b.GROUP&&(t.form.warnGroup=l.notice_list[0]?l.notice_list[0].id:""),t.form.rules=[].concat(u()(l.content)),t.form.time_interval=l.time_interval,t.form.time_interval_unit=Number(l.time_interval_unit)):4002!=o.errno&&t.$message.warning(o.err||"操作失败"),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.log("error => ",e.t0);case 15:return e.prev=15,t.loading=!1,e.finish(15);case 18:case"end":return e.stop()}},e,t,[[0,12,15,18]])}))()},handleClearFormData:function(){this.form.afferent_djuser_list=[],this.form.monitor_user_list=[],this.form.notice_type=b.USER,this.form.warnUserList=[],this.form.warnGroup="",this.form.rules=[{minute:"",check_type:1,num:""}],this.form.time_interval="",this.form.time_interval_unit=1},onInputMinute:function(t,e){this.form.rules[e].minute=Object(h.k)(t)},onChangeMinute:function(t,e){""!==t&&0===Number(t)&&(this.form.rules[e].minute="",this.$message.warning("分钟数不能为0"))},onInputNum:function(t,e){this.form.rules[e].num=Object(h.k)(t)},onChangeNum:function(t,e){},onClickAddRules:function(){this.form.rules.push({minute:"",check_type:1,num:""})},onClickDelRules:function(t){this.form.rules.splice(t,1)},onChangeDjuserList:function(t){this.form.monitor_user_list=t.map(function(t){return{user_id:t.user_id,corpid:t.corpid}})},onInputTimeInterval:function(t){this.form.time_interval=Object(h.k)(t)},onChangeTimeInterval:function(t){""!==t&&0===Number(t)&&(this.form.time_interval="",this.$message.warning("预警间隔时间不能为0"))}}},U={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("el-dialog",{staticClass:"warn-dialog",attrs:{visible:t.dialogVisible,"before-close":t.handleCancel,title:t.title,width:"590px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"form-wrap"},[n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警类型:")]),t._v(" "),n("span",[t._v("新粉丝数添加预警")])]),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警客服:")]),t._v(" "),n("customerServiceCorp",{staticStyle:{margin:"0"},attrs:{title:"",icon_arrow_bg:!1,width:"430px",afferent_users:t.form.afferent_djuser_list},on:{customerDefine:t.onChangeDjuserList}})],1),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警人员:")]),t._v(" "),n("el-radio-group",{staticStyle:{"margin-top":"3px"},model:{value:t.form.notice_type,callback:function(e){t.$set(t.form,"notice_type",e)},expression:"form.notice_type"}},[n("el-radio",{attrs:{label:t.noticeTypes.USER}},[t._v("预警人")]),t._v(" "),n("el-radio",{attrs:{label:t.noticeTypes.GROUP}},[t._v("预警组")])],1)],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.form.notice_type==t.noticeTypes.USER,expression:"form.notice_type == noticeTypes.USER"}],staticClass:"form-item"},[n("span",{staticClass:"lable"}),t._v(" "),n("el-select",{attrs:{size:"small",placeholder:"请选择预警人",clearable:"",filterable:"",multiple:""},model:{value:t.form.warnUserList,callback:function(e){t.$set(t.form,"warnUserList",e)},expression:"form.warnUserList"}},t._l(t.warnUserOptions,function(t){return n("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.form.notice_type==t.noticeTypes.GROUP,expression:"form.notice_type == noticeTypes.GROUP"}],staticClass:"form-item"},[n("span",{staticClass:"lable"}),t._v(" "),n("el-select",{attrs:{size:"small",placeholder:"请选择预警组",clearable:"",filterable:""},model:{value:t.form.warnGroup,callback:function(e){t.$set(t.form,"warnGroup",e)},expression:"form.warnGroup"}},t._l(t.warnGroupOptions,function(t){return n("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1),t._v(" "),n("div",{staticClass:"form-item flex-align-start"},[n("span",{staticClass:"lable required"},[t._v("预警规则:")]),t._v(" "),n("div",{staticClass:"rules-wrap"},[t._l(t.form.rules,function(e,i){return n("div",{key:i,staticClass:"rules-item"},[n("el-input",{attrs:{size:"mini",placeholder:"请输入",maxlength:"3",clearable:""},on:{input:function(e){return t.onInputMinute(e,i)},change:function(e){return t.onChangeMinute(e,i)}},model:{value:e.minute,callback:function(n){t.$set(e,"minute","string"==typeof n?n.trim():n)},expression:"item.minute"}}),t._v(" "),n("span",{staticClass:"text"},[t._v("分钟内,添加人数")]),t._v(" "),n("el-select",{attrs:{size:"mini"},model:{value:e.check_type,callback:function(n){t.$set(e,"check_type",n)},expression:"item.check_type"}},t._l(t.contrastOptions,function(t){return n("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1),t._v(" "),n("el-input",{attrs:{size:"mini",placeholder:"请输入",maxlength:"5",clearable:""},on:{input:function(e){return t.onInputNum(e,i)},change:function(e){return t.onChangeNum(e,i)}},model:{value:e.num,callback:function(n){t.$set(e,"num","string"==typeof n?n.trim():n)},expression:"item.num"}}),t._v(" "),n("span",{staticClass:"text"},[t._v("人")]),t._v(" "),i>0?n("i",{staticClass:"el-icon-error",on:{click:function(e){return t.onClickDelRules(i)}}}):t._e()],1)}),t._v(" "),n("div",{staticClass:"add-wrap",on:{click:t.onClickAddRules}},[n("i",{staticClass:"el-icon-plus"}),t._v(" "),n("span",[t._v("添加规则")])])],2)]),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警间隔:")]),t._v(" "),n("div",{staticClass:"interval-wrap"},[n("el-input",{attrs:{size:"mini",placeholder:"请输入",clearable:""},on:{input:t.onInputTimeInterval,change:t.onChangeTimeInterval},model:{value:t.form.time_interval,callback:function(e){t.$set(t.form,"time_interval","string"==typeof e?e.trim():e)},expression:"form.time_interval"}}),t._v(" "),n("el-select",{attrs:{size:"mini"},model:{value:t.form.time_interval_unit,callback:function(e){t.$set(t.form,"time_interval_unit",e)},expression:"form.time_interval_unit"}},t._l(t.timeIntervalUnitOptions,function(t){return n("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)],1)])]),t._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"mini",disabled:t.loading},on:{click:t.handleCancel}},[t._v("取 消")]),t._v(" "),n("el-button",{attrs:{size:"mini",type:"primary",disabled:t.loading},on:{click:t.handleConfirm}},[t._v("确 定")])],1)])},staticRenderFns:[]};var R={name:"newFansRules",components:{newFansWarnDialog:n("VU/8")(S,U,!1,function(t){n("uosr")},"data-v-d0f428e8",null).exports},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",noticeTypes:l()(b),statusTypes:l()(C),height:"",loading:!1,pagination:{page:1,page_size:20,pages:0,total:0},filter:{keyword:""},list:[],warnDialogVisible:!1,currentWarnConfId:"",tips:{isShow:!1,msg:""}}},created:function(){this.height=document.documentElement.clientHeight-200,this.handleGetList()},methods:{handleGetList:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.loading=!0,n=""+t.URL.BASEURL+t.URL.customerAlerts_confList,i={page:t.pagination.page,page_size:t.pagination.page_size,sys_group_id:t.sys_group_id,warn_type:1},e.next=6,t.$axios.get(n,{params:i});case 6:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno&&Array.isArray(o.rst.data)?(t.list=o.rst.data,t.pagination.total=o.rst.pageInfo.total,t.pagination.pages=o.rst.pageInfo.pages,o.rst.extra&&(t.tips.isShow=1==o.rst.extra.notice,t.tips.msg=o.rst.extra.message||"")):4002!=o.errno&&(t.$message.warning(o.err),t.list=[],t.pagination.total=0,t.pagination.pages=0),e.next=18;break;case 12:e.prev=12,e.t0=e.catch(0),console.log(e.t0),t.list=[],t.pagination.total=0,t.pagination.pages=0;case 18:return e.prev=18,t.loading=!1,e.finish(18);case 21:case"end":return e.stop()}},e,t,[[0,12,18,21]])}))()},handleCurrentChange:function(t){this.pagination.page=t,this.handleGetList()},onClickSetStatus:function(t){var e=this,n=t.conf_id,i=t.status;return s()(a.a.mark(function t(){return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.$confirm("确定"+(i==C.ENABLE?"启用":"禁用")+"当前预警吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:e.handleSetStatus({conf_id:n,status:i}),t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.log("error => ",t.t0);case 9:case"end":return t.stop()}},t,e,[[0,6]])}))()},handleSetStatus:function(t){var e=this,n=t.conf_id,i=t.status;return s()(a.a.mark(function t(){var r,s,o,l,c;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.loading=!0,r=""+e.URL.BASEURL+e.URL.customerAlerts_updateConfStatus,s={conf_id:n,status:i},t.next=6,e.$axios.post(r,s);case 6:o=t.sent,l=o.data,(c=void 0===l?{}:l)&&0==c.errno?(e.$message.success("操作成功"),e.handleGetList()):4002!=c.errno&&e.$message.warning(c.err),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.log(t.t0);case 15:return t.prev=15,e.loading=!1,t.finish(15);case 18:case"end":return t.stop()}},t,e,[[0,12,15,18]])}))()},onClickCreateWarnBtn:function(){this.currentWarnConfId="",this.warnDialogVisible=!0},onClickEditWarnBtn:function(t){this.currentWarnConfId=t,this.warnDialogVisible=!0},onConfirmWarnDialog:function(t){var e=t.isEdit;this.warnDialogVisible=!1,e||(this.pagination.page=1),this.handleGetList()},onCancelWarnDialog:function(){this.warnDialogVisible=!1},handleGetTimeIntervalUnit:function(t){return x.get(t)||""}}},L={render: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:"customerAlerts-wrap"},[t.tips.isShow&&t.tips.msg?n("div",{staticClass:"self-hint",staticStyle:{"margin-bottom":"10px"}},[n("i",{staticClass:"el-icon-message-solid"}),t._v(" "),n("div",[n("p",[t._v(t._s(t.tips.msg))])])]):t._e(),t._v(" "),n("div",{staticClass:"screenBox"},[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.onClickCreateWarnBtn}},[t._v("新建预警")])],1),t._v(" "),n("el-table",{staticStyle:{width:"100%","margin-top":"10px"},attrs:{height:t.height,data:t.list,"tooltip-effect":"dark"}},[n("el-table-column",{attrs:{label:"预警客服",prop:"name","min-width":"200",align:"center",fixed:"left"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.monitor_user_list&&i.monitor_user_list.length?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.monitor_user_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag"},[t._v("\n "+t._s(e.name)+"\n ")])}),0):n("div",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警人员",prop:"name","min-width":"300",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.notice_type==t.noticeTypes.USER?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.notice_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag",staticStyle:{"justify-content":"flex-start"}},[n("i",{staticClass:"el-icon-user-solid"}),t._v(" "+t._s(e.name)+"\n "),n("i",{staticClass:"el-icon-phone",staticStyle:{"margin-left":"8px"}}),t._v(t._s(e.phone)+"\n ")])}),0):i.notice_type==t.noticeTypes.GROUP?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.notice_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag"},[t._v("\n "+t._s(e.name)+"\n ")])}),0):t._e()]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警规则",prop:"name","min-width":"300",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.content_arr&&i.content_arr.length?t._l(i.content_arr,function(e,i){return n("div",{key:i},[t._v("\n 规则"+t._s(i+1)+":"+t._s(e)+"\n ")])}):n("span",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警间隔",prop:"time_interval","min-width":"120",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.time_interval||0==i.time_interval?n("span",[t._v(t._s(i.time_interval)+t._s(t.handleGetTimeIntervalUnit(i.time_interval_unit)))]):n("span",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"添加时间",prop:"create_time","min-width":"170",align:"center"}}),t._v(" "),n("el-table-column",{attrs:{label:"操作","min-width":"160",align:"center",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[[i.status==t.statusTypes.ENABLE?n("span",{staticClass:"btn c-FF604D",on:{click:function(e){return t.onClickSetStatus({conf_id:i.conf_id,status:t.statusTypes.DISABLE})}}},[t._v("禁用")]):i.status==t.statusTypes.DISABLE?n("span",{staticClass:"btn c-007AFF",on:{click:function(e){return t.onClickSetStatus({conf_id:i.conf_id,status:t.statusTypes.ENABLE})}}},[t._v("启用")]):t._e()],t._v(" "),n("span",{staticClass:"btn c-00b38a",on:{click:function(e){return t.onClickEditWarnBtn(i.conf_id)}}},[t._v("编辑")])]}}])})],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.pagination.total>0,expression:"pagination.total > 0"}],staticClass:"pagination"},[n("el-pagination",{attrs:{background:"","current-page":t.pagination.page,layout:"prev, pager, next","page-count":Number(t.pagination.pages)},on:{"current-change":t.handleCurrentChange}})],1),t._v(" "),n("newFansWarnDialog",{attrs:{dialogVisible:t.warnDialogVisible,confId:t.currentWarnConfId},on:{confirm:t.onConfirmWarnDialog,cancel:t.onCancelWarnDialog}})],1)},staticRenderFns:[]};var G=n("VU/8")(R,L,!1,function(t){n("zqfU")},"data-v-0ce253b7",null).exports,E={name:"totalFansWarnDialog",components:{customerServiceCorp:g.a},props:{dialogVisible:{type:Boolean,default:function(){return!1}},confId:{type:[String,Number],default:function(){return""}}},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",loading:!1,contrastOptions:l()(y),noticeTypes:l()(b),timeIntervalUnitOptions:l()(k),warnUserOptions:[],warnGroupOptions:[],form:{afferent_djuser_list:[],monitor_user_list:[],notice_type:b.USER,warnUserList:[],warnGroup:"",rules:[{minute:"",check_type:2,num:""}],time_interval:"",time_interval_unit:1,warn_type:2}}},computed:{isEdit:function(){return!!this.confId},title:function(){return(this.isEdit?"编辑":"新建")+"预警"}},watch:{dialogVisible:function(t){t&&(this.handleGetWarnUserOptions(),this.handleGetWarnGroupOptions(),this.handleGetFormData())}},methods:{handleGetWarnUserOptions:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.$axios.get(t.URL.BASEURL+t.URL.warn_userList,{params:{sys_group_id:t.sys_group_id,page:1,page_size:500}});case 3:n=e.sent,i=n.data,(r=void 0===i?{}:i)&&0==r.errno?t.warnUserOptions=r.rst.data:4002!=r.errno&&(t.warnUserOptions=[],t.$message.warning(r.err)),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),t.warnUserOptions=[],console.log("error => ",e.t0);case 13:case"end":return e.stop()}},e,t,[[0,9]])}))()},handleGetWarnGroupOptions:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.$axios.get(t.URL.BASEURL+t.URL.warn_groupList,{params:{sys_group_id:t.sys_group_id,is_select:1}});case 3:n=e.sent,i=n.data,(r=void 0===i?{}:i)&&0==r.errno?t.warnGroupOptions=r.rst:4002!=r.errno&&(t.warnGroupOptions=[],t.$message.warning(r.err)),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),t.warnGroupOptions=[],console.log("error => ",e.t0);case 13:case"end":return e.stop()}},e,t,[[0,9]])}))()},handleConfirm:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.handleFormValidate();case 3:return n=""+t.URL.BASEURL+t.URL.customerAlerts_setConf,i=t.handleGetParams(),t.loading=!0,e.next=8,t.$axios.post(n,i);case 8:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno?(t.$message.success("操作成功"),t.handleClearFormData(),t.$emit("confirm",{isEdit:t.isEdit})):4002!=o.errno&&t.$message.warning(o.err||"操作失败"),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.log("error => ",e.t0);case 17:return e.prev=17,t.loading=!1,e.finish(17);case 20:case"end":return e.stop()}},e,t,[[0,14,17,20]])}))()},handleCancel:function(){this.handleClearFormData(),this.$emit("cancel")},handleFormValidate:function(){var t=this;return new v.a(function(e,n){var i=t.form,a=i.monitor_user_list,r=i.notice_type,s=i.warnUserList,o=i.warnGroup,l=i.rules,c=i.time_interval,u=l.some(function(t){return""===t.num});a&&a.length?r!=b.USER||s.length?r!=b.GROUP||o?u?(t.$message.warning('请完善"预警规则"'),n("表单校验未通过")):""!==c&&0===Number(c)?(t.$message.warning("预警间隔时间不能为0"),n("表单校验未通过")):c?e("表单校验通过"):(t.$message.warning("请输入预警间隔时间"),n("表单校验未通过")):(t.$message.warning("请选择预警组"),n("表单校验未通过")):(t.$message.warning("请选择预警人"),n("表单校验未通过")):(t.$message.warning("请选择预警客服"),n("表单校验未通过"))})},handleGetParams:function(){var t={monitor_user_list:d()(this.form.monitor_user_list),notice_type:this.form.notice_type,sys_group_id:this.sys_group_id,content:d()(this.form.rules),time_interval:Number(this.form.time_interval),time_interval_unit:Number(this.form.time_interval_unit),conf_id:this.isEdit?this.confId:"",warn_type:this.form.warn_type};return this.form.notice_type==b.USER?t.notice_list=this.form.warnUserList.join(","):this.form.notice_type==b.GROUP&&(t.notice_list=String(this.form.warnGroup)),p()({},t)},handleGetFormData:function(){this.handleClearFormData(),this.isEdit&&this.handleGetRuleDetail()},handleGetRuleDetail:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o,l;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=""+t.URL.BASEURL+t.URL.customerAlerts_confDetail,i={sys_group_id:t.sys_group_id,conf_id:t.confId},t.loading=!0,e.next=6,t.$axios.get(n,{params:i});case 6:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno?((l=o.rst).monitor_user_list&&l.monitor_user_list.length&&(t.form.afferent_djuser_list=l.monitor_user_list.map(function(t){return{user_id:t.user_id,corpid:t.corpid}}),t.form.monitor_user_list=[].concat(u()(t.form.afferent_djuser_list))),t.form.notice_type=Number(l.notice_type),t.form.notice_type==b.USER?t.form.warnUserList=l.notice_list.map(function(t){return t.id}):t.form.notice_type==b.GROUP&&(t.form.warnGroup=l.notice_list[0]?l.notice_list[0].id:""),t.form.rules=[].concat(u()(l.content)),t.form.time_interval=l.time_interval,t.form.time_interval_unit=Number(l.time_interval_unit)):4002!=o.errno&&t.$message.warning(o.err||"操作失败"),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.log("error => ",e.t0);case 15:return e.prev=15,t.loading=!1,e.finish(15);case 18:case"end":return e.stop()}},e,t,[[0,12,15,18]])}))()},handleClearFormData:function(){this.form.afferent_djuser_list=[],this.form.monitor_user_list=[],this.form.notice_type=b.USER,this.form.warnUserList=[],this.form.warnGroup="",this.form.rules=[{minute:"",check_type:2,num:""}],this.form.time_interval="",this.form.time_interval_unit=1},onInputMinute:function(t,e){this.form.rules[e].minute=Object(h.k)(t)},onChangeMinute:function(t,e){""!==t&&0===Number(t)&&(this.form.rules[e].minute="",this.$message.warning("分钟数不能为0"))},onInputNum:function(t,e){this.form.rules[e].num=Object(h.k)(t)},onChangeNum:function(t,e){},onClickAddRules:function(){this.form.rules.push({minute:"",check_type:2,num:""})},onClickDelRules:function(t){this.form.rules.splice(t,1)},onChangeDjuserList:function(t){this.form.monitor_user_list=t.map(function(t){return{user_id:t.user_id,corpid:t.corpid}})},onInputTimeInterval:function(t){this.form.time_interval=Object(h.k)(t)},onChangeTimeInterval:function(t){""!==t&&0===Number(t)&&(this.form.time_interval="",this.$message.warning("预警间隔时间不能为0"))}}},$={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("el-dialog",{staticClass:"warn-dialog",attrs:{visible:t.dialogVisible,"before-close":t.handleCancel,title:t.title,width:"590px","close-on-click-modal":!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"form-wrap"},[n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警类型:")]),t._v(" "),n("span",[t._v("总粉丝数添加预警")])]),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警客服:")]),t._v(" "),n("customerServiceCorp",{staticStyle:{margin:"0"},attrs:{title:"",icon_arrow_bg:!1,width:"430px",afferent_users:t.form.afferent_djuser_list},on:{customerDefine:t.onChangeDjuserList}})],1),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警人员:")]),t._v(" "),n("el-radio-group",{staticStyle:{"margin-top":"3px"},model:{value:t.form.notice_type,callback:function(e){t.$set(t.form,"notice_type",e)},expression:"form.notice_type"}},[n("el-radio",{attrs:{label:t.noticeTypes.USER}},[t._v("预警人")]),t._v(" "),n("el-radio",{attrs:{label:t.noticeTypes.GROUP}},[t._v("预警组")])],1)],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.form.notice_type==t.noticeTypes.USER,expression:"form.notice_type == noticeTypes.USER"}],staticClass:"form-item"},[n("span",{staticClass:"lable"}),t._v(" "),n("el-select",{attrs:{size:"small",placeholder:"请选择预警人",clearable:"",filterable:"",multiple:""},model:{value:t.form.warnUserList,callback:function(e){t.$set(t.form,"warnUserList",e)},expression:"form.warnUserList"}},t._l(t.warnUserOptions,function(t){return n("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.form.notice_type==t.noticeTypes.GROUP,expression:"form.notice_type == noticeTypes.GROUP"}],staticClass:"form-item"},[n("span",{staticClass:"lable"}),t._v(" "),n("el-select",{attrs:{size:"small",placeholder:"请选择预警组",clearable:"",filterable:""},model:{value:t.form.warnGroup,callback:function(e){t.$set(t.form,"warnGroup",e)},expression:"form.warnGroup"}},t._l(t.warnGroupOptions,function(t){return n("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1),t._v(" "),n("div",{staticClass:"form-item flex-align-start"},[n("span",{staticClass:"lable required"},[t._v("预警规则:")]),t._v(" "),n("div",{staticClass:"rules-wrap"},t._l(t.form.rules,function(e,i){return n("div",{key:i,staticClass:"rules-item"},[n("span",{staticClass:"text",staticStyle:{"margin-left":"20px"}},[t._v("总人数")]),t._v(" "),n("el-select",{attrs:{size:"mini",disabled:!0},model:{value:e.check_type,callback:function(n){t.$set(e,"check_type",n)},expression:"item.check_type"}},t._l(t.contrastOptions,function(t){return n("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1),t._v(" "),n("el-input",{attrs:{size:"mini",placeholder:"请输入",maxlength:"5",clearable:""},on:{input:function(e){return t.onInputNum(e,i)},change:function(e){return t.onChangeNum(e,i)}},model:{value:e.num,callback:function(n){t.$set(e,"num","string"==typeof n?n.trim():n)},expression:"item.num"}}),t._v(" "),n("span",{staticClass:"text"},[t._v("人")]),t._v(" "),i>0?n("i",{staticClass:"el-icon-error",on:{click:function(e){return t.onClickDelRules(i)}}}):t._e()],1)}),0)]),t._v(" "),n("div",{staticClass:"form-item"},[n("span",{staticClass:"lable required"},[t._v("预警间隔:")]),t._v(" "),n("div",{staticClass:"interval-wrap"},[n("el-input",{attrs:{size:"mini",placeholder:"请输入",clearable:""},on:{input:t.onInputTimeInterval,change:t.onChangeTimeInterval},model:{value:t.form.time_interval,callback:function(e){t.$set(t.form,"time_interval","string"==typeof e?e.trim():e)},expression:"form.time_interval"}}),t._v(" "),n("el-select",{attrs:{size:"mini"},model:{value:t.form.time_interval_unit,callback:function(e){t.$set(t.form,"time_interval_unit",e)},expression:"form.time_interval_unit"}},t._l(t.timeIntervalUnitOptions,function(t){return n("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})}),1)],1)])]),t._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"mini",disabled:t.loading},on:{click:t.handleCancel}},[t._v("取 消")]),t._v(" "),n("el-button",{attrs:{size:"mini",type:"primary",disabled:t.loading},on:{click:t.handleConfirm}},[t._v("确 定")])],1)])},staticRenderFns:[]};var T={name:"totalFansRules",components:{totalFansWarnDialog:n("VU/8")(E,$,!1,function(t){n("OOxu")},"data-v-08e15d36",null).exports},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",noticeTypes:l()(b),statusTypes:l()(C),height:"",loading:!1,pagination:{page:1,page_size:20,pages:0,total:0},filter:{keyword:""},list:[],warnDialogVisible:!1,currentWarnConfId:"",tips:{isShow:!1,msg:""}}},created:function(){this.height=document.documentElement.clientHeight-200,this.handleGetList()},methods:{handleGetList:function(){var t=this;return s()(a.a.mark(function e(){var n,i,r,s,o;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.loading=!0,n=""+t.URL.BASEURL+t.URL.customerAlerts_confList,i={page:t.pagination.page,page_size:t.pagination.page_size,sys_group_id:t.sys_group_id,warn_type:2},e.next=6,t.$axios.get(n,{params:i});case 6:r=e.sent,s=r.data,(o=void 0===s?{}:s)&&0==o.errno&&Array.isArray(o.rst.data)?(t.list=o.rst.data,t.pagination.total=o.rst.pageInfo.total,t.pagination.pages=o.rst.pageInfo.pages,o.rst.extra&&(t.tips.isShow=1==o.rst.extra.notice,t.tips.msg=o.rst.extra.message||"")):4002!=o.errno&&(t.$message.warning(o.err),t.list=[],t.pagination.total=0,t.pagination.pages=0),e.next=18;break;case 12:e.prev=12,e.t0=e.catch(0),console.log(e.t0),t.list=[],t.pagination.total=0,t.pagination.pages=0;case 18:return e.prev=18,t.loading=!1,e.finish(18);case 21:case"end":return e.stop()}},e,t,[[0,12,18,21]])}))()},handleCurrentChange:function(t){this.pagination.page=t,this.handleGetList()},onClickSetStatus:function(t){var e=this,n=t.conf_id,i=t.status;return s()(a.a.mark(function t(){return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.$confirm("确定"+(i==C.ENABLE?"启用":"禁用")+"当前预警吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:e.handleSetStatus({conf_id:n,status:i}),t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.log("error => ",t.t0);case 9:case"end":return t.stop()}},t,e,[[0,6]])}))()},handleSetStatus:function(t){var e=this,n=t.conf_id,i=t.status;return s()(a.a.mark(function t(){var r,s,o,l,c;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.loading=!0,r=""+e.URL.BASEURL+e.URL.customerAlerts_updateConfStatus,s={conf_id:n,status:i},t.next=6,e.$axios.post(r,s);case 6:o=t.sent,l=o.data,(c=void 0===l?{}:l)&&0==c.errno?(e.$message.success("操作成功"),e.handleGetList()):4002!=c.errno&&e.$message.warning(c.err),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.log(t.t0);case 15:return t.prev=15,e.loading=!1,t.finish(15);case 18:case"end":return t.stop()}},t,e,[[0,12,15,18]])}))()},onClickCreateWarnBtn:function(){this.currentWarnConfId="",this.warnDialogVisible=!0},onClickEditWarnBtn:function(t){this.currentWarnConfId=t,this.warnDialogVisible=!0},onConfirmWarnDialog:function(t){var e=t.isEdit;this.warnDialogVisible=!1,e||(this.pagination.page=1),this.handleGetList()},onCancelWarnDialog:function(){this.warnDialogVisible=!1},handleGetTimeIntervalUnit:function(t){return x.get(t)||""}}},I={render: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:"totalFansRules-wrap"},[t.tips.isShow&&t.tips.msg?n("div",{staticClass:"self-hint",staticStyle:{"margin-bottom":"10px"}},[n("i",{staticClass:"el-icon-message-solid"}),t._v(" "),n("div",[n("p",[t._v(t._s(t.tips.msg))])])]):t._e(),t._v(" "),n("div",{staticClass:"screenBox"},[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.onClickCreateWarnBtn}},[t._v("新建预警")])],1),t._v(" "),n("el-table",{staticStyle:{width:"100%","margin-top":"10px"},attrs:{height:t.height,data:t.list,"tooltip-effect":"dark"}},[n("el-table-column",{attrs:{label:"预警客服",prop:"name","min-width":"200",align:"center",fixed:"left"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.monitor_user_list&&i.monitor_user_list.length?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.monitor_user_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag"},[t._v("\n "+t._s(e.name)+"\n ")])}),0):n("div",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警人员",prop:"name","min-width":"300",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.notice_type==t.noticeTypes.USER?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.notice_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag",staticStyle:{"justify-content":"flex-start"}},[n("i",{staticClass:"el-icon-user-solid"}),t._v(" "+t._s(e.name)+"\n "),n("i",{staticClass:"el-icon-phone",staticStyle:{"margin-left":"8px"}}),t._v(t._s(e.phone)+"\n ")])}),0):i.notice_type==t.noticeTypes.GROUP?n("div",{staticClass:"customerServiceTagBox biaoqian"},t._l(i.notice_list,function(e,i){return n("div",{key:i,staticClass:"customerServiceTag"},[t._v("\n "+t._s(e.name)+"\n ")])}),0):t._e()]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警规则",prop:"name","min-width":"300",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.content_arr&&i.content_arr.length?t._l(i.content_arr,function(e,i){return n("div",{key:i},[t._v("\n "+t._s(e)+"\n ")])}):n("span",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"预警间隔",prop:"time_interval","min-width":"120",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[i.time_interval||0==i.time_interval?n("span",[t._v(t._s(i.time_interval)+t._s(t.handleGetTimeIntervalUnit(i.time_interval_unit)))]):n("span",[t._v(" - ")])]}}])}),t._v(" "),n("el-table-column",{attrs:{label:"添加时间",prop:"create_time","min-width":"170",align:"center"}}),t._v(" "),n("el-table-column",{attrs:{label:"操作","min-width":"160",align:"center",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.row;return[[i.status==t.statusTypes.ENABLE?n("span",{staticClass:"btn c-FF604D",on:{click:function(e){return t.onClickSetStatus({conf_id:i.conf_id,status:t.statusTypes.DISABLE})}}},[t._v("禁用")]):i.status==t.statusTypes.DISABLE?n("span",{staticClass:"btn c-007AFF",on:{click:function(e){return t.onClickSetStatus({conf_id:i.conf_id,status:t.statusTypes.ENABLE})}}},[t._v("启用")]):t._e()],t._v(" "),n("span",{staticClass:"btn c-00b38a",on:{click:function(e){return t.onClickEditWarnBtn(i.conf_id)}}},[t._v("编辑")])]}}])})],1),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.pagination.total>0,expression:"pagination.total > 0"}],staticClass:"pagination"},[n("el-pagination",{attrs:{background:"","current-page":t.pagination.page,layout:"prev, pager, next","page-count":Number(t.pagination.pages)},on:{"current-change":t.handleCurrentChange}})],1),t._v(" "),n("totalFansWarnDialog",{attrs:{dialogVisible:t.warnDialogVisible,confId:t.currentWarnConfId},on:{confirm:t.onConfirmWarnDialog,cancel:t.onCancelWarnDialog}})],1)},staticRenderFns:[]};var O={name:"customerAlerts",components:{newFansRules:G,totalFansRules:n("VU/8")(T,I,!1,function(t){n("9QQI")},"data-v-13474196",null).exports},data:function(){return{tagType:1}},methods:{changeType:function(t){this.tagType=t}}},D={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"topTagBox flex",staticStyle:{"min-width":"1200px"},attrs:{id:"customerAnalysis"}},[n("div",{staticClass:"left flex-align-center"},[n("div",{class:["tagItem",1==t.tagType?"tagItem_active":""],on:{click:function(e){return t.changeType(1)}}},[t._v("新粉丝数添加预警")]),t._v(" "),n("div",{class:["tagItem",2==t.tagType?"tagItem_active":""],on:{click:function(e){return t.changeType(2)}}},[t._v("总粉丝数添加预警")])])]),t._v(" "),1==t.tagType?n("newFansRules"):t._e(),t._v(" "),2==t.tagType?n("totalFansRules"):t._e()],1)},staticRenderFns:[]},B=n("VU/8")(O,D,!1,null,null,null);e.default=B.exports},uosr:function(t,e){},zqfU:function(t,e){}});
|