From 0c6b2eb953f5ed4df00a77a5f7b14b9ff6c563fe Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 04 一月 2026 23:59:06 +0800
Subject: [PATCH] 修改代码

---
 src/views/archiveManager/index.vue |  623 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 467 insertions(+), 156 deletions(-)

diff --git a/src/views/archiveManager/index.vue b/src/views/archiveManager/index.vue
index dcb1fb4..6f319d2 100644
--- a/src/views/archiveManager/index.vue
+++ b/src/views/archiveManager/index.vue
@@ -306,7 +306,16 @@
           v-hasPermi="['system:records:export']"
         >鎵归噺鎻愪氦</el-button>
       </el-col>
-
+   <el-col v-if="userId==1" :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleGivePermission"
+          v-hasPermi="['system:materials:edit']"
+        >鎵归噺鎺堟潈</el-button>
+      </el-col>
         <el-col v-if="userId==1" :span="1.5">
         <el-button
           type="warning"
@@ -350,7 +359,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="recordsList" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="recordsList" @selection-change="handleSelectionChange" @sort-change="handleSortChange">
       <el-table-column type="selection" width="55" align="center" />
 
 
@@ -366,7 +375,45 @@
                   @click="handleInfo(scope.row)"
                   v-hasPermi="['system:records:edit']"
                 >缂栬緫鍗峰唴鐩綍</el-button>
+          <el-button
+                v-if="userId===1"
 
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit"
+                  @click="CheckInfo(scope.row)"
+                  v-hasPermi="['system:records:edit']"
+                >鏌ョ湅鍗峰唴鐩綍</el-button>
+                <el-button
+                      v-if="userId===1"
+
+                        size="mini"
+                        type="text"
+                        icon="el-icon-edit"
+                        @click="backInfo(scope.row)"
+                        v-hasPermi="['system:records:edit']"
+                      >瀵煎嚭澶囪�冭〃</el-button>
+
+                <el-button
+                      v-if="userId===1"
+
+                        size="mini"
+                        type="text"
+                        icon="el-icon-edit"
+                        @click="JuanInfo(scope.row)"
+                        v-hasPermi="['system:records:edit']"
+                      >瀵煎嚭鍗峰唴鐩綍</el-button>
+
+
+                      <el-button
+                            v-if="userId===1"
+
+                              size="mini"
+                              type="text"
+                              icon="el-icon-edit"
+                              @click="pageInfo(scope.row)"
+                              v-hasPermi="['system:records:edit']"
+                            >瀵煎嚭妗堝嵎灏侀潰</el-button>
                 <el-button
                   size="mini"
                   type="text"
@@ -389,6 +436,7 @@
                   @click="handleSubmit(scope.row)"
                   v-hasPermi="['system:records:edit']"
                 >鎻愪氦妗堝嵎</el-button>
+
                 <el-button
                 v-if="scope.row.ownData||userId===1"
 
@@ -416,7 +464,7 @@
               </template>
             </el-table-column>
 
-            <el-table-column label="鐘舵��" align="center" prop="recordStatus" width="120">
+            <el-table-column label="鐘舵��" align="center"  sortable="custom" prop="recordStatus" width="120">
               <template slot-scope="scope">
                 <el-button :type="scope.row.recordStatus === '鏈綍鍏�' ? 'danger' : 'success'" size="mini">
                   {{ scope.row.recordStatus }}
@@ -425,7 +473,7 @@
             </el-table-column>
 
 <!--      <el-table-column label="${comment}" align="center" prop="id" /> -->
-      <el-table-column label="妗f鍙�" align="center" prop="recordId" />
+      <el-table-column label="妗f鍙�" align="center" sortable="custom" prop="recordId" width="120"/>
       <el-table-column label="鍙戞枃鍙�" align="center" prop="inquiryNumber" />
 
 
@@ -859,6 +907,45 @@
         <el-button @click="cancel">鍙� 娑�</el-button>
       </div>
     </el-dialog>
