feat(dashboard): 对接工作台首页数据接口

master
钟良源 5 months ago
parent cdac1b10bb
commit 19385fa878

@ -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<apiResData>(`${urlPrefix}/overview/app`, {
params: { id }
});
}
// 首页数据概览
export function getOverviewHome() {
return axios.get<apiResData>(`${urlPrefix}/overview/home`);
}

@ -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() {
<StatisticItem
icon={<IconCalendar />}
title="工程数量"
count={data.allContents}
count={data.sceneNum}
loading={loading}
unit={t['workplace.pecs']}
/>
@ -100,7 +96,7 @@ function Overview() {
<StatisticItem
icon={<IconContent />}
title="组件数量"
count={data.liveContents}
count={data.compNum}
loading={loading}
unit={t['workplace.pecs']}
/>
@ -110,7 +106,7 @@ function Overview() {
<StatisticItem
icon={<IconComments />}
title="应用数量"
count={data.increaseComments}
count={data.appNum}
loading={loading}
unit={t['workplace.pecs']}
/>
@ -120,7 +116,7 @@ function Overview() {
<StatisticItem
icon={<IconIncrease />}
title="应用实例数量"
count={data.growthRate}
count={data.instanceNum}
loading={loading}
/>
</Col>

Loading…
Cancel
Save