antd 表格分页功能

表格分页

// An highlighted block
		tableOption: {
			columns: [
				{title: '目标类型', key: 'categoryDisplay', dataIndex: 'categoryDisplay',width: '200px'},
                {title: '分公司', key: 'companyName', dataIndex: 'companyName',width: '400px'},
                {title: '年月', key: 'yearMonth', dataIndex: 'yearMonth',width: '200px'},
                {title: '产品分类', key: 'productionTypeName', dataIndex: 'productionTypeName',width: '200px'},
                //{title: '产品分类值', key: 'productionType', dataIndex: 'productionType',width: '200px'},
                {title: '业绩目标(万)', key: 'performanceObjectivesAmount', dataIndex: 'performanceObjectivesAmount',width: '200px'},
                {title: 'PK目标(万)', key: 'pkTargetAmount', dataIndex: 'pkTargetAmount',width: '200px'},
			],
			dataSource: [], //表格显示的总数据
			loading: false,
            scroll: {x: 1600},
			pagination: {
				current: 1, pageSize: 10, total: 0, showTotal: total => `共 ${total} 条`
			}
		},
	/**
	 * 初始化列表
	 */
    loadTable() {
        let self = this, {tableOption} = this.state;
        tableOption.loading = true;
        self.setState({tableOption});
        api.post(APIS.achievementManageSearch+'?current='+tableOption.pagination.current+'&pageSize='+tableOption.pagination.pageSize, {
            data: {
					canshu:666
            }
        }).then(function(response){
            tableOption.dataSource = response.data.data.records;
            tableOption.pagination.total = response.data.data.total;
        }).finally(()=>{
            tableOption.loading = false;
            self.setState({tableOption});
        });
    }
        //表格点击页数事件
    onTableChange(pagination) {
        if (pagination.current) {
            let { tableOption } = this.state;
            tableOption.pagination.current = pagination.current;
            tableOption.pagination.pageSize = pagination.pageSize;
            this.setState({ tableOption });
        }
        this.loadTable();
    };
   componentWillReceiveProps(nextProps) {
        if (this.props.match.params.id !== nextProps.match.params.id) {
            this.Id = nextProps.match.params.id;
            this.loadTable();
        }
    }
   <Table onChange={this.onTableChange.bind(this)}  {...tableOption} bordered />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值