diff --git a/src/api/overview.ts b/src/api/overview.ts new file mode 100644 index 0000000..a39ba6c --- /dev/null +++ b/src/api/overview.ts @@ -0,0 +1,17 @@ +import axios from 'axios'; +import { apiResData } from '@/api/interface/index'; + +// 公共路径 +const urlPrefix = '/api/v1/bpms-workbench'; + +// 应用数据概览 +export function getOverviewApp(id: string) { + return axios.get(`${urlPrefix}/overview/app`, { + params: { id } + }); +} + +// 首页数据概览 +export function getOverviewHome() { + return axios.get(`${urlPrefix}/overview/home`); +} diff --git a/src/pages/dashboard/workplace/overview.tsx b/src/pages/dashboard/workplace/overview.tsx index 47f1898..7a5eb42 100644 --- a/src/pages/dashboard/workplace/overview.tsx +++ b/src/pages/dashboard/workplace/overview.tsx @@ -17,6 +17,7 @@ import IconComments from './assets/comments.svg'; import IconContent from './assets/content.svg'; import IconIncrease from './assets/increase.svg'; import HeatMap from '@/components/Chart/heat-map'; +import { getOverviewHome } from '@/api/overview'; const { Row, Col } = Grid; @@ -47,10 +48,10 @@ function StatisticItem(props: StatisticItemType) { } type DataType = { - allContents?: string; - liveContents?: string; - increaseComments?: string; - growthRate?: string; + sceneNum?: string | number; + compNum?: string | number; + appNum?: string | number; + instanceNum?: string | number; chartData?: { count?: number; date?: string }[]; down?: boolean; }; @@ -62,16 +63,11 @@ function Overview() { const userInfo = useSelector((state: any) => state.userInfo || {}); - const fetchData = () => { + const fetchData = async () => { setLoading(true); - axios - .get('/api/workplace/overview-content') - .then((res) => { - setData(res as any); - }) - .finally(() => { - setLoading(false); - }); + const res: any = await getOverviewHome(); + if (res.code === 200) setData(res.data); + }; useEffect(() => { @@ -90,7 +86,7 @@ function Overview() { } title="工程数量" - count={data.allContents} + count={data.sceneNum} loading={loading} unit={t['workplace.pecs']} /> @@ -100,7 +96,7 @@ function Overview() { } title="组件数量" - count={data.liveContents} + count={data.compNum} loading={loading} unit={t['workplace.pecs']} /> @@ -110,7 +106,7 @@ function Overview() { } title="应用数量" - count={data.increaseComments} + count={data.appNum} loading={loading} unit={t['workplace.pecs']} /> @@ -120,7 +116,7 @@ function Overview() { } title="应用实例数量" - count={data.growthRate} + count={data.instanceNum} loading={loading} />