mirror of https://github.com/halo-dev/halo
Support attachment search.
parent
039b274bc1
commit
2120e8aa9e
|
@ -5,11 +5,11 @@ const baseUrl = '/api/admin/attachments'
|
||||||
|
|
||||||
const attachmentApi = {}
|
const attachmentApi = {}
|
||||||
|
|
||||||
attachmentApi.list = pagination => {
|
attachmentApi.query = params => {
|
||||||
return service({
|
return service({
|
||||||
url: baseUrl,
|
url: baseUrl,
|
||||||
method: 'get',
|
params: params,
|
||||||
params: pagination
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<a-row :gutter="48">
|
<a-row :gutter="48">
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
<a-form-item label="关键词">
|
<a-form-item label="关键词">
|
||||||
<a-input/>
|
<a-input v-model="queryParam.keyword"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
<span class="table-page-search-submitButtons">
|
<span class="table-page-search-submitButtons">
|
||||||
<a-button type="primary">查询</a-button>
|
<a-button type="primary" @click="loadAttachments">查询</a-button>
|
||||||
<a-button style="margin-left: 8px;">重置</a-button>
|
<a-button style="margin-left: 8px;">重置</a-button>
|
||||||
</span>
|
</span>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -63,10 +63,11 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row type="flex" justify="end">
|
<a-row type="flex" justify="end">
|
||||||
<a-pagination
|
<a-pagination
|
||||||
:defaultPageSize="pagination.size"
|
|
||||||
:total="pagination.total"
|
:total="pagination.total"
|
||||||
|
:pageSizeOptions="['18', '36', '54']"
|
||||||
|
showSizeChanger
|
||||||
@change="handlePaginationChange"
|
@change="handlePaginationChange"
|
||||||
></a-pagination>
|
/>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-modal title="上传附件" v-model="uploadVisible" :footer="null">
|
<a-modal title="上传附件" v-model="uploadVisible" :footer="null">
|
||||||
<a-upload-dragger
|
<a-upload-dragger
|
||||||
|
@ -190,9 +191,15 @@ export default {
|
||||||
attachments: [],
|
attachments: [],
|
||||||
editable: false,
|
editable: false,
|
||||||
pagination: {
|
pagination: {
|
||||||
page: 1,
|
current: 1,
|
||||||
|
pageSize: 18,
|
||||||
|
sort: null
|
||||||
|
},
|
||||||
|
queryParam: {
|
||||||
|
page: 0,
|
||||||
size: 18,
|
size: 18,
|
||||||
sort: ''
|
sort: null,
|
||||||
|
keyword: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -201,9 +208,10 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadAttachments() {
|
loadAttachments() {
|
||||||
const pagination = Object.assign({}, this.pagination)
|
this.queryParam.page = this.pagination.current - 1
|
||||||
pagination.page--
|
this.queryParam.size = this.pagination.pageSize
|
||||||
attachmentApi.list(pagination).then(response => {
|
this.queryParam.sort = this.pagination.sort
|
||||||
|
attachmentApi.query(this.queryParam).then(response => {
|
||||||
this.attachments = response.data.data.content
|
this.attachments = response.data.data.content
|
||||||
this.pagination.total = response.data.data.total
|
this.pagination.total = response.data.data.total
|
||||||
})
|
})
|
||||||
|
@ -262,8 +270,9 @@ export default {
|
||||||
this.drawerVisible = false
|
this.drawerVisible = false
|
||||||
},
|
},
|
||||||
handlePaginationChange(page, pageSize) {
|
handlePaginationChange(page, pageSize) {
|
||||||
this.pagination.page = page
|
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
|
||||||
this.pagination.size = pageSize
|
this.pagination.current = page
|
||||||
|
this.pagination.pageSize = pageSize
|
||||||
this.loadAttachments()
|
this.loadAttachments()
|
||||||
},
|
},
|
||||||
handleUpload(option) {
|
handleUpload(option) {
|
||||||
|
|
|
@ -132,7 +132,6 @@ export default {
|
||||||
size: 10,
|
size: 10,
|
||||||
sort: null,
|
sort: null,
|
||||||
keyword: null,
|
keyword: null,
|
||||||
categoryId: null,
|
|
||||||
status: null
|
status: null
|
||||||
},
|
},
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
|
|
Loading…
Reference in New Issue