From e888346ebcd8e3e099a15c7edd7bf367c057193a Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 04 三月 2025 15:33:33 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev'

---
 src/views/CNAS/systemManagement/correctiveAction/components/ViewTestRecord.vue |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 169 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/systemManagement/correctiveAction/components/ViewTestRecord.vue b/src/views/CNAS/systemManagement/correctiveAction/components/ViewTestRecord.vue
new file mode 100644
index 0000000..3c6a5bd
--- /dev/null
+++ b/src/views/CNAS/systemManagement/correctiveAction/components/ViewTestRecord.vue
@@ -0,0 +1,169 @@
+<template>
+  <div>
+    <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢" width="80%" @closed="closeFilesLook">
+      <div style="display: flex;justify-content: space-between;">
+        <el-upload ref='upload' :action="fileAction" :auto-upload="true" :before-upload="fileBeforeUpload"
+          :data="{ superviseDetailsCorrectId: info.superviseDetailsCorrectId }" :headers="uploadHeader"
+          :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
+          accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;">
+          <el-button size="small" style="height: 38px" type="primary">闄勪欢涓婁紶</el-button>
+        </el-upload>
+      </div>
+      <div>
+        <limsTable ref="yearTable" :column="columnData" :height="'calc(100vh - 30em)'" :highlightCurrentRow="true"
+          :table-data="tableData" :table-loading="tableLoading" style="margin-top: 0.5em;">
+        </limsTable>
+      </div>
+    </el-dialog>
+    <el-dialog :visible.sync="lookDialogVisible" fullscreen title="鏌ョ湅闄勪欢" top="5vh" width="800px">
+      <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.fileUrl"
+        style="height: 90vh;overflow-y: auto;" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import filePreview from '@/components/Preview/filePreview.vue'
+import {
+  getSuperviseDetailCorrectFileList,
+  delSuperviseDetailCorrectFile,
+} from '@/api/cnas/systemManagement/correctiveAction.js'
+export default {
+  name: 'ViewTestRecord',
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: { filePreview, limsTable },
+  data() {
+    // 杩欓噷瀛樻斁鏁版嵁
+    return {
+      filesDialogVisible: false,
+      tableLoading: false,
+      filesLookInfo: {},
+      columnData: [
+        {
+          label: '鏂囦欢鍚嶇О',
+          prop: 'fileName',
+          minWidth: '150px'
+        },
+        {
+          dataType: 'action',
+          minWidth: '100',
+          label: '鎿嶄綔',
+          fixed: 'right',
+          operation: [
+            {
+              name: '棰勮',
+              type: 'text',
+              clickFun: (row) => {
+                this.handleLook(row)
+              }
+            },
+            {
+              name: '涓嬭浇',
+              type: 'text',
+              clickFun: (row) => {
+                this.upload(row)
+              }
+            },
+            {
+              name: '鍒犻櫎',
+              type: 'text',
+              color: '#f56c6c',
+              clickFun: (row) => {
+                this.delete(row)
+              }
+            }
+          ]
+        }
+      ],
+      tableData: [],
+      info: {},
+      currentInfo: {},
+      lookDialogVisible: false,
+    };
+  },
+  // 鏂规硶闆嗗悎
+  methods: {
+    openDia(row) {
+      this.filesDialogVisible = true
+      this.info = row
+      this.searchTableList()
+    },
+    // 鏌ヨ闄勪欢鍒楄〃
+    searchTableList() {
+      this.tableLoading = true
+      getSuperviseDetailCorrectFileList({ superviseDetailsCorrectId: this.info.superviseDetailsCorrectId }).then(res => {
+        this.tableLoading = false
+        if (res.code === 201) return
+        this.tableData = res.data
+      }).catch(err => {
+        this.tableLoading = false
+        console.log('err---', err);
+      })
+    },
+    closeFilesLook() {
+      this.filesDialogVisible = false
+    },
+    // 鏌ョ湅鏂囦欢
+    handleLook(row) {
+      this.currentInfo = row
+      this.lookDialogVisible = true
+    },
+    // 涓嬭浇
+    upload(row) {
+      let url = '';
+      if (row.type == 1) {
+        url = this.javaApi + '/img/' + row.fileUrl
+        this.$download.saveAs(url, row.fileName);
+      } else {
+        url = this.javaApi + '/word/' + row.fileUrl
+        this.$download.saveAs(url, row.fileName);
+      }
+    },
+    // 鍒犻櫎
+    delete(row) {
+      this.tableLoading = true
+      delSuperviseDetailCorrectFile({ superviseDetailsCorrectFileId: row.superviseDetailsCorrectFileId }).then(res => {
+        this.tableLoading = false
+        if (res.code === 201) return
+        this.$message.success('鍒犻櫎鎴愬姛')
+        this.searchTableList()
+      }).catch(err => {
+        this.tableLoading = false
+        console.log('err---', err);
+      })
+    },
+    // 涓婁紶楠岃瘉
+    fileBeforeUpload(file) {
+      let flag = true
+      if (file.size > 1024 * 1024 * 10) {
+        this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
+        this.$refs.upload.clearFiles()
+        flag = false
+      }
+      if (!flag) {
+        return Promise.reject(flag); //姝g‘鐨勭粓姝�
+      }
+    },
+    onError(err, file, fileList, type) {
+      this.$message.error('涓婁紶澶辫触')
+      this.$refs.upload.clearFiles()
+    },
+    handleSuccessUp(response,) {
+      this.upLoading = false;
+      if (response.code == 200) {
+        this.$message.success('涓婁紶鎴愬姛');
+        this.searchTableList()
+      }
+    },
+  },
+  computed: {
+    fileAction() {
+      return this.javaApi + '/qualitySupervise/uploadSuperviseDetailCorrectFile'
+
+    }
+  },
+};
+</script>
+
+<style scoped></style>

--
Gitblit v1.9.3