index.jsx 991B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import { PageContainer } from '@ant-design/pro-components';
  3. import { Button, Row, Col, Card } from 'antd';
  4. import List from './List';
  5. import BasicForm from './BasicForm';
  6. import DishList from './DishList';
  7. import './style.less';
  8. export default (props) => {
  9. const [current, setCurrent] = React.useState({});
  10. const pkgRef = React.useRef();
  11. const dishRef = React.useRef();
  12. const onAdd = () => pkgRef.current.new();
  13. const onDishAdd = () => dishRef.current.new();
  14. return (
  15. <Row gutter={24}>
  16. <Col span={12}>
  17. <Card title="套餐列表" extra={<Button type='primary' onClick={onAdd}>新增</Button>}>
  18. <List ref={pkgRef} current={current} setCurrent={setCurrent}/>
  19. </Card>
  20. </Col>
  21. <Col span={12}>
  22. <Card title={`${current.name || '套餐'} 明细`} extra={<Button onClick={onDishAdd}>新增</Button>}>
  23. <DishList current={current} ref={dishRef} />
  24. </Card>
  25. </Col>
  26. </Row>
  27. )
  28. }