fei
昨天 a0f40c39abc6b26e101f54433c150af5bbbc240a
src/views/archiveManager/index.vue
@@ -1,5 +1,6 @@
<template>
  <div class="app-container">
    <el-dialog title="搜索" :visible.sync="openSearch" width="1200px" top="5vh" append-to-body>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="档案号" prop="recordId">
        <el-input
@@ -251,8 +252,18 @@
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
</el-dialog>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleSearch"
        >搜索</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
@@ -296,7 +307,7 @@
        >导出</el-button>
      </el-col>
          <el-col :span="1.5">
          <el-col  v-if="userId!=1" :span="1.5">
        <el-button
          type="warning"
          plain
@@ -316,6 +327,17 @@
          v-hasPermi="['system:materials:edit']"
        >批量授权</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="handleBackPermission"
             v-hasPermi="['system:materials:edit']"
           >批量取消授权</el-button>
         </el-col>
        <el-col v-if="userId==1" :span="1.5">
        <el-button
          type="warning"
@@ -367,7 +389,7 @@
            <el-table-column label="操作" align="center" width="190" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                v-if="scope.row.ownData"
                v-if="scope.row.ownData && scope.row.recordStatus!='录入完成'"
                  size="mini"
                  type="text"
@@ -385,7 +407,7 @@
                  v-hasPermi="['system:records:edit']"
                >查看卷内目录</el-button>
                <el-button
                      v-if="userId===1"
                        size="mini"
                        type="text"
@@ -395,7 +417,7 @@
                      >导出备考表</el-button>
                <el-button
                      v-if="userId===1"
                        size="mini"
                        type="text"
@@ -406,7 +428,7 @@
                      <el-button
                            v-if="userId===1"
                              size="mini"
                              type="text"
@@ -427,6 +449,10 @@
                  @click="viewAndPrintExcel(scope.row)"
                  title="查看并打印Excel文件"
                >打印预整理清单</el-button>
                <el-button   icon="el-icon-edit" size="mini"
                v-if="userId!==1&&scope.row.ownData" type="text" @click="cancelAuthUser(scope.row)">
                  退回管理员</el-button>
          <el-button
                v-if="userId!==1&&scope.row.ownData"
@@ -463,7 +489,15 @@
                </el-dropdown>
              </template>
            </el-table-column>
      <el-table-column label="当前授权录入的用户" align="center" sortable="custom" prop="userName" width="120" v-if="userId==1">
   <template slot-scope="scope">
              <el-button
                :type="scope.row.userName === '' ? 'default' : 'primary'"
                size="mini">
                {{ scope.row.userName === null ? '未分配' : scope.row.userName }}
              </el-button>
              </template>
              </el-table-column>
            <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">
@@ -533,8 +567,8 @@
              <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="index">
                              <span>{{ annotation }}
                              <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="annotation.srt">
                              <span>{{ annotation.name }}
                              </span>
              </label>
              </div>
@@ -546,8 +580,8 @@
              <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="index">
                                 <span>{{ signature }}</span>
                                 <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="signature.sot">
                                 <span>{{ signature.sigaName }}</span>
                  </label>
@@ -711,6 +745,9 @@
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" disabled/>
        </el-form-item>
        <el-form-item label="备考表备注" prop="noteRemark">
          <el-input v-model="form.noteRemark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="历史相关发文号" prop="historicalReferenceNumber">
          <el-input v-model="form.historicalReferenceNumber" placeholder="请输入历史相关发文号" disabled/>
@@ -897,6 +934,9 @@
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备考表备注" prop="noteRemark">
          <el-input v-model="form.noteRemark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="历史相关发文号" prop="historicalReferenceNumber">
          <el-input v-model="form.historicalReferenceNumber" placeholder="请输入历史相关发文号" />
        </el-form-item>
