fei
2025-11-22 749f897a11e711199c6b1677accf2f6e46895315
src/views/archiveManager/index.vue
@@ -17,6 +17,64 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="类别号" prop="categoryNumber">
        <el-row :gutter="8">
          <el-col :span="6">
            <el-select
              v-model="queryParams.categoryType"
              placeholder="选择类别类型"
              clearable
              @change="handleQuery"
            >
              <el-option
                v-for="item in recordTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-select
              v-model="queryParams.categoryZone"
              placeholder="选择地区"
              clearable
              @change="handleQuery"
            >
              <el-option
                v-for="item in zoneTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categoryYear"
              placeholder="年份"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categorySeq"
              placeholder="开始序号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
          <el-col :span="4">
            <el-input
              v-model="queryParams.categorySeqEnd"
              placeholder="结束序号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="案卷题名" prop="caseTitle">
        <el-input
          v-model="queryParams.caseTitle"
@@ -300,7 +358,7 @@
                  icon="el-icon-edit"
                  @click="handleInfo(scope.row)"
                  v-hasPermi="['system:records:edit']"
                >案卷详细信息</el-button>
                >编辑卷内目录</el-button>
                <el-button
                  size="mini"
@@ -411,7 +469,7 @@
            <div class="option-group">
              <label class="option-label">
                <input type="checkbox" v-model="excelOptions.includeQrCode">
                <span>包含二维码</span>
                <span>包含条形码</span>
              </label>
            </div>
@@ -420,7 +478,7 @@
              <div class="option-label">选择注解:</div>
              <div class="annotation-options">
              <label v-for="(annotation, index) in excelOptions.selectedAnnotations" :key="index" class="signature-checkbox">
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="annotation">
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="index">
                              <span>{{ annotation }}
                              </span>
              </label>
@@ -433,7 +491,7 @@
              <div class="signature-options">
                <div class="signature-checkboxes">
                 <label v-for="(signature, index) in excelOptions.selectedSignatures" :key="index" class="signature-checkbox">
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="signature">
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="index">
                                 <span>{{ signature }}</span>
                  </label>
@@ -446,9 +504,8 @@
          </div>
        </div>
    <!-- 优化的Excel预览组件 -->
     <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%">
    <div  >
     <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%" :show-close="true" @click="closeExcelPreviewDialog">
    <div  @click.stop>
      <!-- 主要预览组件 -->
      <vue-office-excel
        v-if="currentExcelUrl"