+
+
+
+
+    <!-- 鎺堟潈鐢ㄦ埛 -->
+     <el-dialog title="閫夋嫨鐢ㄦ埛" :visible.sync="visibleUser" width="800px" top="5vh" append-to-body>
+
+       <el-row>
+         <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSingleSelection"
+    height="260px">
+           <el-table-column type="selection" width="55"></el-table-column>
+           <el-table-column label="鐢ㄦ埛鍚嶇О" prop="userName" :show-overflow-tooltip="true" />
+           <el-table-column label="鐢ㄦ埛鏄电О" prop="nickName" :show-overflow-tooltip="true" />
+           <el-table-column label="閭" prop="email" :show-overflow-tooltip="true" />
+           <el-table-column label="鎵嬫満" prop="phonenumber" :show-overflow-tooltip="true" />
+      <!--     <el-table-column label="鐘舵��" align="center" prop="status">
+             <template slot-scope="scope">
+               <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+             </template>
+           </el-table-column> -->
+           <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
+             <template slot-scope="scope">
+               <span>{{ parseTime(scope.row.createTime) }}</span>
+             </template>
+           </el-table-column>
+         </el-table>
+         <pagination
+           v-show="totalUser>0"
+           :total="totalUser"
+           :page.sync="queryParamsUser.pageNum"
+           :limit.sync="queryParamsUser.pageSize"
+           @pagination="getUserList"
+         />
+       </el-row>
+       <div slot="footer" class="dialog-footer">
+         <el-button type="primary" @click="handleSelectUser">纭� 瀹�</el-button>
+         <el-button @click="visibleUser = false">鍙� 娑�</el-button>
+       </div>
+     </el-dialog>
   </div>
 </template>
 
@@ -872,6 +959,10 @@
 import { listAllCategory } from "@/api/system/category"
 import { listAllProjectName } from "@/api/system/projectName"
 import { listPlaceName, listAllPlaceName } from "@/api/system/placeName"
