|
|
@ -421,33 +421,33 @@ export default { |
|
|
|
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.temp.createOrgSid = res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
this.temp.sid = this.sids[0] |
|
|
|
this.temp.useOrgSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) |
|
|
|
this.temp.userSid = window.sessionStorage.getItem('userSid') |
|
|
|
req.printSettlement(this.temp).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() |
|
|
|
this.temp.sid = this.sids[0] |
|
|
|
this.temp.useOrgSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) |
|
|
|
this.temp.userSid = window.sessionStorage.getItem('userSid') |
|
|
|
req.printSettlement(this.temp).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() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|