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++) {