fix(wms): 统一发货单导出逻辑并修复弹窗拦截问题
1. 替换原有的window.open弹窗导出为a标签下载,解决浏览器拦截弹窗的问题 2. 统一使用Date.now()替代new Date().getTime()优化代码 3. 新增释放URL对象的代码避免内存泄漏 4. 调整线圈页面批量移出发货单按钮的显示条件
This commit is contained in:
@@ -103,7 +103,7 @@
|
|||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<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-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
<el-button icon="el-icon-download" size="mini" @click="handleNewExport" v-if="showNewExport">导出</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>
|
@click="handleBatchRemoveFromWaybill">批量移出发货单</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|||||||
@@ -477,16 +477,13 @@ export default {
|
|||||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const win = window.open(url, '_blank');
|
const a = document.createElement('a');
|
||||||
if (!win) {
|
a.href = url;
|
||||||
this.$message.error('打印失败,请检查浏览器设置');
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
|
||||||
// const a = document.createElement('a');
|
document.body.appendChild(a);
|
||||||
// a.href = url;
|
a.click();
|
||||||
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
document.body.removeChild(a);
|
||||||
// document.body.appendChild(a);
|
URL.revokeObjectURL(url);
|
||||||
// a.click();
|
|
||||||
// document.body.removeChild(a);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async exportExcel() {
|
async exportExcel() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -475,16 +475,13 @@ export default {
|
|||||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const win = window.open(url, '_blank');
|
const a = document.createElement('a');
|
||||||
if (!win) {
|
a.href = url;
|
||||||
this.$message.error('打印失败,请检查浏览器设置');
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
|
||||||
// const a = document.createElement('a');
|
document.body.appendChild(a);
|
||||||
// a.href = url;
|
a.click();
|
||||||
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
document.body.removeChild(a);
|
||||||
// document.body.appendChild(a);
|
URL.revokeObjectURL(url);
|
||||||
// a.click();
|
|
||||||
// document.body.removeChild(a);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async exportExcel() {
|
async exportExcel() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -477,16 +477,13 @@ export default {
|
|||||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const win = window.open(url, '_blank');
|
const a = document.createElement('a');
|
||||||
if (!win) {
|
a.href = url;
|
||||||
this.$message.error('打印失败,请检查浏览器设置');
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
|
||||||
// const a = document.createElement('a');
|
document.body.appendChild(a);
|
||||||
// a.href = url;
|
a.click();
|
||||||
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
document.body.removeChild(a);
|
||||||
// document.body.appendChild(a);
|
URL.revokeObjectURL(url);
|
||||||
// a.click();
|
|
||||||
// document.body.removeChild(a);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async exportExcel() {
|
async exportExcel() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -476,16 +476,13 @@ export default {
|
|||||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const win = window.open(url, '_blank');
|
const a = document.createElement('a');
|
||||||
if (!win) {
|
a.href = url;
|
||||||
this.$message.error('打印失败,请检查浏览器设置');
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
|
||||||
// const a = document.createElement('a');
|
document.body.appendChild(a);
|
||||||
// a.href = url;
|
a.click();
|
||||||
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
document.body.removeChild(a);
|
||||||
// document.body.appendChild(a);
|
URL.revokeObjectURL(url);
|
||||||
// a.click();
|
|
||||||
// document.body.removeChild(a);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async exportExcelByXLSX() {
|
async exportExcelByXLSX() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -475,16 +475,13 @@ export default {
|
|||||||
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const win = window.open(url, '_blank');
|
const a = document.createElement('a');
|
||||||
if (!win) {
|
a.href = url;
|
||||||
this.$message.error('打印失败,请检查浏览器设置');
|
a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || Date.now()}.pdf`;
|
||||||
// const a = document.createElement('a');
|
document.body.appendChild(a);
|
||||||
// a.href = url;
|
a.click();
|
||||||
// a.download = `发货单_${this.waybill.waybillName || this.waybill.waybillNo || new Date().getTime()}.pdf`;
|
document.body.removeChild(a);
|
||||||
// document.body.appendChild(a);
|
URL.revokeObjectURL(url);
|
||||||
// a.click();
|
|
||||||
// document.body.removeChild(a);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async exportExcelByXLSX() {
|
async exportExcelByXLSX() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user