@@ -952,24 +992,29 @@
<script>
import VueOfficeExcel from '@vue-office/excel'
import '@vue-office/excel/lib/index.css'
import store from '@/store'
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { enload, batchSubmitRecords,updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records"
import { enload, getIdFileCounts,batchSubmitRecords,updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records"
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 { judge,getFileCount } from "@/api/system/materials"
import { UserRoleIdList,unallocatedUserList, authUserSelectAll } from "@/api/system/role"
import {authManyRecordsToUsers}  from "@/api/system/archiverecordstouser"
import {authManyRecordsToUsers, delArchiverecordstouserByReIdAndUid, backPermission}  from "@/api/system/archiverecordstouser"
import { selectAllSig } from "@/api/system/signature"
import { selectAllAnn } from "@/api/system/annotation"
export default {
     components: {
        VueOfficeExcel
    },
  name: "Records",
  name: "InfoManager",
  data() {
    return {
      //删除批量授权
      allMapInfo: [],
      recId: '',
      openSearch: false,
      totalUser: 0,
      visibleUser:false,
      userList:[],
@@ -1018,6 +1063,7 @@
      loading: true,
      // 选中数组
      ids: [],
      userAllIds: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
@@ -1035,7 +1081,7 @@
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        pageSize: 50,
        recordId: null,
        inquiryNumber: null,
        categoryType: null, // 类别类型
@@ -1081,8 +1127,8 @@
            "公开属性必须录入,主动公开、依申请公开、免予公开",
             "保管期限:30年或永久",
            "页号按照正式录入页码为准"], // 选中的注解列表
      includeSignature: false, // 是否包含签名栏
            selectedSignatures: ['业务科室移交人:', '审批科移交人:', '档案整理公司:'], // 选中的签名栏列表
            includeSignature: false, // 是否包含签名栏
            selectedSignatures: ['业务科室移交人:','审批科/法规科移交人:', '审批科移交人:', '档案整理公司:'], // 选中的签名栏列表
            subselectedSignatures: [],
            subselectedAnnotations: [],
      signaturePosition: 'bottom' // 签名栏位置:top/bottom
@@ -1129,7 +1175,8 @@
    this.fetchProjectOptions()
    this.fetchProjectCompanyOptions()
this.getList()
    this.getSigInfo();
    this.getAnnInfo();
  },
  watch: {
    'form.constructionUnit': {
@@ -1162,6 +1209,52 @@
    }
  },
  methods: {
    getAnnInfo(){
      selectAllAnn({}).then(response=>{
        this.excelOptions.selectedAnnotations = response.data
      })
    },
    getSigInfo(){
      selectAllSig({}).then(response => {
        console.log(']]][[[[[[[[[]]]]]]]]]')
        console.log(response)
        this.excelOptions.selectedSignatures= response.data
        console.log(this.excelOptions.selectedSignatures)
      })
    },
    /** 取消授权按钮操作 */
      cancelAuthUser(row) {
        const recordId =  row.id
        var userId = store.state.user.id
        var _this = this
        // alert(userId)
        // alert(this.queryParams.archiveRecordsId)
        // alert(row.sysUser.userName)
        this.$modal.confirm('确认要取消该用户的授权吗?').then(function() {
          return delArchiverecordstouserByReIdAndUid({  recordId: recordId, userId: userId   })
        }).then(() => {
        //  this.getList()
        //修改案卷的状态
    //  var id = row.id
        var status = '未上传附件'
        updateStatusById(status, recordId, '退回管理员').then(response=>{
        //  this.$modal.msgSuccess("提交成功")
         this.getList()
        // _this.$store.dispatch('tagsView/delView', this.$route);
        //   _this.$router.push('/archiveManager/infoManager')
          _this.$modal.msgSuccess("取消授权成功")
        })
        }).catch(() => {})
      },
    handleSearch()
    {
      this.openSearch = true;
    },
    /** 选择授权用户操作 */
    handleSelectUser() {
    //  const archiveRecordsId = this.queryParams.archiveRecordsId
@@ -1184,6 +1277,7 @@
        if(res.code === 200) {
          this.$modal.msgSuccess(res.msg)
          this.visibleUser = false
          this.getList()
        //  this.$emit("ok")
        } else {
          this.$modal.msgError(res.msg || "授权失败,已经授权过了")
@@ -1206,6 +1300,10 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.userIds = selection.map(item => item.userId)
      var allMapInfo = selection.map(item =>(item.id, item.userId))
      console.log("0----------00000000000")
      console.log(allMapInfo)
    },
    // 查询表数据
    getUserList() {
@@ -1467,6 +1565,14 @@
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
      console.log(     this.ids)
      this.allMapInfo = selection.map(item => ({
  recordId: item.id,
  userId: item.userId
}));
console.log(this.allMapInfo)
    },
    /** 新增按钮操作 */
    handleAdd() {
@@ -1480,16 +1586,37 @@
    /*查看详情*/
    CheckInfo(row)
    {
      var recordStrId = row.recordId
      console.log(recordStrId==='')
      console.log("+---------------------")
      if(recordStrId===''||recordStrId==null)
      {
        this.$modal.msgWarning("请补充档案号信息,再编辑卷内目录!")
        return
      }
         if( row.projectName==null||row.pageCount==null||row.caseTitle==null||row.constructionUnit==null)
      {
        this.$modal.msgWarning("请先补充页码等相关信息!")
        return;
      }
      var mid = row.id
      const roleId = 2
   //   alert(mid)
var filingNumber = row.filingNumber
if(filingNumber==="")
  filingNumber = ' '
      var recordId = mid
      var pageCount = row.pageCount
      var recordStrId = row.recordId
      var inquiryNumber = row.inquiryNumber
      var sho = false
    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho+"/"+recordStrId+"/"+inquiryNumber+"/"+filingNumber)
    },
    /*导出备考表*/
@@ -1499,24 +1626,30 @@
       var id = row.id
             id = Number(id)
            var recordStrId = row.recordId
       var recordId = row.recordId
   this.download('/system/materials/exportBack/'+id+'/'+recordId, {
   }, `备考表_${new Date().getTime()}.pdf`)
   }, recordStrId +` 备考表.pdf`)
     },
     /*导出卷内目录*/
     JuanInfo(row)
     {
       var id = row.id
       var id = row.id
       console.log(row.pageCount)
      if(row.pageCount==null)
      {
        this.$modal.msgWarning("请先补充页码信息!")
        return;
      }
                 id = Number(id)
           var recordId = row.recordId
       this.download('/system/materials/exportJuan/'+id, {
       }, `卷内目录_${new Date().getTime()}.xls`)
       }, recordId+` 卷内目录.xls`)
     },
     /*导出案卷封面*/
     pageInfo(row)
