| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- import React, { Component } from 'react';
- import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts';
- import { connect } from 'dva';
- import { formatMessage, FormattedMessage } from 'umi/locale';
- import { Row, Col, Card, Tooltip } from 'antd';
- import { Pie, WaterWave, Gauge, TagCloud } from '@/components/Charts';
- import NumberInfo from '@/components/NumberInfo';
- import CountDown from '@/components/CountDown';
- import ActiveChart from '@/components/ActiveChart';
- import numeral from 'numeral';
- import GridContent from '@/components/PageHeaderWrapper/GridContent';
- import Authorized from '@/utils/Authorized';
- import styles from './Monitor.less';
- const { Secured } = Authorized;
- const targetTime = new Date().getTime() + 3900000;
- // use permission as a parameter
- const havePermissionAsync = new Promise(resolve => {
- // Call resolve on behalf of passed
- setTimeout(() => resolve(), 300);
- });
- @Secured(havePermissionAsync)
- @connect(({ monitor, loading }) => ({
- monitor,
- loading: loading.models.monitor,
- }))
- class Monitor extends Component {
- componentDidMount() {
- const { dispatch } = this.props;
- dispatch({
- type: 'monitor/fetchTags',
- });
- }
- render() {
- const { monitor, loading } = this.props;
- const { tags } = monitor;
- return (
- <GridContent>
- <Row gutter={24}>
- <Col xl={18} lg={24} md={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
- <Card
- title={
- <FormattedMessage
- id="app.monitor.trading-activity"
- defaultMessage="Real-Time Trading Activity"
- />
- }
- bordered={false}
- >
- <Row>
- <Col md={6} sm={12} xs={24}>
- <NumberInfo
- subTitle={
- <FormattedMessage
- id="app.monitor.total-transactions"
- defaultMessage="Total transactions today"
- />
- }
- suffix="元"
- total={numeral(124543233).format('0,0')}
- />
- </Col>
- <Col md={6} sm={12} xs={24}>
- <NumberInfo
- subTitle={
- <FormattedMessage
- id="app.monitor.sales-target"
- defaultMessage="Sales target completion rate"
- />
- }
- total="92%"
- />
- </Col>
- <Col md={6} sm={12} xs={24}>
- <NumberInfo
- subTitle={
- <FormattedMessage
- id="app.monitor.remaining-time"
- defaultMessage="Remaining time of activity"
- />
- }
- total={<CountDown target={targetTime} />}
- />
- </Col>
- <Col md={6} sm={12} xs={24}>
- <NumberInfo
- subTitle={
- <FormattedMessage
- id="app.monitor.total-transactions-per-second"
- defaultMessage="Total transactions per second"
- />
- }
- suffix="元"
- total={numeral(234).format('0,0')}
- />
- </Col>
- </Row>
- <div className={styles.mapChart}>
- <Tooltip
- title={
- <FormattedMessage
- id="app.monitor.waiting-for-implementation"
- defaultMessage="Waiting for implementation"
- />
- }
- >
- <img
- src="https://gw.alipayobjects.com/zos/antfincdn/h%24wFbzuuzz/HBWnDEUXCnGnGrRfrpKa.png"
- alt="map"
- />
- </Tooltip>
- </div>
- </Card>
- </Col>
- <Col xl={6} lg={24} md={24} sm={24} xs={24}>
- <Card
- title={
- <FormattedMessage
- id="app.monitor.activity-forecast"
- defaultMessage="Activity forecast"
- />
- }
- style={{ marginBottom: 24 }}
- bordered={false}
- >
- <ActiveChart />
- </Card>
- <Card
- title={<FormattedMessage id="app.monitor.efficiency" defaultMessage="Efficiency" />}
- style={{ marginBottom: 24 }}
- bodyStyle={{ textAlign: 'center' }}
- bordered={false}
- >
- <Gauge
- title={formatMessage({ id: 'app.monitor.ratio', defaultMessage: 'Ratio' })}
- height={180}
- percent={87}
- />
- </Card>
- </Col>
- </Row>
- <Row gutter={24}>
- <Col xl={12} lg={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
- <Card
- title={
- <FormattedMessage
- id="app.monitor.proportion-per-category"
- defaultMessage="Proportion Per Category"
- />
- }
- bordered={false}
- className={styles.pieCard}
- >
- <Row style={{ padding: '16px 0' }}>
- <Col span={8}>
- <Pie
- animate={false}
- percent={28}
- subTitle={
- <FormattedMessage id="app.monitor.fast-food" defaultMessage="Fast food" />
- }
- total="28%"
- height={128}
- lineWidth={2}
- />
- </Col>
- <Col span={8}>
- <Pie
- animate={false}
- color="#5DDECF"
- percent={22}
- subTitle={
- <FormattedMessage
- id="app.monitor.western-food"
- defaultMessage="Western food"
- />
- }
- total="22%"
- height={128}
- lineWidth={2}
- />
- </Col>
- <Col span={8}>
- <Pie
- animate={false}
- color="#2FC25B"
- percent={32}
- subTitle={
- <FormattedMessage id="app.monitor.hot-pot" defaultMessage="Hot pot" />
- }
- total="32%"
- height={128}
- lineWidth={2}
- />
- </Col>
- </Row>
- </Card>
- </Col>
- <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
- <Card
- title={
- <FormattedMessage
- id="app.monitor.popular-searches"
- defaultMessage="Popular Searches"
- />
- }
- loading={loading}
- bordered={false}
- bodyStyle={{ overflow: 'hidden' }}
- >
- <TagCloud data={tags} height={161} />
- </Card>
- </Col>
- <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
- <Card
- title={
- <FormattedMessage
- id="app.monitor.resource-surplus"
- defaultMessage="Resource Surplus"
- />
- }
- bodyStyle={{ textAlign: 'center', fontSize: 0 }}
- bordered={false}
- >
- <WaterWave
- height={161}
- title={
- <FormattedMessage id="app.monitor.fund-surplus" defaultMessage="Fund Surplus" />
- }
- percent={34}
- />
- </Card>
- </Col>
- </Row>
- </GridContent>
- );
- }
- }
- export default props => (
- <AsyncLoadBizCharts>
- <Monitor {...props} />
- </AsyncLoadBizCharts>
- );
|