a-table 带分页查所有数据与查单页区别

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);
    }
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值