@@ -808,6 +865,7 @@
  name: "Records",
  data() {
    return {
      showExcelPreview: false,
                  excel: 'http://localhost:8080/profile/upload/12.xls', //设置文档网络地址,可以是相对地址
      open_check: false,
@@ -861,6 +919,11 @@
        pageSize: 10,
        recordId: null,
        inquiryNumber: null,
        categoryType: null, // 类别类型
        categoryZone: null, // 类别地区
        categoryYear: null, // 类别年份
        categorySeq: null, // 开始序号
        categorySeqEnd: null, // 结束序号
        everyProjectName: null,
        caseTitle: null,
        publicAttribute: null,
@@ -1090,7 +1153,37 @@
      this.loading = true
      console.log(this.queryParams)
      console.log("--------------")
      listRecords(this.queryParams).then(response => {
      // 创建queryParams的副本,避免直接修改原对象
      const queryParams = { ...this.queryParams }
      // 处理类别号搜索
      if (queryParams.categoryType || queryParams.categoryZone || queryParams.categoryYear || queryParams.categorySeq || queryParams.categorySeqEnd) {
        // 构建基础部分
        const baseParts = []
        if (queryParams.categoryType) baseParts.push(queryParams.categoryType)
        if (queryParams.categoryZone) baseParts.push(queryParams.categoryZone)
        if (queryParams.categoryYear) baseParts.push(queryParams.categoryYear)
        const baseCategory = baseParts.join('-')
        // 判断是单个序号搜索还是范围搜索
        if (queryParams.categorySeq && queryParams.categorySeqEnd) {
          // 范围搜索:构建开始和结束类别号
          queryParams.categoryNumberStart = baseCategory ? baseCategory + '-' + queryParams.categorySeq : queryParams.categorySeq
          queryParams.categoryNumberEnd = baseCategory ? baseCategory + '-' + queryParams.categorySeqEnd : queryParams.categorySeqEnd
        } else if (queryParams.categorySeq) {
          // 单个序号搜索:构建完整的类别号
          queryParams.categoryNumber = baseCategory ? baseCategory + '-' + queryParams.categorySeq : queryParams.categorySeq
        }
        // 删除单独的字段,避免重复搜索
        delete queryParams.categoryType
        delete queryParams.categoryZone
        delete queryParams.categoryYear
        delete queryParams.categorySeq
        delete queryParams.categorySeqEnd
      }
      listRecords(queryParams).then(response => {
        console.log(response)
        this.recordsList = response.data.data
@@ -1170,9 +1263,10 @@
    //
    handleSubmit(row)
    {
   //   alert(row.id)
     //alert(row.id)
      var id = row.id
      updateStatusById(id).then(response=>{
      var status = '录入完成'
      updateStatusById(status, id).then(response=>{
        this.$modal.msgSuccess("提交成功")
        this.getList()
      })
@@ -1349,6 +1443,8 @@
    /** 查看并打印Excel文件 */
    viewAndPrintExcel(row) {
      const id = row.id || this.ids;
     // alert(id)
      this.recordId = id;
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 从后端获取Excel文件
@@ -1377,6 +1473,7 @@
    /** 关闭Excel弹窗并清理资源 */
    closeExcelDialog() {
      this.excelDialogVisible = false;
    //  alert(this.excelDialogVisible)
      if (this.excelPreviewTimeout) {
        clearTimeout(this.excelPreviewTimeout);
        this.excelPreviewTimeout = null;
@@ -1387,12 +1484,32 @@
      }
      this.currentExcelBlob = null;
    },
closeExcelPreviewDialog()
{
  this.showExcelPreview = false;
},
    /** 处理预览按钮点击 */
    handlePreviewClick() {
      this.showExcelPreview = true;
      this.excelRenderError = '';
      var id = this.recordId ;
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 从后端获取Excel文件
      this.getExcelFile(id).then(blob => {
        this.$modal.closeLoading();
        // 保存文件信息并显示静态弹窗
        this.currentExcelUrl = URL.createObjectURL(blob);
        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文件失败,请稍后重试');
      });
      // 重置vue-office-excel组件
      if (this.currentExcelUrl) {
        const tempUrl = this.currentExcelUrl;
@@ -1562,9 +1679,9 @@
        // 构建文件名,包含选项信息
        let filename = `record_${this.currentExcelId}`;
        if (includeQrCode) filename += '_qr';
        if (selectedAnnotations.length > 0) {
          filename += `_anno${selectedAnnotations.join('')}`;
        }
        // if (selectedAnnotations.length > 0) {
        //   filename += `_anno${selectedAnnotations.join('')}`;
        // }
        filename += `_${new Date().getTime()}.xlsx`;
        link.download = filename;
@@ -1600,7 +1717,7 @@
      });
    },
    /** 清理Excel预览相关资源 */
    /** 清理Excel预览相关资源并关闭对话框 */
    cleanupExcelPreview(iframe, url) {
      setTimeout(() => {
        if (iframe && iframe.parentNode) {
@@ -1610,12 +1727,27 @@
          URL.revokeObjectURL(url);
        }
        this.excelRenderError = '';
        this.showExcelPreview = false; // 关闭预览对话框
      }, 1000);
    },
    /** 从后端获取Excel文件 */
    getExcelFile(id) {
      var includeQrCode = this.excelOptions.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
        }
      return new Promise((resolve, reject) => {
        // 首先尝试使用axios(项目已有的HTTP客户端)
        try {
@@ -1627,10 +1759,10 @@
            recordId: id,
          };
alert(355)
          axios({
            method: 'Post',
            url: `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`+"/"+includeQrCode,
            url: urls,
            params: params,
            responseType: 'blob',
            headers: { 'Authorization': 'Bearer ' + getToken() }