Support photo search by team.

pull/40/head
ruibaby 2019-09-06 12:00:33 +08:00
parent 1f9e1de998
commit a2935dadd9
3 changed files with 34 additions and 6 deletions

View File

@ -35,4 +35,11 @@ photoApi.delete = photoId => {
})
}
photoApi.listTeams = () => {
return service({
url: `${baseUrl}/teams`,
method: 'get'
})
}
export default photoApi

View File

@ -252,6 +252,7 @@ export default {
this.queryParam.mediaType = null
this.queryParam.attachmentType = null
this.loadAttachments()
this.loadMediaTypes()
},
handleQuery() {
this.queryParam.page = 0

View File

@ -9,7 +9,10 @@
:span="24"
class="search-box"
>
<a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<a-card
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
@ -26,9 +29,15 @@
:sm="24"
>
<a-form-item label="分组">
<a-select>
<a-select-option value="11">11</a-select-option>
<a-select-option value="22">22</a-select-option>
<a-select
v-model="queryParam.team"
@change="loadPhotos(true)"
>
<a-select-option
v-for="(item,index) in teams"
:key="index"
:value="item"
>{{ item }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
@ -80,7 +89,7 @@
</div>
<a-card-meta>
<ellipsis
:length="isMobile()?36:18"
:length="isMobile()?36:16"
tooltip
slot="description"
>{{ item.name }}</ellipsis>
@ -289,6 +298,7 @@ export default {
thumDrawerVisible: false,
photo: {},
photos: [],
teams: [],
editable: false,
pagination: {
page: 1,
@ -299,12 +309,14 @@ export default {
page: 0,
size: 18,
sort: null,
keyword: null
keyword: null,
team: null
}
}
},
created() {
this.loadPhotos()
this.loadTeams()
},
methods: {
loadPhotos(isSearch) {
@ -321,6 +333,11 @@ export default {
this.listLoading = false
})
},
loadTeams() {
photoApi.listTeams().then(response => {
this.teams = response.data.data
})
},
handleCreateOrUpdate() {
if (this.photo.id) {
photoApi.update(this.photo.id, this.photo).then(response => {
@ -365,11 +382,14 @@ export default {
},
selectPhotoThumb(data) {
this.photo.url = encodeURI(data.path)
this.photo.thumbnail = encodeURI(data.thumbPath)
this.thumDrawerVisible = false
},
resetParam() {
this.queryParam.keyword = null
this.queryParam.team = null
this.loadPhotos()
this.loadTeams()
},
onDrawerClose() {
this.drawerVisible = false