Crunchy
2025-04-29 e5454b769d44a34af423bf87ac8a740bf8c20341
src/views/CNAS/systemManagement/documentRecords/outDocumenRecordt.vue
@@ -1,44 +1,34 @@
<template>
  <!-- 外来文件确认记录 -->
  <div class="ExternalDocumentConfirmationRecords">
    <el-row class="title">
      <el-col :span="20" style="padding-left: 20px;text-align: left;">外来文件确认记录</el-col>
    </el-row>
    <el-tabs type="border-card" v-model="activeName" style="height: 100%;">
  <div class="capacity-scope">
    <el-tabs type="border-card" v-model="activeName" style="height: 100%;" @change="getTableData">
      <el-tab-pane label="填写" name="填写" style="height: 100%;">
        <div style="display: flex;align-items: center;justify-content: flex-end;margin-right: 20px;">
          <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;"
            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;">
        <div style="display: flex;align-items: center;justify-content: flex-end;margin-bottom: 10px">
          <el-button size="small" type="primary" @click="openAdd('新增')" style="margin-left: 20px;">新增</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'
            :on-success="handleSuccessUp" style="display:inline-block;margin-left: 20px;">
            <el-button size="small" type="primary" :loading="upLoading">导入</el-button></el-upload>
        </div>
        <div class="table" style="height: calc(100% - 200px)">
          <ValueTable ref="ValueTable0" :url="$api.manageRecordTotal.pageManageRecordVerify"
            :componentData="componentData0" :key="upIndex0" :delUrl="$api.manageRecordTotal.delManageRecordVerify"
            :upUrl="$api.manageRecordTotal.doManageRecordVerify" />
        </div>
        <lims-table :tableData="tableData0" :column="column0" :page="page0" :tableLoading="tableLoading0"
                    :height="'calc(100vh - 290px)'" @pagination="pagination0"></lims-table>
      </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="componentData.entity.year" type="year" placeholder="选择年" format="yyyy"
                value-format="yyyy" size="small" @change="refreshTable()">
        <div>
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
            <el-form-item label="年" prop="year">
              <el-date-picker v-model="queryParams.year" type="year" placeholder="选择年" format="yyyy" value-format="yyyy"
                              size="small" @change="refreshTable()">
              </el-date-picker>
            </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>
            </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="table">
          <ValueTable ref="ValueTable" :url="$api.manageRecordTotal.pageManageRecordTotal"
            :componentData="componentData" :key="upIndex" />
        </div>
        <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
                    :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table>
      </el-tab-pane>
    </el-tabs>
    <!-- 详情/下载/审核 -->
@@ -51,17 +41,64 @@
        <el-button type="primary" @click="submitCheck('通过')" :loading="checkLoading">通 过</el-button>
      </span>
    </el-dialog>
    <!-- 新增/编辑 -->
    <el-dialog :title="title" :visible.sync="addDia" width="500px">
      <el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
        <el-form-item label="外来文件名称" prop="documentName">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.documentName"></el-input>
        </el-form-item>
        <el-form-item label="文件编号" prop="documentCode">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.documentCode">
          </el-input>
        </el-form-item>
        <el-form-item label="标准规范名称" prop="standardName">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.standardName">
          </el-input>
        </el-form-item>
        <el-form-item label="标准号" prop="standardCode">
          <el-input size="small" placeholder="请输入" clearable v-model="addForm.standardCode">
          </el-input>
        </el-form-item>
        <el-form-item label="生效日期" prop="effectiveDate">
          <el-date-picker v-model="addForm.effectiveDate" format="yyyy-MM-dd" placeholder="选择日期" size="small"
            style="width: 100%" type="date" value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="作废日期" prop="cancelDate">
          <el-date-picker v-model="addForm.cancelDate" format="yyyy-MM-dd" placeholder="选择日期" size="small"
            style="width: 100%" type="date" value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注" prop="note">
          <el-input size="small" placeholder="请输入" type="textarea" :rows="2" clearable v-model="addForm.note">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDia = false">取 消</el-button>
        <el-button :loading="uploading" type="primary" @click="submitProduct('addForm')">确 认</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import limsTable from "@/components/Table/lims-table.vue";
