fix: all pagination error.

pull/59/head
ruibaby 2019-11-24 21:02:55 +08:00
parent 7cdb85964a
commit 264180600f
11 changed files with 110 additions and 101 deletions

View File

@ -23,4 +23,4 @@ export default {
}
}
}
</script>
</script>

View File

@ -32,7 +32,7 @@
<a-form-item label="存储位置">
<a-select
v-model="queryParam.attachmentType"
@change="handleQuery"
@change="handleQuery()"
>
<a-select-option
v-for="item in Object.keys(attachmentType)"
@ -49,7 +49,7 @@
<a-form-item label="文件类型">
<a-select
v-model="queryParam.mediaType"
@change="handleQuery"
@change="handleQuery()"
>
<a-select-option
v-for="(item,index) in mediaTypes"
@ -66,11 +66,11 @@
<span class="table-page-search-submitButtons">
<a-button
type="primary"
@click="handleQuery"
@click="handleQuery()"
>查询</a-button>
<a-button
style="margin-left: 8px;"
@click="handleResetParam"
@click="handleResetParam()"
>重置</a-button>
</span>
</a-col>
@ -124,6 +124,7 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['18', '36', '54','72','90','108']"
@ -246,17 +247,15 @@ export default {
this.queryParam.keyword = null
this.queryParam.mediaType = null
this.queryParam.attachmentType = null
this.loadAttachments()
this.handlePaginationChange(1, this.pagination.size)
this.loadMediaTypes()
},
handleQuery() {
this.queryParam.page = 0
this.pagination.page = 1
this.loadAttachments()
this.handlePaginationChange(1, this.pagination.size)
},
onUploadClose() {
this.$refs.upload.handleClearFileList()
this.loadAttachments()
this.handlePaginationChange(1, this.pagination.size)
this.loadMediaTypes()
},
handleJudgeMediaType(attachment) {

View File

@ -15,7 +15,7 @@
<a-input-search
placeholder="搜索附件"
v-model="queryParam.keyword"
@search="loadAttachments(true)"
@search="handleQuery()"
enterButton
/>
</a-row>
@ -50,8 +50,9 @@
<a-divider />
<div class="page-wrapper">
<a-pagination
:defaultPageSize="pagination.size"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
@change="handlePaginationChange"
></a-pagination>
</div>
@ -122,7 +123,7 @@ export default {
},
queryParam: {
page: 0,
size: 18,
size: 12,
sort: null,
keyword: null
},
@ -162,18 +163,18 @@ export default {
this.$log.debug('Show detail of', attachment)
this.detailVisible = true
},
loadAttachments(isSearch) {
loadAttachments() {
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
if (isSearch) {
this.queryParam.page = 0
}
attachmentApi.query(this.queryParam).then(response => {
this.attachments = response.data.data.content
this.pagination.total = response.data.data.total
})
},
handleQuery() {
this.handlePaginationChange(1, this.pagination.size)
},
handlePaginationChange(page, pageSize) {
this.pagination.page = page
this.pagination.size = pageSize
@ -182,7 +183,7 @@ export default {
onUploadClose() {
this.$refs.upload.handleClearFileList()
this.loadSkeleton()
this.loadAttachments()
this.handlePaginationChange(1, this.pagination.size)
},
handleDelete() {
this.loadAttachments()

View File

@ -14,6 +14,8 @@
>
<a-input-search
placeholder="搜索附件"
v-model="queryParam.keyword"
@search="handleQuery()"
enterButton
/>
</a-row>
@ -48,8 +50,9 @@
<a-divider />
<div class="page-wrapper">
<a-pagination
:defaultPageSize="pagination.size"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
@change="handlePaginationChange"
></a-pagination>
</div>
@ -125,6 +128,12 @@ export default {
size: 12,
sort: ''
},
queryParam: {
page: 0,
size: 12,
sort: null,
keyword: null
},
attachments: [],
uploadHandler: attachmentApi.upload
}
@ -148,13 +157,17 @@ export default {
this.uploadVisible = true
},
loadAttachments() {
const pagination = Object.assign({}, this.pagination)
pagination.page--
attachmentApi.query(pagination).then(response => {
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
attachmentApi.query(this.queryParam).then(response => {
this.attachments = response.data.data.content
this.pagination.total = response.data.data.total
})
},
handleQuery() {
this.handlePaginationChange(1, this.pagination.size)
},
handleSelectAttachment(item) {
this.$emit('listenToSelect', item)
},
@ -166,14 +179,10 @@ export default {
this.pagination.size = pageSize
this.loadAttachments()
},
handleAttachmentUploadSuccess() {
this.$message.success('上传成功!')
this.loadAttachments()
},
onUploadClose() {
this.$refs.upload.handleClearFileList()
this.loadSkeleton()
this.loadAttachments()
this.handlePaginationChange(1, this.pagination.size)
},
handleJudgeMediaType(attachment) {
var mediaType = attachment.mediaType

View File

@ -23,7 +23,7 @@
<a-select
v-model="queryParam.status"
placeholder="请选择评论状态"
@change="handleQuery"
@change="handleQuery()"
>
<a-select-option
v-for="status in Object.keys(commentStatus)"
@ -41,11 +41,11 @@
<span class="table-page-search-submitButtons">
<a-button
type="primary"
@click="handleQuery"
@click="handleQuery()"
>查询</a-button>
<a-button
style="margin-left: 8px;"
@click="handleResetParam"
@click="handleResetParam()"
>重置</a-button>
</span>
</a-col>
@ -377,7 +377,9 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
showSizeChanger
@showSizeChange="handlePaginationChange"
@ -522,8 +524,8 @@ export default {
columns: this.type === 'posts' ? postColumns : sheetColumns,
replyCommentVisible: false,
pagination: {
current: 1,
pageSize: 10,
page: 1,
size: 10,
sort: null
},
queryParam: {
@ -559,8 +561,8 @@ export default {
methods: {
loadComments() {
this.loading = true
this.queryParam.page = this.pagination.current - 1
this.queryParam.size = this.pagination.pageSize
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
commentApi.queryComment(this.type, this.queryParam).then(response => {
this.comments = response.data.data.content
@ -569,9 +571,7 @@ export default {
})
},
handleQuery() {
this.queryParam.page = 0
this.pagination.current = 1
this.loadComments()
this.handlePaginationChange(1, this.pagination.size)
},
handleEditStatusClick(commentId, status) {
commentApi.updateStatus(this.type, commentId, status).then(response => {
@ -617,14 +617,14 @@ export default {
},
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.current = page
this.pagination.pageSize = pageSize
this.pagination.page = page
this.pagination.size = pageSize
this.loadComments()
},
handleResetParam() {
this.queryParam.keyword = null
this.queryParam.status = null
this.loadComments()
this.handlePaginationChange(1, this.pagination.size)
},
handlePublishMore() {
if (this.selectedRowKeys.length <= 0) {

View File

@ -36,8 +36,9 @@
<a-divider />
<div class="page-wrapper">
<a-pagination
:defaultPageSize="pagination.size"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
@change="handlePaginationChange"
></a-pagination>
</div>

View File

@ -300,12 +300,13 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="logPagination.page"
:total="logPagination.total"
:defaultPageSize="50"
:defaultPageSize="logPagination.size"
:pageSizeOptions="['50', '100','150','200']"
showSizeChanger
@showSizeChange="onPaginationChange"
@change="onPaginationChange"
@showSizeChange="handlePaginationChange"
@change="handlePaginationChange"
/>
</div>
</a-col>
@ -365,17 +366,14 @@ export default {
},
logs: [],
logPagination: {
current: 1,
pageSize: 50,
page: 1,
size: 50,
sort: null
},
logQueryParam: {
page: 0,
size: 50,
sort: null,
keyword: null,
categoryId: null,
status: null
sort: null
},
interval: null
}
@ -475,8 +473,8 @@ export default {
setTimeout(() => {
this.logsLoading = false
}, 500)
this.logQueryParam.page = this.logPagination.current - 1
this.logQueryParam.size = this.logPagination.pageSize
this.logQueryParam.page = this.logPagination.page - 1
this.logQueryParam.size = this.logPagination.size
this.logQueryParam.sort = this.logPagination.sort
logApi.pageBy(this.logQueryParam).then(response => {
this.logs = response.data.data.content
@ -495,10 +493,10 @@ export default {
window.open(response.data, '_blank')
})
},
onPaginationChange(page, pageSize) {
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.logPagination.current = page
this.logPagination.pageSize = pageSize
this.logPagination.page = page
this.logPagination.size = pageSize
this.loadLogs()
}
}

View File

@ -23,7 +23,7 @@
<a-select
v-model="queryParam.status"
placeholder="请选择文章状态"
@change="handleQuery"
@change="handleQuery()"
>
<a-select-option
v-for="status in Object.keys(postStatus)"
@ -41,7 +41,7 @@
<a-select
v-model="queryParam.categoryId"
placeholder="请选择分类"
@change="handleQuery"
@change="handleQuery()"
>
<a-select-option
v-for="category in categories"
@ -58,11 +58,11 @@
<span class="table-page-search-submitButtons">
<a-button
type="primary"
@click="handleQuery"
@click="handleQuery()"
>查询</a-button>
<a-button
style="margin-left: 8px;"
@click="handleResetParam"
@click="handleResetParam()"
>重置</a-button>
</span>
</a-col>
@ -478,7 +478,9 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
showSizeChanger
@showSizeChange="handlePaginationChange"
@ -586,8 +588,8 @@ export default {
return {
postStatus: postApi.postStatus,
pagination: {
current: 1,
pageSize: 10,
page: 1,
size: 10,
sort: null
},
queryParam: {
@ -601,7 +603,6 @@ export default {
//
columns,
selectedRowKeys: [],
selectedRows: [],
categories: [],
posts: [],
postsLoading: false,
@ -609,8 +610,7 @@ export default {
postCommentVisible: false,
selectedPost: {},
selectedTagIds: [],
selectedCategoryIds: [],
postComments: []
selectedCategoryIds: []
}
},
computed: {
@ -641,8 +641,8 @@ export default {
loadPosts() {
this.postsLoading = true
// Set from pagination
this.queryParam.page = this.pagination.current - 1
this.queryParam.size = this.pagination.pageSize
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
postApi.query(this.queryParam).then(response => {
this.posts = response.data.data.content
@ -672,20 +672,18 @@ export default {
},
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.current = page
this.pagination.pageSize = pageSize
this.pagination.page = page
this.pagination.size = pageSize
this.loadPosts()
},
handleResetParam() {
this.queryParam.keyword = null
this.queryParam.categoryId = null
this.queryParam.status = null
this.loadPosts()
this.handlePaginationChange(1, this.pagination.size)
},
handleQuery() {
this.queryParam.page = 0
this.pagination.current = 1
this.loadPosts()
this.handlePaginationChange(1, this.pagination.size)
},
handleEditStatusClick(postId, status) {
postApi.updateStatus(postId, status).then(response => {

View File

@ -465,7 +465,9 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
showSizeChanger
@showSizeChange="handlePaginationChange"
@ -568,8 +570,8 @@ export default {
data() {
return {
pagination: {
current: 1,
pageSize: 10,
page: 1,
size: 10,
sort: null
},
queryParam: {
@ -589,8 +591,7 @@ export default {
sheetCommentVisible: false,
internalSheets: [],
sheets: [],
menu: {},
sheetComments: []
menu: {}
}
},
computed: {
@ -620,8 +621,8 @@ export default {
methods: {
loadSheets() {
this.sheetsLoading = true
this.queryParam.page = this.pagination.current - 1
this.queryParam.size = this.pagination.pageSize
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
sheetApi.list(this.queryParam).then(response => {
this.sheets = response.data.data.content
@ -676,8 +677,8 @@ export default {
},
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.current = page
this.pagination.pageSize = pageSize
this.pagination.page = page
this.pagination.size = pageSize
this.loadSheets()
},
onSheetSettingsClose() {

View File

@ -25,7 +25,7 @@
<a-select
placeholder="请选择状态"
v-model="queryParam.type"
@change="loadJournals(true)"
@change="handleQuery()"
>
<a-select-option
v-for="type in Object.keys(journalType)"
@ -42,11 +42,11 @@
<span class="table-page-search-submitButtons">
<a-button
type="primary"
@click="loadJournals(true)"
@click="handleQuery()"
>查询</a-button>
<a-button
style="margin-left: 8px;"
@click="resetParam"
@click="resetParam()"
>重置</a-button>
</span>
</a-col>
@ -133,12 +133,13 @@
<div class="page-wrapper">
<a-pagination
class="pagination"
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
showSizeChanger
@showSizeChange="onPaginationChange"
@change="onPaginationChange"
@showSizeChange="handlePaginationChange"
@change="handlePaginationChange"
/>
</div>
</a-list>
@ -262,20 +263,20 @@ export default {
...mapGetters(['user'])
},
methods: {
loadJournals(isSearch) {
loadJournals() {
this.listLoading = true
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
if (isSearch) {
this.queryParam.page = 0
}
this.listLoading = true
journalApi.query(this.queryParam).then(response => {
this.journals = response.data.data.content
this.pagination.total = response.data.data.total
this.listLoading = false
})
},
handleQuery() {
this.handlePaginationChange(1, this.pagination.size)
},
handleNew() {
this.title = '新建'
this.visible = true
@ -344,7 +345,7 @@ export default {
}
this.visible = false
},
onPaginationChange(page, pageSize) {
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.page = page
this.pagination.size = pageSize
@ -357,7 +358,7 @@ export default {
resetParam() {
this.queryParam.keyword = null
this.queryParam.type = null
this.loadJournals()
this.handlePaginationChange(1, this.pagination.size)
}
}
}

View File

@ -31,7 +31,7 @@
<a-form-item label="分组">
<a-select
v-model="queryParam.team"
@change="loadPhotos(true)"
@change="handleQuery()"
>
<a-select-option
v-for="(item,index) in teams"
@ -48,11 +48,11 @@
<span class="table-page-search-submitButtons">
<a-button
type="primary"
@click="loadPhotos(true)"
@click="handleQuery()"
>查询</a-button>
<a-button
style="margin-left: 8px;"
@click="resetParam"
@click="resetParam()"
>重置</a-button>
</span>
</a-col>
@ -101,6 +101,7 @@
</a-row>
<div class="page-wrapper">
<a-pagination
:current="pagination.page"
:total="pagination.total"
:defaultPageSize="pagination.size"
:pageSizeOptions="['18', '36', '54','72','90','108']"
@ -324,20 +325,20 @@ export default {
this.loadTeams()
},
methods: {
loadPhotos(isSearch) {
loadPhotos() {
this.listLoading = true
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
this.queryParam.sort = this.pagination.sort
if (isSearch) {
this.queryParam.page = 0
}
this.listLoading = true
photoApi.query(this.queryParam).then(response => {
this.photos = response.data.data.content
this.pagination.total = response.data.data.total
this.listLoading = false
})
},
handleQuery() {
this.handlePaginationChange(1, this.pagination.size)
},
loadTeams() {
photoApi.listTeams().then(response => {
this.teams = response.data.data
@ -396,7 +397,7 @@ export default {
resetParam() {
this.queryParam.keyword = null
this.queryParam.team = null
this.loadPhotos()
this.handlePaginationChange(1, this.pagination.size)
this.loadTeams()
},
onDrawerClose() {