From 980210de48d28a7645553c741b097311494fb960 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 11 十一月 2021 14:42:55 +0800 Subject: [PATCH] 2021-11-11 --- src/tabviews/custom/components/share/normalTable/index.jsx | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index c80e3d2..cadff9e 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -432,7 +432,8 @@ activeIndex: null, // 鏍囪褰撳墠閫変腑琛� rowspans: null, // 琛屽悎骞跺瓧娈典俊鎭� pickup: false, // 鏀惰捣鏈�夋嫨椤� - orderfields: {} // 鎺掑簭id涓巉ield杞崲 + orderfields: {}, // 鎺掑簭id涓巉ield杞崲 + pageOptions: [] } UNSAFE_componentWillMount () { @@ -519,7 +520,17 @@ document.getElementsByTagName('head')[0].appendChild(ele) } + let size = (setting.pageSize || 10) + '' + let pageOptions = ['10', '25', '50', '100', '500', '1000'] + + if (!pageOptions.includes(size)) { + pageOptions.push(size) + pageOptions = pageOptions.sort((a, b) => a - b) + } + this.setState({ + pageSize: setting.pageSize || 10, + pageOptions, columns: _columns, rowspans, tableId, @@ -845,7 +856,7 @@ render() { const { setting, statFValue, lineMarks, data } = this.props - const { selectedRowKeys, activeIndex, pickup, tableId } = this.state + const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions } = this.state // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� let rowSelection = null @@ -878,7 +889,7 @@ _pagination = { current: this.state.pageIndex, pageSize: this.state.pageSize, - pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], + pageSizeOptions: pageOptions, showSizeChanger: true, total: this.props.total || 0, showTotal: (total, range) => `${range[0]}-${range[1]} ${this.state.dict['main.pagination.of']} ${total} ${this.state.dict['main.pagination.items']}` -- Gitblit v1.8.0