+import { judge } from "@/api/system/materials"
+import { UserRoleIdList,unallocatedUserList, authUserSelectAll } from "@/api/system/role"
+import {authManyRecordsToUsers}  from "@/api/system/archiverecordstouser"
+
 export default {
      components: {
         VueOfficeExcel
@@ -879,6 +970,18 @@
   name: "Records",
   data() {
     return {
+      totalUser: 0,
+      visibleUser:false,
+      userList:[],
+      // 閫変腑鏁扮粍鍊�
+      userIds: [],
+      queryParamsUser: {
+        pageNum: 1,
+        pageSize: 10,
+        roleId: undefined,
+        archiveRecordsId: undefined,
+
+      },
       showExcelPreview: false,
                   excel: 'http://localhost:8080/profile/upload/12.xls', //璁剧疆鏂囨。缃戠粶鍦板潃锛屽彲浠ユ槸鐩稿鍦板潃
 
@@ -957,7 +1060,10 @@
         archiveRoomNumber: null,
         microfilmNumber: null,
         remarks: null,
-        historicalReferenceNumber: null
+        historicalReferenceNumber: null,
+
+                orderByColumn: null,
+                isAsc: null
       },
     // Excel寮圭獥鐩稿叧鏁版嵁
     excelDialogVisible: false,
@@ -1004,6 +1110,9 @@
         ],
         projectName: [
           { required: true, message: "寤鸿椤圭洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        pageCount: [
+          { required: true, message: "妗堝嵎椤垫暟涓嶈兘涓虹┖", trigger: "blur" }
         ]
       }
     }
@@ -1020,6 +1129,7 @@
     this.fetchProjectOptions()
     this.fetchProjectCompanyOptions()
 this.getList()
+
   },
   watch: {
     'form.constructionUnit': {
@@ -1044,14 +1154,70 @@
   beforeDestroy() {
     // 娓呯悊浜嬩欢鐩戝惉鍣ㄥ拰瀹氭椂鍣�
     document.removeEventListener('keydown', this.handleKeyDown);
-    if (this.excelPreviewTimeout) {
-      clearTimeout(this.excelPreviewTimeout);
-    }
+    // if (this.excelPreviewTimeout) {
+    //   clearTimeout(this.excelPreviewTimeout);
+    // }
     if (this.currentExcelUrl) {
       URL.revokeObjectURL(this.currentExcelUrl);
     }
   },
   methods: {
+    /** 閫夋嫨鎺堟潈鐢ㄦ埛鎿嶄綔 */
+    handleSelectUser() {
+    //  const archiveRecordsId = this.queryParams.archiveRecordsId
+      const userIds = this.userIds.join(",")
+     // const aids = this.ids.join(",")
+    //  alert(aids)
+      if (userIds == "") {
+        this.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛")
+        return
+      }
+
+      // 鍒涘缓杞崲鍚庣殑鍙傛暟锛岀‘淇漴ecordId鏄暟瀛楃被鍨�
+     // const convertedRecordId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
+    const convertedRecordId = this.ids.join(",")
+    if (convertedRecordId == "") {
+      this.$modal.msgError("璇烽�夋嫨鐩稿簲鐨勬鍗�")
+      return
+    }
+      authManyRecordsToUsers({ recordIds: convertedRecordId, userIds: userIds }).then(res => {
+        if(res.code === 200) {
+          this.$modal.msgSuccess(res.msg)
+          this.visibleUser = false
+        //  this.$emit("ok")
+        } else {
+          this.$modal.msgError(res.msg || "鎺堟潈澶辫触锛屽凡缁忔巿鏉冭繃浜�")
+        }
+      })
+    },
+    clickRow(row) {
+      this.$refs.table.clearSelection();
+    this.$refs.table.toggleRowSelection(row);
+    },
+    // 鏇挎崲鍘熸湁鐨刪andleSelectionChange鏂规硶
+    handleSingleSelection(selection) {
+      if (selection.length > 1) {
+        this.$refs.table.clearSelection();
+        this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
+      }
+      else
+      this.userIds = selection.map(item => item.userId);
+    },
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.userIds = selection.map(item => item.userId)
+    },
+    // 鏌ヨ琛ㄦ暟鎹�
+    getUserList() {
+      this.queryParamsUser.roleId = 2
+      UserRoleIdList(this.queryParamsUser).then(res => {
+        console.log("=------00000000009")
+        console.log(res)
+
+        this.userList = res.rows
+        this.totalUser = res.total
+      })
+    },
       /** Excel娓叉煋瀹屾垚澶勭悊 */
         renderedHandler() {
             console.log("Excel娓叉煋瀹屾垚");
@@ -1133,7 +1299,7 @@
         console.error('鑾峰彇椤圭洰鍚嶇О鍒楄〃澶辫触:', error)
       }
     },
-    
+
     async fetchProjectCompanyOptions() {
       try {
         const response = await listAllProjectName()
@@ -1189,7 +1355,7 @@
       console.log("--------------")
       // 鍒涘缓queryParams鐨勫壇鏈紝閬垮厤鐩存帴淇敼鍘熷璞�
       const queryParams = { ...this.queryParams }
-      
+
       // 澶勭悊绫诲埆鍙锋悳绱�
       if ((queryParams.categoryType || queryParams.categoryZone || queryParams.categoryYear) && (queryParams.categorySeq || queryParams.categorySeqEnd)) {
         // 鏋勫缓鍩虹閮ㄥ垎锛堝墠涓変釜瀛楁淇濇寔涓�鑷达級
@@ -1198,12 +1364,12 @@
         if (queryParams.categoryZone) baseParts.push(queryParams.categoryZone)
         if (queryParams.categoryYear) baseParts.push(queryParams.categoryYear)
         const baseCategory = baseParts.join('-')
-        
+
         // 鏋勫缓寮�濮嬬被鍒彿
         if (queryParams.categorySeq) {
           queryParams.categoryNumberStart = baseCategory + '-' + queryParams.categorySeq
         }
-        
+
         // 鏋勫缓缁撴潫绫诲埆鍙�
         if (queryParams.categorySeqEnd) {
           queryParams.categoryNumberEnd = baseCategory + '-' + queryParams.categorySeqEnd
@@ -1220,7 +1386,7 @@
         delete queryParams.categorySeq
         delete queryParams.categorySeqEnd
       }
-      
+
       listRecords(queryParams).then(response => {
 
         console.log(response)
@@ -1229,6 +1395,24 @@
         this.loading = false
       })
     },
+    // 鎺掑簭澶勭悊鏂规硶
+
+      // 娣诲姞handleSortChange鏂规硶
+          handleSortChange({ column, prop, order }) {
+           // alert(23)
+
+            if (order === 'ascending') {
+              this.queryParams.orderByColumn = prop;
+              this.queryParams.isAsc = 'asc';
+            } else if (order === 'descending') {
+              this.queryParams.orderByColumn = prop;
+              this.queryParams.isAsc = 'desc';
+            } else {
+              this.queryParams.orderByColumn = null;
+              this.queryParams.isAsc = null;
+            }
+            this.getList();
+          },
     // 鍙栨秷鎸夐挳
     cancel() {
       this.open = false
@@ -1292,16 +1476,82 @@
       this.vis = false;
       this.title = "娣诲姞妗f璁板綍"
     },
+
     /*鏌ョ湅璇︽儏*/
-    handleInfo(row)
+    CheckInfo(row)
     {
 
       var mid = row.id
       const roleId = 2
    //   alert(mid)
+
       var recordId = mid
+      var pageCount = row.pageCount
+      var sho = false
     //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
-      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId)
+      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
+
+    },
+    /*瀵煎嚭澶囪�冭〃*/
+    backInfo(row)
+     {
+
+       var id = row.id
+
+             id = Number(id)
+
+       var recordId = row.recordId
+   this.download('/system/materials/exportBack/'+id+'/'+recordId, {
+
+   }, `澶囪�冭〃_${new Date().getTime()}.pdf`)
+     },
+
+     /*瀵煎嚭鍗峰唴鐩綍*/
+     JuanInfo(row)
+     {
+       var id = row.id
+
+                 id = Number(id)
+
+           var recordId = row.recordId
+       this.download('/system/materials/exportJuan/'+id, {
+
+       }, `鍗峰唴鐩綍_${new Date().getTime()}.xls`)
+     },
+     /*瀵煎嚭妗堝嵎灏侀潰*/
+     pageInfo(row)
+     {
+       var id = row.id
+
+                 id = Number(id)
+
+           var recordId = row.recordId
+       this.download('/system/materials/exportPageInfo/'+id+'/'+recordId, {
+
+       }, `妗堝嵎灏侀潰_${new Date().getTime()}.xls`)
+     },
+    handleInfo(row)
+    {
+
+        //鍒ゆ柇蹇呴』淇敼鐨勫瓧娈垫槸鍚﹁ˉ鍏呭畬鏁翠簡
+       var valid = false;
+      var pageCount = row.pageCount
+      if(row.projectName!=null&&row.pageCount!=null&&row.caseTitle!=null&&row.constructionUnit)
+       valid = true;
+        if (valid) {
+      var mid = row.id
+      const roleId = 2
+   //   alert(mid)
+
+      var recordId = mid
+
+      var sho = true
+    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
+      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
+      }else
+      {
+        this.$modal.msgWarning("璇疯ˉ鍏呴〉鍙风瓑鐩稿叧淇℃伅锛屽啀缂栬緫鍗峰唴鐩綍锛�")
+      }
 
     },
     //
@@ -1309,10 +1559,24 @@
     {
      //alert(row.id)
       var id = row.id
-      var status = '褰曞叆瀹屾垚'
-      updateStatusById(status, id).then(response=>{
-        this.$modal.msgSuccess("鎻愪氦鎴愬姛")
-        this.getList()
+      // 鍦ㄦ彁浜や箣鍓嶏紝璋冪敤鍚庣鎺ュ彛妫�鏌ユ槸鍚﹀凡缁忎笂浼犻檮浠�
+      judge(id).then(response => {
+        // console.log(response)
+        // alert(response.data)
+        if (response.data===undefined||response.data === false) {
+          // 濡傛灉鏂囦欢鏁伴噺涓�0锛屾彁绀虹敤鎴峰厛涓婁紶闄勪欢
+          this.$modal.msgWarning('璇峰厛涓婁紶闄勪欢锛屽啀杩涜鎻愪氦鎿嶄綔')
+        } else {
+          // 濡傛灉宸茬粡涓婁紶浜嗛檮浠讹紝缁х画鎻愪氦鎿嶄綔
+          var status = '褰曞叆瀹屾垚'
+          updateStatusById(status, id).then(response=>{
+            this.$modal.msgSuccess("鎻愪氦鎴愬姛")
+            this.getList()
+          })
+        }
+      }).catch(error => {
+        console.error('妫�鏌ラ檮浠舵暟閲忓け璐�:', error)
+        this.$modal.msgError('妫�鏌ラ檮浠舵暟閲忓け璐ワ紝璇风◢鍚庨噸璇�')
       })
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
@@ -1330,7 +1594,7 @@
   if(this.recordTypeOptions.length > 0) {
       const recordParts = response.data.recordId.split('-')
       this.$set(this.form, 'recordType', recordParts[0])
-      if(this.recordTypeOptions.length==4)
+      if(recordParts.length==4)
       {
         this.$set(this.form, 'recordZone', recordParts[1])
 
@@ -1346,6 +1610,16 @@
         this.open = true
         this.title = "淇敼妗f璁板綍"
       })
+    },
+    /*鎵归噺鎺堟潈*/
+    handleGivePermission()
+    {
+      if (this.ids.length === 0) {
+        this.$modal.msgWarning('璇烽�夋嫨瑕佹巿鏉冪殑妗f璁板綍')
+        return
+      }
+      this.visibleUser = true
+      this.getUserList()
     },
     /** 鎵归噺鎻愪氦 */
     handleBatchSubmit() {
@@ -1386,8 +1660,9 @@
   this.form = response.data
   if(this.recordTypeOptions.length > 0) {
       const recordParts = response.data.recordId.split('-')
+
       this.$set(this.form, 'recordType', recordParts[0])
-      if(this.recordTypeOptions.length==4)
+      if(recordParts.length==4)
       {
             this.$set(this.form, 'recordZone', recordParts[1])
 
@@ -1452,8 +1727,7 @@
     /** 鍒嗛厤鐢ㄦ埛鎿嶄綔 */
     handleAuthUser: function(row) {
       const roleId = 2
-      var archiveRecordsId = row.recordId
-
+      var archiveRecordsId = row.id
       this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+archiveRecordsId)
     },
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
@@ -1475,12 +1749,12 @@
         // 鍙鍑洪�変腑鐨勮褰�
         this.download('system/records/export', {
           ids: this.ids.join(',') // 灏嗛�変腑鐨処D鏁扮粍杞崲涓洪�楀彿鍒嗛殧鐨勫瓧绗︿覆
-        }, `records_${new Date().getTime()}.xlsx`)
+        }, `records_${new Date().getTime()}.xls`)
       } else {
         // 娌℃湁閫変腑璁板綍鏃讹紝瀵煎嚭绗﹀悎鏌ヨ鏉′欢鐨勬墍鏈夎褰�
         this.download('system/records/export', {
           ...this.queryParams
-        }, `records_${new Date().getTime()}.xlsx`)
+        }, `records_${new Date().getTime()}.xls`)
       }
     },
 
