12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import React from 'react';
  2. import { Button, Row, Col, Card, List, Popconfirm, Tree, Space, Modal } from 'antd';
  3. import List from './list';
  4. export default (props) => {
  5. const treeData = [
  6. {
  7. title: 'parent 1',
  8. key: '0-0',
  9. children: [
  10. {
  11. title: 'parent 1-0',
  12. key: '0-0-0',
  13. disabled: true,
  14. children: [
  15. {
  16. title: 'leaf',
  17. key: '0-0-0-0',
  18. disableCheckbox: true,
  19. },
  20. {
  21. title: 'leaf',
  22. key: '0-0-0-1',
  23. },
  24. ],
  25. },
  26. {
  27. title: 'parent 1-1',
  28. key: '0-0-1',
  29. children: [
  30. {
  31. title: (
  32. <span
  33. style={{
  34. color: '#1890ff',
  35. }}
  36. >
  37. sss
  38. </span>
  39. ),
  40. key: '0-0-1-0',
  41. },
  42. ],
  43. },
  44. ],
  45. },
  46. ];
  47. const onSelect = (selectedKeys, info) => {
  48. console.log('selected', selectedKeys, info);
  49. };
  50. const onCheck = (checkedKeys, info) => {
  51. console.log('onCheck', checkedKeys, info);
  52. };
  53. return (
  54. <div>
  55. <Row gutter={24}>
  56. <Col span={8}>
  57. </Col>
  58. <Col span={16}>
  59. <Card title='授权菜单' extra={<Button type='primary' ghost>保存</Button>}>
  60. <Tree
  61. checkable
  62. defaultExpandedKeys={['0-0-0', '0-0-1']}
  63. defaultSelectedKeys={['0-0-0', '0-0-1']}
  64. defaultCheckedKeys={['0-0-0', '0-0-1']}
  65. onSelect={onSelect}
  66. onCheck={onCheck}
  67. treeData={treeData}
  68. />
  69. </Card>
  70. </Col>
  71. </Row>
  72. </div>
  73. )
  74. }