From 544ba0282828b23c3b77fe248e26af6e0d90cf83 Mon Sep 17 00:00:00 2001 From: "851673013@qq.com" <851673013@qq.com> Date: Wed, 6 Jul 2022 17:01:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E8=B6=8B=E5=8A=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ComponentServices.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/front/src/views/capabilityCloud/components/ComponentServices.vue b/front/src/views/capabilityCloud/components/ComponentServices.vue index 2c6dc034..ae100a9f 100644 --- a/front/src/views/capabilityCloud/components/ComponentServices.vue +++ b/front/src/views/capabilityCloud/components/ComponentServices.vue @@ -174,7 +174,7 @@ } else { for (let i = 0; i < 31; i++) { let time = moment() - .subtract('days', 30 - i) + .subtract('days', 29 - i) .format('MM-DD') callTheTrendData.value.time.push(time) console.log('time', callTheTrendData.value, name) @@ -186,14 +186,23 @@ if (!xinhaianIsShow) { callTheTrendPort(start, end, 86400).then((res) => { if (res.data.data.result) { - // res.data.data.result.splice(0, 1) callTheTrendData.value.snum = [] res.data.data.result[0].values.map((item) => { - callTheTrendData.value.snum.push( - moment(item[0] * 1000).format('MM-DD') - ) callTheTrendData.value.snum.push(parseInt(item[1])) }) + if (res.data.data.result[0].values.length < 30) { + for ( + let i = 0; + i < 30 - res.data.data.result[0].values.length; + i++ + ) { + callTheTrendData.value.snum.push(0) + } + } + console.log( + 'callTheTrendData.value.snum', + callTheTrendData.value.snum + ) callTheTrend(callTheTrendData.value) } else { for (let i = 0; i < 30; i++) {