From 7180fca011810561fb26117bd16261d4277f1fae Mon Sep 17 00:00:00 2001 From: yunuo970428 <405378304@qq.com> Date: Fri, 30 Aug 2024 17:20:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BB=93=E6=B8=85=E8=BD=A6?= =?UTF-8?q?=E8=BE=86=E5=8F=B0=E8=B4=A6--=E5=A2=9E=E5=8A=A0=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settlethevehicleaccount.js | 7 ++++ .../settlethevehicleaccount.vue | 36 +++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/anrui-riskcenter-ui/src/api/settlethevehicleaccount/settlethevehicleaccount.js b/anrui-riskcenter-ui/src/api/settlethevehicleaccount/settlethevehicleaccount.js index 5663710e8a..ffc28dc30a 100644 --- a/anrui-riskcenter-ui/src/api/settlethevehicleaccount/settlethevehicleaccount.js +++ b/anrui-riskcenter-ui/src/api/settlethevehicleaccount/settlethevehicleaccount.js @@ -9,5 +9,12 @@ export default { data: params, headers: { 'Content-Type': 'application/json' } }) + }, + downloadPdf: function(data) { + return request({ + url: '/riskcenter/v1/LoanSettleApply/downloadPdf', + method: 'post', + params: data + }) } } diff --git a/anrui-riskcenter-ui/src/views/settlethevehicleaccount/settlethevehicleaccount.vue b/anrui-riskcenter-ui/src/views/settlethevehicleaccount/settlethevehicleaccount.vue index 59012dc691..5c9b9d56f6 100644 --- a/anrui-riskcenter-ui/src/views/settlethevehicleaccount/settlethevehicleaccount.vue +++ b/anrui-riskcenter-ui/src/views/settlethevehicleaccount/settlethevehicleaccount.vue @@ -49,6 +49,11 @@ + + + @@ -58,8 +63,8 @@ - - + + @@ -82,6 +87,7 @@ import pageye from '@/components/pagination/pageye' import ButtonBar from '@/components/ButtonBar' import req from '@/api/settlethevehicleaccount/settlethevehicleaccount' import { typeValues } from '@/api/Common/dictcommons' +import { getStorage } from '@/utils/auth' export default { name: 'SettleTheVehicleAccount', @@ -223,6 +229,32 @@ export default { } this.getList() }, + toDownload(row) { + req.downloadPdf({ sid: row.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(() => {}) + }, toInfo(row) { this.viewState = 4 this.$refs['divInfo'].showInfo(row)