U 优化表格分页支持调整pageSize

pull/137/head
vapao 2020-06-13 11:08:03 +08:00
parent 30c0dfe146
commit 56df2145a2
17 changed files with 187 additions and 19 deletions

View File

@ -17,6 +17,7 @@ class ComTable extends React.Component {
groupMap: {} groupMap: {}
} }
} }
componentDidMount() { componentDidMount() {
store.fetchRecords(); store.fetchRecords();
if (groupStore.records.length === 0) { if (groupStore.records.length === 0) {
@ -65,7 +66,17 @@ class ComTable extends React.Component {
data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase())) data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase()))
} }
return ( return (
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
) )
} }
} }

View File

@ -72,7 +72,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -91,7 +91,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -66,7 +66,17 @@ class ComTable extends React.Component {
data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase())) data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase()))
} }
return ( return (
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
) )
} }
} }

View File

@ -64,7 +64,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -66,7 +66,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -64,7 +64,17 @@ class Record extends React.Component {
title={`${store.env.name} - 更改历史记录`} title={`${store.env.name} - 更改历史记录`}
onCancel={() => store.recordVisible = false} onCancel={() => store.recordVisible = false}
footer={null}> footer={null}>
<Table rowKey="id" loading={loading} dataSource={records} columns={this.columns} /> <Table
rowKey="id"
loading={loading}
dataSource={records}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
</Modal> </Modal>
) )
} }

View File

@ -73,7 +73,18 @@ class TableView extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table size="small" rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
size="small"
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -134,6 +134,12 @@ class ComTable extends React.Component {
loading={store.isFetching} loading={store.isFetching}
dataSource={data} dataSource={data}
expandedRowRender={this.expandedRowRender} expandedRowRender={this.expandedRowRender}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/> columns={this.columns}/>
) )
} }

View File

@ -190,7 +190,17 @@ class ComTable extends React.Component {
} }
} }
return ( return (
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
) )
} }
} }

View File

@ -66,7 +66,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -84,7 +84,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
{store.importVisible && <ComImport/>} {store.importVisible && <ComImport/>}
</React.Fragment> </React.Fragment>

View File

@ -147,7 +147,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -48,7 +48,17 @@ class Record extends React.Component {
title={`任务执行记录 - ${store.record.name}`} title={`任务执行记录 - ${store.record.name}`}
onCancel={() => store.recordVisible = false} onCancel={() => store.recordVisible = false}
footer={null}> footer={null}>
<Table rowKey="id" columns={this.columns} dataSource={this.state.records} loading={this.state.loading}/> <Table
rowKey="id"
columns={this.columns}
dataSource={this.state.records}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
loading={this.state.loading}/>
</Modal> </Modal>
) )
} }

View File

@ -147,7 +147,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
{store.infoVisible && <Info/>} {store.infoVisible && <Info/>}
{store.recordVisible && <Record/>} {store.recordVisible && <Record/>}

View File

@ -116,7 +116,17 @@ class ComTable extends React.Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
{store.formVisible && <ComForm/>} {store.formVisible && <ComForm/>}
</React.Fragment> </React.Fragment>
) )

View File

@ -64,7 +64,17 @@ class ComTable extends React.Component {
data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase())) data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase()))
} }
return ( return (
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/> <Table
rowKey="id"
loading={store.isFetching}
dataSource={data}
pagination={{
showSizeChanger: true,
showLessItems: true,
hideOnSinglePage: true,
pageSizeOptions: ['10', '20', '50', '100']
}}
columns={this.columns}/>
) )
} }
} }