Browse Source

使前后端分页功能能兼容操作
版本号提升为0.0.2

xiaoct 7 years ago
parent
commit
00578be0ed
2 changed files with 19 additions and 12 deletions
  1. 1 1
      package.json
  2. 18 11
      src/components/dashboardDesigner/chartView.jsx

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "bi-web",
   "private": true,
-  "version": "0.0.1",
+  "version": "0.0.2",
   "scripts": {
     "start": "roadhog server",
     "build": "roadhog build",

+ 18 - 11
src/components/dashboardDesigner/chartView.jsx

@@ -44,6 +44,23 @@ class ChartView extends React.Component {
                     />
                 }else if(type === 'table') {
                     const { columns, dataSource } = chartOption;
+                    let pagination
+                    if (chartType === 'dataView') {
+                        pagination = {
+                            pageSize: chartOption.pageSize || 25,
+                            total: chartOption.total,
+                            current: chartOption.pageNum,
+                            showTotal: (total, range) => {
+                                return `第${range[0]}到第${range[1]}条数据,共${total}条数据`;
+                            },
+                            onChange: (page, pageSize) => {
+                                dispatch({ type: 'dashboardDesigner/fetchChartData', item, page, pageSize, mandatory: chartType === 'dataView' });
+                            }
+                        }
+                    }else {pagination = {
+                        pageSize: chartOption.pageSize || 25,
+                        total: chartOption.total
+                    }}
                     children = <Table
                         key={hashcode({
                             columns,
@@ -56,17 +73,7 @@ class ChartView extends React.Component {
                             x: columns ? columns.length * 200 : 0,
                             y: tableBodyHeight,
                         }}
-                        pagination={{
-                            pageSize: chartOption.pageSize || 25,
-                            total: chartOption.total,
-                            current: chartOption.pageNum,
-                            showTotal: (total, range) => {
-                                return `第${range[0]}到第${range[1]}条数据,共${total}条数据`;
-                            },
-                            onChange: (page, pageSize) => {
-                                dispatch({ type: 'dashboardDesigner/fetchChartData', item, page, pageSize, mandatory: true });
-                            }
-                        }}
+                        pagination={pagination}
                         columns={columns ? columns.map(c => ({
                             ...c,
                             width: 200