Crunchy
2025-03-17 0a26d58a3906b9e13946c7cb46fae51a0de98920
src/views/CNAS/systemManagement/documentRecords/regularReviewsRecord.vue
@@ -1,68 +1,55 @@
<template>
  <!-- 文件定期审查记录 -->
  <div class="PeriodicDocumentReviewRecords">
    <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">
    <el-tabs type="border-card" v-model="activeName" style="height: 100%;">
      <el-tab-pane label="填写" name="填写" 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="componentData.entity.documentName" @keyup.enter.native="refreshTable()"></el-input></div>
          <div>
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
              <el-form-item label="文件名称" prop="documentName">
                <el-input size="small" placeholder="请输入" clearable
                          v-model="queryParams.documentName" @keyup.enter.native="refreshTable()"></el-input>
              </el-form-item>
              <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" icon="el-icon-search" size="mini" @click="refreshTable">查 询</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="refresh">重 置</el-button>
              </el-form-item>
            </el-form>
          </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>
          <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">
            <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
            <el-upload :action="action" :multiple="false" :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>
          <div>
            <el-button size="small" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
            <el-upload :action="action" :multiple="false" :show-file-list="false" accept='.doc,.docx'
                       :headers="uploadHeader" :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="small">导入</el-button></el-upload>
          </div>
        </div>
        <div class="table">
          <ValueTable ref="ValueTable" :url="$api.manageRecordIntervals.pageManageRecordIntervals"
            :delUrl="$api.manageRecordIntervals.delManageRecordIntervals" :componentData="componentData"
            :upUrl="$api.manageRecordIssueRecycle.doManageRecordIssueRecycle" :key="upIndex" />
          <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
            :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table>
        </div>
      </el-tab-pane>
      <el-tab-pane label="历史记录" name="历史记录" style="height: 100%;">
        <div class="search">
          <div class="search_thing">
            <div class="search_label">年:</div>
            <div class="search_input">
              <el-date-picker v-model="componentData0.entity.year" type="year" placeholder="选择年" format="yyyy"
                value-format="yyyy" size="small" @change="refreshTable()">
        <div>
          <el-form :model="queryParams0" ref="queryParams0" size="small" :inline="true">
            <el-form-item label="年" prop="year">
              <el-date-picker v-model="queryParams0.year" type="year" placeholder="选择年" format="yyyy"
                              value-format="yyyy" size="small" @change="refreshTable(1)">
              </el-date-picker>
            </div>
          </div>
          <div class="search_thing" style="padding-left: 30px;">
            <el-button size="small" @click="refresh(1)">重 置</el-button>
            <el-button size="small" type="primary" @click="refreshTable(1)">查 询</el-button>
          </div>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable(1)">查 询</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="refresh(1)">重 置</el-button>
            </el-form-item>
          </el-form>
        </div>
        <div class="table">
          <ValueTable ref="ValueTable0" :url="$api.manageRecordIntervals.pageManageRecordIntervalsTotal"
            :componentData="componentData0" :key="upIndex" />
          <lims-table :tableData="tableData0" :column="column0" :page="page0" :tableLoading="tableLoading"
            :height="'calc(100vh - 290px)'" @pagination="pagination0"></lims-table>
        </div>
      </el-tab-pane>
    </el-tabs>
