fei
昨天 ba6ea01d3fe185f760f6c847a5dceaf14c01ef05
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
@@ -955,7 +966,7 @@
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"
@@ -970,6 +981,7 @@
  name: "Records",
  data() {
    return {
      openSearch: false,
      totalUser: 0,
      visibleUser:false,
      userList:[],
@@ -1162,6 +1174,10 @@
    }
  },
  methods: {
    handleSearch()
    {
      this.openSearch = true;
    },
    /** 选择授权用户操作 */
    handleSelectUser() {
    //  const archiveRecordsId = this.queryParams.archiveRecordsId
@@ -1481,15 +1497,22 @@
    CheckInfo(row)
    {
   if(row.pageCount==null)
      {
        this.$modal.msgWarning("请先补充页码信息!")
        return;
      }
      var mid = row.id
      const roleId = 2
   //   alert(mid)
      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)
    },
    /*导出备考表*/
@@ -1510,7 +1533,12 @@
     JuanInfo(row)
     {
       var id = row.id
       console.log(row.pageCount)
      if(row.pageCount==null)
      {
        this.$modal.msgWarning("请先补充页码信息!")
        return;
      }
                 id = Number(id)
           var recordId = row.recordId
@@ -1536,6 +1564,8 @@
        //判断必须修改的字段是否补充完整了
       var valid = false;
      var pageCount = row.pageCount
      var recordStrId = row.recordId
      var inquiryNumber = row.inquiryNumber
      if(row.projectName!=null&&row.pageCount!=null&&row.caseTitle!=null&&row.constructionUnit)
       valid = true;
        if (valid) {
@@ -1547,7 +1577,7 @@
      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)
      }else
      {
        this.$modal.msgWarning("请补充页号等相关信息,再编辑卷内目录!")
@@ -1633,24 +1663,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()