From 6044413384009fa763894246c4d9075280b0cd7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= <2178503051@qq.com>
Date: Sat, 30 May 2026 14:31:20 +0800
Subject: [PATCH] =?UTF-8?q?fix(wms):=20=E7=BB=9F=E4=B8=80=E5=8F=91?=
=?UTF-8?q?=E8=B4=A7=E5=8D=95=E5=AF=BC=E5=87=BA=E9=80=BB=E8=BE=91=E5=B9=B6?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97=E6=8B=A6=E6=88=AA=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
1. 替换原有的window.open弹窗导出为a标签下载,解决浏览器拦截弹窗的问题
2. 统一使用Date.now()替代new Date().getTime()优化代码
3. 新增释放URL对象的代码避免内存泄漏
4. 调整线圈页面批量移出发货单按钮的显示条件
---
klp-ui/src/views/wms/coil/panels/base.vue | 2 +-
.../wms/delivery/components/DugeWayBill1.vue | 17 +++++++----------
.../wms/delivery/components/DugeWayBill2.vue | 17 +++++++----------
.../wms/delivery/components/ZincWayBill1.vue | 17 +++++++----------
.../views/wms/delivery/components/wayBill.vue | 17 +++++++----------
.../views/wms/delivery/components/wayBill2.vue | 17 +++++++----------
6 files changed, 36 insertions(+), 51 deletions(-)
diff --git a/klp-ui/src/views/wms/coil/panels/base.vue b/klp-ui/src/views/wms/coil/panels/base.vue
index e5c49d1d..c2c86195 100644
--- a/klp-ui/src/views/wms/coil/panels/base.vue
+++ b/klp-ui/src/views/wms/coil/panels/base.vue
@@ -103,7 +103,7 @@
搜索
重置
导出
- 批量移出发货单
diff --git a/klp-ui/src/views/wms/delivery/components/DugeWayBill1.vue b/klp-ui/src/views/wms/delivery/components/DugeWayBill1.vue
index 3c97c812..ba9217ad 100644
--- a/klp-ui/src/views/wms/delivery/components/DugeWayBill1.vue
+++ b/klp-ui/src/views/wms/delivery/components/DugeWayBill1.vue
@@ -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 {
diff --git a/klp-ui/src/views/wms/delivery/components/DugeWayBill2.vue b/klp-ui/src/views/wms/delivery/components/DugeWayBill2.vue
index 12281830..ecded388 100644
--- a/klp-ui/src/views/wms/delivery/components/DugeWayBill2.vue
+++ b/klp-ui/src/views/wms/delivery/components/DugeWayBill2.vue
@@ -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 {
diff --git a/klp-ui/src/views/wms/delivery/components/ZincWayBill1.vue b/klp-ui/src/views/wms/delivery/components/ZincWayBill1.vue
index a29d9d7d..c40e9d26 100644
--- a/klp-ui/src/views/wms/delivery/components/ZincWayBill1.vue
+++ b/klp-ui/src/views/wms/delivery/components/ZincWayBill1.vue
@@ -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 {
diff --git a/klp-ui/src/views/wms/delivery/components/wayBill.vue b/klp-ui/src/views/wms/delivery/components/wayBill.vue
index 4d61c7ea..80445ca5 100644
--- a/klp-ui/src/views/wms/delivery/components/wayBill.vue
+++ b/klp-ui/src/views/wms/delivery/components/wayBill.vue
@@ -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 {
diff --git a/klp-ui/src/views/wms/delivery/components/wayBill2.vue b/klp-ui/src/views/wms/delivery/components/wayBill2.vue
index d6ba5d21..40d256cd 100644
--- a/klp-ui/src/views/wms/delivery/components/wayBill2.vue
+++ b/klp-ui/src/views/wms/delivery/components/wayBill2.vue
@@ -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 {