index.jsx 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import React, { useCallback, useEffect, useRef, useState } from 'react';
  2. import { history, Link } from 'umi';
  3. import classNames from 'classnames';
  4. // import { getPersonList, exportPersonList } from '@/services/person';
  5. import { PageHeaderWrapper } from '@ant-design/pro-layout';
  6. import { FullscreenOutlined } from '@ant-design/icons';
  7. import { Button } from 'antd';
  8. import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
  9. import GeoMap from '@/components/GeoMap';
  10. import StatisCard from '@/components/ScreenBox/StatisCard';
  11. import SquareBox from '@/components/ScreenBox/SquareBox';
  12. import { useFullScreen } from './hook';
  13. import MachineryType from './components/MachineryType';
  14. import MachineryStatus from './components/MachineryStatus';
  15. import WorkArea from './components/WorkArea';
  16. import List from './components/List';
  17. import ColorFont from './components/ColorFont';
  18. import WorkData from './components/WorkData';
  19. import Styles from './style.less';
  20. export default (props) => {
  21. const screenRef = useRef();
  22. const [height, setHeight] = useState('1080px');
  23. const { isFullScreen, toggleFullScreen } = useFullScreen(screenRef);
  24. const [machineryTypeData, setMachineryTypeData] = useState([
  25. { name: '收割机', value: 200 },
  26. { name: '播种机', value: 100 },
  27. { name: '农药机', value: 50 },
  28. ]);
  29. const [machineryStatusData, setMachineryStatusData] = useState([
  30. { name: '预约', value: 350 },
  31. { name: '作业', value: 900 },
  32. { name: '闲置', value: 650 },
  33. { name: '离线', value: 180 },
  34. { name: '维修', value: 380 },
  35. ]);
  36. const [workData, setWorkData] = useState([
  37. { name: '收割机', value: 35 },
  38. { name: '播种机', value: 35 },
  39. { name: '农药机', value: 30 },
  40. { name: '其他', value: 180 },
  41. ]);
  42. const [workAreaData, setWorkAreaData] = useState([
  43. { name: '收割机', value: 350 },
  44. { name: '播种机', value: 900 },
  45. { name: '农药机', value: 650 },
  46. { name: '其他', value: 180 },
  47. ]);
  48. return (
  49. <PageHeaderWrapper
  50. extra={
  51. <Button icon={<FullscreenOutlined />} onClick={toggleFullScreen}>
  52. 全屏
  53. </Button>
  54. }
  55. >
  56. <div
  57. className={classNames(Styles['screen-page'], Styles['pd-lr-40'], {
  58. [Styles['full-screen']]: isFullScreen,
  59. })}
  60. style={{ height }}
  61. ref={screenRef}
  62. >
  63. <div className={Styles['grail-layout']}>
  64. <div className={Styles['grail-header']}>
  65. <ScreenHeader weather="多云 21-28 °C" />
  66. </div>
  67. <div className={classNames(Styles['grail-container'], Styles['pd-tp-30'])}>
  68. <div className={Styles['grail-left']}>
  69. <div className="flex flex-column full-height">
  70. <div className="flex-0" style={{ height: '250px' }}>
  71. <MachineryType source={machineryTypeData} />
  72. </div>
  73. <div className="flex-1" style={{ marginTop: '30px' }}>
  74. <MachineryStatus source={machineryStatusData} />
  75. </div>
  76. </div>
  77. </div>
  78. <div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
  79. <div className={Styles['statis-container']}>
  80. <StatisCard color="#23E8AE" icon="icon1" value={2346} title="农机总数(台)" />
  81. <StatisCard color="#0BDAFF" icon="icon2" value={528} title="农机使用数(台)" />
  82. <StatisCard color="#F5CC5C" icon="icon3" value={168} title="总预约数(台)" />
  83. <StatisCard color="#C579FF" icon="icon4" value={1568} title="总服务数(台)" />
  84. </div>
  85. <GeoMap />
  86. </div>
  87. <div className={Styles['grail-right']}>
  88. <div className="flex flex-column full-height">
  89. <div className="flex-0" style={{ height: '250px' }}>
  90. <WorkData source={workData} />
  91. </div>
  92. <div className="flex-1" style={{ marginTop: '30px' }}>
  93. <WorkArea source={workAreaData} />
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div className={classNames(Styles['grail-footer'], Styles['pd-tp-30'])}>
  99. <SquareBox>
  100. <div className="flex">
  101. <div className="flex-1">
  102. <List title="预约订单">
  103. <div>
  104. <ColorFont color="#F5CC5C">[快乐每一天]</ColorFont> 32s前预约了一台收割机,
  105. <ColorFont color="#44F68B">[收割机001]</ColorFont> 接到了此订单!
  106. </div>
  107. <div>
  108. <ColorFont color="#F5CC5C">[幸福人生]</ColorFont> 58分钟前预约了一台收割机,
  109. <ColorFont color="#44F68B">[播种机008]</ColorFont> 接到了此订单!尽快赶到!
  110. </div>
  111. <div>
  112. <ColorFont color="#F5CC5C">[灿烂人生]</ColorFont> 2个小时前预约了一台收割机,
  113. <ColorFont color="#44F68B">[收割机007]</ColorFont>{' '}
  114. 接到了此订单!正在赶往目的地!
  115. </div>
  116. </List>
  117. </div>
  118. <div className={classNames('flex-0', Styles['footer-middle'])} />
  119. <div className="flex-1">
  120. <List title="作业订单" color="green">
  121. <div>
  122. <ColorFont color="#44F68B">[收割机001]</ColorFont>
  123. 32s前接到了一个订单,距离目的地还有3.2公里,请农户耐心等待!
  124. </div>
  125. <div>
  126. <ColorFont color="#44F68B">[播种机008]</ColorFont>{' '}
  127. 2分钟前接到一个订单,距离目的地还有3.8公里,请农户耐心等待!
  128. </div>
  129. <div>
  130. <ColorFont color="#44F68B">[收割机007]</ColorFont>{' '}
  131. 2个小时前接到一个订单,距离目的地还有3.8公里,请农户耐心等待!
  132. </div>
  133. </List>
  134. </div>
  135. </div>
  136. </SquareBox>
  137. <div className={Styles['pd-tp-30']} style={{ height: '30px' }} />
  138. </div>
  139. </div>
  140. </div>
  141. </PageHeaderWrapper>
  142. );
  143. };