|
|
@ -4,7 +4,7 @@ |
|
|
|
<div class="tab-header webtop"> |
|
|
|
<div>盘库报告</div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="settle()">下载pdf</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="downLoadPDF()">下载pdf</el-button> |
|
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -43,7 +43,7 @@ |
|
|
|
|
|
|
|
<div class="title titleOne"> |
|
|
|
<div>总体盘点情况</div> |
|
|
|
<el-button type="primary" size="mini" class="btntopblueline" @click="seleMaintenance()">明细下载</el-button> |
|
|
|
<el-button type="primary" size="mini" class="btntopblueline" @click="downLoadDetail()">明细下载</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex;flex-direction: row;align-items: center; |
|
|
@ -192,6 +192,77 @@ |
|
|
|
this.formobj = {} |
|
|
|
this.submitdisabled = false |
|
|
|
this.$emit('doback') |
|
|
|
}, |
|
|
|
downLoadPDF() { |
|
|
|
|
|
|
|
const loading = this.$loading({ |
|
|
|
lock: true, |
|
|
|
text: 'Loading', |
|
|
|
spinner: 'el-icon-loading', |
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
}) |
|
|
|
req.downloadPDF({ |
|
|
|
sid: this.formobj.sid |
|
|
|
}).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
loading.close() |
|
|
|
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(() => { |
|
|
|
console.log(22222222); |
|
|
|
loading.close() |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
downLoadDetail() { |
|
|
|
|
|
|
|
const loading = this.$loading({ |
|
|
|
lock: true, |
|
|
|
text: 'Loading', |
|
|
|
spinner: 'el-icon-loading', |
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
}) |
|
|
|
req.downloadExcel({ |
|
|
|
sid: this.formobj.sid |
|
|
|
}).then((resp) => { |
|
|
|
loading.close() |
|
|
|
const blob = new Blob([resp], { |
|
|
|
type: 'application/vnd.ms-excel' |
|
|
|
}) |
|
|
|
const fileName = '总体盘库明细' + '.xls' |
|
|
|
const elink = document.createElement('a') |
|
|
|
elink.download = fileName |
|
|
|
elink.style.display = 'nonde' |
|
|
|
elink.href = URL.createObjectURL(blob) |
|
|
|
document.body.appendChild(elink) |
|
|
|
elink.click() |
|
|
|
URL.revokeObjectURL(elink.href) |
|
|
|
document.body.removeChild(elink) |
|
|
|
}).catch(() => { |
|
|
|
loading.close() |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|