diff --git a/src/api/health-diagnosis/index.ts b/src/api/health-diagnosis/index.ts index 980a4a1c5bf8474e543fd1d69cfc1b675c3f432b..7ed0a5f6edea02e83cbd7437173ecd7e0c2e5f51 100644 --- a/src/api/health-diagnosis/index.ts +++ b/src/api/health-diagnosis/index.ts @@ -16,7 +16,7 @@ export function useHealthApi() { data, }); }, - getRawData: (data: { query: string; start_time: any; end_time: any; step: 24 }) => { + getRawData: (data: { query: string; start_time: any; end_time: any; step: 2 }) => { return request({ url: '/api/v1/prometheus/query_range', method: 'get', diff --git a/src/components/echarts/retrievalLine.vue b/src/components/echarts/retrievalLine.vue index 23d3789b181ec05b52b8159800a313e2678549fe..85d259cb99478f1ddca6bdc9869c6cf25f81452a 100644 --- a/src/components/echarts/retrievalLine.vue +++ b/src/components/echarts/retrievalLine.vue @@ -42,8 +42,16 @@ const initChart = () => { axisPointer: { type: 'cross', label: { - backgroundColor: '#6a7985' - } + backgroundColor: '#6a7985', + formatter: (params: any) => { + let value = params.value + if (params.axisDimension === 'x') { + value = formatDate(new Date(value * 1000), 'mm-dd HH:MM:SS') + } + return value + } + }, + }, formatter: (params: any) => { if (params.componentType === "series") { diff --git a/src/views/health-diagnosis/diagnostic-results/components/rawData.vue b/src/views/health-diagnosis/diagnostic-results/components/rawData.vue index cf04d990636d0e649b4045cea5e80f141327c18f..b881ebc895d87d1dc3862a8b40cd9fbaae66c367 100644 --- a/src/views/health-diagnosis/diagnostic-results/components/rawData.vue +++ b/src/views/health-diagnosis/diagnostic-results/components/rawData.vue @@ -110,7 +110,7 @@ const getCondition = (pair: string, condition: string, thresholds: string) => { if (condition === "<") return pairNum < thresholdsNum } const getRawData = (query: string, condition: string, thresholds: any) => { - useHealthApi().getRawData({ query: encodeURIComponent(query), start_time: dayjs().subtract(10, 'minutes').unix(), end_time: dayjs().unix(), step: 24 }).then((res) => { + useHealthApi().getRawData({ query: encodeURIComponent(query), start_time: dayjs().subtract(10, 'minutes').unix(), end_time: dayjs().unix(), step: 2 }).then((res) => { let result if (props.allData) { result = res.data.result.filter((item: any) => { @@ -133,7 +133,7 @@ const getRawData = (query: string, condition: string, thresholds: any) => { let start = dayjs().subtract(10, 'minutes').unix() let end = dayjs().unix() let timeArray = [] - for (let i = start; i <= end; i = i + 24) { + for (let i = start; i <= end; i = i + 2) { timeArray.push(i) } state.total = rawDataList.value.length @@ -152,6 +152,7 @@ const getRawData = (query: string, condition: string, thresholds: any) => { data: Array.from(new Map(item.values)), type: 'line', smooth: true, + symbol: 'none', areaStyle: { opacity: 0.4 }, @@ -184,7 +185,6 @@ const getRawData = (query: string, condition: string, thresholds: any) => { } }) }).catch(error => { - console.log(error); let req = error.response if (req.data.code === 4001) { ElMessage.warning('该表达式查询结果为空')