gaoluyang
2025-04-16 1ea1ad2c56e95e71e1756cfca73e7183f9795ac9
src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue
@@ -1,40 +1,28 @@
<template>
  <!-- 文件修订申请审批记录 -->
  <div class="DocumentRevisionRequestApprovalRecords">
    <el-row class="title">
      <el-col :span="12" style="padding-left: 20px;text-align: left;">文件修订申请审批记录</el-col>
      <el-col :span="12" style="text-align: right;">
        <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
        <!-- <el-upload :action="action" :show-file-list="false"
          accept='.doc,.docx' :headers="headers" :on-change="beforeUpload"
          :on-error="onError" ref='upload' v-if="upPower" :on-success="handleSuccessUp" style="display:inline-block;margin-left: 20px;">
          <el-button type="primary" size="medium">导入</el-button></el-upload> -->
        <el-button size="medium" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower"
          style="display:inline-block;margin-left: 20px;">导出</el-button>
      </el-col>
    </el-row>
  <div class="capacity-scope">
    <div class="search">
      <!-- <div class="search_thing">
        <div class="search_label">文件名称:</div>
        <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.documentName"
            @keyup.enter.native="refreshTable()"></el-input></div>
      </div> -->
      <div class="search_thing">
        <div class="search_label">文件编号:</div>
        <div class="search_input">
          <el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.documentCode"
            @keyup.enter.native="refreshTable()"></el-input>
        </div>
      <div>
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
          <el-form-item label="文件编号" prop="documentCode">
            <el-input size="small" placeholder="请输入" clearable v-model="queryParams.documentCode"
                      @keyup.enter.native="refreshTable()"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" size="mini" @click="refreshTable">查询</el-button>
            <el-button size="mini" @click="refresh">重置</el-button>
          </el-form-item>
        </el-form>
      </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>
        <el-button size="small" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
        <el-button size="small" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower"
                   style="display:inline-block;margin-left: 20px;">导出</el-button>
      </div>
    </div>
    <div class="table">
      <ValueTable ref="ValueTable" :url="$api.manageRecordAudit.pageManageRecordAudit"
        :delUrl="$api.manageRecordAudit.delManageRecordAudit" :componentData="componentData"
        :upUrl="$api.manageRecordIssueRecycle.doManageRecordIssueRecycle" :key="upIndex" />
      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
        :height="'calc(100vh - 260px)'" @pagination="pagination"></lims-table>
    </div>
    <el-dialog :title="title" :visible.sync="addDialogVisible" width="800px" top="6vh">
      <el-row>
