|
@@ -173,13 +173,15 @@ export default {
|
|
|
{ slotName: 'systemInfo' }
|
|
|
],
|
|
|
formQuery: {},
|
|
|
- id: null
|
|
|
+ id: null,
|
|
|
+ itemData: null
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
async open (item) {
|
|
|
this.show = true
|
|
|
this.loading = false
|
|
|
+ this.itemData = null
|
|
|
this.formQuery = this.formItems.reduce((res, val) => {
|
|
|
if (val.key) {
|
|
|
res[val.key] = null
|
|
@@ -193,6 +195,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
this.id = item.id
|
|
|
+ this.itemData = { ...item }
|
|
|
Object.keys(this.formQuery).forEach(key => {
|
|
|
this.formQuery[key] = item[key] || null
|
|
|
})
|
|
@@ -202,10 +205,11 @@ export default {
|
|
|
this.previewUrl = null
|
|
|
return
|
|
|
}
|
|
|
- this.file = item.image_path
|
|
|
+ // this.file = item.image_path
|
|
|
try {
|
|
|
const { data } = await getBusinessCardImage(item.image_path)
|
|
|
- console.log(data)
|
|
|
+ this.file = data
|
|
|
+ this.previewUrl = new Blob([data], { type: 'image/jpeg' })
|
|
|
this.handlePreview(this.file)
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
@@ -234,6 +238,7 @@ export default {
|
|
|
try {
|
|
|
const { data } = await businessCardParse(query)
|
|
|
this.id = data.id
|
|
|
+ this.itemData = { ...data }
|
|
|
Object.keys(this.formQuery).forEach(key => {
|
|
|
this.formQuery[key] = data[key] || null
|
|
|
})
|
|
@@ -249,8 +254,9 @@ export default {
|
|
|
this.$snackbar.error('ID获取异常')
|
|
|
return
|
|
|
}
|
|
|
+ Object.assign(this.itemData, this.formQuery)
|
|
|
try {
|
|
|
- await updateBusinessCardStatus(this.formQuery, this.id)
|
|
|
+ await updateBusinessCardStatus(this.itemData, this.id)
|
|
|
this.$snackbar.success('更新成功')
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|