src/views/CNAS/process/method/methodVerification/component/ViewTestRecord.vue
@@ -1,7 +1,7 @@
<template>
  <div>
    <el-dialog v-model="filesDialogVisible" title="附件上传" width="80%" @closed="closeFilesLook">
      <div style="display: flex;justify-content: space-between;">
    <el-dialog v-model="filesDialogVisible" :title="readOnly ? '查看附件' : '附件上传'" width="80%" @closed="closeFilesLook">
      <div v-if="!readOnly" style="display: flex;justify-content: space-between;">
        <el-upload ref='upload'
                   :action="fileAction"
                   :auto-upload="true"
@@ -17,7 +17,7 @@
      <div>
        <lims-table
          ref="yearTable"
          :column="columnData"
          :column="readOnly ? readonlyColumnData : columnData"
          :height="'calc(100vh - 47em)'"
          :highlightCurrentRow="true"
          :table-data="tableData"
@@ -36,8 +36,16 @@
export default {
  name: 'ViewTestRecord',
  props: { readOnly: { type: Boolean, default: false } },
  // import 引入的组件需要注入到对象中才能使用
  components: { limsTable },
  computed: {
    readonlyColumnData() {
      return this.columnData.map(column => column.dataType === 'action'
        ? { ...column, operation: column.operation.filter(item => item.name !== '删除') }
        : column)
    }
  },
  data() {
    // 这里存放数据
    return {
@@ -122,6 +130,7 @@
    },
    // 删除
    delete (row) {
      if (this.readOnly) return
      this.tableLoading = true
      delVerifyMethodFileList({methodFileId:row.methodFileId}).then(res => {
        this.tableLoading = false
@@ -137,6 +146,7 @@
    },
    // 上传验证
    fileBeforeUpload(file) {
      if (this.readOnly) return false
      let flag = true
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');