|
|
@@ -1,18 +1,17 @@
|
|
|
import React from 'react'
|
|
|
-import { Layout, Button, Icon, Input, Menu, Dropdown, Card, Col, Row, Popover, Breadcrumb, Tree, Tag } from 'antd'
|
|
|
+import { Layout, Button, Icon, Input, Menu, Dropdown, Card, Col, Row } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
|
import { dateFormat } from '../../utils/baseUtils'
|
|
|
import Ellipsis from 'ant-design-pro/lib/Ellipsis'
|
|
|
import 'ant-design-pro/dist/ant-design-pro.css'
|
|
|
-import GroupSelector from '../datasource/groupSelector'
|
|
|
+import Thumbnail from './thumbnail'
|
|
|
import './list.less'
|
|
|
const { Content } = Layout
|
|
|
const { Search } = Input
|
|
|
const CardGrid = Card.Grid
|
|
|
-const { TreeNode } = Tree
|
|
|
|
|
|
|
|
|
-class ChartList extends React.Component {
|
|
|
+class DashboardList extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
@@ -27,24 +26,23 @@ class ChartList extends React.Component {
|
|
|
const { dispatch } = this.props;
|
|
|
this.setBodyWidth();
|
|
|
dispatch({ type: 'dashboard/fetchList' });
|
|
|
- // dispatch({ type: 'chart/remoteGroupList' });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置卡片容器宽度 = 每行最大卡片数量 * 卡片宽度
|
|
|
*/
|
|
|
setBodyWidth() {
|
|
|
- // const chartBody = document.getElementsByClassName('chart-body')[0]; // 卡片容器
|
|
|
- // const parent = chartBody.parentNode; // 父级容器
|
|
|
- // const pWidth = parent.offsetWidth; // 父级容器宽度
|
|
|
- // const pPadding = 10 + 10; // 父级容器左右padding
|
|
|
- // const cWidth = 600; // 每个卡片宽度
|
|
|
- // const cMargin = 5 + 5; // 每个卡片左右margin
|
|
|
- // const pTrueWidth = pWidth - pPadding; // 父容器实际可用宽度
|
|
|
- // const cTrueWidth = cWidth + cMargin; // 卡片实际占用宽度
|
|
|
- // const count = Math.floor(pTrueWidth/cTrueWidth); // 每行最大卡片数量
|
|
|
+ const chartBody = document.getElementsByClassName('dashboard-body')[0]; // 卡片容器
|
|
|
+ const parent = chartBody.parentNode; // 父级容器
|
|
|
+ const pWidth = parent.offsetWidth; // 父级容器宽度
|
|
|
+ const pPadding = 10 + 10; // 父级容器左右padding
|
|
|
+ const cWidth = 512; // 每个卡片宽度
|
|
|
+ const cMargin = 5 + 5; // 每个卡片左右margin
|
|
|
+ const pTrueWidth = pWidth - pPadding; // 父容器实际可用宽度
|
|
|
+ const cTrueWidth = cWidth + cMargin; // 卡片实际占用宽度
|
|
|
+ const count = Math.floor(pTrueWidth/cTrueWidth); // 每行最大卡片数量
|
|
|
|
|
|
- // chartBody.style.width = count * cTrueWidth + 'px';
|
|
|
+ chartBody.style.width = count * cTrueWidth + 'px';
|
|
|
}
|
|
|
|
|
|
generateCard() {
|
|
|
@@ -64,7 +62,7 @@ class ChartList extends React.Component {
|
|
|
</Menu.Item>
|
|
|
<Menu.Divider />
|
|
|
<Menu.Item onClick={() => {
|
|
|
- dispatch({ type: 'dashboard/remoteDelete', code: this.state.selectedRecord.code });
|
|
|
+ dispatch({ type: 'dashboard/remoteDelete', code: selectedRecord.code });
|
|
|
}}>
|
|
|
<Icon type='delete'/>删除
|
|
|
</Menu.Item>
|
|
|
@@ -106,7 +104,7 @@ class ChartList extends React.Component {
|
|
|
dispatch({ type: 'dashboardDesigner/reset' });
|
|
|
dispatch({ type: 'main/redirect', path: '/dashboard/' + l.code });
|
|
|
}}>
|
|
|
- {/* <Thumbnail type={l.type} code={l.code} option={l.chartOption}/> */}
|
|
|
+ <Thumbnail type={l.type} code={l.code} option={l.chartOption}/>
|
|
|
</Row>
|
|
|
<Row className='desc'>
|
|
|
<Ellipsis tooltip={l.description.length > 16} lines={2}>{
|
|
|
@@ -157,9 +155,7 @@ class ChartList extends React.Component {
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const { visibleChooseDataSourceBox, visibleDistributeBox } = this.state;
|
|
|
const { dispatch, dashboard } = this.props;
|
|
|
- const TAG_COLOR = ['blue'];
|
|
|
return (
|
|
|
<Layout className='dashboard-list'>
|
|
|
<Content>
|
|
|
@@ -187,7 +183,7 @@ class ChartList extends React.Component {
|
|
|
</Col>
|
|
|
</Row>
|
|
|
}>
|
|
|
- <div className='chart-body'>
|
|
|
+ <div className='dashboard-body'>
|
|
|
{ this.generateCard() }
|
|
|
</div>
|
|
|
</Card>
|
|
|
@@ -198,8 +194,8 @@ class ChartList extends React.Component {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function mapStateToProps({ present: { chart, dashboard } }) {
|
|
|
- return { chart, dashboard }
|
|
|
+function mapStateToProps({ present: { dashboard } }) {
|
|
|
+ return { dashboard }
|
|
|
}
|
|
|
|
|
|
-export default connect(mapStateToProps)(ChartList)
|
|
|
+export default connect(mapStateToProps)(DashboardList)
|