Compare commits

...

2 Commits

Author SHA1 Message Date
851673013@qq.com 2e3db9a60d Merge branch 'hi-ucs-dev' of http://15.2.21.221:3000/wuhongjian/hi-ucs into hi-ucs-dev 2022-07-01 13:47:54 +08:00
851673013@qq.com 96502e05c6 能力云图 2022-07-01 13:47:32 +08:00
2 changed files with 58 additions and 4 deletions

View File

@ -80,3 +80,17 @@ export function dataResourceInfo(params) {
params,
})
}
//-
export function callTheTrendPort(start, end, params) {
return request({
url: '/metrics/api/v1/query_range?query=sum(increase(apigateway_http_status%5B1d%5D))&start=' + start + '&end=' + end + '&step=' + params,
method: 'get',
})
}
//-
export function totalCallsSnum(params) {
return request({
url: '/metrics/api/v1/query?query=sum(apigateway_http_status)&time=1655793262.495' + params,
method: 'get',
})
}

View File

@ -117,6 +117,8 @@
import {
assemblerBaseStatic,
componentServiceRank,
callTheTrendPort,
totalCallsSnum,
} from '@/api/capabilityCloud'
import * as moment from 'moment'
let snum = ref([
@ -145,20 +147,50 @@
.subtract('days', 6 - i)
.format('MM-DD')
callTheTrendData.value.time.push(time)
callTheTrendData.value.snum.push('0')
console.log('time', callTheTrendData.value, name)
}
const start = parseInt(
(Date.parse(new Date()) - 168 * 60 * 60 * 1000) / 1000
)
const end = Date.parse(new Date()) / 1000
callTheTrendPort(start, end, 86400).then((res) => {
if (res.data.data.result) {
res.data.data.result[0].values.splice(0, 1)
res.data.data.result[0].values.map((item) => {
callTheTrendData.value.snum.push(parseInt(item[1]))
})
callTheTrend(callTheTrendData.value)
} else {
callTheTrendData.value.snum = ['0', '0', '0', '0', '0', '0', '0']
callTheTrend(callTheTrendData.value)
}
})
} else {
for (let i = 0; i < 31; i++) {
let time = moment()
.subtract('days', 30 - i)
.format('MM-DD')
callTheTrendData.value.time.push(time)
callTheTrendData.value.snum.push('0')
console.log('time', callTheTrendData.value, name)
}
const start = parseInt(
(Date.parse(new Date()) - 720 * 60 * 60 * 1000) / 1000
)
const end = Date.parse(new Date()) / 1000
callTheTrendPort(start, end, 86400).then((res) => {
if (res.data.data.result) {
// res.data.data.result.splice(0, 1)
res.data.data.result[0].values.map((item) => {
callTheTrendData.value.snum.push(parseInt(item[1]))
})
callTheTrend(callTheTrendData.value)
} else {
for (let i = 0; i < 30; i++) {
callTheTrendData.value.snum.push('0')
}
callTheTrend(callTheTrendData.value)
}
})
}
}
//echarts
@ -316,10 +348,18 @@
})
})
}
//
const TotalCallsAPI = () => {
const end = Date.parse(new Date()) / 1000
totalCallsSnum(end).then((res) => {
snum.value[1].num = res.data.data.result[0].value[1]
})
}
const init = () => {
timeSwitch(timeSwitchindex.value)
NumberOfComponentServices()
ranking(dataclick.value)
TotalCallsAPI()
}
onMounted(() => {
init()