| | |
| | | <div> |
| | | <el-dialog v-model="filesDialogVisible" title="查看上岗证" width="80%" @closed="closeFilesLook"> |
| | | <div> |
| | | <el-alert v-if="!tableLoading && tableData.length === 0" type="info" :closable="false" |
| | | title="所选检测人员暂无任职授权记录,请核对被任职人员与检测人员是否为同一人。"/> |
| | | <limsTable |
| | | ref="yearTable" |
| | | :column="columnData" |
| | | :height="'calc(100vh - 400px)'" |
| | | :highlightCurrentRow="true" |
| | | :table-data="tableData" |
| | | :table-loading="tableLoading" |
| | | style="margin-top: 0.5em;"> |
| | | ref="yearTable" |
| | | :column="columnData" |
| | | :height="'calc(100vh - 400px)'" |
| | | :highlightCurrentRow="true" |
| | | :table-data="tableData" |
| | | :table-loading="tableLoading" |
| | | style="margin-top: 0.5em;"> |
| | | </limsTable> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog |
| | | v-model="lookDialogVisible" |
| | | fullscreen |
| | | title="查看附件" top="5vh" width="800px"> |
| | | v-model="lookDialogVisible" |
| | | fullscreen |
| | | title="查看附件" top="5vh" width="800px"> |
| | | <filePreview v-if="lookDialogVisible" :currentFile="{}" |
| | | :fileUrl="fileUrl(currentInfo)" style="max-height: 90vh;overflow-y: auto;"/> |
| | | :fileUrl="javaApi+'/img/'+currentInfo.fileUrl" style="max-height: 90vh;overflow-y: auto;"/> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | |
| | | import file from '@/utils/file'; |
| | | import filePreview from '@/components/Preview/filePreview.vue'; |
| | | import limsTable from '@/components/Table/lims-table.vue' |
| | | import {getCurrentWorkFiles} from '@/api/cnas/process/method/methodVerification' |
| | | |
| | | export default { |
| | | name: 'viewWorkPermitDia', |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {filePreview, limsTable}, |
| | | components: { filePreview, limsTable }, |
| | | data() { |
| | | // 这里存放数据 |
| | | return { |
| | |
| | | ], |
| | | tableData: [], |
| | | info: {}, |
| | | currentInfo: {}, |
| | | currentInfo:{}, |
| | | lookDialogVisible: false, |
| | | }; |
| | | }, |
| | |
| | | }, |
| | | // 方法集合 |
| | | methods: { |
| | | fileUrl(row) { |
| | | const image = /\.(png|jpe?g|gif|bmp|webp)$/i.test(row.fileUrl || '') |
| | | return this.javaApi + (image ? '/img/' : '/word/') + row.fileUrl |
| | | }, |
| | | // 两种用法:数组=检测人员id(实时查询);行对象=优先展示已保存的上岗证,其次按已选检测人员实时查询 |
| | | openDia(payload = {}) { |
| | | openDia(row) { |
| | | this.filesDialogVisible = true |
| | | this.tableData = [] |
| | | if (Array.isArray(payload)) { |
| | | this.loadCurrentFiles(payload) |
| | | return |
| | | } |
| | | this.info = payload || {} |
| | | if (Array.isArray(payload.workFileList) && payload.workFileList.length) { |
| | | this.tableData = payload.workFileList |
| | | return |
| | | } |
| | | this.loadCurrentFiles(Array.isArray(payload.confirmUser) ? payload.confirmUser : []) |
| | | this.info = row |
| | | this.tableData = this.info.workFileList |
| | | }, |
| | | loadCurrentFiles(userIds) { |
| | | if (!userIds.length) return |
| | | this.tableLoading = true |
| | | getCurrentWorkFiles({userIds: userIds.join(',')}).then(res => { |
| | | if (res.code === 200) this.tableData = res.data || [] |
| | | }).catch(() => { |
| | | this.$message.error('上岗证读取失败,请稍后重试') |
| | | }).finally(() => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | closeFilesLook() { |
| | | closeFilesLook () { |
| | | this.filesDialogVisible = false |
| | | }, |
| | | // 查看文件 |
| | | handleLook(row) { |
| | | if (!row.fileUrl) { |
| | | this.$message.warning('该人员已有任职授权记录,但尚未上传上岗证书文件') |
| | | return |
| | | } |
| | | handleLook(row){ |
| | | this.currentInfo = row |
| | | this.lookDialogVisible = true |
| | | }, |
| | | // 下载 |
| | | upload(row) { |
| | | if (!row.fileUrl) { |
| | | this.$message.warning('该人员已有任职授权记录,但尚未上传上岗证书文件') |
| | | return |
| | | } |
| | | upload (row) { |
| | | let url = ''; |
| | | if (/\.(png|jpe?g|gif|bmp|webp)$/i.test(row.fileUrl || '')) { |
| | | url = this.javaApi + '/img/' + row.fileUrl |
| | | file.downloadIamge(url, row.fileName) |
| | | } else { |
| | | url = this.javaApi + '/word/' + row.fileUrl |
| | | 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; |