js 批量提交数据

时间:2022-10-30 18:35:24
                // 批量提交数据
let pageSize = 100, total = dataTmp.length, list = dataTmp
let totalPage = Math.ceil(total / pageSize) // 总页数
for(let curPage = 1; curPage <= totalPage; curPage++) {
let actualParams = []
let startRow = (curPage - 1) * pageSize+1; // 开始显示的行
let endRow = curPage * pageSize; // 结束显示的行
endRow = (endRow > total) ? total : endRow;
for(let index = startRow -1; index < endRow; index++) {
actualParams.push(dataTmp[index])
}
console.log('>>>>>>>actualParams:', actualParams)
this.addRequest(actualParams, function(response) {
// 接口返回数据
}) }