| | |
| | | </el-dialog> |
| | | <el-dialog v-model="downloadDialog" title="导出" width="600px"> |
| | | <span> |
| | | <el-button :loading="outLoading" plain type="primary" @click="controlDown">核查记录</el-button> |
| | | <el-button :loading="outLoading" plain type="primary" @click="processingDown">核查比对记录</el-button> |
| | | <el-button :loading="outLoading" type="primary" :disabled="!downRow.recordStatus" @click="controlDown">核查记录</el-button> |
| | | <el-button :loading="outLoading" type="primary" :disabled="!downRow.recordContrastStatus" @click="processingDown">核查比对记录</el-button> |
| | | </span> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="downloadDialog = false">取 消</el-button> |
| | |
| | | this.downRow = row |
| | | this.downloadDialog = true |
| | | }, |
| | | // 导出结果拦截: 后端返回错误 JSON 时提示错误, 不存成坏文件 |
| | | saveDocx(res, filename) { |
| | | const reader = new FileReader(); |
| | | reader.readAsText(res, 'utf-8'); |
| | | reader.onload = () => { |
| | | const text = (reader.result || '').trim(); |
| | | if (text.startsWith('{') || text.startsWith('[')) { |
| | | let msg = '导出失败'; |
| | | try { msg = JSON.parse(text).msg || msg; } catch (e) {} |
| | | this.$message.error(msg); |
| | | } else { |
| | | this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename); |
| | | } |
| | | }; |
| | | reader.onerror = () => { |
| | | this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename); |
| | | }; |
| | | }, |
| | | // 核查记录导出 |
| | | controlDown() { |
| | | this.outLoading = true |
| | | exportReviewExamineRecordDetail({ planDetailsId: this.downRow.planDetailsId }).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res], { type: 'application/octet-stream' }); |
| | | this.$download.saveAs(blob, '仪器设备期间核查记录表.doc') |
| | | this.saveDocx(res, '仪器设备期间核查记录表.doc') |
| | | }).catch(() => { |
| | | this.outLoading = false |
| | | }) |
| | | }, |
| | | // 核查对比导出 |
| | |
| | | this.outLoading = true |
| | | exportReviewExamineRecordContrast({ planDetailsId: this.downRow.planDetailsId }).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res], { type: 'application/octet-stream' }); |
| | | this.$download.saveAs(blob, '仪器设备期间核查比对记录表.doc') |
| | | this.saveDocx(res, '仪器设备期间核查比对记录表.doc') |
| | | }).catch(() => { |
| | | this.outLoading = false |
| | | }) |
| | | }, |
| | | // 导入流程 |
| | |
| | | .title { |
| | | position: relative; |
| | | font-size: 16px; |
| | | color: #333; |
| | | color: var(--lims-text); |
| | | font-weight: 400; |
| | | padding-left: 10px; |
| | | margin-bottom: 10px; |