1 |
- webpackJsonp([64],{CIE7:function(e,t){},KlJZ:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a("Gu7T"),n=a.n(i),r=a("Dd8w"),s=a.n(r),o=a("//Fk"),l=a.n(o),c=a("d7EF"),d=a.n(c),h=a("Xxa5"),u=a.n(h),p=a("exGp"),f=a.n(p),m=a("u2KI"),_=a.n(m),g=a("gzej"),y=a("M4fF"),v=a.n(y),x={components:{datePicker:g.a},data:function(){var e=[this.$getDay(-30,!1),this.$getDay(0,!1)];return{default_time:e,reset:!1,height:"",pageLoading:!1,system_enterprise:[],enterpriseList:[],enterprise:{},chartLoading:!1,myChart:null,chartDataList:[],legendList:[{name:"消耗",key:"paid",color:"#2983DF",selectFlag:!0},{name:"3天流失人数",key:"third_loss_count",color:"#EB4315",selectFlag:!0},{name:"7天流失人数",key:"seventh_loss_count",color:"#84CDFC",selectFlag:!0},{name:"15天流失人数",key:"fifteenth_loss_count",color:"#00B38A",selectFlag:!0},{name:"30天流失人数",key:"thirtieth_loss_count",color:"#AED570",selectFlag:!0},{name:"累计流失人数",key:"loss_count",color:"#7366FF",selectFlag:!0}],percentFields:_()([]),summaryLoading:!1,summaryTableCol:[],detailLoading:!1,detailsTableCol:[],detailsTableColDays:[],pagination:{page:1,page_size:20,pages:0,total:0},filter:{time:e,corpid:"",sort_field:"paid",sort_type:"desc"}}},computed:{isShowTimes:function(){return!this.filter.corpid},isCanExport:function(){return!!this.$store.state.dataBoardAuth.can_export}},created:function(){this.initTableHeight(),this.handleInitCorpOptions(),this.handleGetChart(),this.handleGetSummaryList(),this.handleGetList()},beforeDestroy:function(){this.myChart&&this.myChart.clear()},methods:{initTableHeight:function(){this.height=document.documentElement.clientHeight-200>400?document.documentElement.clientHeight-200:400},handleGetSummaryList:function(){var e=this;return f()(u.a.mark(function t(){var a,i,n,r,s,o,l;return u.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.summaryLoading=!0,a={start_date:e.filter.time[0],end_date:e.filter.time[1],corpid:e.filter.corpid},i=""+e.URL.BASEURL+e.URL.dataBoard_loseUser_summary,t.next=6,e.$axios.get(i,{params:a});case 6:if(n=t.sent,r=n.data,!(s=void 0===r?{}:r)||0!=s.errno){t.next=19;break}return o=[],s.rst.header.forEach(function(e){e.name&&e.name.length>6&&(e.min_width=20*e.name.length),o.push(e)}),e.summaryTableCol=_()(o),t.next=15,e.$nextTick();case 15:l=Array.isArray(s.rst.data)?s.rst.data:[s.rst.data],e.$refs.summaryTable.reloadData(l),t.next=20;break;case 19:4002!=s.errno&&(e.$message.warning(s.err),e.$refs.summaryTable.reloadData([]));case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(0),console.log(t.t0),e.$refs.summaryTable.reloadData([]);case 26:return t.prev=26,e.summaryLoading=!1,t.finish(26);case 29:case"end":return t.stop()}},t,e,[[0,22,26,29]])}))()},handleGetList:function(){var e=this;return f()(u.a.mark(function t(){var a,i,n,r,s,o,l,c;return u.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.detailLoading=!0,a={corpid:e.filter.corpid,page:e.pagination.page,page_size:e.pagination.page_size,start_date:e.filter.time[0],end_date:e.filter.time[1],sort_field:e.filter.sort_field,sort_type:e.filter.sort_type},i=""+e.URL.BASEURL+e.URL.dataBoard_loseUser_account,t.next=6,e.$axios.get(i,{params:a});case 6:if(n=t.sent,r=n.data,!(s=void 0===r?{}:r)||0!=s.errno){t.next=25;break}return s.rst.extra[0].fixed="left",s.rst.extra[1].fixed="left",o=[],l=[],s.rst.extra.forEach(function(t){t.name.includes("DAY")?l.push(t):(t.name&&t.name.length>6&&(t.min_width=20*t.name.length),"ref_date"===t.column&&(t.min_width=e.isShowTimes?200:140),o.push(t))}),e.detailsTableCol=_()(o),e.detailsTableColDays=_()(l),t.next=19,e.$nextTick();case 19:c=Array.isArray(s.rst.data)?s.rst.data:[],e.$refs.detailsTable.reloadData(c),e.pagination.total=s.rst.pageInfo.total,e.pagination.pages=s.rst.pageInfo.pages,t.next=26;break;case 25:4002!=s.errno&&(e.$message.warning(s.err),e.$refs.detailsTable.reloadData([]),e.pagination.total=0,e.pagination.pages=0);case 26:t.next=34;break;case 28:t.prev=28,t.t0=t.catch(0),console.log(t.t0),e.$refs.detailsTable.reloadData([]),e.pagination.total=0,e.pagination.pages=0;case 34:return t.prev=34,e.detailLoading=!1,t.finish(34);case 37:case"end":return t.stop()}},t,e,[[0,28,34,37]])}))()},handleGetChart:function(){var e=this;return f()(u.a.mark(function t(){var a,i,n,r,s;return u.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.chartLoading=!0,a={start_date:e.filter.time[0],end_date:e.filter.time[1],corpid:e.filter.corpid},i=""+e.URL.BASEURL+e.URL.dataBoard_loseUser_curve,t.next=6,e.$axios.get(i,{params:a});case 6:if(n=t.sent,r=n.data,!(s=void 0===r?{}:r)||0!=s.errno){t.next=16;break}return e.chartDataList=Array.isArray(s.rst.data)?s.rst.data:[],t.next=13,e.$nextTick();case 13:e.handleDrawChart(),t.next=22;break;case 16:if(4002==s.errno){t.next=22;break}return e.$message.warning(s.err),e.chartDataList=[],t.next=21,e.$nextTick();case 21:e.myChart&&e.myChart.clear();case 22:t.next=31;break;case 24:return t.prev=24,t.t0=t.catch(0),console.log(t.t0),e.chartDataList=[],t.next=30,e.$nextTick();case 30:e.myChart&&e.myChart.clear();case 31:return t.prev=31,e.chartLoading=!1,t.finish(31);case 34:case"end":return t.stop()}},t,e,[[0,24,31,34]])}))()},handleDrawChart:function(){var e=this;this.myChart&&this.myChart.clear();var t=this,a=[],i=[],n=this.chartDataList.map(function(e){return e.expense_date});this.legendList.forEach(function(r){if(r.selectFlag){i.push({type:"value",name:"",show:!1,position:"left",axisTick:{show:!1},splitLine:{lineStyle:{color:"#F2F2f2",type:"dashed"}},axisLine:{show:!0,lineStyle:{color:"#F2F2f2"}},nameTextStyle:{color:"#999999",fontSize:13},axisLabel:{color:"#999999",fontSize:12,show:!0,formatter:function(e){return t.percentFields.includes(r.name)?t.$formatNum(e)+"%":t.$NumberHandle(e)}}});var s=e.chartDataList.map(function(e){return e[r.key]||0==e[r.key]?e[r.key]:"-"});a.push({type:"line",smooth:!0,name:r.name,yAxisIndex:0,data:s,lineStyle:{width:2},symbol:1==n.length?"emptyCircle":"none",itemStyle:{color:r.color,borderType:"emptyCircle"}})}}),i.forEach(function(e,t){e.show=0==t}),a.forEach(function(e,t){e.yAxisIndex=t});var r={title:"",tooltip:{trigger:"axis",show:!0,formatter:function(e){var a=e[0].name+"<br/>";return e.forEach(function(e){t.percentFields.includes(e.seriesName)?a+=""+e.marker+e.seriesName+":"+t.$formatNum(e.value)+"%<br/>":a+=""+e.marker+e.seriesName+":"+t.$formatNum(e.value)+"<br/>"}),a}},legend:{itemWidth:8,itemHeight:2,icon:"plain",show:!1,textStyle:{fontSize:12,color:"#666666"}},grid:{top:"6%",left:"5%",right:"4%",bottom:"16%",containLabel:!1},xAxis:[{type:"category",data:n,boundaryGap:!1,axisLine:{show:!0,lineStyle:{color:"#F2F2f2"}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:"#666",fontSize:10,rotate:30}}],yAxis:i,series:a};this.myChart=this.myChart?this.myChart:this.$echarts.init(document.getElementById("trend")),this.myChart.setOption(r)},onClickLegend:function(e,t){var a=this;return f()(u.a.mark(function i(){var n,r;return u.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(1!=(n=a.legendList.filter(function(e){return e.selectFlag})).length||n[0].key!=e.key){i.next=3;break}return i.abrupt("return",a.$message.warning("至少存在一条曲线"));case 3:return(r=v.a.cloneDeep(e)).selectFlag=!r.selectFlag,a.$set(a.legendList,t,r),i.next=8,a.$nextTick();case 8:a.handleDrawChart();case 9:case"end":return i.stop()}},i,a)}))()},onChangeCorpidSystem:function(e){var t=this;e.length<1?this.enterprise={}:this.enterpriseList.forEach(function(a){a.manage_corp_list.forEach(function(a){a.corpid==e[1]&&(t.enterprise=a)})}),this.filter.corpid=this.enterprise.corpid||"",this.handleGetChart(),this.handleGetSummaryList(),this.filter.sort_field=this.isShowTimes?"paid":"expense_date",this.filter.sort_type="desc",this.pagination.page=1,this.handleGetList()},onChangeCorpid:function(e){if(e){var t=this.enterpriseList.filter(function(t){return t.corpid==e})[0];this.enterprise=t||{}}else this.enterprise={};this.filter.corpid=this.enterprise.corpid||"",this.handleGetChart(),this.handleGetSummaryList(),this.filter.sort_field=this.isShowTimes?"paid":"expense_date",this.filter.sort_type="desc",this.pagination.page=1,this.handleGetList()},handleInitCorpOptions:function(){if(1==this.$cookie.getCookie("isSuperManage")){var e=this.$store.state.authorize_corpList;e.forEach(function(e){e.self_id=e.group_id.toString(),e.self_name=e.group_name,e.manage_corp_list.forEach(function(e){e.self_id=e.corpid,e.self_name=e.corp_name})}),this.enterpriseList=e}else this.enterpriseList=this.$store.state.authorize_corpList},onChangeTime:function(e){this.filter.time=Array.isArray(e)?e:[],this.handleGetChart(),this.handleGetSummaryList(),this.pagination.page=1,this.handleGetList()},handleCurrentChange:function(e){this.handleGetChart(),this.handleGetSummaryList(),this.pagination.page=e,this.handleGetList()},handleSizeChange:function(e){this.handleGetChart(),this.handleGetSummaryList(),this.pagination.page_size=e,this.pagination.page=1,this.handleGetList()},onClickSearch:function(){this.handleGetChart(),this.handleGetSummaryList(),this.pagination.page=1,this.handleGetList()},onClickSort:function(e,t){this.filter.sort_field===e?this.filter.sort_type===t?(this.filter.sort_field=this.isShowTimes?"paid":"expense_date",this.filter.sort_type="desc"):this.filter.sort_type=t:(this.filter.sort_field=e,this.filter.sort_type=t),this.pagination.page=1,this.handleGetList(),this.handleGetChart(),this.handleGetSummaryList()},onClickReset:function(){this.reset=!this.reset,this.filter.time=this.default_time,this.system_enterprise=[],this.enterprise={},this.filter.corpid="",this.filter.sort_field="paid",this.filter.sort_type="desc",this.pagination.page=1,this.handleGetChart(),this.handleGetSummaryList(),this.handleGetList()},onClickExport:function(){var e=this;return f()(u.a.mark(function t(){var a,i,n,r,o,c,h,p;return u.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.pagination.total){t.next=2;break}return t.abrupt("return",e.$message.warning("暂无数据可导出"));case 2:return t.prev=2,e.pageLoading=!0,a={summary:"",detail:""},i={start_date:e.filter.time[0],end_date:e.filter.time[1],corpid:e.filter.corpid},a.summary=""+e.URL.BASEURL+e.URL.dataBoard_loseUser_summary,a.detail=""+e.URL.BASEURL+e.URL.dataBoard_loseUser_account,t.next=10,l.a.all([e.$axios.get(a.summary,{params:i}),e.$axios.get(a.detail,{params:s()({},i,{sort_field:e.filter.sort_field,sort_type:e.filter.sort_type,page:1,page_size:e.$store.state.exportNumber})})]);case 10:n=t.sent,r=d()(n,2),o=r[0].data,c=void 0===o?{}:o,h=r[1].data,p=void 0===h?{}:h,c&&0==c.errno&&p&&0==p.errno?e.handleExport({summaryData:c.rst,detailData:p.rst}):4002==c.errno&&4002==p.errno||(e.$message.warning(c.err),e.$message.warning(p.err)),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(2),console.log(t.t0),e.$message.warning("导出失败,请重试");case 23:return t.prev=23,e.pageLoading=!1,t.finish(23);case 26:case"end":return t.stop()}},t,e,[[2,19,23,26]])}))()},handleExport:function(e){var t=e.summaryData,a=void 0===t?{}:t,i=e.detailData,r=void 0===i?{}:i,s=[];s=r.extra.filter(function(e){return e.name.includes("DAY")}),a.header.forEach(function(e){"时间"===e.name?e.column="ref_date":"企微主体"===e.name&&(e.column="corp_name")}),a.data.ref_date="汇总",a.data.corp_name="汇总",r.data.forEach(function(e){e.ref_date=e.expense_date+(e.expense_date_end?" ~ "+e.expense_date_end:""),s.forEach(function(t,a){e[t.column]="流失人数: "+(e&&e.day_info&&e.day_info[a]&&(e.day_info[a].loss_count||0==e.day_info[a].loss_count)?e.day_info[a].loss_count:"-")+" 新增流失率: "+(e&&e.day_info&&e.day_info[a]&&(e.day_info[a].new_loss_rate||0==e.day_info[a].new_loss_rate)?e.day_info[a].new_loss_rate:"-")+" 累计流失率: "+(e&&e.day_info&&e.day_info[a]&&(e.day_info[a].total_loss_rate||0==e.day_info[a].total_loss_rate)?e.day_info[a].total_loss_rate:"-")})});var o=[{tHeader:[].concat(n()(a.header.map(function(e){return e.name})),n()(s.map(function(e){return e.name}))),filterVal:[].concat(n()(a.header.map(function(e){return e.column})),n()(s.map(function(e){return e.column}))),tableDatas:[a.data].concat(n()(r.data)),sheetName:""}];this.$exportOrder({excelDatas:o,name:"用户流失趋势(导出时间:"+this.$getDay(0)+")"})},getHeaderCellStyle:function(){return{backgroundColor:"#FFFFFF !important",border:"none!important"}}}},C={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.pageLoading,expression:"pageLoading"}],staticClass:"loseUserTrends-wrap"},[a("div",{staticClass:"screenBox filter-wrap"},[a("datePicker",{staticStyle:{"margin-right":"30px"},attrs:{reset:e.reset,title:"自定义",quickFlag:!0,afferent_time:e.default_time,clearFlag:!1},on:{changeTime:e.onChangeTime}}),e._v(" "),a("div",{staticClass:"flex"},[a("div",{staticClass:"common-screen-item",staticStyle:{"margin-right":"30px"}},[a("label",{staticClass:"common-screen-label",staticStyle:{width:"auto"}},[e._v("企微主体")]),e._v(" "),1==e.$cookie.getCookie("isSuperManage")?a("el-cascader",{attrs:{size:"small",options:e.enterpriseList,props:{value:"self_id",label:"self_name",children:"manage_corp_list"},clearable:"",placeholder:"请选择企微主体"},on:{change:e.onChangeCorpidSystem},model:{value:e.system_enterprise,callback:function(t){e.system_enterprise=t},expression:"system_enterprise"}}):a("el-select",{attrs:{size:"small",placeholder:"请选择企微主体",clearable:""},on:{change:e.onChangeCorpid},model:{value:e.filter.corpid,callback:function(t){e.$set(e.filter,"corpid",t)},expression:"filter.corpid"}},e._l(e.enterpriseList,function(e,t){return a("el-option",{key:t+"enterpriseList",attrs:{label:e.corp_name?e.corp_name:e.corp_full_name?e.corp_full_name:e.corpid,value:e.corpid}})}),1)],1),e._v(" "),a("el-button",{attrs:{size:"mini",type:"primary",plain:""},on:{click:e.onClickSearch}},[e._v("确定")]),e._v(" "),a("el-button",{attrs:{size:"mini",plain:""},on:{click:e.onClickReset}},[e._v("重置")]),e._v(" "),e.isCanExport?a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.onClickExport}},[e._v("导出Excel")]):e._e()],1)],1),e._v(" "),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.chartLoading,expression:"chartLoading"}],staticClass:"trendBox mt-10"},[a("div",{staticClass:"legendBox"},e._l(e.legendList,function(t,i){return a("div",{key:i,staticClass:"legendItem",on:{click:function(a){return e.onClickLegend(t,i)}}},[e._v(e._s(t.name)+"\n "),a("div",{class:["checkbox",t.selectFlag?"checkbox_active":""],style:t.selectFlag?"background: "+t.color+";border-color: "+t.color+";":""},[a("i",{staticClass:"el-icon-check"})])])}),0),e._v(" "),a("div",{staticStyle:{width:"100%",height:"250px"},attrs:{id:"trend"}}),e._v(" "),e.chartDataList&&e.chartDataList.length?e._e():a("div",{staticStyle:{"text-align":"center",color:"#333","font-size":"14px",position:"relative",top:"-100px"}},[e._v("暂无数据")])]),e._v(" "),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.summaryLoading,expression:"summaryLoading"}]},[a("ux-grid",{ref:"summaryTable",staticClass:"summaryTable",attrs:{border:!1,"header-cell-style":e.getHeaderCellStyle,"show-footer-overflow":"tooltip","show-overflow":"tooltip",size:"mini"},on:{"row-click":function(){}}},e._l(e.summaryTableCol,function(t){return a("ux-table-column",{key:t.column+t.name,attrs:{resizable:!0,field:t.column,title:t.name,"min-width":t.min_width?t.min_width:140,fixed:t.fixed?t.fixed:"",align:"center"},scopedSlots:e._u([{key:"header",fn:function(){return[a("div",{staticClass:"flex-align-jus-center"},[e._v("\n "+e._s(t.name)+"\n "),t.notes?a("el-tooltip",{attrs:{content:t.notes,placement:"top"}},[a("div",[a("i",{staticClass:"el-icon-question"})])]):e._e()],1)]},proxy:!0},{key:"default",fn:function(i){var n=i.row;return["时间"===t.name||"企微主体"===t.name?a("div",[a("span",[e._v("汇总")])]):a("span",[e._v(e._s(n[t.column]||0==n[t.column]?e.$formatNum(n[t.column]):"-"))])]}}],null,!0)})}),1)],1),e._v(" "),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.detailLoading,expression:"detailLoading"}]},[a("ux-grid",{ref:"detailsTable",staticClass:"detailsTable",attrs:{border:!1,"header-cell-style":e.getHeaderCellStyle,"show-footer-overflow":"tooltip","show-overflow":"tooltip",size:"mini",height:e.height},on:{"row-click":function(){}}},[e._l(e.detailsTableCol,function(t,i){return a("ux-table-column",{key:t.column+i+t.name,attrs:{resizable:!0,field:t.column,title:t.name,"min-width":t.min_width?t.min_width:140,fixed:t.fixed?t.fixed:"",align:"center"},scopedSlots:e._u([{key:"header",fn:function(){return[a("div",{staticClass:"flex-align-jus-center"},[e._v("\n "+e._s(t.name)+"\n "),t.notes?a("el-tooltip",{attrs:{content:t.notes,placement:"top"}},[a("div",[a("i",{staticClass:"el-icon-question"})])]):e._e(),e._v(" "),t.enable_to_sort?a("div",{staticClass:"sort-wrap"},[a("i",{staticClass:"el-icon-caret-top",class:{active:e.filter.sort_field===t.column&&"asc"===e.filter.sort_type},on:{click:function(a){return e.onClickSort(t.column,"asc")}}}),e._v(" "),a("i",{staticClass:"el-icon-caret-bottom",class:{active:e.filter.sort_field===t.column&&"desc"===e.filter.sort_type},on:{click:function(a){return e.onClickSort(t.column,"desc")}}})]):e._e()],1)]},proxy:!0},{key:"default",fn:function(i){var n=i.row;return["ref_date"===t.column?a("div",[a("span",[e._v(e._s(n.expense_date))]),n.expense_date_end?a("span",[e._v(" ~ "+e._s(n.expense_date_end))]):e._e()]):a("span",[e._v(e._s(n[t.column]||0==n[t.column]?e.$formatNum(n[t.column]):"-"))])]}}],null,!0)})}),e._v(" "),e._l(e.detailsTableColDays,function(t,i){return a("ux-table-column",{key:i+"extra"+t.name,attrs:{width:"140"},scopedSlots:e._u([{key:"header",fn:function(){return[a("div",{staticClass:"flex-align-jus-center"},[e._v(e._s(t.name)+"\n "),0===i?a("el-tooltip",{attrs:{placement:"top"}},[a("div",{attrs:{slot:"content"},slot:"content"},[e._v("流失人数=这天的流失人数"),a("br"),e._v("D1新增流失率=D1用户流失人数/企微加粉人数 D2新增流失率=D2用户流失人数/企微加粉人数"),a("br"),e._v("D1累计流失率=D1新增流失率 D2累计流失率=D1新增流失率+D2新增流失率")]),e._v(" "),a("div",[a("i",{staticClass:"el-icon-question"})])]):e._e()],1)]},proxy:!0},{key:"default",fn:function(t){var n=t.row;return[a("div",{staticClass:"day_class_info"},[a("span",{staticClass:"font",staticStyle:{color:"#2C9841"}},[e._v("流失人数:")]),e._v(" "),a("span",[e._v(e._s(n&&n.day_info&&n.day_info[i]&&n.day_info[i].loss_count?n.day_info[i].loss_count:"-"))])]),e._v(" "),a("div",{staticClass:"day_class_info"},[a("span",{staticClass:"font",staticStyle:{color:"#EB4315"}},[e._v("新增流失率:")]),e._v(" "),a("span",[e._v(e._s(n&&n.day_info&&n.day_info[i]&&n.day_info[i].new_loss_rate?n.day_info[i].new_loss_rate:"-"))])]),e._v(" "),a("div",{staticClass:"day_class_info"},[a("span",{staticClass:"font",staticStyle:{color:"#F28544"}},[e._v("累计流失率:")]),e._v(" "),a("span",[e._v(e._s(n&&n.day_info&&n.day_info[i]&&n.day_info[i].total_loss_rate?n.day_info[i].total_loss_rate:"-"))])])]}}],null,!0)})})],2),e._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:e.pagination.total>0,expression:"pagination.total > 0"}],staticClass:"pagination"},[a("el-pagination",{attrs:{background:"","current-page":e.pagination.page,layout:"prev, pager, next, sizes, jumper","page-sizes":[20,50,100],"page-count":Number(e.pagination.pages)},on:{"current-change":e.handleCurrentChange,"size-change":e.handleSizeChange}})],1)],1)])},staticRenderFns:[]};var L=a("VU/8")(x,C,!1,function(e){a("Zb2A"),a("CIE7")},"data-v-5c33ae38",null);t.default=L.exports},Zb2A:function(e,t){}});
|