@@ -1528,7 +1661,7 @@
           var recordId = row.recordId
       this.download('/system/materials/exportPageInfo/'+id+'/'+recordId, {
       }, `案卷封面_${new Date().getTime()}.xls`)
       },  recordId+` 案卷封面.xls`)
     },
    handleInfo(row)
    {
@@ -1536,7 +1669,18 @@
        //判断必须修改的字段是否补充完整了
       var valid = false;
      var pageCount = row.pageCount
      if(row.projectName!=null&&row.pageCount!=null&&row.caseTitle!=null&&row.constructionUnit)
      var recordStrId = row.recordId
      var filingNumber = row.filingNumber
      var inquiryNumber = row.inquiryNumber
      console.log(recordStrId==='')
      console.log("+---------------------")
      if(recordStrId===''||recordStrId==null)
      {
        this.$modal.msgWarning("请补充档案号信息,再编辑卷内目录!")
        return
      }
      if( row.projectName!=null&&row.pageCount!=null&&row.caseTitle!=null&&row.constructionUnit!=null)
       valid = true;
        if (valid) {
      var mid = row.id
@@ -1544,10 +1688,11 @@
   //   alert(mid)
      var recordId = mid
if(filingNumber==="")
  filingNumber = ' '
      var sho = true
    //  this.$router.push("/archiveManager/infoManagerAu/user/" + roleId+"/"+recordId)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho)
      this.$router.push("/archiveManager/infoManagerAu/archiveMaterialManager/" + recordId+"/"+pageCount+"/"+sho+"/"+recordStrId+"/"+inquiryNumber+"/"+filingNumber)
      }else
      {
        this.$modal.msgWarning("请补充页号等相关信息,再编辑卷内目录!")
@@ -1559,20 +1704,31 @@
    {
     //alert(row.id)
      var id = row.id
         var pageCount = row.pageCount
      if(pageCount===undefined||pageCount===0)
        this.$modal.msgWarning('请先补充案卷页数!')
      // 在提交之前,调用后端接口检查是否已经上传附件
      judge(id).then(response => {
        // console.log(response)
      getFileCount(id).then(response => {
        console.log(response)
        // alert(response.data)
        if (response.data===undefined||response.data === false) {
        if (response.length===undefined||response.length === 0) {
          // 如果文件数量为0,提示用户先上传附件
          this.$modal.msgWarning('请先上传附件,再进行提交操作')
        } else {
        }
        else if(response.length===pageCount)
        {
          // 如果已经上传了附件,继续提交操作
          var status = '录入完成'
          updateStatusById(status, id).then(response=>{
          updateStatusById(status, id, '提交案卷').then(response=>{
            this.$modal.msgSuccess("提交成功")
            this.getList()
          })
        }
        else
        {
          this.$modal.msgWarning('附件数量上传不足,请继续上传!')
        }
      }).catch(error => {
        console.error('检查附件数量失败:', error)
@@ -1611,6 +1767,23 @@
        this.title = "修改档案记录"
      })
    },
    handleBackPermission()
    {
      console.log("--------------------++++++++++]]]]]")
      console.log(this.allMapInfo)
      var _this = this;
    const ids =  this.ids
      this.$modal.confirm('是否确认收回档案记录编号为"' + ids + '"的权限?').then(function() {
        backPermission(_this.allMapInfo)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("收回权限成功")
      }).catch(() => {})
    },
    /*批量授权*/
    handleGivePermission()
    {
@@ -1622,24 +1795,75 @@
      this.getUserList()
    },
    /** 批量提交 */
    handleBatchSubmit() {
    async handleBatchSubmit() {
     // alert(this.ids)
      if (this.ids.length === 0) {
        this.$modal.msgWarning('请选择要提交的档案记录')
        return
      }
      const myValidIds = this.recordsList
  .filter(item => item.ownData === true)
  .map(item => item.id);
          // 检查选中的ID是否全部属于自己
    const invalidIds = this.ids.filter(id => !myValidIds.includes(id));
      const validRecords = this.recordsList
  // .filter(item => item.ownData === true)
    // 1. 转换recordsList为pageCount映射(核心步骤)
    const recordPageCountMap = this.recordsList.reduce((map, item) => {
      map[String(item.id)] = item.pageCount || item.totalpageCount || 0;
      return map;
    }, {});
    if (invalidIds.length > 0) {
      this.$message.error(`包含无权操作的ID: ${invalidIds.join(',')}`);
      return false;
  console.log("-------")
  let recordFileCountMap = {};
  try {
    // 调用接口:入参为有权操作的ID列表,返回 { recordId: 附件数, ... }
    const response = await getIdFileCounts(this.ids)
    // 假设接口返回格式:{ code: 0, data: { "1001": 5, "1002": 8 } }
    if (response.code === 200) {
      recordFileCountMap = response.data;
     // alert(434343)
    } else {
      this.$modal.msgError('获取附件数量失败:' + response.msg);
      return;
    }
  } catch (error) {
    this.$modal.msgError('接口调用失败:' + error.message);
    return;
  }
 // 3. 核心:筛选出「附件数等于自身totalpageCount」的有效ID
 const submitAbleIds = []; // 存储所有符合条件的ID
 const invalidAttachIds = []; // 存储附件数不匹配的ID(用于提示)
 for (const id of this.ids) {
   // 替换为项目实际字段名
   const attachmentCount = recordFileCountMap[id] || 0;
   const recordTotalPage = recordPageCountMap[id] || 0;
   if (attachmentCount === recordTotalPage) {
     submitAbleIds.push(id); // 符合条件,加入提交列表
   } else {
     invalidAttachIds.push({
       id: id,
       required: recordTotalPage
     });
   }
 }
 // 4. 提示附件数不匹配的记录
 if (invalidAttachIds.length > 0) {
   const tipMsg = invalidAttachIds.map(item =>
     `(ID:${item.id}) ,要求${item.required}个`
   ).join(';');
   this.$modal.msgWarning(`以下记录附件数量不匹配,将跳过提交:${tipMsg}`);
 }
 // 5. 检查是否有可提交的ID
 if (submitAbleIds.length === 0) {
   this.$modal.msgWarning('暂无符合所有条件的记录可提交');
   return;
 }
    //如果id全部有效才继续提交
      batchSubmitRecords( this.ids ).then(response => {
      batchSubmitRecords( submitAbleIds ).then(response => {
        if (response.code === 0) {
          this.$modal.msgSuccess('批量提交成功')
          this.getList()
@@ -1763,6 +1987,7 @@
      const id = row.id || this.ids;
     // alert(id)
      this.recordId = id;
      this.recId = row.recordId
      this.$modal.loading('正在获取Excel文件,请稍候...');
      // 从后端获取Excel文件
@@ -1992,6 +2217,7 @@
    /** 处理下载按钮点击 */
    handleDownloadClick() {
      if (this.currentExcelUrl) {
        // 获取用户选择的选项
        const { includeQrCode, selectedAnnotations } = this.excelOptions;
@@ -2007,12 +2233,12 @@
           link.href = this.currentExcelUrl;
           // 构建文件名,包含选项信息
           let filename = `record_${this.currentExcelId}`;
           if (includeQrCode) filename += '_qr';
           let filename =this.recId+ ` 预整理`;
           //if (includeQrCode) filename += '_qr';
           // if (selectedAnnotations.length > 0) {
           //   filename += `_anno${selectedAnnotations.join('')}`;x
           // }
           filename += `_${new Date().getTime()}.xls`;
           filename += `.xls`;
           link.download = filename;
@@ -2113,7 +2339,7 @@
            includeQrCode: this.excelOptions.includeQrCode
          };
          console.log(params)
          alert(457)
        //  alert(457)
          axios({
            method: 'Post',
@@ -2336,7 +2562,7 @@
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = `record_${id}_${new Date().getTime()}.xls`;
            link.download = `预整理.xls`;
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);