fix(wms): 统一发货单导出逻辑并修复弹窗拦截问题

1. 替换原有的window.open弹窗导出为a标签下载,解决浏览器拦截弹窗的问题
2. 统一使用Date.now()替代new Date().getTime()优化代码
3. 新增释放URL对象的代码避免内存泄漏
4. 调整线圈页面批量移出发货单按钮的显示条件
This commit is contained in:
2026-05-30 14:31:20 +08:00
parent 3a0f729669
commit 6044413384
6 changed files with 36 additions and 51 deletions

View File

@@ -103,7 +103,7 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-download" size="mini" @click="handleNewExport" v-if="showNewExport">导出</el-button>
<el-button type="danger" plain icon="el-icon-close" size="mini" :disabled="multiple" :loading="buttonLoading"
<el-button type="danger" v-if="showWaybill" plain icon="el-icon-close" size="mini" :disabled="multiple" :loading="buttonLoading"
@click="handleBatchRemoveFromWaybill">批量移出发货单</el-button>
</el-form-item>

View File

@@ -477,16 +477,13 @@ export default {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const win = window.open(url, '_blank');
if (!win) {
this.$message.error('打印失败,请检查浏览器设置');
// const a = document.createElement('a');
// a.href = url;
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
}
const a = document.createElement('a');
a.href = url;
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
async exportExcel() {
try {

View File

@@ -475,16 +475,13 @@ export default {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const win = window.open(url, '_blank');
if (!win) {
this.$message.error('打印失败,请检查浏览器设置');
// const a = document.createElement('a');
// a.href = url;
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
}
const a = document.createElement('a');
a.href = url;
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
async exportExcel() {
try {

View File

@@ -477,16 +477,13 @@ export default {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const win = window.open(url, '_blank');
if (!win) {
this.$message.error('打印失败,请检查浏览器设置');
// const a = document.createElement('a');
// a.href = url;
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
}
const a = document.createElement('a');
a.href = url;
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
async exportExcel() {
try {

View File

@@ -476,16 +476,13 @@ export default {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const win = window.open(url, '_blank');
if (!win) {
this.$message.error('打印失败,请检查浏览器设置');
// const a = document.createElement('a');
// a.href = url;
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
}
const a = document.createElement('a');
a.href = url;
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
async exportExcelByXLSX() {
try {

View File

@@ -475,16 +475,13 @@ export default {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
const win = window.open(url, '_blank');
if (!win) {
this.$message.error('打印失败,请检查浏览器设置');
// const a = document.createElement('a');
// a.href = url;
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
}
const a = document.createElement('a');
a.href = url;
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
},
async exportExcelByXLSX() {
try {