Detail.jsx 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import { PageHeaderWrapper } from '@ant-design/pro-layout';
  3. import { Col, Row, Divider } from 'antd';
  4. import { getMachineryDetail } from '@/services/machinery';
  5. import Summary from './components/Summary';
  6. import Machines from './components/Machines';
  7. import MaImg from './components/MaImg';
  8. export default (props) => {
  9. const { location } = props;
  10. const { user, machineryId } = location.query || {};
  11. const [current, setCurrent] = React.useState({});
  12. const userId = user || current.ownerId;
  13. React.useEffect(() => {
  14. if (machineryId) {
  15. getMachineryDetail(machineryId).then(setCurrent);
  16. }
  17. }, [machineryId]);
  18. return (
  19. <PageHeaderWrapper>
  20. <div style={{ display: 'flex' }}>
  21. <div style={{ width: '360px', flex: 'none' }}>
  22. <Summary userId={userId} />
  23. <div style={{ marginTop: '24px' }}>
  24. <MaImg machine={current} />
  25. </div>
  26. </div>
  27. <div style={{ flex: '1', marginLeft: '24px' }}>
  28. <Machines current={current} setCurrent={setCurrent} userId={userId} />
  29. </div>
  30. </div>
  31. </PageHeaderWrapper>
  32. );
  33. };