Show type property for attachment detail.

pull/9/head
ruibaby 6 years ago
parent c99282074e
commit 51f575f2fd

@ -56,4 +56,26 @@ attachmentApi.upload = (formData, uploadProgress, cancelToken) => {
}) })
} }
attachmentApi.type = {
LOCAL: {
type: 'local',
text: '本地'
},
SMMS: {
type: 'smms',
text: 'SM.MS'
},
UPYUN: {
type: 'upyun',
text: '又拍云'
},
QNYUN: {
type: 'qnyun',
text: '七牛云'
},
ALIYUN: {
type: 'aliyun',
text: '阿里云'
}
}
export default attachmentApi export default attachmentApi

@ -14,18 +14,22 @@
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-form-item label="存储位置"> <a-form-item label="存储位置">
<a-select v-model="queryParam.attachmentType"> <a-select v-model="queryParam.attachmentType">
<a-select-option value="local">本地</a-select-option> <a-select-option
<a-select-option value="smms">SM.MS</a-select-option> v-for="item in Object.keys(attachmentType)"
<a-select-option value="upyun">又拍云</a-select-option> :key="item"
<a-select-option value="qnyun">七牛云</a-select-option> :value="item"
<a-select-option value="aliyun">阿里云</a-select-option> >{{ attachmentType[item].text }}</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-form-item label="文件类型"> <a-form-item label="文件类型">
<a-select v-model="queryParam.mediaType"> <a-select v-model="queryParam.mediaType">
<a-select-option v-for="(item,index) in mediaTypes" :key="index" :value="item">{{ item }}</a-select-option> <a-select-option
v-for="(item,index) in mediaTypes"
:key="index"
:value="item"
>{{ item }}</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -46,7 +50,7 @@
<a-col :span="24"> <a-col :span="24">
<a-list <a-list
:grid="{ gutter: 12, xs: 1, sm: 2, md: 4, lg: 6, xl: 6, xxl: 6 }" :grid="{ gutter: 12, xs: 1, sm: 2, md: 4, lg: 6, xl: 6, xxl: 6 }"
:dataSource="attachments" :dataSource="formattedDatas"
> >
<a-list-item slot="renderItem" slot-scope="item, index" :key="index"> <a-list-item slot="renderItem" slot-scope="item, index" :key="index">
<a-card :bodyStyle="{ padding: 0 }" hoverable @click="showDetailDrawer(item)"> <a-card :bodyStyle="{ padding: 0 }" hoverable @click="showDetailDrawer(item)">
@ -103,6 +107,7 @@ export default {
mixins: [mixin, mixinDevice], mixins: [mixin, mixinDevice],
data() { data() {
return { return {
attachmentType: attachmentApi.type,
uploadVisible: false, uploadVisible: false,
selectAttachment: {}, selectAttachment: {},
attachments: [], attachments: [],
@ -125,6 +130,14 @@ export default {
drawerVisiable: false drawerVisiable: false
} }
}, },
computed: {
formattedDatas() {
return this.attachments.map(attachment => {
attachment.typeProperty = this.attachmentType[attachment.type]
return attachment
})
}
},
created() { created() {
this.loadAttachments() this.loadAttachments()
this.loadMediaTypes() this.loadMediaTypes()

@ -36,6 +36,11 @@
<span slot="title">附件类型</span> <span slot="title">附件类型</span>
</a-list-item-meta> </a-list-item-meta>
</a-list-item> </a-list-item>
<a-list-item>
<a-list-item-meta :description="attachment.typeProperty">
<span slot="title">存储位置</span>
</a-list-item-meta>
</a-list-item>
<a-list-item> <a-list-item>
<a-list-item-meta> <a-list-item-meta>
<template slot="description"> <template slot="description">

@ -30,7 +30,7 @@
<a-col :span="24"> <a-col :span="24">
<div <div
class="attach-item" class="attach-item"
v-for="(item, index) in attachments" v-for="(item, index) in formattedDatas"
:key="index" :key="index"
@click="showDetailDrawer(item)" @click="showDetailDrawer(item)"
> >
@ -112,6 +112,7 @@ export default {
}, },
data() { data() {
return { return {
attachmentType: attachmentApi.type,
detailVisiable: false, detailVisiable: false,
attachmentDrawerVisible: false, attachmentDrawerVisible: false,
uploadVisible: false, uploadVisible: false,
@ -126,6 +127,14 @@ export default {
attachmentUploadHandler: attachmentApi.upload attachmentUploadHandler: attachmentApi.upload
} }
}, },
computed: {
formattedDatas() {
return this.attachments.map(attachment => {
attachment.typeProperty = this.attachmentType[attachment.type]
return attachment
})
}
},
created() { created() {
this.loadSkeleton() this.loadSkeleton()
this.loadAttachments() this.loadAttachments()

Loading…
Cancel
Save