| | |
| | | icon="el-icon-edit" |
| | | @click="handleInfo(scope.row)" |
| | | v-hasPermi="['system:records:edit']" |
| | | >案卷详细信息</el-button> |
| | | >编辑卷内目录</el-button> |
| | | |
| | | <el-button |
| | | size="mini" |
| | |
| | | </div> |
| | | </div> |
| | | <!-- 优化的Excel预览组件 --> |
| | | <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%"> |
| | | |
| | | <div > |
| | | <el-dialog class="excel-preview-wrapper" :visible.sync="showExcelPreview" :modal="false" width="80%" :show-close="true" @click="closeExcelPreviewDialog"> |
| | | <div @click.stop> |
| | | <!-- 主要预览组件 --> |
| | | <vue-office-excel |
| | | v-if="currentExcelUrl" |
| | |
| | | name: "Records", |
| | | data() { |
| | | return { |
| | | showExcelPreview: false, |
| | | excel: 'http://localhost:8080/profile/upload/12.xls', //设置文档网络地址,可以是相对地址 |
| | | |
| | | open_check: false, |
| | |
| | | /** 关闭Excel弹窗并清理资源 */ |
| | | closeExcelDialog() { |
| | | this.excelDialogVisible = false; |
| | | // alert(this.excelDialogVisible) |
| | | if (this.excelPreviewTimeout) { |
| | | clearTimeout(this.excelPreviewTimeout); |
| | | this.excelPreviewTimeout = null; |
| | |
| | | } |
| | | this.currentExcelBlob = null; |
| | | }, |
| | | closeExcelPreviewDialog() |
| | | { |
| | | |
| | | this.showExcelPreview = false; |
| | | }, |
| | | /** 处理预览按钮点击 */ |
| | | handlePreviewClick() { |
| | | this.showExcelPreview = true; |
| | | this.excelRenderError = ''; |
| | | var id = this.recordId ; |
| | | this.$modal.loading('正在获取Excel文件,请稍候...'); |
| | | alert(id) |
| | | |
| | | // 从后端获取Excel文件 |
| | | this.getExcelFile(id).then(blob => { |
| | | this.$modal.closeLoading(); |
| | |
| | | // 构建文件名,包含选项信息 |
| | | let filename = `record_${this.currentExcelId}`; |
| | | if (includeQrCode) filename += '_qr'; |
| | | if (selectedAnnotations.length > 0) { |
| | | filename += `_anno${selectedAnnotations.join('')}`; |
| | | } |
| | | // if (selectedAnnotations.length > 0) { |
| | | // filename += `_anno${selectedAnnotations.join('')}`; |
| | | // } |
| | | filename += `_${new Date().getTime()}.xlsx`; |
| | | |
| | | link.download = filename; |
| | |
| | | }); |
| | | }, |
| | | |
| | | /** 清理Excel预览相关资源 */ |
| | | /** 清理Excel预览相关资源并关闭对话框 */ |
| | | cleanupExcelPreview(iframe, url) { |
| | | setTimeout(() => { |
| | | if (iframe && iframe.parentNode) { |
| | |
| | | URL.revokeObjectURL(url); |
| | | } |
| | | this.excelRenderError = ''; |
| | | this.showExcelPreview = false; // 关闭预览对话框 |
| | | }, 1000); |
| | | }, |
| | | |