@@ -1495,7 +1769,9 @@
       this.getExcelFile(id).then(blob => {
         this.$modal.closeLoading();
         // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+
         this.currentExcelUrl = URL.createObjectURL(blob);
+
         this.currentExcelBlob = blob;
         this.currentExcelId = id;
         this.excelDialogVisible = true;
@@ -1544,7 +1820,9 @@
       this.getExcelFile(id).then(blob => {
         this.$modal.closeLoading();
         // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+     //   alert(23)
         this.currentExcelUrl = URL.createObjectURL(blob);
+       // alert(this.currentExcelUrl)
         this.currentExcelBlob = blob;
         this.currentExcelId = id;
         this.excelDialogVisible = true;
@@ -1553,113 +1831,116 @@
         this.$modal.closeLoading();
         console.error('鑾峰彇Excel鏂囦欢澶辫触:', error);
         this.$modal.msgError('鑾峰彇Excel鏂囦欢澶辫触锛岃绋嶅悗閲嶈瘯');
+
+
+            this.showExcelPreview = false;
       });
-      // 閲嶇疆vue-office-excel缁勪欢
-      if (this.currentExcelUrl) {
-        const tempUrl = this.currentExcelUrl;
-        this.currentExcelUrl = '';
-        this.$nextTick(() => {
-          this.currentExcelUrl = tempUrl;
-        });
-      }
+      // // 閲嶇疆vue-office-excel缁勪欢
+      // if (this.currentExcelUrl) {
+      //   const tempUrl = this.currentExcelUrl;
+      //   this.currentExcelUrl = '';
+      //   this.$nextTick(() => {
+      //     this.currentExcelUrl = tempUrl;
+      //   });
+      // }
 
-      const previewContainer = this.$refs.excelPreviewContainer;
+      // const previewContainer = this.$refs.excelPreviewContainer;
 
-      // 娓呯┖棰勮瀹瑰櫒
-      if (previewContainer) {
-        previewContainer.innerHTML = '';
+      // // 娓呯┖棰勮瀹瑰櫒
+      // if (previewContainer) {
+      //   previewContainer.innerHTML = '';
 
-        // 灏濊瘯浣跨敤寰蒋Office Online棰勮鏈嶅姟浣滀负澶囬��
-        const officeOnlineUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(this.currentExcelUrl)}`;
+      //   // 灏濊瘯浣跨敤寰蒋Office Online棰勮鏈嶅姟浣滀负澶囬��
+      //   const officeOnlineUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(this.currentExcelUrl)}`;
 
-        // 鍒涘缓iframe鐢ㄤ簬棰勮
-        const iframe = document.createElement('iframe');
-        iframe.style.width = '100%';
-        iframe.style.height = '100%';
-        iframe.style.border = 'none';
-        iframe.style.minHeight = '600px';
-        iframe.src = officeOnlineUrl;
-        iframe.title = 'Excel鏂囦欢棰勮';
+      //   // 鍒涘缓iframe鐢ㄤ簬棰勮
+      //   const iframe = document.createElement('iframe');
+      //   iframe.style.width = '100%';
+      //   iframe.style.height = '100%';
+      //   iframe.style.border = 'none';
+      //   iframe.style.minHeight = '600px';
+      //   iframe.src = officeOnlineUrl;
+      //   iframe.title = 'Excel鏂囦欢棰勮';
 
-        // 鍒涘缓鍔犺浇鎸囩ず鍣�
-        const loadingIndicator = document.createElement('div');
-        loadingIndicator.className = 'loading-indicator';
-        loadingIndicator.innerHTML = `
-          <div class="loading-spinner"></div>
-          <p>姝e湪鍔犺浇Excel鏂囦欢锛岃绋嶅��...</p>
-        `;
-        previewContainer.style.position = 'relative';
-        previewContainer.appendChild(iframe);
-        previewContainer.appendChild(loadingIndicator);
+      //   // 鍒涘缓鍔犺浇鎸囩ず鍣�
+      //   const loadingIndicator = document.createElement('div');
+      //   loadingIndicator.className = 'loading-indicator';
+      //   loadingIndicator.innerHTML = `
+      //     <div class="loading-spinner"></div>
+      //     <p>姝e湪鍔犺浇Excel鏂囦欢锛岃绋嶅��...</p>
+      //   `;
+      //   previewContainer.style.position = 'relative';
+      //   previewContainer.appendChild(iframe);
+      //   previewContainer.appendChild(loadingIndicator);
 
-        // 鐩戝惉iframe鍔犺浇瀹屾垚
-        iframe.onload = () => {
-          this.excelLoading = false;
-          if (loadingIndicator && loadingIndicator.parentNode) {
-            loadingIndicator.parentNode.removeChild(loadingIndicator);
-          }
-        };
+      //   // 鐩戝惉iframe鍔犺浇瀹屾垚
+      //   iframe.onload = () => {
+      //     this.excelLoading = false;
+      //     if (loadingIndicator && loadingIndicator.parentNode) {
+      //       loadingIndicator.parentNode.removeChild(loadingIndicator);
+      //     }
+      //   };
 
-        // 璁剧疆瓒呮椂澶勭悊
-        this.excelPreviewTimeout = setTimeout(() => {
-          this.excelLoading = false;
-          if (loadingIndicator && loadingIndicator.parentNode) {
-            loadingIndicator.parentNode.removeChild(loadingIndicator);
-          }
+      //   // 璁剧疆瓒呮椂澶勭悊
+      //   this.excelPreviewTimeout = setTimeout(() => {
+      //     this.excelLoading = false;
+      //     if (loadingIndicator && loadingIndicator.parentNode) {
+      //       loadingIndicator.parentNode.removeChild(loadingIndicator);
+      //     }
 
-          // 灏濊瘯鐩存帴棰勮浣滀负澶囬�夋柟妗�
-          previewContainer.innerHTML = '';
-          const directIframe = document.createElement('iframe');
-          directIframe.style.width = '100%';
-          directIframe.style.height = '100%';
-          directIframe.style.border = 'none';
-          directIframe.style.minHeight = '600px';
-          directIframe.src = this.currentExcelUrl;
+      //     // 灏濊瘯鐩存帴棰勮浣滀负澶囬�夋柟妗�
+      //     previewContainer.innerHTML = '';
+      //     const directIframe = document.createElement('iframe');
+      //     directIframe.style.width = '100%';
+      //     directIframe.style.height = '100%';
+      //     directIframe.style.border = 'none';
+      //     directIframe.style.minHeight = '600px';
+      //     directIframe.src = this.currentExcelUrl;
 
-          const fallbackMessage = document.createElement('div');
-          fallbackMessage.textContent = 'Office棰勮鏈嶅姟鍔犺浇瓒呮椂锛屾鍦ㄥ皾璇曠洿鎺ラ瑙�...';
-          fallbackMessage.style.cssText = `
-            position: absolute;
-            top: 0;
-            left: 0;
-            right: 0;
-            padding: 10px;
-            background-color: #f56c6c;
-            color: white;
-            text-align: center;
-            font-size: 14px;
-            z-index: 10;
-          `;
+      //     const fallbackMessage = document.createElement('div');
+      //     fallbackMessage.textContent = 'Office棰勮鏈嶅姟鍔犺浇瓒呮椂锛屾鍦ㄥ皾璇曠洿鎺ラ瑙�...';
+      //     fallbackMessage.style.cssText = `
+      //       position: absolute;
+      //       top: 0;
+      //       left: 0;
+      //       right: 0;
+      //       padding: 10px;
+      //       background-color: #f56c6c;
+      //       color: white;
+      //       text-align: center;
+      //       font-size: 14px;
+      //       z-index: 10;
+      //     `;
 
-          previewContainer.appendChild(directIframe);
-          previewContainer.appendChild(fallbackMessage);
+      //     previewContainer.appendChild(directIframe);
+      //     previewContainer.appendChild(fallbackMessage);
 
-          directIframe.onload = () => {
-            if (fallbackMessage && fallbackMessage.parentNode) {
-              fallbackMessage.parentNode.removeChild(fallbackMessage);
-            }
-          };
+      //     directIframe.onload = () => {
+      //       if (fallbackMessage && fallbackMessage.parentNode) {
+      //         fallbackMessage.parentNode.removeChild(fallbackMessage);
+      //       }
+      //     };
 
-          // 浜屾瓒呮椂澶勭悊
-          setTimeout(() => {
-            if (directIframe && directIframe.parentNode) {
-              directIframe.parentNode.removeChild(directIframe);
-            }
-            const errorMessage = document.createElement('div');
-            errorMessage.innerHTML = `
-              <div style="text-align: center; padding: 40px;">
-                <h3 style="color: #f56c6c; margin-bottom: 20px;">棰勮澶辫触</h3>
-                <p style="color: #666; margin-bottom: 30px;">鏃犳硶鍦ㄦ祻瑙堝櫒涓瑙圗xcel鏂囦欢锛岃鐐瑰嚮涓嬫柟鎸夐挳涓嬭浇鏂囦欢鍚庢煡鐪嬨��</p>
-                <button onclick="this.parentNode.parentNode.querySelector('.download-btn').click()"
-                        style="padding: 8px 20px; background: #409EFF; color: white; border: none; border-radius: 4px; cursor: pointer;">
-                  涓嬭浇Excel鏂囦欢
-                </button>
-              </div>
-            `;
-            previewContainer.appendChild(errorMessage);
-          }, 20000);
-        }, 25000);
-      }
+      //     // 浜屾瓒呮椂澶勭悊
+      //     setTimeout(() => {
+      //       if (directIframe && directIframe.parentNode) {
+      //         directIframe.parentNode.removeChild(directIframe);
+      //       }
+      //       const errorMessage = document.createElement('div');
+      //       errorMessage.innerHTML = `
+      //         <div style="text-align: center; padding: 40px;">
+      //           <h3 style="color: #f56c6c; margin-bottom: 20px;">棰勮澶辫触</h3>
+      //           <p style="color: #666; margin-bottom: 30px;">鏃犳硶鍦ㄦ祻瑙堝櫒涓瑙圗xcel鏂囦欢锛岃鐐瑰嚮涓嬫柟鎸夐挳涓嬭浇鏂囦欢鍚庢煡鐪嬨��</p>
+      //           <button onclick="this.parentNode.parentNode.querySelector('.download-btn').click()"
+      //                   style="padding: 8px 20px; background: #409EFF; color: white; border: none; border-radius: 4px; cursor: pointer;">
+      //             涓嬭浇Excel鏂囦欢
+      //           </button>
+      //         </div>
+      //       `;
+      //       previewContainer.appendChild(errorMessage);
+      //     }, 20000);
+      //   }, 25000);
+      // }
     },
 
     /** 澶勭悊鎵撳嵃鎸夐挳鐐瑰嚮 */
