From 5e10a7ee4a5ef882d6b0d92b19b1a888ffcc6f7f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 四月 2020 11:55:03 +0800 Subject: [PATCH] 2020-04-14 --- src/tabviews/zshare/normalTable/index.jsx | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index ab5a446..ddbbaac 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -6,6 +6,11 @@ const { Paragraph } = Typography export default class MainTable extends Component { + static defaultProps = { + pagination: true, + total: 0 + } + static propTpyes = { tableId: PropTypes.string, // 鍒楄〃Id dict: PropTypes.object, // 瀛楀吀椤� @@ -14,12 +19,13 @@ pickup: PropTypes.any, // 鏁版嵁鏀惰捣 columns: PropTypes.array, // 琛ㄦ牸鍒� data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - total: PropTypes.number, // 鎬绘暟 + total: PropTypes.any, // 鎬绘暟 loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� buttonTrigger: PropTypes.func, // 琛ㄦ牸涓寜閽Е鍙戞搷浣� linkTrigger: PropTypes.func, // 瀛楁閫忚 - handleTableId: PropTypes.func // 鏁版嵁鍒囨崲 + handleTableId: PropTypes.func, // 鏁版嵁鍒囨崲 + pagination: PropTypes.any // 鏁版嵁鍒囨崲 } state = { @@ -468,7 +474,7 @@ } render() { - const { setting, pickup } = this.props + const { setting, pickup, pagination } = this.props let { selectedRowKeys } = this.state // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� @@ -503,6 +509,18 @@ _data = _data.filter((item, index) => selectedRowKeys.includes(index)) } + let _pagination = false + if (pagination) { + _pagination = { + current: this.state.pageIndex, + pageSize: this.state.pageSize, + pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], + showSizeChanger: true, + total: this.props.total, + showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` + } + } + return ( <div className="normal-data-table"> {offset && <Affix offsetTop={offset} className="fix-header"> @@ -534,14 +552,7 @@ } }} onChange={this.changeTable} - pagination={{ - current: this.state.pageIndex, - pageSize: this.state.pageSize, - pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], - showSizeChanger: true, - total: this.props.total, - showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` - }} + pagination={_pagination} /> <Modal className="image-scale-modal" -- Gitblit v1.8.0