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 export default photoApi

View File

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

View File

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