|
|
@ -35,6 +35,10 @@ |
|
|
|
<el-button class="diy-button--add" size="small" @click="handleAdd" |
|
|
|
>新增</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
class="diy-button--export" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('room')">下载模板</el-button> |
|
|
|
<el-upload |
|
|
|
ref="upload" |
|
|
|
class="upload-btn" |
|
|
@ -232,6 +236,35 @@ export default { |
|
|
|
this.getTableData(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async handleExportModule () { |
|
|
|
let url = "/heart/iccommunityselforganization/import-template-download" |
|
|
|
|
|
|
|
|
|
|
|
let params = {} |
|
|
|
await this.$http |
|
|
|
.post(url, params) |
|
|
|
.then(res => { |
|
|
|
// this.download(res.data, title + '.xls') |
|
|
|
if (res.headers["content-disposition"]) { |
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
console.log('filename', fileName) |
|
|
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) |
|
|
|
var url = window.URL.createObjectURL(blob) |
|
|
|
var aLink = document.createElement('a') |
|
|
|
aLink.style.display = 'none' |
|
|
|
aLink.href = url |
|
|
|
aLink.setAttribute('download', fileName) |
|
|
|
document.body.appendChild(aLink) |
|
|
|
aLink.click() |
|
|
|
document.body.removeChild(aLink) //下载完成移除元素 |
|
|
|
window.URL.revokeObjectURL(url) //释放掉blob对象 |
|
|
|
} else this.$message.error('下载失败') |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log('err', err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 上传大图标成功 |
|
|
|
handleExcelSuccess(res, file) { |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|