企微助手 ,仓库名 短剧

70.387ad354070843f91f92.js 10KB

1
  1. webpackJsonp([70],{"3TxU":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("ifoU"),o=r.n(n),s=r("Xxa5"),a=r.n(s),i=r("Gu7T"),c=r.n(i),l=r("exGp"),u=r.n(l),p=r("Dd8w"),d=r.n(p),h=r("//Fk"),f=r.n(h),v={props:{value:{type:Boolean,default:function(){return!1}},thresholdInfo:{type:Object,default:function(){return{threshold:0,corp_list:[]}}}},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",loading:!1,corpOptions:[],form:{threshold:0,corpid_list:[],corp_list:[]}}},computed:{visible:{get:function(){return this.value},set:function(e){this.$emit("input",e)}}},watch:{visible:function(e){var t=this;return u()(a.a.mark(function r(){return a.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&t.handleInit();case 1:case"end":return r.stop()}},r,t)}))()}},methods:{handleInit:function(){var e=this;return u()(a.a.mark(function t(){return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.handleInitForm(),t.next=3,e.handleGetAllCorp();case 3:e.handleGetWarnConf();case 4:case"end":return t.stop()}},t,e)}))()},handleInitForm:function(){this.form.threshold=0,this.form.corpid_list=[],this.form.corp_list=[]},handleGetAllCorp:function(){var e=this;return u()(a.a.mark(function t(){var r,n,o,s,i;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.authorize_corpList,n={page:1,page_size:500,active:1,get_user_scale:1},t.next=6,e.$axios.get(r,{params:n});case 6:return o=t.sent,s=o.data,(i=void 0===s?{}:s)&&0==i.errno&&(e.corpOptions=[].concat(c()(i.rst.data))),t.abrupt("return",f.a.resolve());case 13:return t.prev=13,t.t0=t.catch(0),console.log(t.t0),t.abrupt("return",f.a.reject());case 17:return t.prev=17,e.loading=!1,t.finish(17);case 20:case"end":return t.stop()}},t,e,[[0,13,17,20]])}))()},handleGetWarnConf:function(){var e=this;return u()(a.a.mark(function t(){var r,n,o;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=e.thresholdInfo,n=r.threshold,o=r.corp_list,e.form.threshold=n,e.form.corp_list=o,e.form.corpid_list=o.map(function(e){return e.corpid});case 4:case"end":return t.stop()}},t,e)}))()},onChangeCorpidList:function(e){this.form.corpid_list=e,this.form.corp_list=this.handleGetCorpListByCorpidList(e)},handleGetCorpListByCorpidList:function(e){var t=this;if(!e||!e.length)return[];var r=[];return e.forEach(function(e){var n=t.corpOptions.find(function(t){return t.corpid===e});n&&r.push(d()({},n))}),this.form.threshold&&r.forEach(function(e){e.type=t.handleGetCorpTypeByThreshold(e.user_scale,t.form.threshold)}),r},handleGetCorpTypeByThreshold:function(e,t){if(!t)return"";var r=e/t;return r<.8?"1":r<1?"2":"3"},handleGetTagType:function(e){return new o.a([[1,""],[2,"warning"],[3,"danger"]]).get(Number(e))||""},onCloseCorpTag:function(e){this.form.corp_list.splice(e,1);var t=this.form.corp_list.map(function(e){return e.corpid});this.onChangeCorpidList(t)},onClickSave:function(){var e=this;return u()(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("确定"+(e.form.corpid_list.length?"保存":"重置")+"当前预警规则吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:e.handleSubmit(),t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.log(t.t0);case 9:case"end":return t.stop()}},t,e,[[0,6]])}))()},handleSubmit:function(){var e=this;return u()(a.a.mark(function t(){var r,n,o,s,i;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.warn_setCorpUserScaleWarnConfNew,n={sys_group_id:e.sys_group_id,threshold:e.form.threshold,corp_list:e.form.corpid_list},t.next=6,e.$axios.post(r,n);case 6:o=t.sent,s=o.data,(i=void 0===s?{}:s)&&0==i.errno?(e.$message.success("保存成功"),e.$refs.formWrapEl.scrollTop=0,e.$emit("confirm")):4002!=i.errno&&e.$message.warning(i.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]])}))()},handleCloseDrawer:function(){this.visible=!1}}},_={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-drawer",{attrs:{visible:e.visible,"close-on-press-escape":!1,wrapperClosable:!1,withHeader:!1,size:"60%"},on:{"update:visible":function(t){e.visible=t}}},[r("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"formWrapEl",staticClass:"customerWarn-wrap"},[r("div",{staticClass:"self_drawer_title"},[r("div",{staticClass:"flex"},[e._v("设置企微客户规模预警")]),e._v(" "),r("div",{staticClass:"flex-align-center"},[r("i",{staticClass:"el-icon-close pointer",on:{click:e.handleCloseDrawer}})])]),e._v(" "),r("div",{staticClass:"form-wrap"},[r("div",{staticClass:"form-item flex-start"},[r("span",{staticClass:"lable"},[e._v("预警阈值 "),r("span",{staticStyle:{"font-weight":"600"}},[e._v(e._s(e.form.threshold))])]),e._v(" "),r("div",{staticClass:"threshold-wrap"},[r("div",{staticClass:"threshold-item-wrap"},[r("div",{staticClass:"corp-wrap"},[r("el-select",{attrs:{size:"small",placeholder:"请选择企微主体",multiple:"","collapse-tags":"",filterable:"",clearable:""},on:{change:e.onChangeCorpidList},model:{value:e.form.corpid_list,callback:function(t){e.$set(e.form,"corpid_list",t)},expression:"form.corpid_list"}},e._l(e.corpOptions,function(e){return r("el-option",{key:e.corpid,attrs:{label:e.corp_name,value:e.corpid}})}),1)],1),e._v(" "),e.form.corp_list&&e.form.corp_list.length?r("div",{staticClass:"user-wrap"},e._l(e.form.corp_list,function(t,n){return r("div",{key:t.corpid,staticClass:"user-item-wrap"},[r("el-tag",{attrs:{type:e.handleGetTagType(t.type),closable:!0,"disable-transitions":""},on:{close:function(t){return e.onCloseCorpTag(n)}}},[e._v("\n "+e._s(t.corp_name)+"\n "),r("span",[e._v("("+e._s(t.user_scale)+")")])])],1)}),0):e._e()])])])]),e._v(" "),e.loading?e._e():r("div",{staticClass:"button_box"},[r("button",{staticClass:"button ml-170",on:{click:e.onClickSave}},[e._v("保存")])])])])},staticRenderFns:[]};var m={name:"customerWarn",components:{thresholdDrawer:r("VU/8")(v,_,!1,function(e){r("IAxw")},"data-v-306b247a",null).exports},data:function(){return{sys_group_id:1==this.$cookie.getCookie("isSuperManage")?sessionStorage.getItem("company_session_defaultCorp_level_1").toString():"",loading:!1,height:"",warnConf:[],thresholdDrawerVisible:!1,currentThreshold:{threshold:0,corp_list:[]}}},created:function(){this.height=document.documentElement.clientHeight-100,this.handleGetWarnConf()},methods:{handleGetWarnConf:function(){var e=this;return u()(a.a.mark(function t(){var r,n,o,s,i;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.warn_getCorpUserScaleWarnConf,n={sys_group_id:e.sys_group_id},t.next=6,e.$axios.post(r,n);case 6:o=t.sent,s=o.data,(i=void 0===s?{}:s)&&0==i.errno&&(e.warnConf=[].concat(c()(i.rst))),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]])}))()},handleGetTagType:function(e){return new o.a([[1,""],[2,"warning"],[3,"danger"]]).get(Number(e))||""},onClickResetBtn:function(e){var t=this;return u()(a.a.mark(function r(){return a.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,t.$confirm("确定重置当前预警规则吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:t.handleReset(e),r.next=9;break;case 6:r.prev=6,r.t0=r.catch(0),console.log(r.t0);case 9:case"end":return r.stop()}},r,t,[[0,6]])}))()},handleReset:function(e){var t=this;return u()(a.a.mark(function r(){var n,o,s,i,c;return a.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,t.loading=!0,n=""+t.URL.BASEURL+t.URL.warn_setCorpUserScaleWarnConfNew,o={sys_group_id:t.sys_group_id,threshold:e.threshold,corp_list:[]},r.next=6,t.$axios.post(n,o);case 6:s=r.sent,i=s.data,(c=void 0===i?{}:i)&&0==c.errno?(t.$message.success("重置成功"),t.handleGetWarnConf()):4002!=c.errno&&t.$message.warning(c.err||"重置失败"),r.next=15;break;case 12:r.prev=12,r.t0=r.catch(0),console.log(r.t0);case 15:return r.prev=15,t.loading=!1,r.finish(15);case 18:case"end":return r.stop()}},r,t,[[0,12,15,18]])}))()},onClickEditBtn:function(e){var t=e.threshold,r=e.corp_list;this.currentThreshold.threshold=t,this.currentThreshold.corp_list=[].concat(c()(r)),this.thresholdDrawerVisible=!0},onConfirmThreshold:function(){this.thresholdDrawerVisible=!1,this.handleGetWarnConf()},onCancelThreshold:function(){this.thresholdDrawerVisible=!1}}},g={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"customerWarn-wrap"},[r("el-table",{staticStyle:{width:"100%"},attrs:{height:e.height,data:e.warnConf,"tooltip-effect":"dark"}},[r("el-table-column",{attrs:{label:"预警阈值",prop:"threshold",width:"160",align:"center"}}),e._v(" "),r("el-table-column",{attrs:{label:"企微主体",prop:"corp_list",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.row;return[n.corp_list&&n.corp_list.length?r("div",e._l(n.corp_list,function(t,n){return r("el-tag",{key:t.corpid,staticClass:"corp-item-wrap",attrs:{type:e.handleGetTagType(t.type),closable:!1}},[e._v("\n "+e._s(t.corp_name)),r("span",[e._v("("+e._s(t.user_scale)+")")])])}),1):r("div",{staticStyle:{color:"#999"}},[e._v(" - ")])]}}])}),e._v(" "),r("el-table-column",{attrs:{label:"操作",width:"160",align:"center",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.row;return[r("span",{staticClass:"btn c-00b38a",on:{click:function(t){return e.onClickEditBtn(n)}}},[e._v("编辑")]),e._v(" "),n.corp_list&&n.corp_list.length?r("span",{staticClass:"btn c-FF604D",on:{click:function(t){return e.onClickResetBtn(n)}}},[e._v("重置")]):e._e()]}}])})],1),e._v(" "),r("thresholdDrawer",{attrs:{thresholdInfo:e.currentThreshold},on:{confirm:e.onConfirmThreshold,cancel:e.onCancelThreshold},model:{value:e.thresholdDrawerVisible,callback:function(t){e.thresholdDrawerVisible=t},expression:"thresholdDrawerVisible"}})],1)},staticRenderFns:[]};var w=r("VU/8")(m,g,!1,function(e){r("tLOv")},"data-v-40402ea2",null);t.default=w.exports},IAxw:function(e,t){},tLOv:function(e,t){}});