fei
8 天以前 0c6b2eb953f5ed4df00a77a5f7b14b9ff6c563fe
修改代码
3个文件已修改
173 ■■■■■ 已修改文件
src/utils/request.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManager/archiveMaterial/index.vue 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManager/index.vue 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js
@@ -17,7 +17,7 @@
  // axios中请求配置有baseURL选项,表示请求URL公共部分
  baseURL: process.env.VUE_APP_BASE_API,
  // 超时
  timeout: 10000
  timeout: 30000
})
// request拦截器
src/views/archiveManager/archiveMaterial/index.vue
@@ -278,7 +278,7 @@
            icon="el-icon-download"
            size="mini"
            @click="handleExportDir"
            v-hasPermi="['system:materials:export']"
            v-hasPermi="['system:materials:list']"
          >导出卷内目录</el-button>
        </el-col>
@@ -289,7 +289,7 @@
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['system:materials:export']"
            v-hasPermi="['system:materials:list']"
          >导出电子文件目录</el-button>
        </el-col>
@@ -354,7 +354,7 @@
        >导入模板下载</el-button>
      </el-col>
        <el-col :span="1.5">
        <el-col      v-if="sho" :span="1.5">
        <el-upload
          action=""
@@ -376,7 +376,7 @@
      <el-table v-loading="loading" :data="materialsList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="操作" align="center" width="160" class-name="small-padding ">
        <el-table-column v-if="sho" label="操作" align="center" width="160" class-name="small-padding ">
              <template slot-scope="scope">
                <el-button
                  size="mini"
@@ -828,13 +828,17 @@
       importDialogVisible: false,
      fileList: [],
      uploadUrl:  process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId, // 替换为实际的上传接口
      uploadUrl:  process.env.VUE_APP_BASE_API +'/system/materials/uploads/'+this.recordId, // 替换为实际的上传接口
           headers: {
        Authorization: 'Bearer ' + getToken()
      },
      uploadParams: {
        type: 'material' // 自定义上传类型
      },
      // 上传状态跟踪
      uploadSuccessCount: 0,
      uploadFailCount: 0,
      totalUploadFiles: 0,
      // 添加材料类型选项
      fileStyleOptions: [
          { value: '文字材料', label: '文字材料' },
@@ -901,7 +905,7 @@
        titleSearchTimer: null, // 防抖定时器
        creatorSuggestions: [], // 匹配的责任人建议列表
        showCreatorSuggestions: false, // 是否显示责任人建议框
        creatorSearchTimer: null, //  persona查询防抖定时器
        creatorSearchTimer: null, // 责任人查询防抖定时器
        // 是否显示弹出层
        open: false,
        titles: "",
@@ -1051,29 +1055,43 @@
    methods: {
        // 上传失败回调
    handleError(err, file, fileList) {
      this.$modal.msgError("上传失败: " + err.message)
       // 清除上传列表
  this.$refs.upload.clearFiles();
      // 失败计数+1
      this.uploadFailCount++;
      // 检查是否所有文件都上传完成
      this.checkUploadComplete();
    },
          // 上传成功回调
    handleSuccess(response, file, fileList) {
      if (response.code === 200) {
        this.$modal.msgSuccess("上传成功")
 // 清除上传列表
  this.$refs.upload.clearFiles();
  // 关闭上传对话框
  this.importDialogVisible = false;
        // 刷新列表数据
        this.getList();        // 这里可以调用接口关联上传的文件和当前记录
        //更新档案的状态
        // 成功计数+1
        this.uploadSuccessCount++;
      } else {
        // alert(234)
        console.log(response)
        this.$modal.msgError(response.msg)
        // 失败计数+1
        this.uploadFailCount++;
      }
      // 检查是否所有文件都上传完成
      this.checkUploadComplete();
    },
    // 检查所有文件是否上传完成
    checkUploadComplete() {
      // 当所有文件都上传完成时
      if (this.uploadSuccessCount + this.uploadFailCount === this.totalUploadFiles) {
        if (this.uploadFailCount === 0) {
          // 所有文件上传成功
          this.$modal.msgSuccess("所有文件上传成功");
        } else {
          // 部分文件上传失败
          this.$modal.msgError(`上传完成,但有 ${this.uploadFailCount} 个文件上传失败`);
        }
        // 清除上传列表
        this.$refs.upload.clearFiles();
        // 关闭上传对话框
        this.importDialogVisible = false;
        // 刷新列表数据
        this.getList();
      }
    },
       // 打开导入对话框
     // 打开导入对话框
    handleImport() {
      //生成新的记录
      insertFile(this.recordId, this.totalPageCount).then(response => {
@@ -1118,6 +1136,10 @@
       }
       else
       {
         // 初始化上传状态计数
         this.uploadSuccessCount = 0;
         this.uploadFailCount = 0;
         this.totalUploadFiles = fileCount;
         // 执行上传
           this.$refs.upload.submit()
           this.getList()
@@ -1743,11 +1765,6 @@
  background-color: #fff;
}
</style>
src/views/archiveManager/index.vue
@@ -1820,9 +1820,9 @@
      this.getExcelFile(id).then(blob => {
        this.$modal.closeLoading();
        // 保存文件信息并显示静态弹窗
        alert(23)
     //   alert(23)
        this.currentExcelUrl = URL.createObjectURL(blob);
        alert(this.currentExcelUrl)
       // alert(this.currentExcelUrl)
        this.currentExcelBlob = blob;
        this.currentExcelId = id;
        this.excelDialogVisible = true;
@@ -1996,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('')}`;x
        // }
        filename += `_${new Date().getTime()}.xls`;
        link.download = filename;
        // 触发下载
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        // 提示下载成功
        this.$modal.msgSuccess('Excel文件下载成功');
      }
    },
@@ -2059,20 +2080,25 @@
    /** 从后端获取Excel文件 */
    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 {
@@ -2082,13 +2108,17 @@
          // 构建参数,包含注解内容
          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 => {