From 5d1f953e434f173115c4677a07064ebee5524b31 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 25 二月 2025 15:37:12 +0800 Subject: [PATCH] 导出修改 --- src/views/business/inspectionTask/components/InspectionWord.vue | 7 ++----- src/views/business/inspectionReview/index.vue | 8 ++------ src/views/business/materialOrderComponents/materialOrder/downFileDialog.vue | 4 ++-- src/views/business/reportPreparation/index.vue | 2 +- src/api/business/rawMaterialOrder.js | 5 +++-- src/views/business/productOrder/index.vue | 3 +-- src/views/business/materialOrder/index.vue | 12 +++--------- 7 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/api/business/rawMaterialOrder.js b/src/api/business/rawMaterialOrder.js index 4b5c746..31f9cb3 100644 --- a/src/api/business/rawMaterialOrder.js +++ b/src/api/business/rawMaterialOrder.js @@ -214,12 +214,13 @@ data: query }) } -// 鍘熸潗鏂欎笅鍗曞嚭鍘傛挙閿� +// 鍘熸潗鏂欐姤妫�鍏ㄩ儴瀵煎嚭 export function rawAllExport(query) { return request({ url: '/rawMaterialOrder/rawAllExport', method: 'post', - data: query + data: query, + responseType: "blob" }) } // 鍘熸潗鏂欎笅鍗曞嚭鍘傛挙閿� diff --git a/src/views/business/inspectionReview/index.vue b/src/views/business/inspectionReview/index.vue index 7586d81..8c19573 100644 --- a/src/views/business/inspectionReview/index.vue +++ b/src/views/business/inspectionReview/index.vue @@ -362,12 +362,8 @@ }, // 涓嬭浇鎶ュ憡 download(row) { - let url = (row.urlS===null||row.urlS==='')?row.url:row.urlS - const link = document.createElement('a'); - link.href = this.javaApi + url; - link.target = '_blank'; - document.body.appendChild(link); - link.click(); + let url = this.javaApi+'/word/' + (row.urlS===null||row.urlS==='')?row.url:row.urlS + this.$download.saveAs(url, row.fileName); }, // 杩樺師鎿嶄綔 handleRestore(row) { diff --git a/src/views/business/inspectionTask/components/InspectionWord.vue b/src/views/business/inspectionTask/components/InspectionWord.vue index 4b88e82..862f456 100644 --- a/src/views/business/inspectionTask/components/InspectionWord.vue +++ b/src/views/business/inspectionTask/components/InspectionWord.vue @@ -2039,13 +2039,10 @@ let url = ''; if(res.data.type==1){ url = this.javaApi+'/img/'+res.data.fileUrl - file.downloadIamge(url,row.fileName) + this.$download.saveAs(url, row.fileName); }else{ url = this.javaApi+'/word/'+res.data.fileUrl - const link = document.createElement('a'); - link.href = url; - link.download = row.fileName; - link.click(); + this.$download.saveAs(url, row.fileName); } } }).catch(error => { diff --git a/src/views/business/materialOrder/index.vue b/src/views/business/materialOrder/index.vue index 4a20344..c8e8854 100644 --- a/src/views/business/materialOrder/index.vue +++ b/src/views/business/materialOrder/index.vue @@ -1073,17 +1073,11 @@ let entity = this.tabIndex === 3 ? { ...this.entity, isInspect: 2 } : { ...this.entity, state: 2, orderState: 4, } delete entity.orderBy this.outLoading = true - rawAllExport({ - entity: entity - }, { responseType: "blob" }).then(res => { + rawAllExport({entity: entity}).then(res => { this.outLoading = false this.$message.success('瀵煎嚭鎴愬姛') - const blob = new Blob([res], { type: 'application/octet-stream' }); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鍘熸潗鏂欐娴嬩俊鎭鍑�.xlsx'; - link.click(); + let url = this.javaApi + '/word/' + res.data + this.$download.saveAs(url, '鍘熸潗鏂欐娴嬩俊鎭鍑�.xlsx'); }) }, // 鎻愪氦淇敼濮旀墭缂栧彿淇℃伅 diff --git a/src/views/business/materialOrderComponents/materialOrder/downFileDialog.vue b/src/views/business/materialOrderComponents/materialOrder/downFileDialog.vue index b0d2d49..1f2faab 100644 --- a/src/views/business/materialOrderComponents/materialOrder/downFileDialog.vue +++ b/src/views/business/materialOrderComponents/materialOrder/downFileDialog.vue @@ -46,12 +46,12 @@ methods: { // 杩涘巶妫�楠屾姤鍛婁笅杞� downLoad0 () { - let url = this.downLoadInfo.enterUrlS ? this.downLoadInfo.enterUrlS : this.downLoadInfo.enterUrl + let url = this.javaApi+'/word/' + this.downLoadInfo.enterUrlS ? this.downLoadInfo.enterUrlS : this.downLoadInfo.enterUrl this.$download.saveAs(url, this.downLoadInfo.fileName); }, // 瀛e害妫�楠屾姤鍛婁笅杞� downLoad1 () { - let url = this.downLoadInfo.quarterUrlS ? this.downLoadInfo.quarterUrlS : this.downLoadInfo.quarterUrl + let url = this.javaApi+'/word/' + this.downLoadInfo.quarterUrlS ? this.downLoadInfo.quarterUrlS : this.downLoadInfo.quarterUrl this.$download.saveAs(url, this.downLoadInfo.fileName); } }, diff --git a/src/views/business/productOrder/index.vue b/src/views/business/productOrder/index.vue index af91337..135973f 100644 --- a/src/views/business/productOrder/index.vue +++ b/src/views/business/productOrder/index.vue @@ -992,9 +992,8 @@ }, // 涓嬭浇鎶ュ憡 download(row) { - let url = row.urlS?row.urlS:row.url; + let url = this.javaApi+'/word/' + row.urlS?row.urlS:row.url; if(url){ - url = url.split('.')[0]+'.pdf' this.$download.saveAs(url, this.downLoadInfo.fileName); } }, diff --git a/src/views/business/reportPreparation/index.vue b/src/views/business/reportPreparation/index.vue index 0da6616..640fd87 100644 --- a/src/views/business/reportPreparation/index.vue +++ b/src/views/business/reportPreparation/index.vue @@ -696,7 +696,7 @@ } }, download(row) { - let url = row.urlS ? row.urlS : row.url; + let url = this.javaApi+'/word/' + row.urlS ? row.urlS : row.url; this.$download.saveAs(url, row.fileName); }, // 杩樺師鎿嶄綔 -- Gitblit v1.9.3