@@ -1715,28 +1996,49 @@
         // 鑾峰彇鐢ㄦ埛閫夋嫨鐨勯�夐」
         const { includeQrCode, selectedAnnotations } = this.excelOptions;
         console.log('涓嬭浇閫夐」:', { includeQrCode, selectedAnnotations });
+     var id = this.recordId ;
+        this.getExcelFile(id).then(blob => {
+           this.$modal.closeLoading();
+           // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+        //   alert(23)
+           this.currentExcelUrl = URL.createObjectURL(blob);
 
+           const link = document.createElement('a');
+           link.href = this.currentExcelUrl;
+
+           // 鏋勫缓鏂囦欢鍚嶏紝鍖呭惈閫夐」淇℃伅
+           let filename = `record_${this.currentExcelId}`;
+           if (includeQrCode) filename += '_qr';
+           // if (selectedAnnotations.length > 0) {
+           //   filename += `_anno${selectedAnnotations.join('')}`;x
+           // }
+           filename += `_${new Date().getTime()}.xls`;
+
+           link.download = filename;
+
+           // 瑙﹀彂涓嬭浇
+           document.body.appendChild(link);
+           link.click();
+           document.body.removeChild(link);
+
+           // 鎻愮ず涓嬭浇鎴愬姛
+           this.$modal.msgSuccess('Excel鏂囦欢涓嬭浇鎴愬姛');
+          // alert(this.currentExcelUrl)
+           // this.currentExcelBlob = blob;
+           // this.currentExcelId = id;
+           // this.excelDialogVisible = true;
+           // this.excelLoading = false;
+         }).catch(error => {
+           this.$modal.closeLoading();
+           console.error('鑾峰彇Excel鏂囦欢澶辫触:', error);
+           this.$modal.msgError('鑾峰彇Excel鏂囦欢澶辫触锛岃绋嶅悗閲嶈瘯');
+
+
+               this.showExcelPreview = false;
+         });
+       // alert(this.excelOptions.includeQrCode)
         // 鍒涘缓涓嬭浇閾炬帴锛屾枃浠跺悕鍖呭惈閫夐」淇℃伅
