修复表格分页搜索和删除BUG #20

This commit is contained in:
zhengjie
2019-06-25 09:21:07 +08:00
parent 94b2e78246
commit 6c06d89355
17 changed files with 33 additions and 0 deletions

View File

@@ -37,6 +37,15 @@ export default {
this.page = 0
this.size = e
this.init()
},
// 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据
dleChangePage(size) {
if (size === undefined) {
size = 1
}
if (this.data.length === size && this.page !== 0) {
this.page = this.page - 1
}
}
}
}

View File

@@ -23,6 +23,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"

View File

@@ -27,6 +27,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"

View File

@@ -24,6 +24,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"

View File

@@ -36,6 +36,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -80,6 +81,7 @@ export default {
del(row.key).then(res => {
this.delLoading = false
this.$refs[index].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -40,6 +40,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -107,6 +108,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -36,6 +36,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -76,6 +77,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -47,6 +47,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -96,6 +97,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -45,6 +45,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -156,6 +157,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -44,6 +44,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -111,6 +112,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -40,6 +40,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
:page-size="6"
style="margin-top:8px;"
layout="total, prev, pager, next"

View File

@@ -20,6 +20,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"

View File

@@ -52,6 +52,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -117,6 +118,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -38,6 +38,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@@ -82,6 +83,7 @@ export default {
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',

View File

@@ -67,6 +67,7 @@ export default {
delAll(ids).then(res => {
this.delLoading = false
this.$parent.init()
this.$parent.dleChangePage(ids.length)
this.$notify({
title: '删除成功',
type: 'success',

View File

@@ -48,6 +48,7 @@
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"

View File

@@ -81,6 +81,7 @@ export default {
}
delAll(ids).then(res => {
this.delLoading = false
this.$parent.dleChangePage(ids.length)
this.$parent.init()
this.$notify({
title: '删除成功',