|
@@ -1,64 +1,115 @@
|
1
|
|
-import React from 'react';
|
|
1
|
+import React, { useState, useRef } from 'react';
|
2
|
2
|
import { PageContainer } from '@ant-design/pro-layout';
|
3
|
|
-import { Card, Alert, Typography } from 'antd';
|
4
|
|
-import { useIntl, FormattedMessage } from 'umi';
|
5
|
|
-import styles from './Welcome.less';
|
6
|
|
-
|
7
|
|
-const CodePreview = ({ children }) => (
|
8
|
|
- <pre className={styles.pre}>
|
9
|
|
- <code>
|
10
|
|
- 66666
|
11
|
|
- <Typography.Text copyable>{children}</Typography.Text>
|
12
|
|
- </code>
|
13
|
|
- </pre>
|
14
|
|
-);
|
|
3
|
+import { Card, Row, Col } from 'antd';
|
|
4
|
+import { useIntl } from 'umi';
|
|
5
|
+import WCard from '@/components/WelcomeCard'
|
|
6
|
+import userImg from '@/assets/welcome/user.png'
|
|
7
|
+import cooperative from '@/assets/welcome/cooperative.png'
|
|
8
|
+import machinery from '@/assets/welcome/machinery.png'
|
|
9
|
+import order from '@/assets/welcome/order.png'
|
|
10
|
+import Bar from '@/components/Bar/index.jsx';
|
|
11
|
+import WorkArea from './MonitoringScreen/components/WorkArea';
|
|
12
|
+import WorkData from './MonitoringScreen/components/WorkData';
|
|
13
|
+import MachineryStatus from './MonitoringScreen/components/MachineryStatus';
|
|
14
|
+import './Welcome.less'
|
|
15
|
+import Pie from '@/components/Pie';
|
|
16
|
+import PieArea from '@/components/PieArea';
|
15
|
17
|
|
16
|
18
|
const Welcome = () => {
|
17
|
19
|
const intl = useIntl();
|
|
20
|
+ const topData = [
|
|
21
|
+ {
|
|
22
|
+ icon: userImg,
|
|
23
|
+ title: '注册用户',
|
|
24
|
+ value: 580239,
|
|
25
|
+ percentage: 32.6
|
|
26
|
+ },
|
|
27
|
+ {
|
|
28
|
+ icon: cooperative,
|
|
29
|
+ title: '合作社数',
|
|
30
|
+ value: 2017,
|
|
31
|
+ percentage: 5.6
|
|
32
|
+ },
|
|
33
|
+ {
|
|
34
|
+ icon: machinery,
|
|
35
|
+ title: '农用机数',
|
|
36
|
+ value: 2000,
|
|
37
|
+ percentage: 42.6
|
|
38
|
+ },
|
|
39
|
+ {
|
|
40
|
+ icon: order,
|
|
41
|
+ title: '订单数',
|
|
42
|
+ value: 2075994,
|
|
43
|
+ percentage: -1.6
|
|
44
|
+ },
|
|
45
|
+ ]
|
|
46
|
+ const centerData = [
|
|
47
|
+ {
|
|
48
|
+ title: '预约订单',
|
|
49
|
+ keyList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
50
|
+ valueList: [320, 332, 301, 334, 390, 88, 320, 332, 301, 334, 390, 88]
|
|
51
|
+ },
|
|
52
|
+ {
|
|
53
|
+ title: '完成订单',
|
|
54
|
+ keyList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
55
|
+ valueList: [220, 182, 191, 234, 290, 256, 220, 182, 191, 234, 290, 356]
|
|
56
|
+ }
|
|
57
|
+ ]
|
|
58
|
+
|
|
59
|
+ const [machineryStatus, setMachineryStatus] = useState([
|
|
60
|
+ {
|
|
61
|
+ keyList: ['预约', '作业', '闲置', '离线', '维修'],
|
|
62
|
+ valueList: [350, 900, 650, 180, 380],
|
|
63
|
+ }
|
|
64
|
+ ])
|
|
65
|
+
|
|
66
|
+ const [workData, setWorkData] = useState([
|
|
67
|
+ { name: '收割机', value: 35 },
|
|
68
|
+ { name: '播种机', value: 35 },
|
|
69
|
+ { name: '农药机', value: 30 },
|
|
70
|
+ { name: '其他', value: 180 },
|
|
71
|
+ ]);
|
|
72
|
+ const [workAreaData, setWorkAreaData] = useState([
|
|
73
|
+ { name: '收割机', value: 350 },
|
|
74
|
+ { name: '播种机', value: 900 },
|
|
75
|
+ { name: '农药机', value: 650 },
|
|
76
|
+ { name: '其他', value: 180 },
|
|
77
|
+ ]);
|
18
|
78
|
return (
|
19
|
79
|
<PageContainer>
|
20
|
|
- <Card>
|
21
|
|
- <Alert
|
22
|
|
- message={intl.formatMessage({
|
23
|
|
- id: 'pages.welcome.alertMessage',
|
24
|
|
- defaultMessage: 'Faster and stronger heavy-duty components have been released.',
|
25
|
|
- })}
|
26
|
|
- type="success"
|
27
|
|
- showIcon
|
28
|
|
- banner
|
29
|
|
- style={{
|
30
|
|
- margin: -12,
|
31
|
|
- marginBottom: 24,
|
32
|
|
- }}
|
33
|
|
- />
|
34
|
|
- <Typography.Text strong>
|
35
|
|
- <FormattedMessage id="pages.welcome.advancedComponent" defaultMessage="Advanced Form" />{' '}
|
36
|
|
- <a
|
37
|
|
- href="https://procomponents.ant.design/components/table"
|
38
|
|
- rel="noopener noreferrer"
|
39
|
|
- target="__blank"
|
40
|
|
- >
|
41
|
|
- <FormattedMessage id="pages.welcome.link" defaultMessage="Welcome" />
|
42
|
|
- </a>
|
43
|
|
- </Typography.Text>
|
44
|
|
- <CodePreview>yarn add @ant-design/pro-table</CodePreview>
|
45
|
|
- <Typography.Text
|
46
|
|
- strong
|
47
|
|
- style={{
|
48
|
|
- marginBottom: 12,
|
49
|
|
- }}
|
50
|
|
- >
|
51
|
|
- <FormattedMessage id="pages.welcome.advancedLayout" defaultMessage="Advanced layout" />{' '}
|
52
|
|
- <a
|
53
|
|
- href="https://procomponents.ant.design/components/layout"
|
54
|
|
- rel="noopener noreferrer"
|
55
|
|
- target="__blank"
|
56
|
|
- >
|
57
|
|
- <FormattedMessage id="pages.welcome.link" defaultMessage="Welcome" />
|
58
|
|
- </a>
|
59
|
|
- </Typography.Text>
|
60
|
|
- <CodePreview>yarn add @ant-design/pro-layout</CodePreview>
|
61
|
|
- </Card>
|
|
80
|
+ <div className="welcome">
|
|
81
|
+ <div className="head">
|
|
82
|
+ <Row justify='space-between'>
|
|
83
|
+ <Col flex='320px'>
|
|
84
|
+ <WCard value={topData[0]} />
|
|
85
|
+ </Col>
|
|
86
|
+ <Col flex='320px'>
|
|
87
|
+ <WCard value={topData[1]} />
|
|
88
|
+ </Col>
|
|
89
|
+ <Col flex='320px'>
|
|
90
|
+ <WCard value={topData[2]} />
|
|
91
|
+ </Col>
|
|
92
|
+ <Col flex='320px'>
|
|
93
|
+ <WCard value={topData[3]} />
|
|
94
|
+ </Col>
|
|
95
|
+ </Row>
|
|
96
|
+ </div>
|
|
97
|
+ <Card style={{ marginTop: '32px' }}>
|
|
98
|
+ <Bar h='500px' title='本年度预约订单数据概览' opt={centerData} />
|
|
99
|
+ </Card>
|
|
100
|
+
|
|
101
|
+ <div className='flex bottom'>
|
|
102
|
+ <Card className='flex-1 card'>
|
|
103
|
+ <Bar h='300px' title='农机状态统计' opt={machineryStatus} />
|
|
104
|
+ </Card>
|
|
105
|
+ <Card className='flex-1 card'>
|
|
106
|
+ <PieArea opt={workAreaData} />
|
|
107
|
+ </Card>
|
|
108
|
+ <Card className='flex-1 card'>
|
|
109
|
+ <Pie opt={workData} />
|
|
110
|
+ </Card>
|
|
111
|
+ </div>
|
|
112
|
+ </div>
|
62
|
113
|
</PageContainer>
|
63
|
114
|
);
|
64
|
115
|
};
|