Browse Source

删除多余的函数

lite
luyisha 3 years ago
parent
commit
1937b5756d
  1. 119
      src/views/index.vue

119
src/views/index.vue

@ -8,8 +8,8 @@
<span class="kliu_title">总服务人次趋势</span> <span class="kliu_title">总服务人次趋势</span>
<div class="kliu_st"> <div class="kliu_st">
<span id="yitem" :class="klselt == 'y' ? 'spactive' : ''" @click="selitem('y')"></span> <span id="yitem" :class="klselt == 'y' ? 'spactive' : ''" @click="selitem('y')"></span>
<span id="mitem" :class="klselt == 'm' ? 'spactive' : ''" @click="selitem2('m')"></span> <span id="mitem" :class="klselt == 'm' ? 'spactive' : ''" @click="selitem('m')"></span>
<span id="ditem" :class="klselt == 'd' ? 'spactive' : ''" @click="selitem3('d')"></span> <span id="ditem" :class="klselt == 'd' ? 'spactive' : ''" @click="selitem('d')"></span>
</div> </div>
</div> </div>
<!-- 立体柱状图 --> <!-- 立体柱状图 -->
@ -215,95 +215,29 @@ export default {
this.timer0 = setInterval(() => { this.timer0 = setInterval(() => {
if(this.klselt == 'y'){ if(this.klselt == 'y'){
this.klselt = 'm'; this.klselt = 'm';
this.btgetdata2();
}else if(this.klselt == 'm'){ }else if(this.klselt == 'm'){
this.klselt = 'd'; this.klselt = 'd';
this.btgetdata3();
}else if(this.klselt == 'd'){ }else if(this.klselt == 'd'){
this.klselt = 'y'; this.klselt = 'y';
this.btgetdata();
} }
this.btgetdata();
}, 5000); }, 5000);
}, },
btgetdata() { btgetdata() {
// //
let that = this; let that = this;
that.proportionData = []; that.proportionData = [];
that.groupNameData = []; that.groupNameData = [];
that.dataP = []; that.dataP = [];
// console.log(type) // console.log(type)
// let rqtp; let rqtp;
// switch (this.klselt) { switch (this.klselt) {
// case 'd': rqtp = "daily"; break; case 'd': rqtp = "daily"; break;
// case 'm': rqtp = "monthly"; break; case 'm': rqtp = "monthly"; break;
// case 'y': rqtp = "yearly"; break; case 'y': rqtp = "yearly"; break;
// } }
// allTygGroupTimeNum // allTygGroupTimeNum // /pass.passcc/allGroupTimeNum
homeApi.allGroupTimeNum().then(res => { homeApi.allTygGroupTimeNum({granularity:rqtp}).then(res => {
const tmpdata = res.data.data.allTimeData
const dkeys = res.data.data.dkeys
const groupsData = res.data.data.groupsData
let datas = []
Object.values(tmpdata).forEach((value) => {
datas.push(value.num);
});
that.klqsDatas = datas;
that.klqsXDatas = dkeys;
that.proportionData = [];that.groupNameData=[];that.dataP=[];
groupsData.forEach((item) => {
that.proportionData.push(item.proportion);
that.groupNameData.push(item.groupName);
that.dataP.push({
name:item.groupName,
value:item.proportion.split('%')[0]
})
})
this.home_bar();
});
},
btgetdata2() {
//
let that = this;
that.proportionData = [];
that.groupNameData = [];
that.dataP = [];
homeApi.allGroupTimeNum2().then(res => {
const tmpdata = res.data.data.allTimeData
const dkeys = res.data.data.dkeys
const groupsData = res.data.data.groupsData
let datas = []
Object.values(tmpdata).forEach((value) => {
datas.push(value.num);
});
that.klqsDatas = datas;
that.klqsXDatas = dkeys;
that.proportionData = [];that.groupNameData=[];that.dataP=[];
groupsData.forEach((item) => {
that.proportionData.push(item.proportion);
that.groupNameData.push(item.groupName);
that.dataP.push({
name:item.groupName,
value:item.proportion.split('%')[0]
})
})
this.home_bar();
});
},
btgetdata3() {
//
let that = this;
that.proportionData = [];
that.groupNameData = [];
that.dataP = [];
homeApi.allGroupTimeNum3().then(res => {
const tmpdata = res.data.data.allTimeData const tmpdata = res.data.data.allTimeData
const dkeys = res.data.data.dkeys const dkeys = res.data.data.dkeys
const groupsData = res.data.data.groupsData const groupsData = res.data.data.groupsData
@ -329,6 +263,7 @@ export default {
this.home_bar(); this.home_bar();
}); });
}, },
// //
selitem(type) { selitem(type) {
// console.log(type); // console.log(type);
@ -337,18 +272,6 @@ export default {
this.btgetdata(); this.btgetdata();
this.autoTimer0(); this.autoTimer0();
}, },
selitem2(type) {
// console.log(type);
this.klselt = type;
this.btgetdata2();
this.autoTimer0();
},
selitem3(type) {
// console.log(type);
this.klselt = type;
this.btgetdata3();
this.autoTimer0();
},
// -- // --
home_bar() { home_bar() {
@ -535,9 +458,9 @@ export default {
option && myChart.setOption(option); option && myChart.setOption(option);
function run(myChart) { function run(myChart) {
if(that.klselt == 'd'){ if(that.klselt == 'd'){
that.btgetdata3(); that.btgetdata();
}else if(that.klselt == 'm'){ }else if(that.klselt == 'm'){
that.btgetdata2() that.btgetdata()
}else if(that.klselt == 'y'){ }else if(that.klselt == 'y'){
that.btgetdata() that.btgetdata()
} }
@ -579,12 +502,12 @@ export default {
] ]
}); });
} }
clearInterval(this.timer1) // clearInterval(this.timer1)
that.timer1 = setInterval(function () { // that.timer1 = setInterval(function () {
myChart.clear(); // myChart.clear();
option && myChart.setOption(option); // option && myChart.setOption(option);
run(myChart); // run(myChart);
}, 5000); // }, 5000);
}, },
// //

Loading…
Cancel
Save