index.js 7.91 KB
Newer Older
jim's avatar
jim committed
1
import React, { PureComponent } from 'react';
2
import { connect } from 'dva';
陈帅's avatar
陈帅 committed
3
import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale';
4
import { Row, Col, Card, Tooltip } from 'antd';
5 6
import { NumberInfo, Charts } from 'ant-design-pro';
import CountDown from 'ant-design-pro/lib/CountDown';
7
import numeral from 'numeral';
jim's avatar
jim committed
8

9 10
import ActiveChart from './components/ActiveChart';
import styles from './style.less';
11

12
const { Pie, WaterWave, Gauge, TagCloud } = Charts;
陈帅's avatar
陈帅 committed
13

14 15
const targetTime = new Date().getTime() + 3900000;

16 17
@connect(({ BLOCK_NAME_CAMEL_CASE, loading }) => ({
  BLOCK_NAME_CAMEL_CASE,
Andreas Cederström's avatar
Andreas Cederström committed
18
  loading: loading.models.monitor,
19
}))
20
class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
21
  componentDidMount() {
陈帅's avatar
陈帅 committed
22 23
    const { dispatch } = this.props;
    dispatch({
24
      type: 'BLOCK_NAME_CAMEL_CASE/fetchTags',
25
    });
nikogu's avatar
nikogu committed
26
  }
nikogu's avatar
nikogu committed
27

