信用报告下载完成

This commit is contained in:
aixianling
2022-07-05 15:23:25 +08:00
parent 7ee368e6db
commit 2f351dbd68
2 changed files with 38 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
<div class="top-right">
<div class="top-right__top">
<h2 v-text="info.name "/>
<el-button type="primary" icon="iconfont iconDownload">下载报告</el-button>
<el-button type="primary" icon="iconfont iconDownload" @click="handleDownload(info.id)">下载报告</el-button>
</div>
<div class="top-right__bottom">
<ai-wrapper
@@ -110,6 +110,24 @@ export default {
this.info = res.data
}
})
},
handleDownload(id) {
this.$confirm("是否要下载报告?").then(() => {
this.instance.post("/appcreditreport/downloadCreditReport", null, {
params: {id, type: 1}
}).then(res => {
if (res?.data) {
const link = document.createElement('a')
link.style.display = 'none'
link.href = res.data
link.setAttribute('download', this.info.name + '信用报告.pdf')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
})
}).catch(() => 0)
}
},
props: {

View File

@@ -14,7 +14,7 @@
<ai-info-item label="结婚状态:" :value="info.maritalStatus"/>
<ai-info-item label="所在地区:" :value="info.address" isLine/>
</ai-wrapper>
<el-button type="primary">下载报告</el-button>
<el-button type="primary" icon="iconfont iconDownload" @click="handleDownload(info.id)">下载报告</el-button>
</div>
<el-tabs type="border-card" stretch>
<el-tab-pane label="基本信息">
@@ -115,6 +115,24 @@ export default {
this.info = res.data
}
})
},
handleDownload(id) {
this.$confirm("是否要下载报告?").then(() => {
this.instance.post("/appcreditreport/downloadCreditReport", null, {
params: {id, type: 0}
}).then(res => {
if (res?.data) {
const link = document.createElement('a')
link.style.display = 'none'
link.href = res.data
link.setAttribute('download', this.info.name + '信用报告.pdf')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
})
}).catch(() => 0)
}
},
props: {