From d67b031476d33a4a2d002ed32bc30dac34fc5493 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 25 二月 2025 15:29:45 +0800
Subject: [PATCH] 导出修改

---
 src/api/business/productOrder.js                                              |    3 +
 src/api/business/materialInspection.js                                        |    3 +
 src/views/business/rawMaterialInspection/index.vue                            |   11 +----
 src/views/business/reportPreparation/index.vue                                |   25 ++----------
 src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue |    7 +--
 src/views/business/productOrder/index.vue                                     |   23 +++--------
 6 files changed, 19 insertions(+), 53 deletions(-)

diff --git a/src/api/business/materialInspection.js b/src/api/business/materialInspection.js
index 3f592b1..4104e1c 100644
--- a/src/api/business/materialInspection.js
+++ b/src/api/business/materialInspection.js
@@ -93,6 +93,7 @@
   return request({
     url: '/rawMaterialOrder/rawAllExport',
     method: 'post',
-    data: query
+    data: query,
+    responseType: "blob"
   })
 }
diff --git a/src/api/business/productOrder.js b/src/api/business/productOrder.js
index 8ae703b..00862c6 100644
--- a/src/api/business/productOrder.js
+++ b/src/api/business/productOrder.js
@@ -22,7 +22,8 @@
   return request({
     url: '/insOrder/rawAllInsOrderExport',
     method: 'post',
-    data: query
+    data: query,
+    responseType: "blob"
   })
 }
 // 灏嗗緟妫�楠岀殑鐨勬挙閿�杩涜鏇存敼
diff --git a/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue b/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue
index db188d7..8dc8ee0 100644
--- a/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue
+++ b/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue
@@ -158,13 +158,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/productOrder/index.vue b/src/views/business/productOrder/index.vue
index 757f49d..af91337 100644
--- a/src/views/business/productOrder/index.vue
+++ b/src/views/business/productOrder/index.vue
@@ -865,14 +865,10 @@
     },
     // 瀵煎嚭璁板綍
     downLoad () {
-      rawAllInsOrderExport({...this.entity, responseType: "blob"}).then(res => {
+      rawAllInsOrderExport({...this.entity}).then(res => {
         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');
       }).catch(err => {
         console.log('err---', err);
       })
@@ -984,13 +980,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 => {
@@ -1002,11 +995,7 @@
       let url = row.urlS?row.urlS:row.url;
       if(url){
         url = url.split('.')[0]+'.pdf'
-        const link = document.createElement('a');
-        link.href = this.javaApi + url;
-        link.target = '_blank';
-        document.body.appendChild(link);
-        link.click();
+        this.$download.saveAs(url, this.downLoadInfo.fileName);
       }
     },
     // 鎾ら攢
diff --git a/src/views/business/rawMaterialInspection/index.vue b/src/views/business/rawMaterialInspection/index.vue
index 2ea2eb7..a993bac 100644
--- a/src/views/business/rawMaterialInspection/index.vue
+++ b/src/views/business/rawMaterialInspection/index.vue
@@ -795,16 +795,11 @@
       this.outLoading = true
       rawAllExport({
         entity:entity
-      },{
-        responseType: "blob"}).then(res => {
+      }).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");
       })
     },
     clear() {
diff --git a/src/views/business/reportPreparation/index.vue b/src/views/business/reportPreparation/index.vue
index f1a6481..0da6616 100644
--- a/src/views/business/reportPreparation/index.vue
+++ b/src/views/business/reportPreparation/index.vue
@@ -555,13 +555,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 => {
@@ -603,17 +600,7 @@
       downAll({ids: str}).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 = '鎶ュ憡.zip';
-        // link.click();
-        const link = document.createElement('a');
-        link.href = this.javaApi + res.message;
-        link.target = '_blank';
-        document.body.appendChild(link);
-        link.click();
+        this.$download.saveAs(this.javaApi + res.message, row.fileName);
       })
     },
     beforeUpload(file){
@@ -710,11 +697,7 @@
     },
     download(row) {
       let url = row.urlS ? row.urlS : row.url;
-      const link = document.createElement('a');
-      link.href = this.javaApi + url;
-      link.target = '_blank';
-      document.body.appendChild(link);
-      link.click();
+      this.$download.saveAs(url, row.fileName);
     },
     // 杩樺師鎿嶄綔
     handleRestore(row) {

--
Gitblit v1.9.3