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: {}
}
}
componentDidMount() {
store.fetchRecords();
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()))
}
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 (
<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/>}
</React.Fragment>
)

View File

@ -91,7 +91,17 @@ class ComTable extends React.Component {
}
return (
<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/>}
</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()))
}
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 (
<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/>}
</React.Fragment>
)

View File

@ -66,7 +66,17 @@ class ComTable extends React.Component {
}
return (
<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/>}
</React.Fragment>
)

View File

@ -64,7 +64,17 @@ class Record extends React.Component {
title={`${store.env.name} - 更改历史记录`}
onCancel={() => store.recordVisible = false}
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>
)
}

View File

@ -73,7 +73,18 @@ class TableView extends React.Component {
}
return (
<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/>}
</React.Fragment>
)

View File

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

View File

@ -190,7 +190,17 @@ class ComTable extends React.Component {
}
}
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 (
<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/>}
</React.Fragment>
)

View File

@ -84,7 +84,17 @@ class ComTable extends React.Component {
}
return (
<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.importVisible && <ComImport/>}
</React.Fragment>

View File

@ -147,7 +147,17 @@ class ComTable extends React.Component {
}
return (
<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/>}
</React.Fragment>
)

View File

@ -48,7 +48,17 @@ class Record extends React.Component {
title={`任务执行记录 - ${store.record.name}`}
onCancel={() => store.recordVisible = false}
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>
)
}

View File

@ -147,7 +147,17 @@ class ComTable extends React.Component {
}
return (
<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.infoVisible && <Info/>}
{store.recordVisible && <Record/>}

View File

@ -116,7 +116,17 @@ class ComTable extends React.Component {
}
return (
<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/>}
</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()))
}
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}/>
)
}
}