list.jsx 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import React from 'react'
  2. import { Layout, Tabs, Button, Icon, Input, Menu, Dropdown, Card, Col, Row, Avatar } from 'antd'
  3. import { Link } from 'react-router-dom'
  4. const { Header, Content } = Layout
  5. const { Search } = Input
  6. const { TabPane } = Tabs
  7. const { Meta } = Card
  8. import { connect } from 'dva'
  9. import '../../models/chart'
  10. class ChartList extends React.Component {
  11. constructor(props) {
  12. super(props);
  13. this.state = {
  14. }
  15. }
  16. generateCard() {
  17. const list = this.props.chart.list;
  18. return list.map(i => {
  19. return (
  20. <Card key={i.dashboardID}
  21. className='dashboard-card'
  22. cover={<img alt={i.coverAlt} src={i.coverImg} />}
  23. actions={[<Icon type="setting" />, <Icon type="edit" />, <Icon type="ellipsis" />]}
  24. >
  25. <Meta
  26. avatar={<Avatar src={i.avatar} />}
  27. title={i.title}
  28. description={i.description}
  29. />
  30. </Card>
  31. )
  32. })
  33. }
  34. render() {
  35. return (
  36. <Layout>
  37. <Header>
  38. <div className='toolbar'>
  39. <div>
  40. </div>
  41. <div className='tools'>
  42. <Search
  43. placeholder="请输入关键字"
  44. onSearch={value => console.log(value)}
  45. />
  46. <Link to='/chart/chartdesigner/create'>
  47. <Button>
  48. <Icon type="area-chart" />创建图表
  49. </Button>
  50. </Link>
  51. </div>
  52. </div>
  53. </Header>
  54. <Content>
  55. </Content>
  56. </Layout>
  57. )
  58. // <Tabs
  59. // className='dashboard-tabs'
  60. // type="card"
  61. // defaultActiveKey="1"
  62. // tabBarExtraContent={
  63. // <div className='dashboard-tabs-tools'>
  64. // <Button onClick={() => {
  65. // dispatch({ type: activeTab == 'dashboard' ? 'databoard/remoteList' : 'dashboard/testData' });
  66. // }}>测试数据</Button>
  67. // <Search
  68. // placeholder="请输入关键字"
  69. // onSearch={value => console.log(value)}
  70. // />
  71. // <Dropdown overlay={(
  72. // <Menu onClick={(item, key, keyPath) => {
  73. // const type = item.key;
  74. // dispatch({ type: 'dashboard/resetNewModel' });
  75. // dispatch({ type: 'dashboard/setNewModelField', name: 'type', value: type });
  76. // dispatch({ type: 'main/redirect', path: { pathname: '/dashboard/' + type + '/create' } });
  77. // }}>
  78. // <Menu.Item key='static'>报告</Menu.Item>
  79. // <Menu.Item key='dynamic'>看板</Menu.Item>
  80. // </Menu>
  81. // )} trigger={['click']}>
  82. // <Button style={{ display: 'inline-block' }}>
  83. // <Icon type="plus" />创建
  84. // </Button>
  85. // </Dropdown>
  86. // </div>
  87. // }
  88. // onChange={(key) => {
  89. // this.setState({
  90. // activeTab: key == '1' ? 'static' : 'dynamic'
  91. // });
  92. // }}
  93. // >
  94. // <TabPane tab="我的看板" key="1" >
  95. // <div style={{ display: 'flex', background: '#ECECEC', padding: '30px', flexWrap: 'wrap' }}>
  96. // {this.generateCard()}
  97. // </div>
  98. // </TabPane>
  99. // <TabPane tab="我的报告" key="2" >
  100. // {/* 我的报表View */}
  101. // </TabPane>
  102. // <TabPane tab="最近打开" key="3" >
  103. // {/* 最近打开View */}
  104. // </TabPane>
  105. // </Tabs>
  106. }
  107. }
  108. function mapStateToProps({present: {chart}}) {
  109. return { chart }
  110. }
  111. export default connect(mapStateToProps)(ChartList)