fei
1 天以前 a0f40c39abc6b26e101f54433c150af5bbbc240a
src/views/archiveManager/archiveMaterial/index.vue
@@ -2,7 +2,7 @@
    <div class="app-container">
      <div v-if="sho">
         <h2 class="title-border">添加案卷详细记录   {当前录入了{{total}}条}</h2>
         <h2 class="title-border">添加案卷详细记录   {录入了{{total}}条}  { {{recordStrId}} } { {{inquiryNumber}} } { {{filingNumber}} }  </h2>
 <el-form ref="form" :model="form" :rules="rules" label-width="100px">
   <el-row>
@@ -19,23 +19,23 @@
            <div class="title-search-wrapper">
              <el-input
                type="textarea"
                rows="1"
                rows="2"
                    v-auto-height="{ minRows: 2, maxRows: 10 }"
                v-model="form.creator"
                placeholder="请输入责任者"
                @input="handleCreatorInput"
                @focus="showCreatorSuggestions = true"
                @blur="handleCreatorBlur"
                  @focus="(e) => e.target.select()"
              />
              <!-- 下拉建议框 -->
              <div
                v-if="showCreatorSuggestions && creatorSuggestions.length > 0"
                v-if="showCreatorSuggestions && creatorSuggestions.length > 0 && false"
                class="title-suggestions"
              >
                <div
                  v-for="(item, index) in creatorSuggestions"
                  :key="index"
                  class="suggestion-item"
                  @mousedown="selectCreatorSuggestion(item)"
                  @mousedown.prevent="selectCreatorSuggestion(item)"
                >
                  {{ item }}
                </div>
@@ -51,16 +51,14 @@
            <div class="title-search-wrapper">
              <el-input
                type="textarea"
                rows="1"
                rows="2"
                v-model="form.title"
                placeholder="请输入文件题名"
                @input="handleTitleInput"
                @focus="showTitleSuggestions = true"
                @blur="handleTitleBlur"
                @focus="(e) => e.target.select()"
              />
              <!-- 下拉建议框 -->
              <div
                v-if="showTitleSuggestions && titleSuggestions.length > 0"
                v-if="showTitleSuggestions && titleSuggestions.length > 0  && false"
                class="title-suggestions"
              >
                <div
@@ -282,7 +280,7 @@
          >导出卷内目录</el-button>
        </el-col>
        <el-col :span="1.5">
        <el-col :span="1.2">
          <el-button
            type="warning"
            plain
@@ -306,43 +304,7 @@
          >删除</el-button>
        </el-col>
          <el-col :span="1.5">
          <el-button
          v-if="sho"
            type="success"
            plain
            icon="el-icon-edit"
            size="mini"
            @click="handleImport"
            v-hasPermi="['system:materials:edit']"
          >全部附件导入</el-button>
            <!-- 在按钮下方添加导入对话框 -->
  <el-dialog title="批量导入附件" :visible.sync="importDialogVisible" width="50%">
    <el-upload
      class="upload-demo"
      ref="upload"
      :action="uploadUrl"
      :headers="headers"
      :data="uploadParams"
      :on-success="handleSuccess"
      :on-error="handleError"
      :on-preview="handlePreview"
      :on-remove="handleRemove"
      :file-list="fileList"
        :on-change="handleFileChange"
      :auto-upload="false"
      multiple
      accept=".jpg,.png"
    >
      <el-button slot="trigger" size="small" type="primary">选择文件</el-button>
      <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
      <el-button style="margin-left: 10px;" size="small" type="danger" @click="clearFileList">清空列表</el-button>
      <div slot="tip" class="el-upload__tip">可上传JPG等格式文件,单个文件不超过50MB</div>
    </el-upload>
  </el-dialog>
        </el-col>
        <el-col :span="1.5">
        <el-button
          type="warning"
@@ -354,7 +316,7 @@
        >导入模板下载</el-button>
      </el-col>
        <el-col      v-if="sho" :span="1.5">
        <el-col      v-if="sho" :span="1.2">
        <el-upload
          action=""
