Browse Source

更新数据

lite
luyisha 3 years ago
parent
commit
826e73ba66
  1. 57
      src/views/index.vue

57
src/views/index.vue

@ -197,7 +197,8 @@ export default {
mounted() {
this.getStat();
this.getHomeBarData();
this.btgetdata();
this.getPieData();
this.getInfoDatas();
this.getGcgNumDatas();
@ -237,7 +238,6 @@ export default {
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) => {
@ -247,16 +247,6 @@ export default {
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();
});
},
@ -265,7 +255,6 @@ export default {
selitem(type) {
// console.log(type);
this.klselt = type;
// this.getHomeBarData();
this.btgetdata();
this.autoTimer0();
},
@ -499,7 +488,7 @@ export default {
]
});
}
clearInterval(this.timer1);//
clearInterval(that.timer1);//
that.timer1 = setInterval(function () {
myChart.clear();
option && myChart.setOption(option);
@ -772,25 +761,15 @@ export default {
});
},
getHomeBarData() {
getPieData() {
let that = this;
homeApi.homeBarData().then(res => {
// /pass.passcc/allGroupTimeNum&granularity=daily
// get allTimeData
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;
const pieData = res.data.data.groupsData;
that.proportionData = [];that.groupNameData=[];that.dataP=[];
groupsData.forEach((item) => {
pieData.forEach((item) => {
that.proportionData.push(item.proportion);
that.groupNameData.push(item.groupName);
that.dataP.push({
@ -866,7 +845,7 @@ export default {
// {name: '',value: 12,},
// // {name: '',value: 13,}
// ];
var dataP = that.dataP;
function hexToRgba(hex, opacity) {
return (
'rgba(' +
@ -880,6 +859,10 @@ export default {
')'
);
}
function run(myChart){
var dataP = that.dataP;
// -
let color = ['#ff9acc', '#6666ff', '#ff6600', '#02ff00','#00ffff', '#fdff00'];
let color1=[], color2=[], color3=[];
//
@ -975,27 +958,17 @@ export default {
},
],
}
function run(myChart){
// -
myChart.setOption({
series: [{
data: data1,
},
{
data: data1,
}
]
});
option && myChart.setOption(option);
}
// 使
setTimeout(()=>{
var pieDom1 = document.getElementById("indexPie1");
var myChart = echarts.init(pieDom1);
option && myChart.setOption(option);
run(myChart);
setInterval(function () {
myChart.clear();
option && myChart.setOption(option);
that.getPieData();
run(myChart);
}, 4000);
}, 200)

Loading…
Cancel
Save