Fixed attachment drawer error.

pull/3445/head
ruibaby 2019-04-24 23:06:35 +08:00
parent 8e66102aa1
commit c25508e2bb
2 changed files with 16 additions and 12 deletions

View File

@ -224,14 +224,6 @@ export default {
showUploadModal() { showUploadModal() {
this.uploadVisible = true this.uploadVisible = true
}, },
handleChange(info) {
const status = info.file.status
if (status === 'done') {
this.$message.success(`${info.file.name} 文件上传成功`)
} else if (status === 'error') {
this.$message.error(`${info.file.name} 文件上传失败`)
}
},
handleUploadSuccess() { handleUploadSuccess() {
this.loadAttachments() this.loadAttachments()
this.loadMediaTypes() this.loadMediaTypes()

View File

@ -14,6 +14,8 @@
> >
<a-input-search <a-input-search
placeholder="搜索附件" placeholder="搜索附件"
v-model="queryParam.keyword"
@search="loadAttachments(true)"
enterButton enterButton
/> />
</a-row> </a-row>
@ -122,6 +124,12 @@ export default {
size: 10, size: 10,
sort: '' sort: ''
}, },
queryParam: {
page: 0,
size: 18,
sort: null,
keyword: null
},
attachments: [], attachments: [],
selectedAttachment: {}, selectedAttachment: {},
attachmentUploadHandler: attachmentApi.upload attachmentUploadHandler: attachmentApi.upload
@ -161,10 +169,14 @@ export default {
this.$log.debug('Show detail of', attachment) this.$log.debug('Show detail of', attachment)
this.detailVisiable = true this.detailVisiable = true
}, },
loadAttachments() { loadAttachments(isSearch) {
const pagination = Object.assign({}, this.pagination) this.queryParam.page = this.pagination.page - 1
pagination.page-- this.queryParam.size = this.pagination.size
attachmentApi.query(pagination).then(response => { 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.attachments = response.data.data.content
this.pagination.total = response.data.data.total this.pagination.total = response.data.data.total
}) })