| | |
| | | <div class="search_thing"> |
| | | <div class="search_label">上传附件:</div> |
| | | <div class="search_input"><el-upload style="margin: 8px 0 0px 50px;" action="#" :auto-upload="false" |
| | | :multiple="false" accept='.pdf' :on-change="handleChangeUpload" v-if="addDialogVisible"> |
| | | :multiple="false" accept='.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.wps,.et,.dps,.txt,.jpg,.jpeg,.png' :on-change="handleChangeUpload" v-if="addDialogVisible"> |
| | | <el-button size="small" type="primary">上传附件</el-button> |
| | | </el-upload></div> |
| | | </div> |
| | |
| | | handleCheck0(row) { |
| | | this.checkStampDialogVisible = false |
| | | this.checkDialogVisible = true |
| | | checkManageDocumentControlledPdf({ id: row.id }).then(res => { |
| | | const blob = new Blob([res]); |
| | | checkManageDocumentControlledPdf({ id: row.id }).then(async 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.checkDialogVisible = 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.currentStamp) |
| | | }).catch(err => { |
| | | this.checkDialogVisible = false |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | handleDown(row) { |
| | | if (!row.url) return this.$message.warning('文件未上传') |
| | | this.$download.saveAs(row.url, row.url); |
| | | const fileName = row.url.replace(/^[0-9a-fA-F-]{36}_/, '') |
| | | this.$download.saveAs(this.javaApi + '/word/' + row.url, fileName); |
| | | }, |
| | | async uploadPDF(pdfBlob) { |
| | | const formData = new FormData(); |
| | | formData.append('file', pdfBlob, this.fileName + '.pdf'); // 文件字段 |
| | | formData.append('file', pdfBlob, (this.currentInfo.name || 'controlled') + '.pdf'); // 文件字段 |
| | | formData.append('id', this.currentInfo.id); // 文件名字段 |
| | | formData.append('state', this.type); // 文件名字段 |
| | | formData.append('writer', this.currentInfo.writer); // 文件名字段 |