| | |
| | | <span>{{scope.row.passed == 0 ? '不合格':'合格'}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="培训记录" prop="passed" align="center" width="130"> |
| | | <el-table-column label="培训记录" prop="passed" align="center" width="180"> |
| | | <template #default="scope"> |
| | | <div v-for="item in scope.row.files" style="display: flex;flex-direction: column"> |
| | | <el-link type="primary" @click="openFile(item.filePath)">{{item.fileName}}</el-link> |
| | | <div style="display: flex;flex-direction: column;align-items: center"> |
| | | <el-link type="primary" @click="openFile(item.filePath)">{{item.fileName}}</el-link> |
| | | <el-button style="width: 50px;margin-bottom: 5px" size="small" @click="downloadFile(item)">下载</el-button> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </template> |
| | |
| | | import {delStudent, getStudent} from "@/api/onlineEducation/student"; |
| | | import {delRecord, getRecord} from "@/api/onlineEducation/examRecord"; |
| | | import {renderAsync} from "docx-preview"; |
| | | import axios from "axios"; |
| | | import {getToken} from "@/utils/auth"; |
| | | |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | const downloadFile = (e)=>{ |
| | | axios.get(import.meta.env.VITE_APP_BASE_API + '/' +e.filePath,{headers:{'Content-Type': 'application/json','Authorization': `${getToken()}`},responseType: 'blob'}).then(res=>{ |
| | | if (res) { |
| | | const link = document.createElement('a') |
| | | let blob = new Blob([res.data],{type: res.data.type}) |
| | | link.style.display = "none"; |
| | | link.href = URL.createObjectURL(blob); // 创建URL |
| | | link.setAttribute("download", e.fileName); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件读取失败' |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | </script> |