-        const link = document.createElement('a');
-        link.href = this.currentExcelUrl;
 
-        // 鏋勫缓鏂囦欢鍚嶏紝鍖呭惈閫夐」淇℃伅
-        let filename = `record_${this.currentExcelId}`;
-        if (includeQrCode) filename += '_qr';
-        // if (selectedAnnotations.length > 0) {
-        //   filename += `_anno${selectedAnnotations.join('')}`;
-        // }
-        filename += `_${new Date().getTime()}.xlsx`;
-
-        link.download = filename;
-
-        // 瑙﹀彂涓嬭浇
-        document.body.appendChild(link);
-        link.click();
-        document.body.removeChild(link);
-
-        // 鎻愮ず涓嬭浇鎴愬姛
-        this.$modal.msgSuccess('Excel鏂囦欢涓嬭浇鎴愬姛');
       }
     },
 
@@ -1778,20 +2080,25 @@
     /** 浠庡悗绔幏鍙朎xcel鏂囦欢 */
     getExcelFile(id) {
       var includeQrCode = this.excelOptions.includeQrCode;
-      var urls = `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`+"/"+includeQrCode;
+      var urls = `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`
+      //+"/"+includeQrCode;
 
 
-      if(this.excelOptions.subselectedSignatures.length!=0)
-      {
-        var selectedSignatures = this.excelOptions.subselectedSignatures
-        urls = urls +'/'+ selectedSignatures
-        }
-      if(this.excelOptions.subselectedAnnotations.length!=0)
-      {
-        var selectedAnnotations = this.excelOptions.subselectedAnnotations
-        urls = urls+"/"+selectedAnnotations
-        }
-
+//       // if(this.excelOptions.subselectedSignatures.length!=0)
+//       // {
+//       //   var selectedSignatures = this.excelOptions.subselectedSignatures
+//       //   urls = urls +'/'+ selectedSignatures
+//       //  // alert(urls)
+//       //   }
+//       console.log(this.excelOptions.subselectedAnnotations)
+//       alert(234)
+//       if(this.excelOptions.subselectedAnnotations.length!=0)
+//       {
+//         var selectedAnnotations = this.excelOptions.subselectedAnnotations
+//         urls = urls+"/"+selectedAnnotations
+//        // alert(urls)
+//         }
+// alert(urls)
       return new Promise((resolve, reject) => {
         // 棣栧厛灏濊瘯浣跨敤axios锛堥」鐩凡鏈夌殑HTTP瀹㈡埛绔級
         try {
@@ -1801,13 +2108,17 @@
           // 鏋勫缓鍙傛暟锛屽寘鍚敞瑙e唴瀹�
           const params = {
             recordId: id,
-
+            selectedSignatures: this.excelOptions.subselectedSignatures,
+            selectedAnnotations: this.excelOptions.subselectedAnnotations,
+            includeQrCode: this.excelOptions.includeQrCode
           };
+          console.log(params)
+          alert(457)
 
           axios({
             method: 'Post',
             url: urls,
-            params: params,
+            data: params,
             responseType: 'blob',
             headers: { 'Authorization': 'Bearer ' + getToken() }
           }).then(response => {
@@ -2006,7 +2317,7 @@
         // 鐩存帴涓嬭浇
         const link = document.createElement('a');
         link.href = url;
-        link.download = `${prefix}_${new Date().getTime()}.xlsx`;
+        link.download = `${prefix}_${new Date().getTime()}.xls`;
         document.body.appendChild(link);
         link.click();
         document.body.removeChild(link);
@@ -2025,7 +2336,7 @@
             const url = URL.createObjectURL(blob);
             const link = document.createElement('a');
             link.href = url;
-            link.download = `record_${id}_${new Date().getTime()}.xlsx`;
+            link.download = `record_${id}_${new Date().getTime()}.xls`;
             document.body.appendChild(link);
             link.click();
             document.body.removeChild(link);
@@ -2044,13 +2355,13 @@
     {
       this.download('/system/records/model', {
 
-      }, `records_${new Date().getTime()}.xlsx`)
+      }, `records_${new Date().getTime()}.xls`)
     },
     handleExportTemplateOther()
     {
           this.download('/system/records/modelOther', {
 
-      }, `records_${new Date().getTime()}.xlsx`)
+      }, `records_${new Date().getTime()}.xls`)
     },
   /** 瀵煎叆鎿嶄綔*/
     async handleImportData({file}){

--
Gitblit v1.9.1