From eafd6aea1926c2580116a8d3c2f7e0e65060b023 Mon Sep 17 00:00:00 2001 From: "851673013@qq.com" <851673013@qq.com> Date: Thu, 4 Aug 2022 16:52:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E4=BA=91=E5=9B=BE-=E6=80=BB?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/api/capabilityCloud.js | 2 +- .../components/ComponentServices.vue | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/front/src/api/capabilityCloud.js b/front/src/api/capabilityCloud.js index 011517fe..0cb3eebe 100644 --- a/front/src/api/capabilityCloud.js +++ b/front/src/api/capabilityCloud.js @@ -97,7 +97,7 @@ export function callTheTrendPort(start, end, params) { export function totalCallsSnum(params) { return request({ url: - `/metrics/api/v1/query?time=${params}&query=sum(apigateway_http_status)`, + `/gateway-monitor/getCallCount`, method: 'get', }) } diff --git a/front/src/views/capabilityCloud/components/ComponentServices.vue b/front/src/views/capabilityCloud/components/ComponentServices.vue index f43a0dd9..d64c3bee 100644 --- a/front/src/views/capabilityCloud/components/ComponentServices.vue +++ b/front/src/views/capabilityCloud/components/ComponentServices.vue @@ -409,13 +409,16 @@ const TotalCallsAPI = () => { const end = Date.parse(new Date()) / 1000 totalCallsSnum(end).then((res) => { - debugger - snum.value[1].num = res.data.data.result[0].value[1] + snum.value[1].num = Number(res.data.data) totalCallsSnum2(end).then((resSon) => { - snum.value[2].num = - parseInt( - (resSon.data.data.result[0].value[1] / snum.value[1].num) * 100 - ) + '%' + if (snum.value[1].num === 0) { + num.value[2].num = '100%' + } else { + snum.value[2].num = + parseInt( + (resSon.data.data.result[0].value[1] / snum.value[1].num) * 100 + ) + '%' + } }) }) }