@@ -335,14 +323,27 @@
</template>
<script>
import ValueTable from '@/components/Table/value-table.vue'
import limsTable from "@/components/Table/lims-table.vue";
import { exportHtmlToPDF } from '@/utils/downHtmlToPDF'
import filePreview from '@/components/Preview/filePreview.vue'
import {
  exportOutManageRecordAudit,
  addManageRecordAudit,
  doManageRecordAudit,
  selectCNSAPersonTree,
  ratifyManageRecordAudit,
  pageManageRecordAudit,
  delManageRecordAudit,
} from '@/api/cnas/systemManagement/documentRecords.js'
import {
  pageManageDocumentList,
} from '@/api/cnas/systemManagement/documentControl.js'
import {
  selectUserCondition,
} from "@/api/business/inspectionTask.js";
export default {
  components: {
    ValueTable,
    filePreview
  },
  name: 'RevisionRecord',
  components: {filePreview, limsTable},
  data() {
    return {
      addPower: true,
@@ -350,114 +351,6 @@
      outLoading: false,
      lookDialogVisible: false,
      addLoading: false,
      componentData: {
        entity: {
          // documentName: null,
          documentCode: null,
          orderBy: {
            field: 'createTime',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: false,
        select: false,
        // selectMethod: 'handleChangeTask',
        do: [{
          id: 'handleLook',
          font: '查看',
          type: 'text',
          method: 'handleLook'
        }, {
          id: 'handleLook0',
          font: '文件预览',
          type: 'text',
          method: 'handleLook0'
        }, {
          id: 'handleOut',
          font: '下载',
          type: 'text',
          method: 'handleOut'
        }, {
          id: 'delete',
          font: '删除',
          type: 'text',
          method: 'doDiy',
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }, {
          id: 'handleEdit',
          font: '修改',
          type: 'text',
          method: 'handleEdit',
          field: [],
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }, {
          id: 'handleRatify',
          font: '批准',
          type: 'text',
          method: 'handleRatify',
          field: [],
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }, {
          id: 'handlework0',
          font: '申请意见',
          type: 'text',
          method: 'handlework0',
          field: [],
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }, {
          id: 'handlework1',
          font: '原定制意见',
          type: 'text',
          method: 'handlework1',
          field: [],
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }, {
          id: 'handlework2',
          font: '原审核意见',
          type: 'text',
          method: 'handlework2',
          field: [],
          disabFun: (row, index) => {
            return !!row.ratifyUser
          }
        }],
        tagField: {
          // documentType:{
          //   select: []
          // },
          // receiveUserName:{
          //   select: []
          // },
        },
        selectField: {
          // documentType:{
          //   select: []
          // },
          // receiveUserName:{
          //   select: []
          // },
        },
        addUpload: ['signatoryUrl'],
        requiredAdd: [],
        requiredUp: [],
        datePicker: ['receiveDate'],
        noHead: ['signedUserName', 'signedDate', 'departLims'],//不参与新增编辑的字段
        needSort: [],
        inputType: ''
      },
      entityCopy: {},
      upIndex: 0,
      title: '新增',
      addInfo: {
        method: '修订',
@@ -470,117 +363,179 @@
      file: null,
      title0: '查看',
      currentInfo: {},
      queryParams: {},
      tableData: [],
      column: [
        { label: "文件编号", prop: "documentCode" },
        { label: "章节号", prop: "capter", width: "120px" },
        {
          label: "页码",
          prop: "pages",
        },
        { label: "修订次数", prop: "number" },
        { label: "修改前版本号", prop: "beforeVersion" },
        { label: "修改后版本号", prop: "afterVersion" },
        { label: "修改内容", prop: "alterThing" },
        { label: "修订人", prop: "alterUserName" },
        { label: "批准人", prop: "ratifyUserName" },
        { label: "日期", prop: "date" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "查看",
              type: "text",
              clickFun: (row) => {
                this.handleLook(row);
              },
            },
            {
              name: "文件预览",
              type: "text",
              clickFun: (row) => {
                this.handleLook0(row);
              },
            },
            {
              name: "下载",
              type: "text",
              clickFun: (row) => {
                this.handleOut(row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.handleEdit(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            {
              name: "批准",
              type: "text",
              clickFun: (row) => {
                this.handleRatify(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            {
              name: "申请意见",
              type: "text",
              clickFun: (row) => {
                this.handlework0(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            {
              name: "原定制意见",
              type: "text",
              clickFun: (row) => {
                this.handlework1(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            {
              name: "原审核意见",
              type: "text",
              clickFun: (row) => {
                this.handlework2(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.getPower()
    this.getList()
    this.getFileList()
    this.getAuthorizedPerson()
    this.selectTreeList()
  },
  methods: {
    getPower() {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let add = false
      let del = false
      let out = false;
      let ratify = false
      let audit1 = false
      let audit2 = false
      let audit3 = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'addManageRecordAudit') {
          add = true
        }
        if (power[i].menuMethod == 'delManageRecordAudit') {
          del = true
        }
        if (power[i].menuMethod == 'ratifyManageRecordAudit') {
          ratify = true
        }
        if (power[i].menuMethod == 'exportOutManageRecordAudit') {
          out = true
        }
        if (power[i].menuMethod == 'manageRecordAudit1') {
          audit1 = true
        }
        if (power[i].menuMethod == 'manageRecordAudit2') {
          audit2 = true
        }
        if (power[i].menuMethod == 'manageRecordAudit3') {
          audit3 = true
        }
      }
      if (!audit3) {
        this.componentData.do.splice(8, 1)
      }
      if (!audit2) {
        this.componentData.do.splice(7, 1)
      }
      if (!audit1) {
        this.componentData.do.splice(6, 1)
      }
      if (!ratify) {
        this.componentData.do.splice(5, 1)
      }
      if (!add) {
        this.componentData.do.splice(4, 1)
      }
      if (!del) {
        this.componentData.do.splice(3, 1)
      }
      this.addPower = add
      this.outPower = out
    },
    openAdd() {
      this.addInfo = {
        method: '修订',
      }
      this.title = '新增'
      this.file = null
      this.addDialogVisible = true;
    },
    // 导出
    handleDown() {
      this.outLoading = true
      this.$axios.post(this.$api.manageRecordAudit.exportOutManageRecordAudit, { entity: this.componentData.entity }, { headers: { 'Content-Type': 'application/json' } }).then(res => {
      exportOutManageRecordAudit(this.queryParams).then(res => {
        this.outLoading = false
        if (res.code == 201) return this.$message.error('导出失败')
        this.$message.success('导出成功')
        let url = this.javaApi + 'word/' + res.message
        const link = document.createElement('a');
        link.href = url;
        link.download = '文件修订表';
        link.click();
        this.$download.saveAs(res.data, "文件修订表");
      })
    },
    refreshTable() {
      this.refreshTable()()
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      pageManageRecordAudit({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.page.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.getList();
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.upIndex++
      this.refreshTable()
      this.queryParams = {};
      this.page.current = 1;
      this.getList();
    },
    refreshTable() {
      this.page.current = 1;
      this.getList();
    },
    // 获取文件列表--文件清单
    getFileList() {
      this.$axios.post(this.$api.manageDocumentList.pageManageDocumentList, {
        entity: {
          orderBy: {
            field: 'createTime',
            order: 'desc'
          }
        },
        page: {
          current: -1,
          size: -1
        }
      }, {
        headers: {
          'Content-Type': 'application/json'
        }
      pageManageDocumentList({
        current: -1,
        size: -1
      }).then(res => {
        this.fileList = res.data.body.records.map(m => {
        this.fileList = res.data.records.map(m => {
          m.title = m.documentCode
          return m
        })
@@ -600,12 +555,7 @@
          fd.append(m, this.addInfo[m])
        }
        this.addLoading = true
        this.$axios.post(this.$api.manageRecordAudit.addManageRecordAudit, fd, {
          headers: {
            'Content-Type': 'multipart/form-data'
          },
          noQs: true
        }).then(res => {
        addManageRecordAudit(fd).then(res => {
          this.addLoading = false
          if (res.code == 200) {
            this.$message({
@@ -636,12 +586,7 @@
          }
        }
        this.addLoading = true
        this.$axios.post(this.$api.manageRecordAudit.doManageRecordAudit, fd, {
          headers: {
            'Content-Type': 'multipart/form-data'
          },
          noQs: true
        }).then(res => {
        doManageRecordAudit(fd).then(res => {
          this.addLoading = false
          if (res.code == 200) {
            this.refreshTable()
@@ -656,7 +601,7 @@
      }
    },
    getAuthorizedPerson() {
      this.$axios.get(this.$api.user.getUserMenu).then(res => {
      selectUserCondition().then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
@@ -664,14 +609,12 @@
            value: a.id
          })
        })
        // this.componentData.tagField.receiveUserName.select = data
        // this.componentData.selectField.receiveUserName.select = data
        this.personList = data
      })
    },
    // 查询树形列表
    selectTreeList() {
      this.$axios.get(this.$api.personnel.selectCNSAPersonTree).then((res) => {
      selectCNSAPersonTree().then((res) => {
        this.list = res.data[0].children;
      });
    },
@@ -682,6 +625,7 @@
    handleEdit(row) {
      this.addInfo = row
      this.title = '修改'
      this.file = null
      this.addDialogVisible = true;
    },
    // 审批
@@ -692,15 +636,10 @@
        type: 'warning'
      })
        .then(() => {
          this.$axios
            .post(this.$api.manageRecordAudit.ratifyManageRecordAudit, { id: row.id })
            .then(res => {
              if (res.code === 201) {
                return;
              }
              this.$message.success('操作成功');
              this.refreshTable();
            })
          ratifyManageRecordAudit({ id: row.id }).then(res => {
            this.$message.success('操作成功');
            this.refreshTable();
          })
            .catch(e => {
              this.$message.error('操作失败');
            });
@@ -744,22 +683,30 @@
    handleLook0(row) {
      this.currentInfo = row;
      this.lookDialogVisible = true
    }
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delManageRecordAudit({ id: row.id }).then((res) => {
            this.$message.success("删除成功");
            this.refresh();
          });
        })
        .catch(() => { });
    },
  }
}
</script>
<style scoped>
.title {
  height: 60px;
  line-height: 60px;
}
.search {
  background-color: #fff;
  height: 80px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search_thing {
@@ -778,18 +725,11 @@
  width: calc(100% - 110px);
}
.table {
  margin-top: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 80px - 10px - 40px);
  padding: 20px;
}
.tables {
  table-layout: fixed;
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
}
.tables td {
@@ -842,7 +782,4 @@
  left: 0;
}
>>>.el-dialog__body {
  height: auto;
}
</style>