From df68891c6027e124234282aa017aabcefb0f9616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C002001lixiaobang=E2=80=9D?= <2547956374@qq.com> Date: Mon, 19 Dec 2022 09:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/index.vue | 98 +++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/src/views/index.vue b/src/views/index.vue index 18b5f42..a69839a 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -452,26 +452,32 @@ export default { dataGdzl = res.data.data this.detailedTwo(dataGdzl); }) - //配变停运 - getPbtyqk({ - action:"week" - }).then((res)=>{ - let dataPbty = []; - dataPbty = res.data.data - console.log(dataPbty,'dataPbty'); - this.detailedFive(dataPbty); - let dataPb = []; - let dataCf = []; - let dataCfl = []; - for (let i = 0; i < dataPbty.length; i++) { - dataPb.push(dataPbty[i].pbsl); - dataCf.push(dataPbty[i].cftytc); - dataCfl.push(dataPbty[i].pbcftyl) - } - this.topContent[0].count = dataPb.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) + '%' - }) + // //配变停运 + // getPbtyqk({ + // action:"week" + // }).then((res)=>{ + // let dataPbty = []; + // dataPbty = res.data.data + // console.log(dataPbty,'dataPbty'); + // this.detailedFive(dataPbty); + // let dataPb = []; + // let dataCf = []; + // let dataCfl = []; + // for (let i = 0; i < dataPbty.length; i++) { + // dataPb.push(dataPbty[i].pbsl); + // dataCf.push(dataPbty[i].cftytc); + // dataCfl.push(dataPbty[i].pbcftyl) + // } + // 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 +'%' + // } + // }) this.handleDate(0); let that = this; window.addEventListener('message', function (e) { @@ -1463,10 +1469,10 @@ export default { }, handleDate(index){ this.currentIndex = index - if (index == 0) { + // if (index == 0) { //周配变停运 getPbtyqk({ - action:"week" + action: index==0?"week":'month' }).then((res)=>{ let dataPbty = []; dataPbty = res.data.data @@ -1479,25 +1485,39 @@ export default { } 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); + 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.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){ if(this.currentIndex == index) {