| | |
| | | <el-button link type="text" size="small">更多</el-button> |
| | | </template> |
| | | <div> |
| | | <el-button style="margin-left: 10px" type="text" size="small" @click="download(scope.row)">下载</el-button> |
| | | <el-button style="margin-left: 10px" type="text" size="small" |
| | | :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">下载</el-button> |
| | | <el-button type="text" size="small" @click="viewInspectInfo(scope.row)">原始记录</el-button> |
| | | <el-button type="text" size="small" @click="handleFileLook(scope.row)">附件上传</el-button> |
| | | </div> |
| | |
| | | // import ShowInfo from "../do/b1-material-ins-order/showInfo.vue"; |
| | | import { |
| | | downAll, |
| | | downloadReport, |
| | | examineReport, |
| | | pageInsReport, |
| | | ratifyReport, |
| | |
| | | } |
| | | }, |
| | | download(row) { |
| | | let url = row.urlS ? row.urlS : row.url; |
| | | const link = document.createElement('a'); |
| | | link.href = this.javaApi + url; |
| | | link.target = '_blank'; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | downloadReport(row.id).then(res => { |
| | | if (res.type && res.type.includes('application/json')) { |
| | | const reader = new FileReader() |
| | | reader.onload = () => { |
| | | try { |
| | | this.$message.error(JSON.parse(reader.result).msg || '报告下载失败') |
| | | } catch (e) { |
| | | this.$message.error('报告下载失败') |
| | | } |
| | | } |
| | | reader.readAsText(res) |
| | | return |
| | | } |
| | | const reportUrl = row.urlS || row.url || '' |
| | | const filename = decodeURIComponent(reportUrl.substring(reportUrl.lastIndexOf('/') + 1)) || `${row.code}.docx` |
| | | this.$download.saveAs(res, filename) |
| | | }).catch(() => { |
| | | this.$message.error('报告下载失败') |
| | | }) |
| | | }, |
| | | // 还原操作 |
| | | handleRestore(row) { |