Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

最后一页中分页删除问题 #2239

Closed
mbh1210554992 opened this issue Jan 27, 2021 · 2 comments
Closed

最后一页中分页删除问题 #2239

mbh1210554992 opened this issue Jan 27, 2021 · 2 comments

Comments

@mbh1210554992
Copy link

版本号:v2.4.2
问题描述:分页删除问题。

在表格中,当最后一页只有一项时,删除这一项,会重新查询分页数据,这时查询到的并不是前一页的数据,而是空(相当于还是查询了最后一页的数据,但这是最后一页已经没有数据了,应该查询前一页的数据)

截图&代码:

QQ截图20210127151651
本次删除第二页最后一个数据后,直接会显示无数据。

友情提示: 未按格式要求发帖,会直接删掉。

@waves86
Copy link

waves86 commented Feb 3, 2021

修改 /src/mixins/JeecgListMixin.js batchDel 和 handleDelete 方法

batchDel: function () {
if(!this.url.deleteBatch){
this.$message.error("请设置url.deleteBatch属性!")
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!');
return;
} else {
var ids = "";
for (var a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ",";
}
var that = this;
this.$confirm({
title: "确认删除",
content: "是否删除选中数据?",
onOk: function () {
that.loading = true;
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message);
if(that.ipagination.total%that.ipagination.pageSize===that.selectedRowKeys.length){
that.loadData(that.ipagination.current===1?that.ipagination.current:that.ipagination.current-1);
}else{
that.loadData();
}
that.onClearSelected();
} else {
that.$message.warning(res.message);
}
}).finally(() => {
that.loading = false;
});
}
});
}
},
handleDelete: function (id) {
if(!this.url.delete){
this.$message.error("请设置url.delete属性!")
return
}
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message);
if(that.ipagination.total%that.ipagination.pageSize===1){
that.loadData(that.ipagination.current===1?that.ipagination.current:that.ipagination.current-1);
}else{
that.loadData();
}
} else {
that.$message.warning(res.message);
}
});
},

@zhangdaiscott
Copy link
Member

已经修复了,下个版本发布

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants