From 2b2fa317c30ee2de7a8b6f5fc964532031adea66 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期日, 20 九月 2026 13:48:54 +0800
Subject: [PATCH] fix: 优化报告功能

---
 src/views/business/reportPreparation/index.vue |  259 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 170 insertions(+), 89 deletions(-)

diff --git a/src/views/business/reportPreparation/index.vue b/src/views/business/reportPreparation/index.vue
index 74f7232..56d1f0e 100644
--- a/src/views/business/reportPreparation/index.vue
+++ b/src/views/business/reportPreparation/index.vue
@@ -4,30 +4,30 @@
       <el-form :model="entity" ref="entity" size="small" :inline="true">
         <el-form-item label="鎶ュ憡缂栧彿" prop="code">
           <el-input v-model="entity.code" clearable placeholder="璇疯緭鍏�" size="small"
-            @keyup.enter.native="refreshTable()"></el-input>
+                    @keyup.enter.native="refreshTable()"></el-input>
         </el-form-item>
         <el-form-item label="鐘舵��" prop="queryStatus">
           <el-select v-model="entity.queryStatus" clearable size="small" @change="refreshTable()">
             <el-option v-for="(a, i) in queryStatusList" :key="i" :label="a.label" :value="a.value"></el-option>
           </el-select>
         </el-form-item>
-<!--        <el-form-item label="鎶ュ憡绫诲瀷" prop="reportType">-->
-<!--          <el-select v-model="entity.reportType" clearable size="small" @change="refreshTable()">-->
-<!--            <el-option v-for="item in reportTypeList" :key="item.value" :label="item.label" :value="item.value"></el-option>-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="涓嬪崟绫诲埆" prop="typeSource">-->
-<!--          <el-select v-model="entity.typeSource" clearable size="small" @change="refreshTable()">-->
-<!--            <el-option v-for="(a, i) in typeSourceList" :key="i" :label="a.label" :value="a.value"></el-option>-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="鐗╂枡灞炴��" prop="materialProp">-->
-<!--          <el-select clearable size="small" v-model="entity.materialProp" style="width: 100%">-->
-<!--            <el-option v-for="dict in dict.type.material_prop_type" :key="dict.value" :label="dict.label"-->
-<!--                       :value="dict.value">-->
-<!--            </el-option>-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
+        <!--        <el-form-item label="鎶ュ憡绫诲瀷" prop="reportType">-->
+        <!--          <el-select v-model="entity.reportType" clearable size="small" @change="refreshTable()">-->
+        <!--            <el-option v-for="item in reportTypeList" :key="item.value" :label="item.label" :value="item.value"></el-option>-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="涓嬪崟绫诲埆" prop="typeSource">-->
+        <!--          <el-select v-model="entity.typeSource" clearable size="small" @change="refreshTable()">-->
+        <!--            <el-option v-for="(a, i) in typeSourceList" :key="i" :label="a.label" :value="a.value"></el-option>-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="鐗╂枡灞炴��" prop="materialProp">-->
+        <!--          <el-select clearable size="small" v-model="entity.materialProp" style="width: 100%">-->
+        <!--            <el-option v-for="dict in dict.type.material_prop_type" :key="dict.value" :label="dict.label"-->
+        <!--                       :value="dict.value">-->
+        <!--            </el-option>-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
         <el-form-item label="妫�楠岀被鍒�" prop="orderType">
           <el-select v-model="entity.orderType" clearable size="small" @change="refreshTable()">
             <el-option v-for="(a, i) in orderTypeList" :key="i" :label="a.label" :value="a.value"></el-option>
@@ -45,57 +45,66 @@
     </div>
     <div>
       <lims-table :tableData="valueTableData" :column="column" :page="page" :tableLoading="tableLoading"
-        :isSelection="true" :handleSelectionChange="handleChange" :height="'calc(100vh - 290px)'"
-        @pagination="pagination" key="valueTableData">
+                  :isSelection="true" :handleSelectionChange="handleChange" :height="'calc(100vh - 290px)'"
+                  @pagination="pagination" key="valueTableData">
         <div slot="action" slot-scope="scope">
-<!--          <el-button size="small" type="text" @click="viewIssued(scope.row)">鏌ョ湅鎶ュ憡</el-button>-->
+          <!--          <el-button size="small" type="text" @click="viewIssued(scope.row)">鏌ョ湅鎶ュ憡</el-button>-->
           <el-upload ref='upload1' style="display: inline;margin: 0 6px" :action="fileAction1 + '?id=' + scope.row.id"
-            :auto-upload="true" :before-upload="fileBeforeUpload1" :headers="uploadHeader" :on-error="onError1"
-            :on-success="handleSuccessUp1" :show-file-list="false" accept='.doc,.docx'>
+                     :auto-upload="true" :before-upload="fileBeforeUpload1" :headers="uploadHeader" :on-error="onError1"
+                     :on-success="handleSuccessUp1" :show-file-list="false" accept='.doc,.docx'>
             <el-button size="small" type="text"
-              :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName">涓婁紶</el-button>
+                       :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName">涓婁紶
+            </el-button>
           </el-upload>
-<!--          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"-->
-<!--            @click="handleRestore(scope.row)">杩樺師</el-button>-->
+          <!--          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"-->
+          <!--            @click="handleRestore(scope.row)">杩樺師</el-button>-->
+          <el-button type="text" size="small" @click="sendBackTask(scope.row)">閫�鍥炰换鍔�</el-button>
           <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"
-            @click="sendBackTask(scope.row)">閫�鍥炰换鍔�</el-button>
-          <el-button type="text" size="small" :disabled="scope.row.state != 0 || nickName !== scope.row.writeUserName"
-            @click="handle(scope.row)">鎻愪氦</el-button>
+                     @click="handle(scope.row)">鎻愪氦
+          </el-button>
           <el-button type="text" size="small"
-            :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 1 || nickName !== scope.row.examineUser"
-            @click="handleIssued(scope.row)">瀹℃牳</el-button>
+                     :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 1 || nickName !== scope.row.examineUser"
+                     @click="handleIssued(scope.row)">瀹℃牳
+          </el-button>
           <el-button type="text" size="small"
-            :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 0 || scope.row.isExamine == null || scope.row.isRatify == 1 || nickName !== scope.row.ratifyUser"
-            @click="handleApprove(scope.row)">鎵瑰噯</el-button>
+                     :disabled="scope.row.state == null || scope.row.state == 0 || scope.row.isExamine == 0 || scope.row.isExamine == null || scope.row.isRatify == 1 || nickName !== scope.row.ratifyUser"
+                     @click="handleApprove(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>
+                     :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">涓嬭浇
+          </el-button>
+          <el-button type="text" size="small"
+                     :loading="regeneratingReportId === scope.row.id"
+                     :disabled="regeneratingReportId === scope.row.id"
+                     @click="handleRegenerate(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>
       </lims-table>
     </div>
     <el-dialog :fullscreen="fullscreen" :modal-append-to-body="false" :visible.sync="claimVisible" title="鍦ㄧ嚎缂栧埗"
-      width="22cm">
+               width="22cm">
       <div class="full-screen">
         <i v-if="!fullscreen" class="el-icon-full-screen" style="cursor: pointer;font-size: 18px"
-          @click="fullscreen = true;"></i>
+           @click="fullscreen = true;"></i>
         <img v-else alt="" src="@/assets/images/no-full.svg" style="cursor: pointer;" @click="fullscreen = false;">
       </div>
-      <Word v-if="claimVisible" ref="Word" :class="{ fullscreen: fullscreen }" :value="value" style="height:70vh" />
+      <Word v-if="claimVisible" ref="Word" :class="{ fullscreen: fullscreen }" :value="value" style="height:70vh"/>
       <span slot="footer" class="dialog-footer">
         <el-button @click="claimVisible = false">鍙� 娑�</el-button>
         <el-button type="primary" @click="confirmClaim">纭� 瀹�</el-button>
       </span>
     </el-dialog>
     <el-dialog :fullscreen="fullscreen" :modal-append-to-body="false" :visible.sync="issuedVisible" title="鎶ュ憡瀹℃牳"
-      width="80vw">
+               width="80vw">
       <div class="full-screen">
         <i v-if="!fullscreen" class="el-icon-full-screen" style="cursor: pointer;font-size: 18px"
-          @click="fullscreen = true;"></i>
+           @click="fullscreen = true;"></i>
         <img v-else alt="" src="@/assets/images/no-full.svg" style="cursor: pointer;" @click="fullscreen = false;">
       </div>
       <div v-if="issuedVisible" style="height: 70vh;">
-        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;" />
+        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;"/>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button :disabled="loadingIssued" @click="issuedReasonVisible = true">涓嶉�氳繃</el-button>
@@ -105,7 +114,9 @@
     <el-dialog :modal-append-to-body="false" :visible.sync="issuedReasonVisible" title="涓嶉�氳繃鍘熷洜" width="400px">
       <div class="search_thing">
         <div class="search_label">涓嶉�氳繃鍘熷洜锛�</div>
-        <div class="search_input"><el-input v-model="reason" clearable placeholder="璇疯緭鍏�" size="small"></el-input></div>
+        <div class="search_input">
+          <el-input v-model="reason" clearable placeholder="璇疯緭鍏�" size="small"></el-input>
+        </div>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button :disabled="loadingIssuedReason" @click="issuedReasonVisible = false">鍙栨秷</el-button>
@@ -113,14 +124,14 @@
       </span>
     </el-dialog>
     <el-dialog :fullscreen="fullscreen" :modal-append-to-body="false" :visible.sync="approveVisible" title="鎶ュ憡鎵瑰噯"
-      width="80vw">
+               width="80vw">
       <div class="full-screen">
         <i v-if="!fullscreen" class="el-icon-full-screen" style="cursor: pointer;font-size: 18px"
-          @click="fullscreen = true;"></i>
+           @click="fullscreen = true;"></i>
         <img v-else alt="" src="@/assets/images/no-full.svg" style="cursor: pointer;" @click="fullscreen = false;">
       </div>
       <div v-if="approveVisible" style="height: 70vh;">
-        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;" />
+        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;"/>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button :disabled="loadingApprove" @click="approveReasonVisible = true">涓嶆壒鍑�</el-button>
@@ -130,7 +141,9 @@
     <el-dialog :modal-append-to-body="false" :visible.sync="approveReasonVisible" title="涓嶆壒鍑嗗師鍥�" width="400px">
       <div class="search_thing">
         <div class="search_label">涓嶆壒鍑嗗師鍥狅細</div>
-        <div class="search_input"><el-input v-model="reason" clearable placeholder="璇疯緭鍏�" size="small"></el-input></div>
+        <div class="search_input">
+          <el-input v-model="reason" clearable placeholder="璇疯緭鍏�" size="small"></el-input>
+        </div>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button :disabled="loadingApproveReason" @click="approveReasonVisible = false">鍙栨秷</el-button>
@@ -138,7 +151,7 @@
       </span>
     </el-dialog>
     <el-dialog :close-on-click-modal="false" :visible.sync="addApproverDia" title="鎸囧畾鎵瑰噯浜哄憳" width="400px"
-      @close="closeAddApproverDia">
+               @close="closeAddApproverDia">
       <div class="body" style="display: flex;padding: 10px;align-items: center;">
         <div class="search_label" style="width: 150px;"><span class="required-span">*</span>鎵瑰噯浜猴細</div>
         <div class="search_input" style="width: 100%;">
@@ -154,7 +167,7 @@
       </span>
     </el-dialog>
     <el-dialog :close-on-click-modal="false" :visible.sync="addVerifyDia" title="鎸囧畾瀹℃牳浜哄憳" width="400px"
-      @close="closeAddVerifyDia">
+               @close="closeAddVerifyDia">
       <div class="body" style="display: flex;padding: 10px;align-items: center;">
         <div class="search_label" style="width: 150px;"><span class="required-span">*</span>瀹℃牳浜猴細</div>
         <div class="search_input" style="width: 100%;">
@@ -173,28 +186,46 @@
     <!--    <ShowInfo v-if="showInfoDialog" ref="showInfoDialog" :showInfoDialog="showInfoDialog"></ShowInfo>-->
     <!--鎶ュ憡鏌ョ湅-->
     <el-dialog :fullscreen="fullscreen" :modal-append-to-body="false" :visible.sync="viewIssuedVisible" title="鎶ュ憡鏌ョ湅"
-      width="80vw">
+               width="80vw">
       <div class="full-screen">
         <i v-if="!fullscreen" class="el-icon-full-screen" style="cursor: pointer;font-size: 18px"
-          @click="fullscreen = true;"></i>
+           @click="fullscreen = true;"></i>
         <img v-else alt="" src="@/assets/images/no-full.svg" style="cursor: pointer;" @click="fullscreen = false;">
       </div>
       <div v-if="viewIssuedVisible" style="height: 80vh;">
-        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;" />
+        <onlyoffice ref="onlyoffice" :options="option" style="width: 100%;height: 100%;"/>
       </div>
     </el-dialog>
     <!--闄勪欢鏌ョ湅-->
     <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢鏌ョ湅" width="80%" @closed="closeFilesLook">
       <div style="margin-bottom: 10px">
         <el-upload ref='upload' :action="fileAction" :auto-upload="true" :before-upload="fileBeforeUpload"
-          :data="{ orderId: filesLookInfo.insOrderId }" :headers="uploadHeader" :on-error="onError"
-          :on-success="handleSuccessUp" :show-file-list="false"
-          accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;">
+                   :data="{ orderId: filesLookInfo.insOrderId }" :headers="uploadHeader" :on-error="onError"
+                   :on-success="handleSuccessUp" :show-file-list="false"
+                   accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
+                   style="width: 80px !important;">
           <el-button size="small" style="height: 38px" type="primary">闄勪欢涓婁紶</el-button>
         </el-upload>
       </div>
       <lims-table :tableData="tableDataFile" :column="columnFile" height="600px"
-        key="tableDataFile" :tableLoading="tableLoadingFile"></lims-table>
+                  key="tableDataFile" :tableLoading="tableLoadingFile"></lims-table>
+    </el-dialog>
+    <el-dialog title="閫夋嫨涓嬭浇鎶ュ憡" :visible.sync="downloadDialogVisible" width="400px"
+               :close-on-click-modal="false" @closed="closeDownloadDialog">
+      <el-form label-width="90px">
+        <el-form-item label="鎶ュ憡绫诲瀷锛�">
+          <el-radio-group v-model="selectedReportType">
+            <el-radio :label="0">妫�娴嬫姤鍛�</el-radio>
+            <el-radio :label="1" :disabled="!downloadRow || !downloadRow.inspectionUrl">妫�楠屾姤鍛�</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="downloadDialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" :loading="downloadingReportType !== null"
+                   :disabled="selectedReportType === null || downloadingReportType !== null"
+                   @click="downloadSelectedReport(selectedReportType)">涓� 杞�</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
@@ -207,19 +238,21 @@
   downloadReport,
   examineReport,
   pageInsReport,
+  regenerateReport,
   ratifyReport,
   sendBackTask,
   upReportUrl,
   writeReport,
   reportAllExport
 } from "@/api/business/insReport";
-import { mapGetters } from "vuex";
-import { selectUserCondition } from "@/api/business/inspectionTask";
+import {mapGetters} from "vuex";
+import {selectUserCondition} from "@/api/business/inspectionTask";
 import limsTable from "@/components/Table/lims-table.vue";
 import {delFile, downFile, getFileList} from "@/api/business/rawMaterialOrder";
+
 export default {
   name: 'ReportPreparation',
-  components: { limsTable, onlyoffice },
+  components: {limsTable, onlyoffice},
   dicts: ['material_prop_type'],
   data() {
     return {
@@ -255,6 +288,11 @@
       mutiList: [],
       outLoading: false,
       outExportLoading: false,
+      regeneratingReportId: null,
+      downloadDialogVisible: false,
+      downloadRow: null,
+      selectedReportType: 0,
+      downloadingReportType: null,
       inLoading: false,
       addApproverDia: false, // 鎸囧畾瀹℃壒浜哄憳寮规
       approver: '', // 瀹℃壒浜哄憳
@@ -264,19 +302,19 @@
       verifyUser: null, // 瀹℃牳浜哄憳
       loadingVerify: false, // 瀹℃牳浜哄憳
       typeSourceList: [
-        { label: '濮旀墭涓嬪崟', value: -1 },
-        { label: '澶栬喘涓嬪崟', value: 0 },
-        { label: '鍘熸潗鏂欎笅鍗�', value: 1 },
+        {label: '濮旀墭涓嬪崟', value: -1},
+        {label: '澶栬喘涓嬪崟', value: 0},
+        {label: '鍘熸潗鏂欎笅鍗�', value: 1},
       ],
       orderTypeList: [
-        { label: '濮旀墭璇曢獙', value: 'Customer-ordered test' },
-        { label: '鎶芥', value: '鎶芥' },
+        {label: '濮旀墭璇曢獙', value: 'Customer-ordered test'},
+        {label: '鎶芥', value: '鎶芥'},
         // { label: '杩涘巶妫�楠�', value: '杩涘巶妫�楠�' },
         // { label: '瀛e害妫�楠�', value: 'Quarterly inspection' },
       ],
       reportTypeList: [
-        { label: '妫�娴嬫姤鍛�', value: 0 },
-        { label: '妫�楠屾姤鍛�', value: 1 },
+        {label: '妫�娴嬫姤鍛�', value: 0},
+        {label: '妫�楠屾姤鍛�', value: 1},
       ],
       showInfoDialog: false, // 浜т笟閾句俊鎭煡鐪�
       isReport: 1,
@@ -286,9 +324,9 @@
       examine: null,
       viewIssuedVisible: false,
       queryStatusList: [
-        { label: '寰呮彁浜�', value: 0 },
-        { label: '寰呭鏍�', value: 1 },
-        { label: '寰呮壒鍑�', value: 2 },
+        {label: '寰呮彁浜�', value: 0},
+        {label: '寰呭鏍�', value: 1},
+        {label: '寰呮壒鍑�', value: 2},
       ],
       state: 0,
       orderId: 0,
@@ -324,9 +362,9 @@
             }
           }
         },
-        { label: '闄勪欢鍚嶇О', prop: 'fileName' },
-        { label: '涓婁紶浜�', prop: 'name' },
-        { label: '涓婁紶鏃堕棿', prop: 'createTime' },
+        {label: '闄勪欢鍚嶇О', prop: 'fileName'},
+        {label: '涓婁紶浜�', prop: 'name'},
+        {label: '涓婁紶鏃堕棿', prop: 'createTime'},
         {
           dataType: 'action',
           fixed: 'right',
@@ -411,9 +449,9 @@
             return this.orderTypeList.find((m) => m.value == params).type;
           },
         },
-        { label: "鍒涘缓鏃堕棿", prop: "createTime" },
-        { label: "鎻愪氦浜�", prop: "writeUserName" },
-        { label: "鎻愪氦鏃堕棿", prop: "writeTime" },
+        {label: "鍒涘缓鏃堕棿", prop: "createTime"},
+        {label: "鎻愪氦浜�", prop: "writeUserName"},
+        {label: "鎻愪氦鏃堕棿", prop: "writeTime"},
         {
           label: "鎻愪氦鐘舵��",
           prop: "state",
@@ -434,8 +472,8 @@
             }
           },
         },
-        { label: "瀹℃牳浜�", prop: "examineUser" },
-        { label: "瀹℃牳鏃堕棿", prop: "examineTime" },
+        {label: "瀹℃牳浜�", prop: "examineUser"},
+        {label: "瀹℃牳鏃堕棿", prop: "examineTime"},
         {
           label: "瀹℃牳鐘舵��",
           prop: "isExamine",
@@ -460,9 +498,9 @@
             }
           },
         },
-        { label: "瀹℃牳澶囨敞", prop: "examineTell" },
-        { label: "鎵瑰噯浜�", prop: "ratifyUser" },
-        { label: "鎵瑰噯鏃堕棿", prop: "ratifyTime" },
+        {label: "瀹℃牳澶囨敞", prop: "examineTell"},
+        {label: "鎵瑰噯浜�", prop: "ratifyUser"},
+        {label: "鎵瑰噯鏃堕棿", prop: "ratifyTime"},
         {
           label: "鎵瑰噯鐘舵��",
           prop: "isRatify",
@@ -487,12 +525,12 @@
             }
           },
         },
-        { label: "鎵瑰噯澶囨敞", prop: "ratifyTell" },
+        {label: "鎵瑰噯澶囨敞", prop: "ratifyTell"},
         {
           fixed: "right",
           dataType: "slot",
           slot: "action",
-          width: '360px',
+          width: '440px',
           label: "鎿嶄綔"
         }
       ],
@@ -525,7 +563,7 @@
         this.valueTableData = res.data.body.records
       })
     },
-    pagination({ page, limit }) {
+    pagination({page, limit}) {
       this.page.current = page;
       this.page.size = limit;
       this.refreshTable();
@@ -565,7 +603,7 @@
     // 鏌ヨ闄勪欢鏌ョ湅鍒楄〃鍥炶皟
     getFileList() {
       this.tableLoadingFile = true
-      getFileList({ insOrderId: this.filesLookInfo.insOrderId,current: -1, size: -1 }).then(res => {
+      getFileList({insOrderId: this.filesLookInfo.insOrderId, current: -1, size: -1}).then(res => {
         this.tableLoadingFile = false
         if (res.code === 200) {
           this.tableDataFile = res.data.records
@@ -607,7 +645,7 @@
         type: 'warning'
       }).then(() => {
         this.tableLoadingFile = true
-        delFile({ id: row.id }).then(res => {
+        delFile({id: row.id}).then(res => {
           this.tableLoadingFile = false
           this.$message.success('鍒犻櫎鎴愬姛')
           this.getFileList()
@@ -636,7 +674,7 @@
       }
       let str = this.mutiList.map(m => m.id).join(',')
       this.outLoading = true
-      downAll({ ids: str }).then(res => {
+      downAll({ids: str}).then(res => {
         this.outLoading = false
         this.$download.zip(res.data, '鎶ュ憡.zip');
       }).catch(() => {
@@ -651,7 +689,7 @@
         ...this.entity
       }).then(res => {
         this.outExportLoading = false
-        const blob = new Blob([res], { type: 'application/octet-stream' });
+        const blob = new Blob([res], {type: 'application/octet-stream'});
         this.$download.saveAs(blob, "鎶ュ憡鎶ヨ〃瀵煎嚭.xlsx");
       })
     },
@@ -749,7 +787,28 @@
       }
     },
     download(row) {
-      downloadReport(row.id).then(res => {
+      this.downloadRow = row
+      // 鍘嗗彶鏁版嵁鍙湁妫�娴嬫姤鍛婏細鐩存帴鎸夋娴嬫姤鍛婁笅杞斤紝淇濇寔鍘熸湁鎿嶄綔涔犳儻銆�
+      if (!row.inspectionUrl) {
+        this.downloadSelectedReport(0)
+        return
+      }
+      this.selectedReportType = 0
+      this.downloadDialogVisible = true
+    },
+    closeDownloadDialog() {
+      if (this.downloadingReportType === null) {
+        this.downloadRow = null
+        this.selectedReportType = 0
+      }
+    },
+    downloadSelectedReport(reportType) {
+      if (!this.downloadRow) {
+        return
+      }
+      const row = this.downloadRow
+      this.downloadingReportType = reportType
+      downloadReport(row.id, reportType).then(res => {
         if (res.type && res.type.includes('application/json')) {
           const reader = new FileReader()
           reader.onload = () => {
@@ -762,11 +821,33 @@
           reader.readAsText(res)
           return
         }
-        const reportUrl = row.urlS || row.url || ''
+        const reportUrl = reportType === 1 ? row.inspectionUrl : (row.urlS || row.url || '')
         const filename = decodeURIComponent(reportUrl.substring(reportUrl.lastIndexOf('/') + 1)) || `${row.code}.docx`
         this.$download.saveAs(res, filename)
+        this.downloadDialogVisible = false
       }).catch(() => {
         this.$message.error('鎶ュ憡涓嬭浇澶辫触')
+      }).finally(() => {
+        this.downloadingReportType = null
+        if (!this.downloadDialogVisible) {
+          this.downloadRow = null
+        }
+      })
+    },
+    handleRegenerate(row) {
+      this.$confirm('灏嗘牴鎹綋鍓嶅師濮嬭褰曢噸鏂扮敓鎴愬苟瑕嗙洊绯荤粺鎶ュ憡锛屾槸鍚︾户缁紵', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        this.regeneratingReportId = row.id
+        return regenerateReport(row.id).then(() => {
+          this.$message.success('鎶ュ憡閲嶆柊鐢熸垚鎴愬姛')
+          this.refreshTable()
+        }).finally(() => {
+          this.regeneratingReportId = null
+        })
+      }).catch(() => {
       })
     },
     // 杩樺師鎿嶄綔
@@ -837,7 +918,7 @@
         type: 'warning'
       }).then(() => {
         this.upLoad = true
-        sendBackTask({ id: row.id }).then(res => {
+        sendBackTask({id: row.id}).then(res => {
           this.upLoad = false
           this.$message.success('閫�鍥炴垚鍔燂紒')
           this.refreshTable('page')
@@ -885,7 +966,7 @@
     },
     // 鑾峰彇浜哄憳鍒楄〃
     getAuthorizedPerson() {
-      selectUserCondition({ type: 1 }).then((res) => {
+      selectUserCondition({type: 1}).then((res) => {
         let data = [];
         res.data.forEach((a) => {
           data.push({

--
Gitblit v1.9.3