|
|
@@ -1,27 +1,91 @@
|
|
|
import React from 'react'
|
|
|
-import { Tabs } from 'antd'
|
|
|
-
|
|
|
+import { Tabs, Button, Icon, Input, Menu, Dropdown, Card, Col, Row, Avatar } from 'antd'
|
|
|
+import './dashboard.less'
|
|
|
+import dashboard from '../../models/dashboard'
|
|
|
+import { connect } from 'dva'
|
|
|
+const { Search } = Input
|
|
|
const { TabPane } = Tabs
|
|
|
+const { Meta } = Card;
|
|
|
+
|
|
|
|
|
|
-class DashboardView extends React.Component {
|
|
|
+class Dashboard extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
-
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+
|
|
|
+ generateCard() {
|
|
|
+ const list = this.props.dashboard.myDashboardList
|
|
|
+ return list.map(i => {
|
|
|
+ return (
|
|
|
+ <Card key={i.dashboardID}
|
|
|
+ className='dashboard-card'
|
|
|
+ cover={<img alt={i.coverAlt} src={i.coverImg} />}
|
|
|
+ actions={[<Icon type="setting" />, <Icon type="edit" />, <Icon type="ellipsis" />]}
|
|
|
+ >
|
|
|
+ <Meta
|
|
|
+ avatar={<Avatar src={i.avatar} />}
|
|
|
+ title={i.title}
|
|
|
+ description={i.description}
|
|
|
+ />
|
|
|
+ </Card>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
render() {
|
|
|
- return (
|
|
|
- <Tabs defaultActiveKey="1">
|
|
|
+ return (
|
|
|
+ <Tabs
|
|
|
+ className='dashboard-tabs'
|
|
|
+ type="card"
|
|
|
+ defaultActiveKey="1"
|
|
|
+ tabBarExtraContent={
|
|
|
+ <div className='dashboard-tabs-tools'>
|
|
|
+ <Button onClick={() => {
|
|
|
+ dispatch({ type: activeTab == 'dashboard' ? 'databoard/remoteList' : 'dashboard/testData' });
|
|
|
+ }}>测试数据</Button>
|
|
|
+ <Search
|
|
|
+ placeholder="请输入关键字"
|
|
|
+ onSearch={value => console.log(value)}
|
|
|
+ />
|
|
|
+ <Dropdown overlay={(
|
|
|
+ <Menu onClick={(item, key, keyPath) => {
|
|
|
+ const type = item.key;
|
|
|
+ dispatch({ type: 'dashboard/resetNewModel' });
|
|
|
+ dispatch({ type: 'dashboard/setNewModelField', name: 'type', value: type });
|
|
|
+ dispatch({ type: 'main/redirect', path: { pathname: '/dashboard/' + type + '/create' } });
|
|
|
+ }}>
|
|
|
+ <Menu.Item key='static'>报告</Menu.Item>
|
|
|
+ <Menu.Item key='dynamic'>看板</Menu.Item>
|
|
|
+ </Menu>
|
|
|
+ )} trigger={['click']}>
|
|
|
+ <Button style={{ display: 'inline-block' }}>
|
|
|
+ <Icon type="plus" />创建
|
|
|
+ </Button>
|
|
|
+ </Dropdown>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ onChange={(key) => {
|
|
|
+ this.setState({
|
|
|
+ activeTab: key == '1' ? 'static' : 'dynamic'
|
|
|
+ });
|
|
|
+ }}
|
|
|
+
|
|
|
+ >
|
|
|
<TabPane tab="我的看板" key="1" >
|
|
|
- {/* 我的看板VIEW */}
|
|
|
+ <div style={{ display: 'flex', background: '#ECECEC', padding: '30px', flexWrap: 'wrap' }}>
|
|
|
+ {this.generateCard()}
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
</TabPane>
|
|
|
- <TabPane tab="我的报表" key="2" >
|
|
|
+ <TabPane tab="我的报告" key="2" >
|
|
|
{/* 我的报表View */}
|
|
|
</TabPane>
|
|
|
<TabPane tab="最近打开" key="3" >
|
|
|
{/* 最近打开View */}
|
|
|
- </TabPane>
|
|
|
+ </TabPane>
|
|
|
</Tabs>
|
|
|
)
|
|
|
|
|
|
@@ -29,4 +93,9 @@ class DashboardView extends React.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export default DashboardView
|
|
|
+
|
|
|
+function mapStateToProps({present: {dashboard}}) {
|
|
|
+ return { dashboard }
|
|
|
+}
|
|
|
+
|
|
|
+export default connect(mapStateToProps)(Dashboard)
|