diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts index f4793515..c85f3733 100644 --- a/src/api/faultManage/actAlarm.ts +++ b/src/api/faultManage/actAlarm.ts @@ -303,6 +303,7 @@ export async function origGet() { params: { SQL: totalSQL, }, + timeout: 30_000, }); //// @@ -340,6 +341,7 @@ export async function top3Sel(filterFlag?: string) { params: { SQL: top3SQL, }, + timeout: 30_000, }); // 解析数据 diff --git a/src/views/dashboard/overview/components/AlarnTypeBar/index.vue b/src/views/dashboard/overview/components/AlarnTypeBar/index.vue index fa4e7757..18bae59e 100644 --- a/src/views/dashboard/overview/components/AlarnTypeBar/index.vue +++ b/src/views/dashboard/overview/components/AlarnTypeBar/index.vue @@ -17,6 +17,7 @@ import { BarChart, PieChart } from 'echarts/charts'; import { CanvasRenderer } from 'echarts/renderers'; import { LabelLayout } from 'echarts/features'; import useI18n from '@/hooks/useI18n'; +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; const { t } = useI18n(); @@ -96,18 +97,24 @@ function initPicture() { let pieArr: any = []; let testArr: any = []; if (resArr[0].status === 'fulfilled') { - testArr = completeData(resArr[0].value.data, wantArr); - testArr.map((item: any) => { - item.name = t('views.index.' + item.name) + ': ' + item.value; - pieArr.push(item); - }); + const res0 = resArr[0].value; + if (res0.code === RESULT_CODE_SUCCESS) { + testArr = completeData(res0.data, wantArr); + testArr.map((item: any) => { + item.name = t('views.index.' + item.name) + ': ' + item.value; + pieArr.push(item); + }); + } + } + if (resArr[1].status === 'fulfilled') { + const res1 = resArr[1].value; + if (res1.code === RESULT_CODE_SUCCESS) { + res1.data.map((item: any) => { + barArr.push(item); + }); + } } - if (resArr[1].status === 'fulfilled') { - resArr[1].value.data.map((item: any) => { - barArr.push(item); - }); - } let firstThreeItems = barArr .sort((a: any, b: any) => { return b.value - a.value;