perf: under the list, after deleting all the data on the current page, query the data on the previous page (#550)

pull/552/head
QuentinHsu 2022-04-17 19:46:09 +08:00 committed by GitHub
parent 7b50b28934
commit 6d3380ef55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 1 deletions

View File

@ -548,6 +548,11 @@ export default {
const { categoryId } = this.list.params
this.list.params.categoryId = categoryId === 0 ? undefined : categoryId
const response = await apiClient.post.list(this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListPosts()
return
}
this.list.data = response.data.content
this.list.total = response.data.total

View File

@ -254,6 +254,11 @@ export default {
const response = await apiClient.attachment.list(this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListAttachments()
return
}
this.list.data = response.data.content
this.list.total = response.data.total
this.list.hasNext = response.data.hasNext

View File

@ -533,6 +533,11 @@ export default {
this.list.loading = true
const response = await apiClient.comment.list(this.targetName, this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListComments()
return
}
this.list.data = response.data.content
this.list.total = response.data.total

View File

@ -369,7 +369,11 @@ export default {
}
const { data } = await apiClient.sheet.list(this.list.params)
if (data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListSheets()
return
}
this.list.data = data.content
this.list.total = data.total
this.list.hasPrevious = data.hasPrevious

View File

@ -265,6 +265,11 @@ export default {
this.list.loading = true
const { data } = await apiClient.journal.list(this.list.params)
if (data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListJournals()
return
}
this.list.data = data.content
this.list.total = data.total

View File

@ -227,6 +227,11 @@ export default {
apiClient.option
.listAsView(this.queryParam)
.then(response => {
if (response.data.content.length === 0 && this.pagination.page > 0) {
this.pagination.page--
this.handleListOptions()
return
}
this.options = response.data.content
this.pagination.total = response.data.total
})