@@ -139,12 +126,25 @@
</template>
<script>
import ValueTable from '@/components/Table/value-table.vue'
import limsTable from "@/components/Table/lims-table.vue";
import filePreview from '@/components/Preview/filePreview.vue'
import { getToken } from "@/utils/auth";
import {
  exportOutManageRecordIntervals,
  addManageRecordIntervals,
  doManageRecordIntervals,
  ratifyManageRecordIntervalsTotal,
  submitManageRecordIntervalsTotal,
  pageManageRecordIntervals,
  pageManageRecordIntervalsTotal,
  delManageRecordIntervals,
} from '@/api/cnas/systemManagement/documentRecords.js'
import {
  pageManageDocumentList,
} from '@/api/cnas/systemManagement/documentControl.js'
export default {
  name: 'RegularReviewsRecord',
  components: {
    ValueTable,
    limsTable,
    filePreview
  },
  data() {
@@ -159,110 +159,6 @@
      lookDialogVisible: false,
      noCheckLoading: false,
      checkLoading: false,
      componentData: {
        entity: {
          documentName: null,
          documentCode: null,
          orderBy: {
            field: 'id',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: false,
        select: false,
        // selectMethod: 'handleChangeTask',
        do: [{
          id: 'handleEdit',
          font: '修改',
          type: 'text',
          method: 'handleEdit',
          field: [],
        }, {
          id: 'delete',
          font: '删除',
          type: 'text',
          method: 'doDiy',
        }],
        tagField: {
          // documentType:{
          //   select: []
          // },
          // receiveUserName:{
          //   select: []
          // },
        },
        selectField: {
          // documentType:{
          //   select: []
          // },
          // receiveUserName:{
          //   select: []
          // },
        },
        addUpload: ['signatoryUrl'],
        requiredAdd: [],
        requiredUp: [],
        datePicker: ['receiveDate'],
        noHead: ['signedUserName', 'signedDate', 'departLims'],//不参与新增编辑的字段
        needSort: [],
        inputType: ''
      },
      componentData0: {
        entity: {
          year: null,
          orderBy: {
            field: 'id',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: false,
        select: false,
        do: [{
          id: 'handleLook',
          font: '查看',
          type: 'text',
          method: 'handleLook',
          disabFun: (row, index) => {
            return !row.url
          }
        }, {
          id: 'handleDown0',
          font: '下载',
          type: 'text',
          method: 'handleDown0',
          disabFun: (row, index) => {
            return !row.url
          }
        },
        {
          id: 'handleSubmit',
          font: '提交',
          type: 'text',
          method: 'handleSubmit',
          disabFun: (row, index) => {
            return !!row.submitUserName
          }
        }, {
          id: 'handleApproval',
          font: '批准',
          type: 'text',
          method: 'handleApproval',
          disabFun: (row, index) => {
            return !row.submitUserName || !!row.ratifyUserName
          }
        }],
        tagField: {},
        selectField: {},
        requiredAdd: [],
        requiredUp: [],
        needSort: [],
        inputType: ''
      },
      entityCopy: {},
      entityCopy0: {},
      upIndex: 0,
      addInfo: {},
      title: '新增',
      addInfo: {},
@@ -270,74 +166,129 @@
      fileList: [],
      typeList: [],
      currentInfo: {},
      queryParams: {},
      tableData: [],
      column: [
        { label: "文件名称", prop: "documentName" },
        { label: "文件编号", prop: "documentCode", width: "120px" },
        {
          label: "版本号",
          prop: "documentVersion",
        },
        { label: "修订号", prop: "revision" },
        { label: "适宜性", prop: "suitability" },
        { label: "备注", prop: "remark" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.handleEdit(row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
      queryParams0: {},
      tableData0: [],
      column0: [
        { label: "年份", prop: "year" },
        { label: "总数量", prop: "totalNum", width: "120px" },
        {
          label: "拟制人",
          prop: "submitUserName",
        },
        { label: "拟制日期", prop: "submitDate" },
        { label: "批准人", prop: "ratifyUserName" },
        { label: "批准日期", prop: "ratifyDate" },
        { label: "批准结果", prop: "ratifyState" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "查看",
              type: "text",
              clickFun: (row) => {
                this.handleLook(row);
              },
              disabled: (row) => {
                return !row.url
              },
            },
            {
              name: "下载",
              type: "text",
              clickFun: (row) => {
                this.handleDown0(row);
              },
              disabled: (row) => {
                return !row.url
              },
            },
            {
              name: "提交",
              type: "text",
              clickFun: (row) => {
                this.handleSubmit(row);
              },
              disabled: (row) => {
                return !!row.submitUserName && row.ratifyState != '不通过'
              },
            },
            {
              name: "批准",
              type: "text",
              clickFun: (row) => {
                this.handleApproval(row);
              },
              disabled: (row) => {
                return (!row.submitUserName || !!row.ratifyUserName) && row.ratifyState != '不通过'
              },
            },
          ],
        },
      ],
      page0: {
        total: 0,
        size: 10,
        current: 0,
      },
    }
  },
  // 用于上传文件的信息
  computed: {
    headers() {
      return {
        'Authorization': "Bearer " + getToken()
      }
    },
    action() {
      return this.javaApi + this.$api.manageRecordIntervals.exportInManageRecordIntervals
      return this.javaApi + '/manageRecordIntervals/exportInManageRecordIntervals'
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.entityCopy0 = this.HaveJson(this.componentData0.entity);
    this.getPower()
    this.getList()
    this.getList0()
    this.getFileList()
    this.selectEnumByCategory()
  },
  methods: {
    getPower() {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let add = false
      let del = false
      let up = false;
      let out = false;
      let submit = false
      let ratify = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'addManageRecordIntervals') {
          add = true
        }
        if (power[i].menuMethod == 'delManageRecordIntervals') {
          del = true
        }
        if (power[i].menuMethod == 'exportInManageRecordIntervals') {
          up = true
        }
        if (power[i].menuMethod == 'exportOutManageRecordIntervals') {
          out = true
        }
        if (power[i].menuMethod == 'submitManageRecordIntervalsTotal') {
          submit = true
        }
        if (power[i].menuMethod == 'ratifyManageRecordIntervalsTotal') {
          ratify = true
        }
      }
      if (!ratify) {
        this.componentData0.do.splice(3, 1)
      }
      if (!submit) {
        this.componentData0.do.splice(2, 1)
      }
      if (!add) {
        this.componentData.do.splice(1, 1)
      }
      if (!del) {
        this.componentData.do.splice(0, 1)
      }
      this.addPower = add
      this.outPower = out
      this.upPower = up
    },
    // 新增
    openAdd() {
      // this.$refs.ValueTable.openAddDia(this.$api.manageRecordIssueRecycle.addManageRecordIssueRecycle);
      this.addInfo = {}
      this.title = '新增'
      this.addDialogVisible = true;
@@ -345,31 +296,71 @@
    // 导出
    handleDown() {
      this.outLoading = true
      this.$axios.post(this.$api.manageRecordIntervals.exportOutManageRecordIntervals, { entity: this.componentData.entity }, { headers: { 'Content-Type': 'application/json' } }).then(res => {
      exportOutManageRecordIntervals(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.message, "文件定期审查记录");
      })
    },
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      pageManageRecordIntervals({ ...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();
    },
    getList0() {
      this.tableLoading = true;
      let param = { ...this.queryParams0, ...this.page0 };
      delete param.total;
      pageManageRecordIntervalsTotal({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData0 = res.data.records;
            this.page0.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination0({ page, limit }) {
      this.page0.current = page;
      this.page0.size = limit;
      this.getList0();
    },
    refreshTable(num) {
      if (num) {
        this.$refs['ValueTable0'].selectList()
        this.page0.current = 1;
        this.getList0();
      } else {
        this.refreshTable()()
        this.page.current = 1;
        this.getList();
      }
    },
    refresh(num) {
      if (num) {
        this.componentData0.entity = this.HaveJson(this.entityCopy0)
        this.upIndex++
        this.queryParams0 = {};
        this.page0.current = 1;
        this.getList0();
      } else {
        this.componentData.entity = this.HaveJson(this.entityCopy)
        this.upIndex++
        this.queryParams = {};
        this.page.current = 1;
        this.getList();
      }
    },
    beforeUpload(file) {
@@ -390,7 +381,7 @@
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success('上传成功');
        this.refreshTable()()
        this.refreshTable()
      } else {
        this.$message.error('上传失败');
      }
@@ -406,34 +397,21 @@
    },
    // 获取文件列表--文件清单
    getFileList() {
      this.$axios.post(this.$api.manageDocumentList.pageManageDocumentList, {
        entity: {
          orderBy: {
            field: 'id',
            order: 'asc'
          }
        },
        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
        })
      }).catch(err => { })
    },
    selectEnumByCategory() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "适宜性"
      }).then(res => {
        this.typeList = res.data
      })
      // 文件类别
      this.getDicts("suitability").then((response) => {
        this.typeList = this.dictToValue(response.data);
      });
    },
    // 提交
    handleAdd() {
@@ -446,18 +424,27 @@
        let { id, documentCode, documentName, documentVersion, revision, suitability, remark } = this.addInfo
        obj = { id, documentCode, documentName, documentVersion, revision, suitability, remark }
      }
      this.$axios.post(this.$api.manageRecordIntervals[this.title == '新增' ? 'addManageRecordIntervals' : 'doManageRecordIntervals'], obj, { headers: { 'Content-Type': 'application/json' }, noQs: true }).then(res => {
        this.addLoading = false
        if (res.code == 201) {
          return
        }
        this.addDialogVisible = false
        this.$message({
          type: 'success',
          message: '操作成功!'
        });
        this.refreshTable()
      }).catch(err => { })
      if (this.title == '新增') {
        addManageRecordIntervals(obj).then(res => {
          this.addLoading = false
          this.addDialogVisible = false
          this.$message({
            type: 'success',
            message: '操作成功!'
          });
          this.refreshTable()
        }).catch(err => { })
      } else {
        doManageRecordIntervals(obj).then(res => {
          this.addLoading = false
          this.addDialogVisible = false
          this.$message({
            type: 'success',
            message: '操作成功!'
          });
          this.refreshTable()
        }).catch(err => { })
      }
    },
    // 修改
    handleEdit(row) {
@@ -471,20 +458,17 @@
      } else {
        this.noCheckLoading = true
      }
      this.$axios.post(this.$api.manageRecordIntervals.ratifyManageRecordIntervalsTotal, {
      ratifyManageRecordIntervalsTotal({
        id: this.currentInfo.id,
        ratifyState: state
      }).then(res => {
        this.checkLoading = false
        if (res.code == 201) {
          return
        }
        this.noCheckLoading = false
        this.$message({
          type: 'success',
          message: '操作成功!'
        });
        this.$refs['ValueTable0'].selectList()
        this.refreshTable(1);
        this.lookDialogVisible = false
      }).catch(err => { });
    },
@@ -501,11 +485,7 @@
      }
    },
    handleDown0(row) {
      let url = this.javaApi + 'word/' + row.url
      const link = document.createElement('a');
      link.href = url;
      link.download = row.month + ' 所有文件定期检查记录';
      link.click();
      this.$download.saveAs(row.url, "所有文件定期检查记录");
    },
    // 提交
    handleSubmit(row) {
@@ -514,15 +494,14 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.post(this.$api.manageRecordIntervals.submitManageRecordIntervalsTotal, {
        submitManageRecordIntervalsTotal({
          id: row.id
        }).then(res => {
          if (res.code === 201) return
          this.$message({
            type: 'success',
            message: '提交成功!'
          });
          this.$refs['ValueTable0'].selectList()
          this.refreshTable(1);
        }).catch(err => { });
      })
    },
@@ -531,22 +510,29 @@
      this.title0 = '批准'
      this.commonFun(row)
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delManageRecordIntervals({ id: row.id }).then((res) => {
            this.$message.success("删除成功");
            this.refreshTable();
          });
        })
        .catch(() => { });
    },
  }
}
</script>
<style scoped>
.title {
  height: 60px;
  line-height: 60px;
}
.search {
  background-color: #fff;
  height: 40px;
  height: 46px;
  display: flex;
  align-items: center;
  position: relative;
  justify-content: space-between;
}
.search_thing {
@@ -565,21 +551,7 @@
  width: calc(100% - 110px);
}
.table {
  margin-top: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 140px);
  padding: 20px;
}
>>>.el-tabs__content {
  height: 100%;
}
.btns {
  position: absolute;
  right: 20px;
  top: 5px;
}
</style>