mirror of https://github.com/halo-dev/halo-admin
Refactor query methods
parent
a835758b7f
commit
2158c12bff
|
@ -56,7 +56,7 @@
|
|||
<span class="table-page-search-submitButtons">
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="loadAttachments(true)"
|
||||
@click="handleQuery"
|
||||
>查询</a-button>
|
||||
<a-button
|
||||
style="margin-left: 8px;"
|
||||
|
@ -196,13 +196,10 @@ export default {
|
|||
this.loadMediaTypes()
|
||||
},
|
||||
methods: {
|
||||
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
|
||||
}
|
||||
this.listLoading = true
|
||||
attachmentApi.query(this.queryParam).then(response => {
|
||||
this.attachments = response.data.data.content
|
||||
|
@ -238,6 +235,10 @@ export default {
|
|||
this.queryParam.attachmentType = null
|
||||
this.loadAttachments()
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParam.page = 0
|
||||
this.loadAttachments()
|
||||
},
|
||||
handleDelete(attachment) {
|
||||
this.loadAttachments()
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<span class="table-page-search-submitButtons">
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="loadPosts(true)"
|
||||
@click="handleQuery"
|
||||
>查询</a-button>
|
||||
<a-button
|
||||
style="margin-left: 8px;"
|
||||
|
@ -275,15 +275,12 @@ export default {
|
|||
this.loadPosts()
|
||||
},
|
||||
methods: {
|
||||
loadPosts(isSearch) {
|
||||
loadPosts() {
|
||||
this.postsLoading = true
|
||||
// Set from pagination
|
||||
this.queryParam.page = this.pagination.current - 1
|
||||
this.queryParam.size = this.pagination.pageSize
|
||||
this.queryParam.sort = this.pagination.sort
|
||||
if (isSearch) {
|
||||
this.queryParam.page = 0
|
||||
}
|
||||
postApi.query(this.queryParam).then(response => {
|
||||
this.posts = response.data.data.content
|
||||
this.pagination.total = response.data.data.total
|
||||
|
@ -321,6 +318,10 @@ export default {
|
|||
this.queryParam.status = null
|
||||
this.loadPosts()
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParam.page = 0
|
||||
this.loadPosts()
|
||||
},
|
||||
handleEditStatusClick(postId, status) {
|
||||
postApi.updateStatus(postId, status).then(response => {
|
||||
this.$message.success('操作成功!')
|
||||
|
|
Loading…
Reference in New Issue