代码提交

This commit is contained in:
lixiaobang 2022-12-19 09:44:50 +08:00
parent 72b90a584f
commit df68891c60
1 changed files with 59 additions and 39 deletions

View File

@ -452,26 +452,32 @@ export default {
dataGdzl = res.data.data dataGdzl = res.data.data
this.detailedTwo(dataGdzl); this.detailedTwo(dataGdzl);
}) })
// // //
getPbtyqk({ // getPbtyqk({
action:"week" // action:"week"
}).then((res)=>{ // }).then((res)=>{
let dataPbty = []; // let dataPbty = [];
dataPbty = res.data.data // dataPbty = res.data.data
console.log(dataPbty,'dataPbty'); // console.log(dataPbty,'dataPbty');
this.detailedFive(dataPbty); // this.detailedFive(dataPbty);
let dataPb = []; // let dataPb = [];
let dataCf = []; // let dataCf = [];
let dataCfl = []; // let dataCfl = [];
for (let i = 0; i < dataPbty.length; i++) { // for (let i = 0; i < dataPbty.length; i++) {
dataPb.push(dataPbty[i].pbsl); // dataPb.push(dataPbty[i].pbsl);
dataCf.push(dataPbty[i].cftytc); // dataCf.push(dataPbty[i].cftytc);
dataCfl.push(dataPbty[i].pbcftyl) // dataCfl.push(dataPbty[i].pbcftyl)
} // }
this.topContent[0].count = dataPb.reduce((x, y) => x + y) // this.topContent[0].count = dataPb.reduce((x, y) => x + y)
this.topContent[1].count = dataCf.reduce((x, y) => x + y) // this.topContent[1].count = dataCf.reduce((x, y) => x + y)
this.topContent[2].count = dataCfl.reduce((x, y) => x + y) + '%' // let pbCount = (this.topContent[1].count/this.topContent[0].count)*100
}) // let pbCountString = pbCount.toString()
// if (pbCountString.indexOf(".") != -1) {
// this.topContent[2].count = pbCountString.substring(0,pbCountString.indexOf(".")+3) + '%'
// }else{
// this.topContent[2].count = pbCountString +'%'
// }
// })
this.handleDate(0); this.handleDate(0);
let that = this; let that = this;
window.addEventListener('message', function (e) { window.addEventListener('message', function (e) {
@ -1463,10 +1469,10 @@ export default {
}, },
handleDate(index){ handleDate(index){
this.currentIndex = index this.currentIndex = index
if (index == 0) { // if (index == 0) {
// //
getPbtyqk({ getPbtyqk({
action:"week" action: index==0?"week":'month'
}).then((res)=>{ }).then((res)=>{
let dataPbty = []; let dataPbty = [];
dataPbty = res.data.data dataPbty = res.data.data
@ -1479,25 +1485,39 @@ export default {
} }
this.topContent[0].count = dataPb.reduce((x, y) => x + y) this.topContent[0].count = dataPb.reduce((x, y) => x + y)
this.topContent[1].count = dataCf.reduce((x, y) => x + y) this.topContent[1].count = dataCf.reduce((x, y) => x + y)
}) let pbCount = (this.topContent[1].count/this.topContent[0].count)*100
}else if (index == 1) { let pbCountString = pbCount.toString()
// if (pbCountString.indexOf(".") != -1) {
getPbtyqk({ this.topContent[2].count = pbCountString.substring(0,pbCountString.indexOf(".")+3) + '%'
action:"month" }else{
}).then((res)=>{ this.topContent[2].count = pbCountString +'%'
let dataPbty = [];
dataPbty = res.data.data
this.detailedFive(dataPbty);
let dataPb = [];
let dataCf = [];
for (let i = 0; i < dataPbty.length; i++) {
dataPb.push(dataPbty[i].pbsl);
dataCf.push(dataPbty[i].cftytc);
} }
this.topContent[0].count = dataPb.reduce((x, y) => x + y)
this.topContent[1].count = dataCf.reduce((x, y) => x + y)
}) })
} // }else if (index == 1) {
// //
// getPbtyqk({
// action:"month"
// }).then((res)=>{
// let dataPbty = [];
// dataPbty = res.data.data
// this.detailedFive(dataPbty);
// let dataPb = [];
// let dataCf = [];
// for (let i = 0; i < dataPbty.length; i++) {
// dataPb.push(dataPbty[i].pbsl);
// dataCf.push(dataPbty[i].cftytc);
// }
// this.topContent[0].count = dataPb.reduce((x, y) => x + y)
// this.topContent[1].count = dataCf.reduce((x, y) => x + y)
// let pbCount = (this.topContent[1].count/this.topContent[0].count)*100
// let pbCountString = pbCount.toString()
// if (pbCountString.indexOf(".") != -1) {
// this.topContent[2].count = pbCountString.substring(0,pbCountString.indexOf(".")+3) + '%'
// }else{
// this.topContent[2].count = pbCountString +'%'
// }
// })
// }
}, },
addColor(index){ addColor(index){
if(this.currentIndex == index) { if(this.currentIndex == index) {