@@ -371,6 +333,55 @@
        </el-upload>
      </el-col>
      <el-col  :span="1.1">
        <el-button type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          @click="handleImport"
          v-hasPermi="['system:materials:edit']"
        >查看附件</el-button>
      </el-col>
      <el-col :span="1.2">
              <el-button
              v-if="sho"
                type="success"
                plain
                icon="el-icon-edit"
                size="mini"
                @click="handleImport"
                v-hasPermi="['system:materials:edit']"
              >全部附件导入</el-button>
              已经上传了 {{this.fileCut}} 张附件,还要上传 {{this.totalPageCount-this.fileCut}} 张附件
                <!-- 在按钮下方添加导入对话框 -->
      <el-dialog title="批量导入附件" :visible.sync="importDialogVisible" width="50%">
        <el-upload
          class="upload-demo"
          ref="upload"
          :action="uploadUrl"
          :headers="headers"
          :data="uploadParams"
          :on-success="handleSuccess"
          :on-error="handleError"
          :on-preview="handlePreview"
          :on-remove="handleRemove"
          :file-list="fileList"
            :on-change="handleFileChange"
          :auto-upload="false"
          multiple
          accept=".jpg,.png"
        >
          <el-button slot="trigger" size="small" type="primary">选择文件</el-button>
          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
          <el-button style="margin-left: 10px;" size="small" type="danger" @click="clearFileList">清空列表</el-button>
          <div slot="tip" class="el-upload__tip">可上传JPG等格式文件,单个文件不超过50MB</div>
        </el-upload>
      </el-dialog>
            </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>
@@ -402,17 +413,17 @@
              </template>
            </el-table-column>
                <el-table-column label="文件材料序号" align="center" prop="fileNumber" />
        <el-table-column label="文件编号" align="center" prop="documentNumber" />
        <el-table-column label="文件编号" align="center" prop="documentNumber" width="180"/>
        <el-table-column label="责任者" align="center" prop="creator" />
        <el-table-column label="文件题名" align="center" prop="title" />
        <el-table-column label="责任者" align="center" prop="creator" width="180"/>
        <el-table-column label="文件题名" align="center" prop="title" width="220"/>
        <el-table-column label="日期" align="center" prop="date" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="页号" sortable align="center" prop="pageNumber"  />
        <el-table-column label="备注" align="center" prop="remarks" />
        <el-table-column label="备注" align="center" prop="remarks" width="180"/>
            <!--          <el-table-column label="页次" sortable align="center" prop="pageOrder"  />
--->
        <el-table-column label="所处阶段" sortable align="center" width="180" prop="stage" />
@@ -457,15 +468,17 @@
              <el-input v-model="forms.documentNumber" placeholder="请输入文件编号" />
            </el-form-item>
           <el-row>
           <el-col :span="16">
           <el-col >
               <el-form-item label="责任者" prop="creator">
                   <el-input type="textarea" rows="1" v-model="forms.creator" placeholder="请输入责任者" />
                   <el-input type="textarea"          rows="2"
                    v-auto-height="{ minRows: 2, maxRows: 10 }" v-model="forms.creator" placeholder="请输入责任者" />
                 </el-form-item>
           </el-col>
           </el-row>
           <el-form-item label="文件题名" prop="title">
             <el-input type="textarea" rows="1" v-model="forms.title" placeholder="请输入文件题名" />
             <el-input type="textarea"          rows="2"
                    v-auto-height="{ minRows: 2, maxRows: 10 }" v-model="forms.title" placeholder="请输入文件题名" />
           </el-form-item>
                 <el-form-item label="日期" prop="date">
                  <el-input v-model="forms.date" placeholder="请输入日期 (格式:yyyy-mm-dd)" style="width: 200px;" />
