Browse Source

下载房屋二维码

master
wanggongfeng 3 years ago
parent
commit
ec7c5e86cf
  1. 16
      src/views/modules/personroom/epidemicbuildingunit.vue

16
src/views/modules/personroom/epidemicbuildingunit.vue

@ -83,7 +83,7 @@
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<!-- <el-button type="text" size="small" @click="downloadMa(scope.row.id)">下载房屋二维码</el-button>--> <el-button type="text" size="small" @click="downloadMa(scope.row.id)">下载房屋二维码</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -148,7 +148,8 @@ export default {
roomUseArr: [], roomUseArr: [],
dataForm: { dataForm: {
id: '' id: ''
} },
uploadUrl: ''
} }
}, },
components: { components: {
@ -256,10 +257,13 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
downloadMa (id) { downloadMa (id) {
this.$http.post(`/custom/epidemicbuildingunit/createHouseQrcode`, {id: id}).then(({ data: res }) => { this.$http.post(`/custom/epidemicbuildingunit/createHouseQrcode`, {id: id}, { responseType: 'blob' }).then(res => {
if (res.code !== 0) { let fileName = '房屋二维码.png'
return this.$message.error(res.msg) let objectUrl = URL.createObjectURL(new Blob([res.data]))
} const link = document.createElement('a')
link.download = decodeURI(fileName)
link.href = objectUrl
link.click()
}).catch(() => {}) }).catch(() => {})
}, },
// //

Loading…
Cancel
Save