diff --git a/anrui-riskcenter-ui/src/api/returntothewarehouse/returntothewarehouse.js b/anrui-riskcenter-ui/src/api/returntothewarehouse/returntothewarehouse.js index 897af26b63..8f58fb9390 100644 --- a/anrui-riskcenter-ui/src/api/returntothewarehouse/returntothewarehouse.js +++ b/anrui-riskcenter-ui/src/api/returntothewarehouse/returntothewarehouse.js @@ -25,6 +25,13 @@ export default { params: data }) }, + createPdf: function(data) { + return request({ + url: '/riskcenter/v1/loanoutboundapply/createPdf', + method: 'post', + params: data + }) + }, // 提交流程 submit: function(params) { return request({ diff --git a/anrui-riskcenter-ui/src/views/returntothewarehouse/returntothewarehouse.vue b/anrui-riskcenter-ui/src/views/returntothewarehouse/returntothewarehouse.vue index 17bf0bccda..f7b98647c3 100644 --- a/anrui-riskcenter-ui/src/views/returntothewarehouse/returntothewarehouse.vue +++ b/anrui-riskcenter-ui/src/views/returntothewarehouse/returntothewarehouse.vue @@ -79,6 +79,7 @@ @@ -338,6 +339,32 @@ export default { this.viewState = 4 this.$refs['divInfo'].showInfo(row) }, + toDownload(row) { + req.createPdf({ sid: row.sid, userName: window.sessionStorage.getItem('name') }).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(() => {}) + }, // 修改、编辑、详情返回列表页面 resetState() { this.viewState = 1