This commit is contained in:
itcast 2025-12-12 21:30:44 +08:00
parent 25de7d3510
commit de41f8a4cf
5 changed files with 8 additions and 41 deletions

View File

@ -255,7 +255,7 @@ export default {
//
onHandleDownload() {
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`)
this.download('material-mall/decChange/exportDetailsRepair', { id: this.recordId }, `维修记录单.xlsx`)
},
//

View File

@ -262,42 +262,9 @@ export default {
)
},
// PDF
//
onHandleDownload() {
this.downloadPDF('material-mall/decChange/exportDetails', { id: this.recordId }, '出库记录单.pdf');
},
// PDF
async downloadPDF(url, params, fileName) {
try {
// responseTypeblob
const response = await this.$axios({
method: 'post',
url: url,
data: params, // POST
responseType: 'blob', // blob
headers: {
'Content-Type': 'application/json;charset=UTF-8' //
}
});
//
const blob = new Blob([response.data], { type: 'application/pdf' });
const downloadUrl = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = fileName; //
document.body.appendChild(link);
link.click(); //
//
document.body.removeChild(link);
window.URL.revokeObjectURL(downloadUrl);
this.$message.success('PDF导出成功');
} catch (error) {
this.$message.error('PDF导出失败' + (error.message || '未知错误'));
}
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`)
},
//

View File

@ -265,7 +265,7 @@ export default {
//
onHandleDownload() {
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`)
this.download('material-mall/decChange/exportDetailsRetire', { id: this.recordId }, `退役记录单.xlsx`)
},
//

View File

@ -255,7 +255,7 @@ export default {
//
onHandleDownload() {
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `库记录单.xlsx`)
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `退库记录单.xlsx`)
},
//

View File

@ -79,7 +79,7 @@
</el-col>
<el-button
icon="el-icon-download"
style="margin-left: 1250px"
style="margin-left: 1320px"
type="primary"
size="mini"
@click="handleExport"