Crunchy
2025-04-29 e5454b769d44a34af423bf87ac8a740bf8c20341
src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
@@ -1,24 +1,21 @@
<template>
  <!-- 文件受控申请 -->
  <div class="controlled-file-application" style="height: 100%;">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">申请文件编号:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="queryParams.documentCode"
            @keyup.enter.native="refreshTable()"></el-input></div>
  <div>
    <div style="display: flex;justify-content: space-between">
      <div style="display: flex;">
        <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
          <span style="width: 128px;font-size: 14px;font-weight: 700;color: #606266;">申请文件编号</span>
          <el-input size="small" placeholder="请输入" clearable v-model="queryParams.documentCode"
                    @keyup.enter.native="refreshTable()"></el-input>
        </div>
        <div style="line-height: 30px;">
          <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
          <el-button size="mini" @click="refresh">重置</el-button>
        </div>
      </div>
      <!-- <div class="search_thing">
        <div class="search_label">申请人:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable
            v-model="queryParams.createUserName" @keyup.enter.native="refreshTable()"></el-input></div>
      </div> -->
      <div class="search_thing" style="padding-left: 30px;">
        <el-button size="small" @click="refresh()">重 置</el-button>
        <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
      </div>
      <div class="btns" style="padding-left: 30px;">
        <el-button size="small" type="primary"
          @click="addDialogVisible = true, addInfo = {}, file = null">文件受控申请</el-button>
      <div style="line-height: 30px;">
        <el-button size="small" type="primary" icon="el-icon-plus"
                   @click="addDialogVisible = true, addInfo = {}, file = null">文件受控申请</el-button>
      </div>
    </div>
    <div class="table">
@@ -190,10 +187,18 @@
        {
          label: "文件类别", prop: "type", width: "120px", dataType: "tag",
          formatData: (params) => {
            return this.fileType.find((m) => m.value == params).label;
            if(this.fileType.find((m) => m.value == params)) {
              return this.fileType.find((m) => m.value == params).label;
            } else {
              return null
            }
          },
          formatType: (params) => {
            return this.fileType.find((m) => m.value == params).type;
            if(this.fileType.find((m) => m.value == params)) {
              return this.fileType.find((m) => m.value == params).type;
            } else {
              return null
            }
          },
        },
        {
@@ -239,7 +244,12 @@
                this.handleCheck(row);
              },
              disabled: (row) => {
                return !row.dutyUserName.includes(this.nickName) || row.state == '通过'
                if(row.dutyUserName != null && row.dutyUserName != "") {
                  return !row.dutyUserName.includes(this.nickName) || row.state == '通过'
                }else {
                  return false
                }
              }
            },
            {
@@ -313,37 +323,6 @@
      this.queryParams = {};
      this.page.current = 1;
      this.getList();
    },
    getPower() {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let up = false
      let del = false
      let add = false
      // let check = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'addManageDocumentControlled') {
          up = true
        }
        if (power[i].menuMethod == 'addManageDocumentControlled') {
          add = true
        }
        if (power[i].menuMethod == 'delManageDocumentControlled') {
          del = true
        }
        // if (power[i].menuMethod == 'checkManageDocumentControlled') {
        //   check = true
        // }
      }
      // if (!check) {
      //   this.componentData.do.splice(2, 1)
      // }
      if (!del) {
        this.componentData.do.splice(1, 1)
      }
      if (!up) {
        this.componentData.do.splice(0, 1)
      }
      this.addPower = add
    },
    getAuthorizedPerson() {
      selectUserCondition().then(res => {
@@ -433,6 +412,7 @@
    handleUpdate(row) {
      this.title = '文件变更申请'
      this.addInfo = this.HaveJson(row)
      this.file = null
      this.addDialogVisible = true
    },
    // 查看附件
@@ -460,8 +440,7 @@
    },
    handleDown(row) {
      if (!row.url) return this.$message.warning('文件未上传')
      let url = this.javaApi + '/word/' + row.url
      this.$download.saveAs(url, row.url);
      this.$download.saveAs(row.url, row.url);
    },
    async uploadPDF(pdfBlob) {
      const formData = new FormData();
@@ -470,18 +449,25 @@
      formData.append('state', this.type); // 文件名字段
      formData.append('writer', this.currentInfo.writer); // 文件名字段
      let res = await checkManageDocumentControlled(formData)
      this.checkLoading = false
      this.noCheckLoading = false
      if (res.code == 200) {
        this.$message({ message: '操作成功', type: 'success' });
        this.checkDialogVisible = false;
        this.refreshTable()
        return true
      } else {
        this.$message({ message: '操作失败', type: 'error' });
        return false
      try {
        let res = await checkManageDocumentControlled(formData)
        this.checkLoading = false
        this.noCheckLoading = false
        if (res.code == 200) {
          this.$message({ message: '操作成功', type: 'success' });
          this.checkDialogVisible = false;
          this.refreshTable()
          return true
        } else {
          this.$message({ message: '操作失败', type: 'error' });
          return false
        }
      } catch (e) {
        this.checkLoading = false
        this.noCheckLoading = false
      }
    },
    handleCheckSub(type) {
      this.type = type
@@ -501,7 +487,6 @@
      })
        .then(() => {
          delManageDocumentControlled({ id: row.id }).then((res) => {
            if (res.code == 201) return;
            this.$message.success("删除成功");
            this.refresh();
          });
@@ -513,19 +498,6 @@
</script>
<style scoped>
.title {
  height: 60px;
  line-height: 60px;
}
.search {
  background-color: #fff;
  height: 40px;
  display: flex;
  align-items: center;
  position: relative;
}
.search_thing {
  width: 350px;
  display: flex;
@@ -541,19 +513,6 @@
.search_input {
  width: calc(100% - 110px);
}
.table {
  background-color: #fff;
  height: calc(100% - 60px - 80px);
  padding: 20px;
}
.btns {
  position: absolute;
  right: 20px;
  top: 5px;
}
.stamp {
  cursor: pointer;
  border: #fff 1px solid;