From e38ecc06dbfea02080f197ed3352c7673be5e9ab Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期一, 17 十一月 2025 15:11:00 +0800
Subject: [PATCH] 修改了对应代码
---
src/views/archiveManager/index.vue | 62 +++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/src/views/archiveManager/index.vue b/src/views/archiveManager/index.vue
index ca8a990..0a0a9a4 100644
--- a/src/views/archiveManager/index.vue
+++ b/src/views/archiveManager/index.vue
@@ -300,7 +300,7 @@
icon="el-icon-edit"
@click="handleInfo(scope.row)"
v-hasPermi="['system:records:edit']"
- >妗堝嵎璇︾粏淇℃伅</el-button>
+ >缂栬緫鍗峰唴鐩綍</el-button>
<el-button
size="mini"
@@ -420,7 +420,7 @@
<div class="option-label">閫夋嫨娉ㄨВ:</div>
<div class="annotation-options">
<label v-for="(annotation, index) in excelOptions.selectedAnnotations" :key="index" class="signature-checkbox">
- <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="annotation">
+ <input type="checkbox" v-model="excelOptions.subselectedAnnotations" :value="index">
<span>{{ annotation }}
</span>
</label>
@@ -433,7 +433,7 @@
<div class="signature-options">
<div class="signature-checkboxes">
<label v-for="(signature, index) in excelOptions.selectedSignatures" :key="index" class="signature-checkbox">
- <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="signature">
+ <input type="checkbox" v-model="excelOptions.subselectedSignatures" :value="index">
<span>{{ signature }}</span>
</label>
@@ -446,9 +446,8 @@
</div>
</div>
<!-- 浼樺寲鐨凟xcel棰勮缁勪欢 -->
- <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"
@@ -808,6 +807,7 @@
name: "Records",
data() {
return {
+ showExcelPreview: false,
excel: 'http://localhost:8080/profile/upload/12.xls', //璁剧疆鏂囨。缃戠粶鍦板潃锛屽彲浠ユ槸鐩稿鍦板潃
open_check: false,
@@ -1349,6 +1349,8 @@
/** 鏌ョ湅骞舵墦鍗癊xcel鏂囦欢 */
viewAndPrintExcel(row) {
const id = row.id || this.ids;
+ // alert(id)
+ this.recordId = id;
this.$modal.loading('姝e湪鑾峰彇Excel鏂囦欢锛岃绋嶅��...');
// 浠庡悗绔幏鍙朎xcel鏂囦欢
@@ -1377,6 +1379,7 @@
/** 鍏抽棴Excel寮圭獥骞舵竻鐞嗚祫婧� */
closeExcelDialog() {
this.excelDialogVisible = false;
+ // alert(this.excelDialogVisible)
if (this.excelPreviewTimeout) {
clearTimeout(this.excelPreviewTimeout);
this.excelPreviewTimeout = null;
@@ -1387,12 +1390,32 @@
}
this.currentExcelBlob = null;
},
+closeExcelPreviewDialog()
+{
+ this.showExcelPreview = false;
+},
/** 澶勭悊棰勮鎸夐挳鐐瑰嚮 */
handlePreviewClick() {
this.showExcelPreview = true;
this.excelRenderError = '';
+ var id = this.recordId ;
+ this.$modal.loading('姝e湪鑾峰彇Excel鏂囦欢锛岃绋嶅��...');
+ // 浠庡悗绔幏鍙朎xcel鏂囦欢
+ this.getExcelFile(id).then(blob => {
+ this.$modal.closeLoading();
+ // 淇濆瓨鏂囦欢淇℃伅骞舵樉绀洪潤鎬佸脊绐�
+ this.currentExcelUrl = URL.createObjectURL(blob);
+ this.currentExcelBlob = blob;
+ this.currentExcelId = id;
+ this.excelDialogVisible = true;
+ this.excelLoading = false;
+ }).catch(error => {
+ this.$modal.closeLoading();
+ console.error('鑾峰彇Excel鏂囦欢澶辫触:', error);
+ this.$modal.msgError('鑾峰彇Excel鏂囦欢澶辫触锛岃绋嶅悗閲嶈瘯');
+ });
// 閲嶇疆vue-office-excel缁勪欢
if (this.currentExcelUrl) {
const tempUrl = this.currentExcelUrl;
@@ -1562,9 +1585,9 @@
// 鏋勫缓鏂囦欢鍚嶏紝鍖呭惈閫夐」淇℃伅
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;
@@ -1600,7 +1623,7 @@
});
},
- /** 娓呯悊Excel棰勮鐩稿叧璧勬簮 */
+ /** 娓呯悊Excel棰勮鐩稿叧璧勬簮骞跺叧闂璇濇 */
cleanupExcelPreview(iframe, url) {
setTimeout(() => {
if (iframe && iframe.parentNode) {
@@ -1610,12 +1633,27 @@
URL.revokeObjectURL(url);
}
this.excelRenderError = '';
+ this.showExcelPreview = false; // 鍏抽棴棰勮瀵硅瘽妗�
}, 1000);
},
/** 浠庡悗绔幏鍙朎xcel鏂囦欢 */
getExcelFile(id) {
var includeQrCode = this.excelOptions.includeQrCode;
+ var urls = `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`+"/"+includeQrCode;
+
+
+ if(this.excelOptions.subselectedSignatures.length!=0)
+ {
+ var selectedSignatures = this.excelOptions.subselectedSignatures
+ urls = urls +'/'+ selectedSignatures
+ }
+ if(this.excelOptions.subselectedAnnotations.length!=0)
+ {
+ var selectedAnnotations = this.excelOptions.subselectedAnnotations
+ urls = urls+"/"+selectedAnnotations
+ }
+
return new Promise((resolve, reject) => {
// 棣栧厛灏濊瘯浣跨敤axios锛堥」鐩凡鏈夌殑HTTP瀹㈡埛绔級
try {
@@ -1627,10 +1665,10 @@
recordId: id,
};
-alert(355)
+
axios({
method: 'Post',
- url: `${process.env.VUE_APP_BASE_API}/system/records/recordFileList`+"/"+includeQrCode,
+ url: urls,
params: params,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
--
Gitblit v1.9.1