|
|
@ -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) |
|
|
|