Browse Source

完善划扣--详情页面增加下载

master
yunuo970428 1 year ago
parent
commit
e63bcf9ff8
  1. 7
      anrui-riskcenter-ui/src/api/deduct/deduct.js
  2. 28
      anrui-riskcenter-ui/src/views/deduct/deductInfo.vue

7
anrui-riskcenter-ui/src/api/deduct/deduct.js

@ -40,6 +40,13 @@ export default {
headers: { 'Content-Type': 'application/json' }
})
},
buckleCreatePdf: function(data) {
return request({
url: '/riskcenter/v1/loanbuckleapply/buckleCreatePdf',
method: 'post',
params: data
})
},
// 提交流程
submit: function(params) {
return request({

28
anrui-riskcenter-ui/src/views/deduct/deductInfo.vue

@ -4,6 +4,7 @@
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" @click="handleDownload()">下载</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
@ -69,6 +70,7 @@
<script>
import req from '@/api/deduct/deduct'
import { getStorage } from '@/utils/auth'
export default {
name: 'DeductInfo',
@ -115,6 +117,32 @@ export default {
}
})
},
handleDownload() {
req.buckleCreatePdf({ sid: this.formobj.sid }).then((res) => {
if (res.success) {
var xhr = new XMLHttpRequest()
xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + res.data + '&outFileName=' + '月还划扣', true)
xhr.setRequestHeader('token', getStorage())
xhr.responseType = 'blob'
xhr.onload = function(e) {
//
var blob = this.response
var filename = '月还划扣.pdf'
var a = document.createElement('a')
// blob.type="application/octet-stream";
// url
var url = URL.createObjectURL(blob)
a.href = url
a.download = filename
a.click()
// URL
window.URL.revokeObjectURL(url)
}
//
xhr.send()
}
}).catch(() => {})
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.formobj = {

Loading…
Cancel
Save