| | |
| | | </template> |
| | | |
| | | <script> |
| | | 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' |
| | |
| | | const image = /\.(png|jpe?g|gif|bmp|webp)$/i.test(row.fileUrl || '') |
| | | return this.javaApi + (image ? '/img/' : '/word/') + row.fileUrl |
| | | }, |
| | | openDia(userIds) { |
| | | // 两种用法:数组=检测人员id(实时查询);行对象=优先展示已保存的上岗证,其次按已选检测人员实时查询 |
| | | openDia(payload = {}) { |
| | | 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 : []) |
| | | }, |
| | | loadCurrentFiles(userIds) { |
| | | if (!userIds.length) return |
| | | this.tableLoading = true |
| | | getCurrentWorkFiles({userIds: userIds.join(',')}).then(res => { |
| | | if (res.code === 200) this.tableData = res.data || [] |
| | |
| | | this.$message.warning('该人员已有任职授权记录,但尚未上传上岗证书文件') |
| | | return |
| | | } |
| | | 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 |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = row.fileName; |
| | | link.click(); |
| | | } |
| | | return this.$download.attachment({ fileUrl: row.fileUrl }, row.fileName) |
| | | }, |
| | | }, |
| | | }; |