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