| | |
| | | <div class="search_thing" style="width: 100%;"> |
| | | <div class="search_label">相关附件:</div> |
| | | <div class="search_input"><el-upload v-if="addDialogVisible" :auto-upload="false" :multiple="false" |
| | | :on-change="handleChangeUpload" accept='.pdf' action="#" style="margin: 8px 0 0px 50px;"> |
| | | :on-change="handleChangeUpload" accept='.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.wps,.et,.dps,.txt,.jpg,.jpeg,.png' action="#" style="margin: 8px 0 0px 50px;"> |
| | | <el-button size="small" type="primary">上传附件</el-button> |
| | | </el-upload></div> |
| | | </div> |
| | |
| | | this.getCurrentFile(alterBeforeCode) |
| | | this.addDialogVisible = true |
| | | this.diaLoading = true |
| | | checkManageDocumentAlterPdf({ id: row.id }).then(res => { |
| | | checkManageDocumentAlterPdf({ id: row.id }).then(async res => { |
| | | // |
| | | this.diaLoading = false |
| | | const blob = new Blob([res]); |
| | | // 后端转 PDF 失败时会返回 JSON 错误,blob 里就不是 PDF |
| | | if (res.type && res.type.includes('json')) { |
| | | const data = JSON.parse(await res.text()) |
| | | this.$message.error(data.msg || '附件转换预览失败') |
| | | this.addDialogVisible = false |
| | | return |
| | | } |
| | | const blob = new Blob([res], { type: 'application/pdf' }); |
| | | const file = new File([blob], row.name, { type: 'application/pdf' }) |
| | | this.$refs.UpPdfStamp.lookFile(file) |
| | | this.currentInfo = row |
| | | }).catch(err => { |
| | | this.diaLoading = false |
| | | this.addDialogVisible = false |
| | | console.log(err) |
| | | }) |
| | | }, |