From fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 九月 2026 09:21:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_新疆_新聚' into dev_新疆_新聚
---
src/views/business/reportPreparation/index.vue | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/views/business/reportPreparation/index.vue b/src/views/business/reportPreparation/index.vue
index 6501a8d..a9e4513 100644
--- a/src/views/business/reportPreparation/index.vue
+++ b/src/views/business/reportPreparation/index.vue
@@ -72,7 +72,8 @@
<el-button link type="text" size="small">鏇村</el-button>
</template>
<div>
- <el-button style="margin-left: 10px" type="text" size="small" @click="download(scope.row)">涓嬭浇</el-button>
+ <el-button style="margin-left: 10px" type="text" size="small"
+ :disabled="!scope.row.url && !scope.row.urlS" @click="download(scope.row)">涓嬭浇</el-button>
<el-button type="text" size="small" @click="viewInspectInfo(scope.row)">鍘熷璁板綍</el-button>
<el-button type="text" size="small" @click="handleFileLook(scope.row)">闄勪欢涓婁紶</el-button>
</div>
@@ -210,6 +211,7 @@
// import ShowInfo from "../do/b1-material-ins-order/showInfo.vue";
import {
downAll,
+ downloadReport,
examineReport,
pageInsReport,
ratifyReport,
@@ -754,12 +756,25 @@
}
},
download(row) {
- let url = row.urlS ? row.urlS : row.url;
- const link = document.createElement('a');
- link.href = this.javaApi + url;
- link.target = '_blank';
- document.body.appendChild(link);
- link.click();
+ downloadReport(row.id).then(res => {
+ if (res.type && res.type.includes('application/json')) {
+ const reader = new FileReader()
+ reader.onload = () => {
+ try {
+ this.$message.error(JSON.parse(reader.result).msg || '鎶ュ憡涓嬭浇澶辫触')
+ } catch (e) {
+ this.$message.error('鎶ュ憡涓嬭浇澶辫触')
+ }
+ }
+ reader.readAsText(res)
+ return
+ }
+ const reportUrl = row.urlS || row.url || ''
+ const filename = decodeURIComponent(reportUrl.substring(reportUrl.lastIndexOf('/') + 1)) || `${row.code}.docx`
+ this.$download.saveAs(res, filename)
+ }).catch(() => {
+ this.$message.error('鎶ュ憡涓嬭浇澶辫触')
+ })
},
// 杩樺師鎿嶄綔
handleRestore(row) {
--
Gitblit v1.9.3