|
@@ -34,7 +34,7 @@
|
|
|
:on-success="handleAvatarSuccess"
|
|
|
:before-upload="beforeAvatarUpload"
|
|
|
:accept="'image/*'"
|
|
|
- :file-list="form.bar_img_url"
|
|
|
+ :file-list="fileList"
|
|
|
list-type="picture-card"
|
|
|
action="/v1/upload/file"
|
|
|
multiple>
|
|
@@ -130,7 +130,8 @@ export default {
|
|
|
bar_place_reserve_start_time: '', // 座位预定开始时间
|
|
|
bar_place_reserve_end_time: '', // 座位预定结束时间
|
|
|
note: '' // 备注
|
|
|
- }
|
|
|
+ },
|
|
|
+ fileList: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -142,8 +143,11 @@ export default {
|
|
|
return isLt2M
|
|
|
},
|
|
|
handleRemove (file) {
|
|
|
- const { path } = file.response.data
|
|
|
- this.form.bar_img_url = this.form.bar_img_url.filter(item => item !== path)
|
|
|
+ let path = file.url
|
|
|
+ if (file.response && file.response.data) {
|
|
|
+ path = file.response.data.path
|
|
|
+ }
|
|
|
+ this.form.bar_img_url = this.form.bar_img_url.filter(item => item !== path.replace(/^\/\//, ''))
|
|
|
},
|
|
|
handleAvatarSuccess (res) {
|
|
|
if (res.code === 200) {
|
|
@@ -172,10 +176,19 @@ export default {
|
|
|
mounted () {
|
|
|
if (this.exData.id) {
|
|
|
this.$set(this.form, 'id', this.exData.id)
|
|
|
+ this.fileList = this.exData.bar_img_url.map(item => {
|
|
|
+ return {
|
|
|
+ name: '',
|
|
|
+ url: '//' + item // todo 这里补全了地址
|
|
|
+ }
|
|
|
+ })
|
|
|
for (const key in this.exData) {
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
- const value = this.exData[key]
|
|
|
+ let value = this.exData[key]
|
|
|
if ((Array.isArray(value) && value.length > 0) || value) {
|
|
|
+ if (key === 'bar_status') {
|
|
|
+ value = value.toString()
|
|
|
+ }
|
|
|
this.$set(this.form, key, value)
|
|
|
}
|
|
|
}
|