import filePreview from '@/components/Preview/filePreview.vue'
import ValueTable from '@/components/Table/value-table.vue'
import { getToken } from "@/utils/auth";
import {
  addManageRecordVerify,
  pageManageRecordVerify,
  submitManageRecordTotal,
  ratifyManageRecordTotal,
  delManageRecordVerify,
  pageManageRecordTotal,
  doManageRecordVerify
} from '@/api/cnas/systemManagement/documentRecords.js'
export default {
  name: 'OutDocumenRecordt',
  components: {
    ValueTable,
    filePreview,
    limsTable,
  },
  data() {
    return {
@@ -70,158 +107,205 @@
      lookDialogVisible: false,
      noCheckLoading: false,
      checkLoading: false,
      componentData: {
        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: ''
      },
      // 样品列表
      componentData0: {
        entity: {
          manageRecordTotalId: null,
          orderBy: {
            field: 'id',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: false,
        select: false,
        do: [{
          id: 'update',
          font: '修改',
          type: 'text',
          method: 'doDiy'
        }, {
          id: 'delete',
          font: '删除',
          type: 'text',
          method: 'doDiy'
        }],
        tagField: {},
        selectField: {},
        requiredAdd: ['documentName', 'documentCode'],
        requiredUp: ['documentName', 'documentCode'],
        datePicker: ['effectiveDate', 'cancelDate'],
        needSort: [],
        inputType: ''
      },
      upIndex0: 100,
      entityCopy: {},
      upIndex: 0,
      addPower: true,
      upPower: true,
      currentInfo: {},
      upLoading: false,
      queryParams: {},
      tableData: [],
      column: [
        { 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
              },
            },
            {
              name: "批准",
              type: "text",
              clickFun: (row) => {
                this.handleApproval(row);
              },
              disabled: (row) => {
                return !row.submitUserName || !!row.ratifyUserName
              },
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
      tableData0: [],
      column0: [
        { label: "外来文件名称", prop: "documentName" },
        { label: "文件编号", prop: "documentCode", width: "120px" },
        {
          label: "标准规范名称",
          prop: "standardName",
        },
        { label: "标准号", prop: "standardCode" },
        { label: "生效日期", prop: "effectiveDate" },
        { label: "作废日期", prop: "cancelDate" },
        { label: "备注", prop: "note" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.openAdd("编辑", row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
            },
          ],
        },
      ],
      page0: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading0: false,
      title: '新增',
      addForm: {},
      addDia: false,
      addRules: {
        documentName: [{ required: true, message: "请输入外来文件名称", trigger: "blur" }],
        documentCode: [
          { required: true, message: "请输入文件编号", trigger: "blur" },
        ],
      },
      uploading: false,
    }
  },
  // 用于上传文件的信息
  computed: {
    headers() {
      return {
        'Authorization': "Bearer " + getToken()
      }
    },
    action() {
      return this.javaApi + this.$api.manageRecordTotal.exportManageRecordVerify
      return this.javaApi + '/manageRecordVerify/exportManageRecordVerify'
    }
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.componentData.entity);
    this.getPower()
    this.getTableData();
  },
  methods: {
    getPower() {
      let power = JSON.parse(sessionStorage.getItem('power'))
      let add = false
      let del = false
      let up = false;
      let sub = false
      let ratify = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'addManageRecordVerify') {
          add = true
        }
        if (power[i].menuMethod == 'delManageRecordVerify') {
          del = true
        }
        if (power[i].menuMethod == 'exportManageRecordVerify') {
          up = true
        }
        if (power[i].menuMethod == 'submitManageRecordTotal') {
          sub = true
        }
        if (power[i].menuMethod == 'ratifyManageRecordTotal') {
          ratify = true
        }
    getTableData() {
      if (this.activeName === '填写') {
        this.getList0()
      } else {
        this.getList()
      }
      if (!ratify) {
        this.componentData.do.splice(3, 1)
      }
      if (!sub) {
        this.componentData.do.splice(2, 1)
      }
      if (!del) {
        this.componentData0.do.splice(1, 1)
      }
      if (!add) {
        this.componentData0.do.splice(0, 1)
      }
      this.addPower = add
      this.upPower = up
    },
    handleAdd0() {
      this.$refs.ValueTable0.openAddDia(this.$api.manageRecordTotal.addManageRecordVerify);
    openAdd(title, row) {
      this.title = title;
      if (row) {
        this.addForm = row;
      } else {
        this.addForm = {};
      }
      this.addDia = true;
    },
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      pageManageRecordTotal({ ...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.tableLoading0 = true;
      let param = { ...this.page0 };
      delete param.total;
      pageManageRecordVerify({ ...param })
        .then((res) => {
          this.tableLoading0 = false;
          if (res.code === 200) {
            this.tableData0 = res.data.records;
            this.page0.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading0 = false;
        });
    },
    pagination0({ page, limit }) {
      this.page0.current = page;
      this.page0.size = limit;
      this.getList0();
    },
    refresh() {
      this.queryParams = {};
      this.page.current = 1;
      this.getList();
    },
    refreshTable() {
      this.refreshTable()()
      this.page.current = 1;
      this.getList();
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
@@ -241,15 +325,10 @@
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success('上传成功');
        this.$refs['ValueTable0'].selectList()
        this.getList0();
      } else {
        this.$message.error('上传失败');
      }
    },
    refresh() {
      this.componentData.entity = this.HaveJson(this.entityCopy)
      this.upIndex++
      this.refreshTable()
    },
    submitCheck(type) { },
    // 查看
@@ -260,19 +339,12 @@
    // 公用方法
    commonFun(row, callbanck) {
      this.currentInfo = row
      this.componentData0.entity.manageRecordTotalId = row.id
      this.$axios.post(this.$api.manageRecordTotal.pageManageRecordVerify, {
        entity: this.componentData0.entity,
        page: {
          current: -1,
          size: -1
        }
      }, {
        headers: {
          'Content-Type': 'application/json'
        }, noQs: true
      pageManageRecordVerify({
        current: -1,
        size: -1,
        manageRecordTotalId: row.id
      }).then(res => {
        this.currentInfo.arr = res.data.body.records
        this.currentInfo.arr = res.data.records
        this.lookDialogVisible = true
        if (callbanck) {
          callbanck()
@@ -280,11 +352,7 @@
      }).catch(err => { });
    },
    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) {
@@ -293,14 +361,14 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.post(this.$api.manageRecordTotal.submitManageRecordTotal, {
        submitManageRecordTotal({
          id: row.id
        }).then(res => {
          this.$message({
            type: 'success',
            message: '提交成功!'
          });
          this.refreshTable()()
          this.refreshTable()
        }).catch(err => { });
      })
    },
@@ -316,20 +384,71 @@
      } else {
        this.noCheckLoading = true
      }
      this.$axios.post(this.$api.manageRecordTotal.ratifyManageRecordTotal, {
      ratifyManageRecordTotal({
        id: this.currentInfo.id,
        ratifyState: state
      }).then(res => {
        this.checkLoading = false
        this.noCheckLoading = false
        if (res.code === 201) return
        this.$message({
          type: 'success',
          message: '操作成功!'
        });
        this.refreshTable()()
        this.refreshTable()
        this.lookDialogVisible = false
      }).catch(err => { });
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delManageRecordVerify({ id: row.id }).then((res) => {
            this.$message.success("删除成功");
            this.getList0()
          });
        })
        .catch(() => { });
    },
    submitProduct(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.uploading = true;
          if (this.title == "新增") {
            addManageRecordVerify(this.addForm)
              .then((res) => {
                this.uploading = false;
                if (res.code != 200) {
                  return;
                }
                this.$message.success("提交成功");
                this.getList0()
                this.addDia = false;
              })
              .catch((err) => {
                this.uploading = false;
              });
          } else {
            doManageRecordVerify(this.addForm)
              .then((res) => {
                this.uploading = false;
                if (res.code != 200) {
                  return;
                }
                this.$message.success("提交成功");
                this.getList0()
                this.addDia = false;
              })
              .catch((err) => {
                this.uploading = false;
              });
          }
        } else {
          return false;
        }
      });
    },
  }
}
@@ -356,7 +475,7 @@
}
.search_label {
  width: 110px;
  width: 30px;
  font-size: 14px;
  text-align: right;
}
@@ -367,9 +486,8 @@
.table {
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 140px);
  padding: 20px;
  height: 100%;
  margin-top: 10px;
}
>>>.el-tabs__content {