From fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 九月 2026 09:21:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_新疆_新聚' into dev_新疆_新聚

---
 src/views/business/reportPreparation/index.vue |   29 ++++++++++++++++++++++-------
 src/views/business/inspectionView/index.vue    |    3 ++-
 src/api/business/insReport.js                  |   10 ++++++++++
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/src/api/business/insReport.js b/src/api/business/insReport.js
index 50e5a93..0c66aaf 100644
--- a/src/api/business/insReport.js
+++ b/src/api/business/insReport.js
@@ -25,6 +25,16 @@
     params: query
   })
 }
+
+// 鍗曚唤鎶ュ憡涓嬭浇
+export function downloadReport(id) {
+  return request({
+    url: '/insReport/download',
+    method: 'get',
+    params: { id },
+    responseType: 'blob'
+  })
+}
 // 鎶ュ憡閫�鍥炲埌妫�楠屼换鍔�
 export function sendBackTask(query) {
   return request({
diff --git a/src/views/business/inspectionView/index.vue b/src/views/business/inspectionView/index.vue
index 697e2c0..7346997 100644
--- a/src/views/business/inspectionView/index.vue
+++ b/src/views/business/inspectionView/index.vue
@@ -2029,7 +2029,7 @@
     openAddVerifyDia() {
       this.addVerifyDia = true;
     },
-    submit() {
+    async submit() {
       if (this.verifyUser === null || this.verifyUser === "") {
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
         return;
@@ -2042,6 +2042,7 @@
         this.$message.error("璇疯緭鍏ユ俯搴�");
         return;
       }
+      await this.waitForPendingSaves();
       this.submitLoading = true;
       checkSubmitPlan({
         orderId: this.orderId,
diff --git a/src/views/business/reportPreparation/index.vue b/src/views/business/reportPreparation/index.vue
index 6501a8d..a9e4513 100644
--- a/src/views/business/reportPreparation/index.vue
+++ b/src/views/business/reportPreparation/index.vue
@@ -72,7 +72,8 @@
               <el-button link type="text" size="small">鏇村</el-button>
             </template>
             <div>
-              <el-button style="margin-left: 10px" type="text" size="small" @click="download(scope.row)">涓嬭浇</el-button>
+              <el-button style="margin-left: 10px" type="text" size="small"
+                :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">涓嬭浇</el-button>
               <el-button type="text" size="small" @click="viewInspectInfo(scope.row)">鍘熷璁板綍</el-button>
               <el-button type="text" size="small" @click="handleFileLook(scope.row)">闄勪欢涓婁紶</el-button>
             </div>
@@ -210,6 +211,7 @@
 // import ShowInfo from "../do/b1-material-ins-order/showInfo.vue";
 import {
   downAll,
+  downloadReport,
   examineReport,
   pageInsReport,
   ratifyReport,
@@ -754,12 +756,25 @@
       }
     },
     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();
+      downloadReport(row.id).then(res => {
+        if (res.type && res.type.includes('application/json')) {
+          const reader = new FileReader()
+          reader.onload = () => {
+            try {
+              this.$message.error(JSON.parse(reader.result).msg || '鎶ュ憡涓嬭浇澶辫触')
+            } catch (e) {
+              this.$message.error('鎶ュ憡涓嬭浇澶辫触')
+            }
+          }
+          reader.readAsText(res)
+          return
+        }
+        const reportUrl = row.urlS || row.url || ''
+        const filename = decodeURIComponent(reportUrl.substring(reportUrl.lastIndexOf('/') + 1)) || `${row.code}.docx`
+        this.$download.saveAs(res, filename)
+      }).catch(() => {
+        this.$message.error('鎶ュ憡涓嬭浇澶辫触')
+      })
     },
     // 杩樺師鎿嶄綔
     handleRestore(row) {

--
Gitblit v1.9.3