28
  render() {
29 30
    const { BLOCK_NAME_CAMEL_CASE, loading } = this.props;
    const { tags } = BLOCK_NAME_CAMEL_CASE;
31 32

    return (
33
      <React.Fragment>
34
        <Row gutter={24}>
niko's avatar
niko committed
35
          <Col xl={18} lg={24} md={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
36 37 38
            <Card
              title={
                <FormattedMessage
39
                  id="BLOCK_NAME.monitor.trading-activity"
40 41 42 43 44
                  defaultMessage="Real-Time Trading Activity"
                />
              }
              bordered={false}
            >
45
              <Row>
niko's avatar
niko committed
46
                <Col md={6} sm={12} xs={24}>
47
                  <NumberInfo
48 49
                    subTitle={
                      <FormattedMessage
50
                        id="BLOCK_NAME.monitor.total-transactions"
51 52 53
                        defaultMessage="Total transactions today"
                      />
                    }
niko's avatar
niko committed
54
                    suffix=""
55 56 57
                    total={numeral(124543233).format('0,0')}
                  />
                </Col>
niko's avatar
niko committed
58
                <Col md={6} sm={12} xs={24}>
59 60 61
                  <NumberInfo
                    subTitle={
                      <FormattedMessage
62
                        id="BLOCK_NAME.monitor.sales-target"
63 64 65 66 67
                        defaultMessage="Sales target completion rate"
                      />
                    }
                    total="92%"
                  />
68
                </Col>
niko's avatar
niko committed
69
                <Col md={6} sm={12} xs={24}>
70 71 72
                  <NumberInfo
                    subTitle={
                      <FormattedMessage
73
                        id="BLOCK_NAME.monitor.remaining-time"
74 75 76 77 78
                        defaultMessage="Remaining time of activity"
                      />
                    }
                    total={<CountDown target={targetTime} />}
                  />
79
                </Col>
niko's avatar
niko committed
80
                <Col md={6} sm={12} xs={24}>
81
                  <NumberInfo
82 83
                    subTitle={
                      <FormattedMessage
84
                        id="BLOCK_NAME.monitor.total-transactions-per-second"
85 86 87
                        defaultMessage="Total transactions per second"
                      />
                    }
niko's avatar
niko committed
88
                    suffix=""
89 90 91 92 93
                    total={numeral(234).format('0,0')}
                  />
                </Col>
              </Row>
              <div className={styles.mapChart}>
94 95 96
                <Tooltip
                  title={
                    <FormattedMessage
97
                      id="BLOCK_NAME.monitor.waiting-for-implementation"
98 99 100 101
                      defaultMessage="Waiting for implementation"
                    />
                  }
                >
niko's avatar
niko committed
102 103 104 105
                  <img
                    src="https://gw.alipayobjects.com/zos/rmsportal/HBWnDEUXCnGnGrRfrpKa.png"
                    alt="map"
                  />
106
                </Tooltip>
107 108 109
              </div>
            </Card>
          </Col>
niko's avatar
niko committed
110
          <Col xl={6} lg={24} md={24} sm={24} xs={24}>
111 112 113
            <Card
              title={
                <FormattedMessage
114
                  id="BLOCK_NAME.monitor.activity-forecast"
115 116 117 118 119 120
                  defaultMessage="Activity forecast"
                />
              }
              style={{ marginBottom: 24 }}
              bordered={false}
            >
nikogu's avatar
nikogu committed
121
              <ActiveChart />
122
            </Card>
123
            <Card
xiaohuoni's avatar
xiaohuoni committed
124 125 126
              title={
                <FormattedMessage id="BLOCK_NAME.monitor.efficiency" defaultMessage="Efficiency" />
              }
127 128 129 130
              style={{ marginBottom: 24 }}
              bodyStyle={{ textAlign: 'center' }}
              bordered={false}
            >
131
              <Gauge
132
                title={formatMessage({ id: 'BLOCK_NAME.monitor.ratio', defaultMessage: 'Ratio' })}
133 134 135
                height={180}
                percent={87}
              />
136 137 138 139
            </Card>
          </Col>
        </Row>
        <Row gutter={24}>
afc163's avatar
afc163 committed
140
          <Col xl={12} lg={24} sm={24} xs={24} style={{ marginBottom: 24 }}>
141 142 143
            <Card
              title={
                <FormattedMessage
144
                  id="BLOCK_NAME.monitor.proportion-per-category"
145 146 147 148 149 150
                  defaultMessage="Proportion Per Category"
                />
              }
              bordered={false}
              className={styles.pieCard}
            >
afc163's avatar
afc163 committed
151
              <Row style={{ padding: '16px 0' }}>
152 153
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
154
                    animate={false}
155
                    percent={28}
156
                    subTitle={
xiaohuoni's avatar
xiaohuoni committed
157 158 159 160
                      <FormattedMessage
                        id="BLOCK_NAME.monitor.fast-food"
                        defaultMessage="Fast food"
                      />
161
                    }
162
                    total="28%"
偏右's avatar
偏右 committed
163
                    height={128}
afc163's avatar
afc163 committed
164
                    lineWidth={2}
165 166 167 168
                  />
                </Col>
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
169
                    animate={false}
niko's avatar
niko committed
170
                    color="#5DDECF"
171
                    percent={22}
172 173
                    subTitle={
                      <FormattedMessage
174
                        id="BLOCK_NAME.monitor.western-food"
175 176 177
                        defaultMessage="Western food"
                      />
                    }
178
                    total="22%"
偏右's avatar
偏右 committed
179
                    height={128}
afc163's avatar
afc163 committed
180
                    lineWidth={2}
181 182 183 184
                  />
                </Col>
                <Col span={8}>
                  <Pie
nikogu's avatar
nikogu committed
185
                    animate={false}
niko's avatar
niko committed
186
                    color="#2FC25B"
187
                    percent={32}
188
                    subTitle={
189
                      <FormattedMessage id="BLOCK_NAME.monitor.hot-pot" defaultMessage="Hot pot" />
190
                    }
191
                    total="32%"
偏右's avatar
偏右 committed
192
                    height={128}
afc163's avatar
afc163 committed
193
                    lineWidth={2}
194 195 196 197 198
                  />
                </Col>
              </Row>
            </Card>
          </Col>
afc163's avatar
afc163 committed
199
          <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
niko's avatar
niko committed
200
            <Card
201 202
              title={
                <FormattedMessage
203
                  id="BLOCK_NAME.monitor.popular-searches"
204 205 206
                  defaultMessage="Popular Searches"
                />
              }
niko's avatar
niko committed
207 208 209 210 211
              loading={loading}
              bordered={false}
              bodyStyle={{ overflow: 'hidden' }}
            >
              <TagCloud data={tags} height={161} />
212 213
            </Card>
          </Col>
afc163's avatar
afc163 committed
214
          <Col xl={6} lg={12} sm={24} xs={24} style={{ marginBottom: 24 }}>
niko's avatar
niko committed
215
            <Card
216 217
              title={
                <FormattedMessage
218
                  id="BLOCK_NAME.monitor.resource-surplus"
219 220 221
                  defaultMessage="Resource Surplus"
                />
              }
niko's avatar
niko committed
222 223 224
              bodyStyle={{ textAlign: 'center', fontSize: 0 }}
              bordered={false}
            >
225 226 227
              <WaterWave
                height={161}
                title={
xiaohuoni's avatar
xiaohuoni committed
228 229 230 231
                  <FormattedMessage
                    id="BLOCK_NAME.monitor.fund-surplus"
                    defaultMessage="Fund Surplus"
                  />
232 233 234
                }
                percent={34}
              />
235 236 237
            </Card>
          </Col>
        </Row>
238
      </React.Fragment>
239 240 241
    );
  }
}
陈帅's avatar
陈帅 committed
242

243
export default PAGE_NAME_UPPER_CAMEL_CASE;