From dc3af0cbb4a6d105bdff497b510cc0a87b3e8d0a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 28 二月 2025 17:53:44 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-before into dev

---
 src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue |  186 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 186 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue b/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue
new file mode 100644
index 0000000..e9938c7
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue
@@ -0,0 +1,186 @@
+<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="{trainingDetailedId: info.id}"
+                   :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>
+        <lims-table :tableData="tableData" :column="columnData"
+                    :height="'calc(100vh - 47em)'"
+                    :highlightCurrentRow="true"
+                    :tableLoading="tableLoading"></lims-table>
+      </div>
+    </el-dialog>
+    <el-dialog
+      :visible.sync="lookDialogVisible"
+      fullscreen
+      title="鏌ョ湅闄勪欢" width="800px">
+      <filePreview v-if="lookDialogVisible" :currentFile="{}"
+                   :fileUrl="javaApi+'/word/'+currentInfo.fileUrl" style="height: 90vh;overflow-y: auto;top: 0"/>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import file from '@/utils/file';
+import filePreview from '@/components/Preview/filePreview.vue';
+import limsTable from "@/components/Table/lims-table.vue";
+import {delTrainingDetailedFileList, getTrainingDetailedFileList} from "@/api/cnas/personal/personalTraining";
+import {delCustomById} from "@/api/system/customer";
+
+export default {
+  name: 'ViewRecord',
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: {limsTable, filePreview },
+  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
+      getTrainingDetailedFileList({trainingDetailedId: this.info.id}).then(res => {
+        this.tableLoading = false
+        this.tableData = res.data
+      }).catch(err => {
+        this.tableLoading = false
+        console.log('err---', err);
+      })
+    },
+    closeFilesLook () {
+      this.filesDialogVisible = false
+    },
+    // 涓嬭浇
+    upload (row) {
+      let url = '';
+      if(row.type==1){
+        url = this.javaApi+'/img/'+row.fileUrl
+        file.downloadIamge(url,row.fileName)
+      }else{
+        url = this.javaApi+'/word/'+row.fileUrl
+        const link = document.createElement('a');
+        link.href = url;
+        link.download = row.fileName;
+        link.click();
+      }
+    },
+    // 鍒犻櫎
+    delete (row) {
+      this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(() => {
+        this.tableLoading = true
+        delTrainingDetailedFileList({detailedFileId: row.detailedFileId}).then(res => {
+          this.tableLoading = false
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.searchTableList()
+        }).catch(err => {
+          this.tableLoading = false
+          console.log('err---', err);
+        })
+      }).catch(() => {})
+    },
+    // 涓婁紶楠岃瘉
+    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()
+      }
+    },
+    // 鏌ョ湅鏂囦欢
+    handleLook(row){
+      this.currentInfo = row
+      this.lookDialogVisible = true
+    },
+  },
+  computed: {
+    fileAction() {
+      return this.javaApi + '/personTraining/uploadTrainingDetailedFile'
+
+    }
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.9.3