1、查单页数据分页,点击页码查询再次发起请求服务。
1)前台
<a-table
:pagination="false"
ref="table"
size="middle"
:rowKey="(record,index)=>{return index}"
class="j-table-force-nowrap"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}"
:customRow="clickThenSelect"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
</a-table>
datas(){
return {
ipagination:{
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '40','50'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " 共" + total + "条"
},
showQuickJumper: false,
showSizeChanger: false,
total: 0,
},
url: {
list: "/das/rsPersonArchive/list", //查单页数据
justyOrderNum : "/das/rsPersonArchive//justyOrderNum"
}
} ,
columns: [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 50,
customRender: (text,record,index)=> {
return index + 1
},
},
}],
},
methods: {
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
}
2)后台
@AutoLog(value = "卷内数据-分页列表查询")
@ApiOperation(value = "卷内数据-分页列表查询", notes = "卷内数据-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(DasInfoVolumes dasInfoVolumes,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<DasInfoVolumes> queryWrapper = QueryGenerator.initQueryWrapper(dasInfoVolumes, req.getParameterMap());
Page<DasInfoVolumes> page = new Page<DasInfoVolumes>(pageNo, pageSize);
IPage<DasInfoVolumes> pageList = dasInfoVolumesService.page(page, queryWrapper);
return Result.OK(pageList);
}
2、查所有数据后再分页,点击页码查询不再发起请求服务。
1)前台
<a-table
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
:pagination="ipagination"
:rowKey="(record,index)=>{return (this.ipagination.current-1)*this.ipagination.pageSize+parseInt(index)}"
:data-source="dataSource"
>
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
</a-table>
ipagination:{
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '40','50'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " 共" + total + "条"
},
showQuickJumper: false,
showSizeChanger: false,
total: 0,
onShowSizeChange: (current, pageSize) => {
this.ipagination.current = 1;
this.ipagination.pageSize = pageSize;
},
// 改变每页数量时更新显示
onChange: (current, size) => {
this.ipagination.current = current;
this.ipagination.pageSize = size;
},
},
data () {
return {
columns: [
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 50,
customRender: (text,record,index)=> {
return (this.ipagination.current -1 )*this.ipagination.pageSize +index + 1
},
},
}],
url: {
list: "/das/rsPersonArchive/querylist", //查所有数据
justyOrderNum : "/das/rsPersonArchive//justyOrderNum"
}
},
2)后台
@AutoLog(value = "卷内表-列表查询")
@ApiOperation(value="卷内表-列表查询", notes="卷内表-列表查询")
@GetMapping(value = "/querylist")
public Result<?> queryListAll(DasInfoVolumes dasInfoVolumes,
HttpServletRequest req) {
Map<String, String[]> parameterMap = req.getParameterMap();
QueryWrapper<DasInfoVolumes> queryWrapper = QueryGenerator.initQueryWrapper(dasInfoVolumes,parameterMap );
queryWrapper.orderByAsc("piece_no");
List<DasInfoVolumes> list = dasInfoVolumesService.list(queryWrapper);
return Result.OK(list);
}