You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/views/Home.jsx

56 lines
1.6 KiB
React

import { useContext, useEffect } from 'react';
import { observer } from 'mobx-react';
import { Row, Col, Spin, } from 'antd';
import { stores_Context } from '../config';
import { useNavigate } from 'react-router-dom';
import { SlackOutlined, SketchOutlined, AntCloudOutlined, RedditOutlined, GithubOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons';
import StatisticCard from './../charts/StatisticCard';
2 years ago
import { empty } from './../utils/commons';
import './home.css';
3 years ago
2 years ago
export default observer(() => {
const navigate = useNavigate();
const { TradeStore } = useContext(stores_Context);
2 years ago
const { sideData, summaryData, topData } = TradeStore;
3 years ago
useEffect(() => {
2 years ago
if (empty(summaryData.dataSource)) {
TradeStore.fetchSummaryData();
2 years ago
TradeStore.fetchTradeDataByMonth();
2 years ago
TradeStore.fetchTradeDataByType('Country');
TradeStore.fetchTradeDataByType('Area');
}
return () => {};
}, []);
3 years ago
2 years ago
const layoutProps = {
gutter: { xs: 8, sm: 8, lg: 16 },
lg: { span: 6 },
sm: { span: 12 },
xs: { span: 24 },
};
return (
<>
<h2>年度业绩</h2>
<section>
<Spin spinning={summaryData.loading}>
2 years ago
<Row gutter={layoutProps.gutter}>
{summaryData.dataSource.map(item =>
<Col {...layoutProps} key={item.title}>
<StatisticCard {...item} showProgress={(item.hasKPI)} />
</Col>
2 years ago
)}
</Row>
</Spin>
</section>
2 years ago
<h3>市场进度</h3>
<section>
2 years ago
<Spin spinning={sideData.loading}></Spin>
</section>
2 years ago
<h3>TOP</h3>
<section></section>
</>
);
2 years ago
});