BarModal.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import DateRadio from '@/components/DateRadio';
  2. import BarChartModule from '@/components/ManagementPage/BarChartModule';
  3. import ChartModule from '@/components/ManagementPage/chartModule';
  4. import { Modal } from 'antd';
  5. import { useState } from 'react';
  6. const BarModal = ({ type = 1, title, data, visible, onCancel, onChange }) => {
  7. const [tab, setTab] = useState('1');
  8. const option = {
  9. yName: '水量(t)',
  10. xData: ['00:00', '01:15', '02:30', '03:45', '05:00', '06:15', '07:30'],
  11. dataList: [
  12. {
  13. type: 0,
  14. name: '进水水量',
  15. data: [820, 932, 901, 934, 1290, 1330, 1320],
  16. },
  17. {
  18. type: 0,
  19. name: '进水水量111',
  20. data: [420, 932, 601, 934, 1990, 1330, 1520],
  21. },
  22. {
  23. type: 0,
  24. name: '预测出水量',
  25. data: [720, 832, 601, 834, 1190, 1230, 1220],
  26. },
  27. {
  28. type: 0,
  29. name: '实际出水量',
  30. data: [820, 632, 501, 534, 1190, 1130, 1120],
  31. },
  32. ],
  33. };
  34. return (
  35. <Modal
  36. title={title}
  37. visible={visible}
  38. onCancel={onCancel}
  39. footer={null}
  40. width={600}
  41. >
  42. <DateRadio onChange={(tab) => onChange(tab)} />
  43. <div style={{ height: '600px' }}>
  44. {type == 1 && (
  45. <BarChartModule
  46. xData={['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']}
  47. dataList={[
  48. { name: 'xzhou ', data: [120, 200, 150, 80, 70, 110, 130] },
  49. ]}
  50. />
  51. )}
  52. {type == 2 && <ChartModule {...option} />}
  53. </div>
  54. </Modal>
  55. );
  56. };
  57. export default BarModal;