diff --git a/src/api/modules/http.js b/src/api/modules/http.js index 040b193..6aeaef0 100644 --- a/src/api/modules/http.js +++ b/src/api/modules/http.js @@ -550,6 +550,78 @@ export function trendtrendAnalysisProject(query) { }) } +//获取顾问 +export function trendAnalysisAllAccount(query) { + return request({ + url: 'autoSR/cusStageStatistics/trendAnalysisAllAccount', + method:'get', + params:query + }) +} + +//顾问维度 +export function trendAnalysisAccount(query) { + return request({ + url: 'autoSR/cusStageStatistics/trendAnalysisAccount', + method:'get', + params:query + }) +} + +//获取一级二级 +export function trendAnalysisAllLevel(query) { + return request({ + url: 'autoSR/cusStageStatistics/trendAnalysisAllLevel', + method:'get', + params:query + }) +} + + +//销讲二级 +export function trendAnalysisLevel2(query) { + return request({ + url: 'autoSR/cusStageStatistics/trendAnalysisLevel2', + method:'get', + params:query + }) +} +//团队对比表格 +export function teamteamTable(query) { + return request({ + url: 'autoSR/cusStageStatistics/teamTable', + method:'get', + params:query + }) +} + +//团队对比图表 +export function teamData(query) { + return request({ + url: 'autoSR/cusStageStatistics/teamData', + method:'get', + params:query + }) +} + +//团队对比一级 +export function teamAllLevel(query) { + return request({ + url: 'autoSR/cusStageStatistics/teamAllLevel', + method:'get', + params:query + }) +} + + +//楼盘对比 +export function houseTable(query) { + return request({ + url: 'autoSR/cusStageStatistics/houseTable', + method:'get', + params:query + }) +} diff --git a/src/views/Statistics/BuildingContrast.vue b/src/views/Statistics/BuildingContrast.vue index d11de18..b71d939 100644 --- a/src/views/Statistics/BuildingContrast.vue +++ b/src/views/Statistics/BuildingContrast.vue @@ -2,26 +2,15 @@
-
- 楼盘选择: - - - - -
-
- 今日 +
+ 近7天
-
- 昨日 +
+ 近15天
-
- 近一周 +
+ 近30天
@@ -47,13 +36,13 @@ style="width: 100%"> @@ -204,21 +256,266 @@ export default { checked: false,//是否对比 Confirmthecontrast:false, tableData: [],//表格数据 - cardobj:{} + cardobj:{}, + departmentlist:[], + departmentid:'', + echartsisshow:true, + consultantlist:[], + consultantid:'', + tablelist1:[], + tablelist2:[], + tablelist3:[], + tablelist4:[], + Level1:[], + Level2:[], + Level1id:'', + Level2id:'' }; }, mounted() { this.houseId = localStorage.getItem("houseId"); this.tabtimetap(4); + this.overviewfindList() }, methods: { - //获取部门下拉菜单 - overviewfindList(){ - this.$api.http.overviewfindList({ - houseId:this.houseId, - }).then((res) => { - console.log(res) - }) + //销讲二级 + trendAnalysisLevel2(){ + let pamaet={ + showStatus:'', + houseId:this.houseId, + timeType:0, + firstStartDate:this.page.openTime, + firstEndDate:this.page.closeTime, + lastStartDate:this.selectTime, + lastEndDate:this.selectTime1, + marketingId:this.Level2id + } + + if(this.timeType==-1){ + pamaet.timeType=null + }else{ + pamaet.timeType=this.timeType + } + if(this.checked==true){ + pamaet.showStatus=1; + pamaet.timeType=null + }else{ + pamaet.showStatus=0 + } + this.$api.http.trendAnalysisLevel2(pamaet).then((res) => { + if(this.Confirmthecontrast==false){ + let newlist=res.data.startList || []; + var newline=[]; + var newline2=[]; + newlist.map(item=>{ + newline.push(item.zxl) + newline2.push(item.statDate.slice(5,10)) + }) + this.SwitchCARDS(newline,newline2) + }else{ + let newlist=res.data.startList || []; + let newlist2=res.data.endList || []; + let hejilist=res.data.comparedList || []; + var newline=[];//起始数据 + var newline2=[];//对比数据 + var newline1=[];//时间 + + let arr=[]; + newlist.map(item=>{ + newline.push(item.zxl) + }) + newlist2.map(item=>{ + newline1.push(item.zxl) + }) + newlist.forEach((item, sdf) => { + newlist2.forEach((child, zxc) => { + if (sdf == zxc) { + newline2.push(item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10)) + arr.push({ + name:item.statDate.substring(5,10) + 'vs' + child.statDate.substring(5, 10), + shiduan1:item.zxl, + shiduan2:child.zxl, + }); + } + }) + }) + hejilist.forEach((acd,xdx)=>{ + arr.forEach((che,ind)=>{ + if(xdx==ind){ + che.heji=acd.zxl; + } + }) + }) + arr.unshift({ + name:'项目合计', + shiduan1:res.data.startSum, + shiduan2:res.data.endSum, + heji:res.data.comparedSum, + }) + + this.SwitchCARDS2(newline,newline1,newline2) + this.tableData=arr; + console.log( this.tableData) + } + }) + + }, + //切换一级 + Level1tap(){ + this.Level1.forEach((item,index)=>{ + if(this.Level1id==item.marketingId){ + this.Level2=item.children || []; + this.Level2id=item.children[0].marketingId || ''; + } + }) + this.trendAnalysisLevel2() + }, + //切换er级 + Level2tap(){ + this.trendAnalysisLevel2() + }, + //一二级 + trendAnalysisAllLevel(){ + let pamaet={ + showStatus:'', + houseId:this.houseId, + timeType:0, + firstStartDate:this.page.openTime, + firstEndDate:this.page.closeTime, + lastStartDate:this.selectTime, + lastEndDate:this.selectTime1, + } + + if(this.timeType==-1){ + pamaet.timeType=null + }else{ + pamaet.timeType=this.timeType + } + if(this.checked==true){ + pamaet.showStatus=1; + pamaet.timeType=null + }else{ + pamaet.showStatus=0 + } + this.$api.http.trendAnalysisAllLevel(pamaet).then((res) => { + this.Level1=res.data || []; + this.Level1id=res.data[0].marketingId || ''; + this.Level2=res.data[0].children || []; + this.Level2id=res.data[0].children[0].marketingId || ''; + this.trendAnalysisLevel2() + }) + }, + + //切换顾问 + consultanttap(){ + this.trendAnalysisAccount() + }, + // 获取顾问 + trendAnalysisAllAccount(pamaet){ + this.$api.http.trendAnalysisAllAccount(pamaet).then((res) => { + this.consultantlist=res.data || []; + if( this.consultantlist.length!=0){ + this.consultantid=res.data[0].accountId; + this.trendAnalysisAccount() + }else{ + echarts.init(document.getElementById("main")).dispose(); + this.echartsisshow=false; + this.tableData=[]; + } + }) + }, + trendAnalysisAccount(){ + var that=this; + let pamaet={ + showStatus:'', + houseId:this.houseId, + timeType:0, + firstStartDate:this.page.openTime, + firstEndDate:this.page.closeTime, + lastStartDate:this.selectTime, + lastEndDate:this.selectTime1, + + } + if(this.aliasclass==3){ + pamaet.accountId=this.consultantid + } + if(this.timeType==-1){ + pamaet.timeType=null + }else{ + pamaet.timeType=this.timeType + } + if(this.checked==true){ + pamaet.showStatus=1; + pamaet.timeType=null + }else{ + pamaet.showStatus=0 + } + this.$api.http.trendAnalysisAccount(pamaet).then((res) => { + if(this.Confirmthecontrast==false){ + let newlist=res.data.firstList || []; + var newline=[];//起始数据 + var newlinename=[]; + let tablist=[ + {name:'时间',} + ] + let tablist2=[ + {name:that.customtime[0].substring(5,10)+'/'+that.customtime[1].substring(5,10),} + ] + newlist.map(item=>{ + newline.push(item.zxl) + newlinename.push({name:item.name,max:100}) + tablist.push({name:item.name}) + tablist2.push({name:item.zxl+'%',}) + }) + this.tablelist1=tablist; + this.tablelist2=tablist2; + this.tablelist3=[]; + this.tablelist4=[]; + this.piechart(newline,newlinename) + }else{ + + let newlist=res.data.firstList || []; + let newlist2=res.data.secondList|| []; + let newlist4=res.data.thirdList|| []; + + var newline=[];//起始数据 + let newline2=[];//对比数据 + var newlinename=[]; + + let tablist1=[ + {name:'时间',} + ] + let tablist2=[ + {name:that.customtime[0].substring(5,10)+'/'+that.customtime[1].substring(5,10),} + ] + let tablist3=[ + {name:that.selectTime.substring(5,10)+'/'+that.selectTime1.substring(5,10),} + ] + let tablist4=[ + {name:'变化',} + ] + + newlist.map(item=>{ + newline.push(item.zxl) + newlinename.push({name:item.name,max:100}) + tablist1.push({name:item.name}) + tablist2.push({name:item.zxl+'%',}) + }) + newlist2.map(item=>{ + newline2.push(item.zxl) + tablist3.push({name:item.zxl+'%',}) + }) + newlist4.map(item=>{ + tablist4.push({name:item.zxl,}) + }) + + this.tablelist1=tablist1; + this.tablelist2=tablist2; + this.tablelist3=tablist3; + this.tablelist4=tablist4; + this.piechart2(newline,newlinename,newline2) + } + }) }, //获取卡片 trendtrendAnalysis(){ @@ -231,6 +528,7 @@ export default { lastStartDate:this.selectTime, lastEndDate:this.selectTime1 } + if(this.timeType==-1){ pamaet.timeType=null }else{ @@ -245,7 +543,27 @@ export default { this.$api.http.trendtrendAnalysis(pamaet).then((res) => { this.cardobj=res.data; if(this.aliasclass==1){ + this.echartsisshow=true; this.trendtrendAnalysisProject(pamaet) + }else if(this.aliasclass==2){ + if(this.departmentid!=''){ + pamaet.deptId=this.departmentid + this.trendtrendAnalysisProject(pamaet) + }else{ + echarts.init(document.getElementById("main")).dispose(); + this.echartsisshow=false; + this.tableData=[]; + } + }else if(this.aliasclass==3){ + if(this.consultantid.length==0){ + this.trendAnalysisAllAccount(pamaet) + }else{ + this.trendAnalysisAccount() + } + }else if(this.aliasclass==4){ + this.trendAnalysisAccount() + }else{ + this.trendAnalysisAllLevel() } }) @@ -309,6 +627,24 @@ export default { } }) }, + //获取部门下拉菜单 + overviewfindList(){ + this.$api.http.overviewfindList({ + houseId:this.houseId, + }).then((res) => { + this.departmentlist=res.data || []; + if(this.departmentlist.length!=0){ + this.departmentid=res.data[0].deptId + }else{ + this.departmentid='' + } + }) + }, + //切换部门 + departmenttap(){ + this.trendtrendAnalysis() + }, + //选项卡切换 tapChange(idx){ @@ -569,6 +905,93 @@ export default { myChart.resize(); }); }, + piechart2(newline,newlinename,newline2){ + echarts.init(document.getElementById("main")).dispose(); + var chartDom = document.getElementById("main"); + var myChart = echarts.init(chartDom); + var option; + option = { + tooltip: { + trigger: 'axis' + }, + legend: { + data: ['起始时间','对比时间'], + bottom: "10", + }, + color:[ + '#2671E2', + '#F3787B', + ], + radar: { + // shape: 'circle', + indicator: newlinename + }, + series: [ + { + type: 'radar', + tooltip: { + trigger: 'item' + }, + data: [ + { + value:newline, + name: '起始时间' + }, + { + value:newline2, + name: '对比时间' + }, + ] + } + ] + }; + option && myChart.setOption(option); + window.addEventListener("resize", () => { + myChart.resize(); + }); + }, + piechart(newline,newlinename){ + echarts.init(document.getElementById("main")).dispose(); + var chartDom = document.getElementById("main"); + var myChart = echarts.init(chartDom); + var option; + option = { + tooltip: { + trigger: 'axis' + }, + legend: { + data: ['起始时间'], + bottom: "10", + }, + color:[ + '#2671E2', + '#F3787B', + ], + radar: { + // shape: 'circle', + indicator: newlinename + }, + series: [ + { + type: 'radar', + tooltip: { + trigger: 'item' + }, + data: [ + { + value:newline, + name: '起始时间' + }, + ] + } + ] + }; + option && myChart.setOption(option); + window.addEventListener("resize", () => { + myChart.resize(); + }); + } + }, }; @@ -581,6 +1004,24 @@ export default { padding-bottom: 100px; } +.table { + border-collapse: collapse; + width: 100%; +} +.tbody { + display: block; + // width: 100%; + // overflow-x: auto; + // overflow-y: auto; + height: 220px; +} +.tbody tr { + display: table; + width: 100%; + table-layout: fixed; + // word-break: break-all; +} + #main { width: 100%; height: 380px; @@ -746,4 +1187,14 @@ export default { cursor: pointer; color: #606266; } + .theadtd{ + width: 140px; + height: 48px; + border: 1px solid #E0E0E0; + text-align: center; + line-height: 48px; + font-size: 16px; + color: #32363D; + + }