fei
1 天以前 8444c1e188ed58b8469699c9049ea1c033b8ed86
src/views/archiveManager/index.vue
@@ -359,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" />
@@ -464,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 }}
@@ -473,7 +473,7 @@
            </el-table-column>
<!--      <el-table-column label="${comment}" align="center" prop="id" /> -->
      <el-table-column label="档案号" align="center" prop="recordId" />
      <el-table-column label="档案号" align="center" sortable="custom" prop="recordId" width="120"/>
      <el-table-column label="发文号" align="center" prop="inquiryNumber" />
@@ -1060,7 +1060,10 @@
        archiveRoomNumber: null,
        microfilmNumber: null,
        remarks: null,
        historicalReferenceNumber: null
        historicalReferenceNumber: null,
                orderByColumn: null,
                isAsc: null
      },
    // Excel弹窗相关数据
    excelDialogVisible: false,
@@ -1151,9 +1154,9 @@
  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);
    }
@@ -1392,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
@@ -1512,15 +1533,25 @@
    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 pageCount = row.pageCount
      var sho = true
    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
      }else
      {
        this.$modal.msgWarning("请补充页号等相关信息,再编辑卷内目录!")
      }
    },
    //
@@ -1738,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;
@@ -1787,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;
@@ -1796,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>正在加载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>正在加载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;">无法在浏览器中预览Excel文件,请点击下方按钮下载文件后查看。</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;">无法在浏览器中预览Excel文件,请点击下方按钮下载文件后查看。</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);
      // }
    },
    /** 处理打印按钮点击 */
@@ -1967,7 +2005,7 @@
        let filename = `record_${this.currentExcelId}`;
        if (includeQrCode) filename += '_qr';
        // if (selectedAnnotations.length > 0) {
        //   filename += `_anno${selectedAnnotations.join('')}`;
        //   filename += `_anno${selectedAnnotations.join('')}`;x
        // }
        filename += `_${new Date().getTime()}.xls`;