fei
2025-10-14 fc98e676332302c4b835f8fa4ed42d72e177801f
src/views/archiveManager/archiveMaterial/index.vue
@@ -162,6 +162,10 @@
         <el-button type="primary" @click="resetForms">重置</el-button>
          <el-button @click="cancel">取 消</el-button>
                    <el-button type="warning" @click="cancelAuthUser">退回管理员</el-button>
        </div>
@@ -239,12 +243,14 @@
      :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>
@@ -687,14 +693,17 @@
  <script>
  import { listMaterials, enload, getMaterials, delMaterials, addMaterials, updateMaterials } from "@/api/system/materials"
import { getToken } from '@/utils/auth'
import store from '@/store'
import { updateStatusById } from "@/api/system/records"
import {delArchiverecordstouserByReIdAndUid} from "@/api/system/archiverecordstouser"
  export default {
    name: "Materials",
    data() {
      return {
       importDialogVisible: false,
      fileList: [],
      uploadUrl:  process.env.VUE_APP_BASE_API +'/system/materials/upload', // 替换为实际的上传接口
      uploadUrl:  process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId, // 替换为实际的上传接口
           headers: {
        Authorization: 'Bearer ' + getToken()
      },     
@@ -833,7 +842,7 @@
      const recordId = this.$route.params && this.$route.params.recordId
      //alert(recordId)
      this.recordId = recordId;
      this.uploadUrl = process.env.VUE_APP_BASE_API +'/system/materials/upload/'+this.recordId
// alert('Bearer ' + getToken())
      this.reset()
      this.form.securityLevel = '普通' // 设置对话框表单默认值
@@ -863,8 +872,10 @@
  this.$refs.upload.clearFiles();
  // 关闭上传对话框
  this.importDialogVisible = false;
  // 刷新列表数据
  this.getList();        // 这里可以调用接口关联上传的文件和当前记录
        // 刷新列表数据
        this.getList();        // 这里可以调用接口关联上传的文件和当前记录
        //更新档案的状态
      } else {
        // alert(234)
        console.log(response)
@@ -883,9 +894,29 @@
    handlePreview(file) {
      console.log(file)
    },
     handleFileChange(file, fileList) {
    console.log('当前文件列表:', fileList);
    this.fileList = fileList;
  },
    // 提交上传
    submitUpload() {
      // 获取当前选择的文件数量
      const fileCount = this.fileList.length
      if (fileCount === 0) {
        this.$modal.msgWarning('请先选择文件再上传')
        return
      }
      if(fileCount!==this.total)
      {
        this.$modal.msgWarning('请选择与记录数一致的文件')
        return
      }
      // 执行上传
      this.$refs.upload.submit()
    },
    clearFileList() {
      this.fileList = [];
      this.$modal.msgSuccess('已清空上传列表');
    },
          handleKeyDown(e) {
      // 在keydown事件中更早地阻止默认行为
@@ -903,6 +934,10 @@
  if ((e.ctrlKey || e.metaKey) && e.key === 'd') {
    e.preventDefault();
    this.resetForms();
  }
  if ((e.ctrlKey || e.metaKey) && e.key === 'w') {
    e.preventDefault();
    this.closeCurrentTab();
  }
    },
      /** 查询【请填写功能名称】列表 */
@@ -1016,15 +1051,19 @@
        })
      },
      resetForms()
      {
    {
   this.reset()
          this.form.securityLevel = '普通' // 设置对话框表单默认值
          this.form.isSensitive = '否' // 设置对话框表单默认值
          this.form.isCanceled = '否' // 设置对话框表单默认值
          this.form.isAttachment = '否' // 设置对话框表单默认值
          this.form.isDiagram = '否' // 设置对话框表单默认值
          this.form.retentionPeriod = '永久' // 设置对话框表单默认值
      },
          this.form.securityLevel = '普通'
          this.form.isSensitive = '否'
          this.form.isCanceled = '否'
          this.form.isAttachment = '否'
          this.form.isDiagram = '否'
          this.form.retentionPeriod = '永久'
    },
    closeCurrentTab() {
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.push('/archiveManager/infoManager')
    },
      submitForm()
      {
        console.log(this.form)
@@ -1086,8 +1125,8 @@
  // }
  const formData = new FormData();
  formData.append('file', file);
  formData.append('recordId', this.recordId)
  alert(this.recordId)
 // formData.append('recordId', this.recordId)
  // alert(this.recordId)
  console.log(file)
  // 显示加载中状态
@@ -1111,7 +1150,33 @@
    this.$message.error('导入失败: ' + (error.message || '未知错误'));
  });
    }
    },
     /** 取消授权按钮操作 */
    cancelAuthUser(row) {
      const recordId =  this.recordId
      var userId = store.state.user.id
      var _this = this
      // alert(userId)
      // 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(() => {})
    },
    }
  }
  </script>