fei
7 天以前 c50a874feed1ceceb18e0d42f95e4094eef98128
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"
@@ -150,12 +208,19 @@
        />
      </el-form-item>
      <el-form-item label="扫描加工公司" prop="scanningCompany">
        <el-input
        <el-select
          v-model="queryParams.scanningCompany"
          placeholder="请输入扫描加工公司"
          placeholder="请选择扫描加工公司"
          clearable
          @keyup.enter.native="handleQuery"
        />
          @change="handleQuery"
        >
          <el-option
            v-for="item in projectCompanyOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="档案管(室)号" prop="archiveRoomNumber">
        <el-input
@@ -300,7 +365,7 @@
                  icon="el-icon-edit"
                  @click="handleInfo(scope.row)"
                  v-hasPermi="['system:records:edit']"
                >案卷详细信息</el-button>
                >编辑卷内目录</el-button>
                <el-button
                  size="mini"
@@ -411,7 +476,7 @@
            <div class="option-group">
              <label class="option-label">
                <input type="checkbox" v-model="excelOptions.includeQrCode">
                <span>包含二维码</span>
                <span>包含条形码</span>
              </label>
            </div>
@@ -419,10 +484,11 @@
            <div class="option-group">
              <div class="option-label">选择注解:</div>
              <div class="annotation-options">
                <label v-for="i in 5" :key="i" class="annotation-checkbox">
                  <input type="checkbox" v-model="excelOptions.selectedAnnotations" :value="i">
                  <span>注解{{ i }}</span>
                </label>
              <label v-for="(annotation, index) in excelOptions.selectedAnnotations" :key="index" class="signature-checkbox">
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="index">
                              <span>{{ annotation }}
                              </span>
              </label>
              </div>
            </div>
@@ -431,10 +497,13 @@
              <div class="option-label">签名栏设置:</div>
              <div class="signature-options">
                <div class="signature-checkboxes">
                  <label v-for="i in 3" :key="i" class="signature-checkbox">
                    <input type="checkbox" v-model="excelOptions.selectedSignatures" :value="i">
                    <span>签名栏{{ i }}</span>
                 <label v-for="(signature, index) in excelOptions.selectedSignatures" :key="index" class="signature-checkbox">
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="index">
                                 <span>{{ signature }}</span>
                  </label>
                </div>
<!--                <p v-if="excelOptions.selectedSignatures.length === 0" class="option-tip">请选择至少一个签名栏</p> -->
              </div>
@@ -442,7 +511,8 @@
          </div>
        </div>
    <!-- 优化的Excel预览组件 -->
    <div class="excel-preview-wrapper" v-if="excelDialogVisible">
     <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"
@@ -464,7 +534,7 @@
        <button class="excel-dialog-btn download-btn" @click="handleDownloadClick">下载Excel文件</button>
      </div>
    </div>
</el-dialog>
        <div class="excel-dialog-footer">
          <button class="excel-dialog-btn preview-btn" @click="handlePreviewClick">预览</button>
          <button class="excel-dialog-btn print-btn" @click="handlePrintClick">打印</button>
@@ -761,7 +831,14 @@
          <el-input v-model="form.projectNumber" placeholder="请输入项目编号" />
        </el-form-item>
        <el-form-item label="扫描加工公司" prop="scanningCompany">
          <el-input v-model="form.scanningCompany" placeholder="请输入扫描加工公司" />
          <el-select v-model="form.scanningCompany" placeholder="请选择扫描加工公司">
            <el-option
              v-for="item in projectCompanyOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="档案管(室)号" prop="archiveRoomNumber">
          <el-input v-model="form.archiveRoomNumber" placeholder="请输入档案管(室)号" />
