Browse Source

完善还款计划表--详情页面增加下载

master
yunuo970428 1 year ago
parent
commit
d4179c129b
  1. 9
      anrui-riskcenter-ui/src/api/repaymentschedule/repaymentschedule.js
  2. 41
      anrui-riskcenter-ui/src/views/repaymentschedule/repaymentschedule.vue

9
anrui-riskcenter-ui/src/api/repaymentschedule/repaymentschedule.js

@ -42,5 +42,14 @@ export default {
method: 'get',
params: data
})
},
// 下载还款计划表
createRepaymentVoucher: function(data) {
return request({
url: '/riskcenter/v1/loanrepaymentschedule/createRepaymentVoucher',
method: 'post',
data: data,
headers: { 'Content-Type': 'application/json' }
})
}
}

41
anrui-riskcenter-ui/src/views/repaymentschedule/repaymentschedule.vue

@ -91,6 +91,7 @@ import req from '@/api/repaymentschedule/repaymentschedule'
import { getButtonPermissions } from '@/api/Common/dictcommons'
import repaymentscheduleAdd from './repaymentscheduleAdd'
import repaymentscheduleInfo from './repaymentscheduleInfo'
import { getStorage } from '@/utils/auth'
export default {
name: 'RepaymentSchedule',
@ -112,6 +113,13 @@ export default {
btnKey: 'toEdit',
btnLabel: '办理'
},
{
type: 'primary',
size: 'small',
icon: '',
btnKey: 'downloadRepaymentPlan',
btnLabel: '下载还款计划表'
},
{
type: 'info',
size: 'small',
@ -183,6 +191,9 @@ export default {
case 'toEdit':
this.toEdit()
break
case 'downloadRepaymentPlan':
this.downloadRepaymentPlan()
break
case 'doClose':
this.doClose()
break
@ -261,6 +272,36 @@ export default {
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' })
}
},
downloadRepaymentPlan() {
if (this.sids.length > 0) {
req.createRepaymentVoucher(this.sids).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(() => {})
} else {
this.$message({ showClose: true, type: 'error', message: '请至少选择一条记录进行下载操作' })
}
},
toInfo(row) {
this.viewState = 3
this.$refs['divInfo'].showInfo(row)

Loading…
Cancel
Save