From 33af5d3a97c13cf5bb5b14474f0ccd1c4c731edd Mon Sep 17 00:00:00 2001 From: douzhuo <17611323298@163.com> Date: Fri, 18 Nov 2022 11:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=97=A5=E6=8A=A5=E5=91=A8?= =?UTF-8?q?=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/reportExcel/weekReport.vue | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pages/reportExcel/weekReport.vue b/pages/reportExcel/weekReport.vue index 391e7bc..1a2e0fc 100644 --- a/pages/reportExcel/weekReport.vue +++ b/pages/reportExcel/weekReport.vue @@ -684,15 +684,22 @@ ...res.zkMessage, } } - let [max1, max2] = [this.weekObj.level1List[0].total||1, this.weekObj.level2List[0].total||1] - this.weekObj.level1List.forEach(item => { - item.percent = Math.floor((item.total/max1)*100) - }) + if (this.weekObj.level1List[0] && this.weekObj.level1List[0].total) { + let max1 = this.weekObj.level1List[0].total || 1 + this.weekObj.level1List.forEach(item => { + item.percent = Math.floor((item.total/max1)*100) + }) + } - this.weekObj.level2List.forEach(item => { - item.percent = Math.floor((item.total/max2)*100) - }) + if (this.weekObj.level2List[0] && this.weekObj.level2List[0].total) { + let max2 = this.weekObj.level2List[0].total || 1 + + this.weekObj.level2List.forEach(item => { + item.percent = Math.floor((item.total/max2)*100) + }) + } + this.weekObj.createTimeName = this.getTimeLines(this.weekObj.weekDate, 1) console.log(this.weekObj, 'this.weekObj')