@@ -814,10 +827,15 @@
import { updateStatusById } from "@/api/system/records"
import {delArchiverecordstouserByReIdAndUid} from "@/api/system/archiverecordstouser"
  export default {
    name: "Materials",
    name: "ArchiveMaterialManager",
    data() {
      return {
        //附件数量
        fileCut: 0,
        //是否显示相关内容
        sho: true,
        totalPageCount: 0,
@@ -883,6 +901,9 @@
          { value: '06-业务数据', label: '06-业务数据' },
        ],
        recordId: null,
        inquiryNumber: '',
        filingNumber: '',
        recordStrId: '',
        // 遮罩层
        loading: true,
        // 选中数组
@@ -913,7 +934,7 @@
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          pageSize: 50,
          creator: null,
          title: null,
          date: null,
@@ -1027,7 +1048,9 @@
    created() {
      //const roleId = this.$route.params && this.$route.params.roleId
      const recordId = this.$route.params && this.$route.params.recordId
      this.recordStrId = this.$route.params && this.$route.params.recordStrId
      this.inquiryNumber = this.$route.params && this.$route.params.inquiryNumber
      this.filingNumber = this.$route.params && this.$route.params.filingNumber
      this.totalPageCount = this.$route.params && this.$route.params.pageCount
      this.sho = this.$route.params && this.$route.params.sho
@@ -1037,7 +1060,7 @@
      //alert(this.totalPageCount)
      //alert(recordId)
      this.recordId = recordId;
      this.uploadUrl = process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId
      this.uploadUrl = process.env.VUE_APP_BASE_API +'/system/materials/uploads/'+this.recordId
// alert('Bearer ' + getToken())
      this.reset()
      this.form.securityLevel = '普通' // 设置对话框表单默认值
@@ -1050,9 +1073,56 @@
        this.queryParams.recordId = recordId
        this.getList()
        getFileCount(recordId).then(response=>{
          this.fileCut = response.length
         // alert(this.fileCut)
        })
      }
    },
    methods: {
    handleTabKey (event) {
     // 默认行为
     event.preventDefault()
     // 手动全选
     const textarea = event.target
     textarea.select()
     // 如果需要切换到下一个元素,可以手动触发
     // const focusableElements = getFocusableElements()
     // moveFocusToNextElement()
   },
      // 输入事件(示例:可根据输入内容过滤建议列表)
          handleCreatorInput(val) {
            // 重置选中索引
            this.selectedIndex = -1;
            // 这里替换成你的实际建议列表获取逻辑
            // this.creatorSuggestions = ['张三', '李四', '王五', '赵六'].filter(item =>
            //   item.includes(val)
            // );
          },
          // 上方向键逻辑
          handleKeyUp() {
            if (!this.showCreatorSuggestions || this.creatorSuggestions.length === 0) return;
            // 向上切换,到顶则回到最后一项
            this.selectedIndex = this.selectedIndex <= 0
              ? this.creatorSuggestions.length - 1
              : this.selectedIndex - 1;
          },
          // 下方向键逻辑
          handleKeyDown() {
            if (!this.showCreatorSuggestions || this.creatorSuggestions.length === 0) return;
            // 向下切换,到底则回到第一项
            this.selectedIndex = this.selectedIndex >= this.creatorSuggestions.length - 1
              ? 0
              : this.selectedIndex + 1;
          },
          // 回车选中当前高亮项
          handleKeyEnter() {
            if (this.selectedIndex >= 0 && this.selectedIndex < this.creatorSuggestions.length) {
              this.selectCreatorSuggestion(this.creatorSuggestions[this.selectedIndex]);
            }
          },
        // 上传失败回调
    handleError(err, file, fileList) {
      // 失败计数+1
@@ -1087,17 +1157,24 @@
        this.$refs.upload.clearFiles();
        // 关闭上传对话框
        this.importDialogVisible = false;
      //  alert(123)
        // 刷新列表数据
        this.getList();
        getFileCount(this.recordId).then(response=>{
          this.fileCut = response.length
    //      alert(98)
         // alert(this.fileCut)
         this.getList();
        })
      }
    },
     // 打开导入对话框
    handleImport() {
      //生成新的记录
      insertFile(this.recordId, this.totalPageCount).then(response => {
        console.log(response)
      //  alert(3245)
        })
      // insertFile(this.recordId, this.totalPageCount).then(response => {
      //   console.log(response)
      // //  alert(3245)
      //   })
      this.importDialogVisible = true
    },
    // 文件移除
@@ -1120,6 +1197,7 @@
        this.$modal.msgWarning('请先选择文件再上传')
        return
      }
     // alert(this.recordId)