@@ -802,6 +879,7 @@
  name: "Records",
  data() {
    return {
      showExcelPreview: false,
                  excel: 'http://localhost:8080/profile/upload/12.xls', //设置文档网络地址,可以是相对地址
      open_check: false,
@@ -812,6 +890,8 @@
      maxId: 0,
      // 项目名称选项
      projectOptions: [],
      // 项目管理公司选项
      projectCompanyOptions: [],
      // 档案类型选项
      recordTypeOptions: [],
      //地区类型
@@ -855,6 +935,11 @@
        pageSize: 10,
        recordId: null,
        inquiryNumber: null,
        categoryType: null, // 类别类型
        categoryZone: null, // 类别地区
        categoryYear: null, // 类别年份
        categorySeq: null, // 开始序号
        categorySeqEnd: null, // 结束序号
        everyProjectName: null,
        caseTitle: null,
        publicAttribute: null,
@@ -885,8 +970,15 @@
    // Excel选项配置
    excelOptions: {
      includeQrCode: false, // 是否包含二维码
      selectedAnnotations: [], // 选中的注解列表
      selectedAnnotations: ["本清单由档案形成部门完成",
           "文件类型必须录入,包括结论材料、过程材料、申请材料,其他材料",
            "公开属性必须录入,主动公开、依申请公开、免予公开",
             "保管期限:30年或永久",
            "页号按照正式录入页码为准"], // 选中的注解列表
      includeSignature: false, // 是否包含签名栏
            selectedSignatures: ['业务科室移交人:', '审批科移交人:', '档案整理公司:'], // 选中的签名栏列表
            subselectedSignatures: [],
            subselectedAnnotations: [],
      signaturePosition: 'bottom' // 签名栏位置:top/bottom
    },
      // 表单参数
@@ -926,6 +1018,7 @@
    this.getRecordTypes()
    this.getZoneOptions()
    this.fetchProjectOptions()
    this.fetchProjectCompanyOptions()
this.getList()
  },
  watch: {
@@ -1040,6 +1133,23 @@
        console.error('获取项目名称列表失败:', error)
      }
    },
    async fetchProjectCompanyOptions() {
      try {
        const response = await listAllProjectName()
        console.log("项目管理公司数据:", response)
        // 从项目数据中提取管理公司信息
        const companies = [...new Set(response.data.data.map(item => item.companyName).filter(Boolean))]
               console.log("项目管理公司数据:", companies)
        this.projectCompanyOptions = companies.map(company => ({
          value: company,
          label: company
        }))
      } catch (error) {
        console.error('获取项目管理公司列表失败:', error)
      }
    },
       /** 获取档案类型列表 */
       getRecordTypes() {
        return new Promise((resolve) => {
@@ -1077,7 +1187,41 @@
      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.categoryNumberStart = baseCategory + '-' + queryParams.categorySeq
        }
        // 构建结束类别号
        if (queryParams.categorySeqEnd) {
          queryParams.categoryNumberEnd = baseCategory + '-' + queryParams.categorySeqEnd
        } else if (queryParams.categorySeq) {
          // 如果没有结束序号,则结束类别号与开始类别号相同
          queryParams.categoryNumberEnd = queryParams.categoryNumberStart
        }
        console.log(queryParams)
        console.log("9999999999999999999")
        // 删除单独的字段,避免重复搜索
        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
@@ -1126,6 +1270,12 @@
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      // 确保类别号相关字段被完全重置
      this.queryParams.categoryType = null
      this.queryParams.categoryZone = null
      this.queryParams.categoryYear = null
      this.queryParams.categorySeq = null
      this.queryParams.categorySeqEnd = null
      this.handleQuery()
    },
    // 多选框选中数据
@@ -1157,9 +1307,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()
      })
@@ -1336,6 +1487,8 @@
    /** 查看并打印Excel文件 */
    viewAndPrintExcel(row) {
      const id = row.id || this.ids;
     // alert(id)
      this.recordId = id;
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 从后端获取Excel文件
@@ -1364,6 +1517,7 @@
    /** 关闭Excel弹窗并清理资源 */
    closeExcelDialog() {
      this.excelDialogVisible = false;
    //  alert(this.excelDialogVisible)
      if (this.excelPreviewTimeout) {
        clearTimeout(this.excelPreviewTimeout);
        this.excelPreviewTimeout = null;
@@ -1374,12 +1528,32 @@
      }
      this.currentExcelBlob = null;
    },
closeExcelPreviewDialog()
{
  this.showExcelPreview = false;
},
    /** 处理预览按钮点击 */
    handlePreviewClick() {
      this.excelLoading = true;
      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;
@@ -1549,9 +1723,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;
@@ -1587,7 +1761,7 @@
      });
    },
    /** 清理Excel预览相关资源 */
    /** 清理Excel预览相关资源并关闭对话框 */
    cleanupExcelPreview(iframe, url) {
      setTimeout(() => {
        if (iframe && iframe.parentNode) {
@@ -1597,18 +1771,43 @@
          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 {
          // 获取用户选择的注解
          const { selectedAnnotations } = this.excelOptions;
          // 构建参数,包含注解内容
          const params = {
            recordId: id,
          };
          axios({
            method: 'Post',
            url: `${process.env.VUE_APP_BASE_API}/system/records/model`,
            params: { id: id },
            url: urls,
            params: params,
            responseType: 'blob',
            headers: { 'Authorization': 'Bearer ' + getToken() }
          }).then(response => {
@@ -1629,9 +1828,20 @@
    fallbackGetExcelFile(id, resolve, reject) {
      try {
        const xhr = new XMLHttpRequest();
        // 构建查询参数,包含注解内容
        const queryParams = new URLSearchParams({
          id: id,
          annotation1: "本清单由档案形成部门完成",
          annotation2: "文件类型必须录入,包括结论材料、过程材料、申请材料,其他材料",
          annotation3: "公开属性必须录入,主动公开、依申请公开、免予公开",
          annotation4: "保管期限:30年或永久",
          annotation5: "页号按照正式录入页码为准"
        }).toString();
        // 尝试不同的API路径,以适应可能的后端实现
        const apiUrls = [
          `${process.env.VUE_APP_BASE_API}/system/records/model?id=${id}`,
          `${process.env.VUE_APP_BASE_API}/system/records/model?${queryParams}`,
          `${process.env.VUE_APP_BASE_API}/system/records/model`
        ];