曹睿
2025-02-25 83be7ca0c138b64b3447cc207b63c7933690f6ec
src/views/CNAS/systemManagement/correctiveAction/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,203 @@
<template>
  <div>
    <div class="search-background">
      <span class="search-group">
        <span style="width: 150px">不合格描述:</span>
        <el-input v-model="searchForm.raiseResult" clearable size="small"></el-input>
      </span>
      <span class="search-group">
        <el-button size="small" @click="resetSearchForm">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="searchList">查 è¯¢</el-button>
      </span>
    </div>
    <div class="table">
      <div>
        <TableCard :showForm="false" :showTitle="false">
          <template v-slot:table>
            <limsTable :column="tableColumn" :height="'calc(100vh - 17em)'" :table-data="tableData"
              :table-loading="tableLoading" style="padding: 0 15px;margin-bottom: 16px" @pagination="pagination"
              :page="page">
            </limsTable>
          </template>
        </TableCard>
      </div>
    </div>
    <corrective-info v-if="correctiveInfo" ref="correctiveInfo"></corrective-info>
    <ViewTestRecord v-if="viewTestRecordDialog" ref="viewTestRecordDialog"></ViewTestRecord>
  </div>
</template>
<script>
import TableCard from '@/components/TableCard/index.vue';
import limsTable from "@/components/Table/lims-table.vue";
import CorrectiveInfo from './components/correctiveInfo.vue';
// import QualityInfo from '../do/a7-nonconforming-item/qualityInfo.vue';
import ViewTestRecord from './components/ViewTestRecord.vue';
import {
  pageSuperviseDetailCorrect,
  exportSuperviseDetaillCorrect,
} from '@/api/cnas/systemManagement/correctiveAction.js'
export default {
  name: 'a8-corrective-action',
  // import å¼•入的组件需要注入到对象中才能使用
  components: {
    // QualityInfo,
    CorrectiveInfo,
    limsTable,
    TableCard,
    ViewTestRecord
  },
  data() {
    // è¿™é‡Œå­˜æ”¾æ•°æ®
    return {
      searchForm: {
        raiseResult: '',
      },
      tableColumn: [
        {
          label: '不合格或偏离事实的描述',
          prop: 'raiseResult',
          minWidth: '100'
        },
        {
          label: '原因分析',
          prop: 'causeResult',
          minWidth: '100'
        },
        {
          label: '纠正措施',
          prop: 'correctResult',
          minWidth: '100'
        },
        {
          label: '实施验证结果',
          prop: 'validationResult',
          minWidth: '100'
        },
        {
          dataType: 'action',
          minWidth: '60',
          label: '操作',
          operation: [
            {
              name: '查看',
              type: 'text',
              clickFun: (row) => {
                this.viewInfo(row);
              },
            },
            {
              name: '导出',
              type: 'text',
              clickFun: (row) => {
                this.handleDown(row)
              }
            },
            {
              name: '查看附件',
              type: 'text',
              clickFun: (row) => {
                this.viewFiles(row);
              },
            },
          ]
        }
      ],
      tableData: [],
      tableLoading: false,
      page: {
        size: 20,
        current: 1,
      },
      total: 0,
      correctiveInfo: false,
      viewTestRecordDialog: false,
    };
  },
  mounted() {
    this.searchList()
  },
  // æ–¹æ³•集合
  methods: {
    // æŸ¥è¯¢åˆ—表
    searchList() {
      const entity = {
        raiseResult: this.searchForm.raiseResult,
      }
      const page = this.page
      this.tableLoading = true
      pageSuperviseDetailCorrect({ ...entity, ...page }).then(res => {
        this.tableLoading = false
        if (res.code === 201) return
        this.tableData = res.data.records
        this.total = res.data.total
      }).catch(err => {
        console.log('err---', err);
        this.tableLoading = false
      })
    },
    // å¯¼å‡º
    handleDown(row) {
      exportSuperviseDetaillCorrect({ superviseDetailsCorrectId: row.superviseDetailsCorrectId }).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '监督纠正措施' + '.docx');
      })
    },
    // é‡ç½®æŸ¥è¯¢æ¡ä»¶
    resetSearchForm() {
      this.searchForm.raiseResult = '';
      this.searchList()
    },
    // æŸ¥çœ‹è¯¦æƒ…
    viewInfo(row) {
      this.correctiveInfo = true
      this.$nextTick(() => {
        this.$refs.correctiveInfo.openDia(row)
      })
    },
    // æŸ¥çœ‹é™„ä»¶
    viewFiles(row) {
      this.viewTestRecordDialog = true
      this.$nextTick(() => {
        this.$refs.viewTestRecordDialog.openDia(row)
      })
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.searchList();
    },
  }
};
</script>
<style scoped>
.view-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  padding-left: 20px;
}
.search-background {
  width: 100%;
  height: 80px;
  line-height: 80px;
  background-color: #ffffff;
  display: flex;
}
.search-group {
  display: flex;
  align-items: center;
  margin: 0 20px;
}
.table {
  background-color: #ffffff;
}
</style>