@@ -1129,20 +1207,47 @@
     //   var res = response.data.res
     //  console.log(res)
       //alert(response.data.total)
       if(fileCount!=this.totalPageCount)
       // if(fileCount!=this.totalPageCount)
       // {
       //   this.$modal.msgWarning('请选择与记录数一致的文件')
       //   return
       // }
     //  else
       {
         this.$modal.msgWarning('请选择与记录数一致的文件')
         return
       }
       else
       {
         // 定义允许的最大值
         const maxValue = this.totalPageCount;
         // 过滤fileList数组,保留数字部分不超过maxValue的元素
         this.fileList = this.fileList.filter(item => {
          // 步骤1:检测是否包含中文([\u4e00-\u9fa5]是中文的Unicode范围)
             const hasChinese = /[\u4e00-\u9fa5]/.test(item.name);
             // 有中文直接返回false,删除该元素
             if (hasChinese) return false;
           // 步骤1:提取name中的纯数字部分
           // 正则表达式解释:\d+ 匹配一个或多个数字
           const numStr = item.name.match(/\d+/);
           // 处理没有数字的情况(返回false,会被过滤掉)
           if (!numStr) return false;
           // 步骤2:将数字字符串转为数字
           const num = parseInt(numStr[0], 10);
           // 步骤3:判断是否小于等于最大值
           return num <= maxValue;
         });
         // 初始化上传状态计数
         this.uploadSuccessCount = 0;
         this.uploadFailCount = 0;
         this.totalUploadFiles = fileCount;
         // 执行上传
         console.log(this.fileList)
           this.$refs.upload.submit()
           this.getList()
      //     this.getList()
       }
       // else
       // {
@@ -1330,6 +1435,16 @@
      selectCreatorSuggestion(creator) {
        this.form.creator = creator;
        this.showCreatorSuggestions = false;
        // 手动触发 input 事件,确保表单验证等逻辑正常
            this.$nextTick(() => {
              const inputElement = this.$el.querySelector('textarea');
              if (inputElement) {
                inputElement.focus();
                // 将光标定位到文本末尾
                const length = inputElement.value.length;
                inputElement.setSelectionRange(length, length);
              }
            });
      },
      // 处理材料类型变化
@@ -1552,14 +1667,14 @@
          this.download('system/materials/exportDir', {
            ids: this.ids.join(','),
         //   exportType: 'selected'
          }, `materiaDir_selected_${new Date().getTime()}.xls`)
          }, this.recordStrId+ `  卷内目录.xls`)
        } else {
          // 显示导出全部数据的提示
          this.$message.info('正在导出符合当前查询条件的所有数据...');
          // 没有选中行时,导出当前查询条件的数据
          this.download('system/materials/exportDir', {
            ...this.queryParams
          }, `materiaDir_${new Date().getTime()}.xls`)
          }, this.recordStrId+`  卷内目录.xls`)
        }
      },
      /** 导出按钮操作 - 支持导出选中行或全部数据 */
@@ -1572,14 +1687,14 @@
          this.download('system/materials/export', {
            ids: this.ids.join(','),
         //   exportType: 'selected'
          }, `materials_selected_${new Date().getTime()}.xls`)
          }, this.recordStrId+`  电子文件信息.xls`)
        } else {
          // 显示导出全部数据的提示
          this.$message.info('正在导出符合当前查询条件的所有数据...');
          // 没有选中行时,导出当前查询条件的数据
          this.download('system/materials/export', {
            ...this.queryParams
          }, `materials_${new Date().getTime()}.xls`)
          }, this.recordStrId+`  电子文件信息.xls`)
        }
      },
@@ -1634,14 +1749,14 @@
      // alert(userId)
      // alert(this.queryParams.archiveRecordsId)
      // alert(row.sysUser.userName)
      this.$modal.confirm('确认要取消该用户的"' + '' + '"授权吗?').then(function() {
      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=>{
      updateStatusById(status, recordId, '退回管理员').then(response=>{
      //  this.$modal.msgSuccess("提交成功")
      //  this.getList()
      _this.$store.dispatch('tagsView/delView', this.$route);