【修改】下载

This commit is contained in:
zhoulingpo
2023-05-26 14:26:06 +08:00
parent 4aed5a8e7d
commit 7bb05f8b8a
2 changed files with 19 additions and 6 deletions
+18 -5
View File
@@ -56,7 +56,7 @@
<div class="report-download"> <div class="report-download">
<span>报告详情</span> <span>报告详情</span>
<el-button v-if="row.downPower==1" @click="downloadRow(file)" <el-button v-if="row.downPower==1" @click="downloadRow(file)"
:disabled="showText" size="mini" class="checkBtn">报告下载</el-button> :disabled="showText && !isExcel" size="mini" class="checkBtn">报告下载</el-button>
</div> </div>
<div class="preview-box" v-watermark="{ text: watermarkText }"> <div class="preview-box" v-watermark="{ text: watermarkText }">
<div class="preview-list" > <div class="preview-list" >
@@ -153,6 +153,7 @@ export default {
}, },
userId: this.$store.getters.userInfo.usid, userId: this.$store.getters.userInfo.usid,
userName: this.$store.getters.userInfo.usname, userName: this.$store.getters.userInfo.usname,
isExcel:false
} }
}, },
methods: { methods: {
@@ -266,6 +267,7 @@ export default {
}, },
handleFile(row){ handleFile(row){
this.file=row this.file=row
let lastName=row.fileName.split('.') let lastName=row.fileName.split('.')
let list=['xls','xlsx','XLS','XLSX'] let list=['xls','xlsx','XLS','XLSX']
if(list.indexOf(lastName[lastName.length-1])>-1){ if(list.indexOf(lastName[lastName.length-1])>-1){
@@ -283,9 +285,16 @@ export default {
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({ reportId: this.row.id}).then(res => { if(this.isExcel){
downloadFile(res) this.$api.report.reportDownloadALL({ reportId: this.row.id}).then(res => {
}) downloadFile(res)
})
}else{
this.$api.report.reportDownload({ reportId: this.row.id}).then(res => {
downloadFile(res)
})
}
// }) // })
}, },
// 获取详情 // 获取详情
@@ -300,7 +309,11 @@ export default {
}, },
mounted() { mounted() {
this.reportId = this.$route.query.reportId this.reportId = this.$route.query.reportId
if(this.$route.query.isExecel){
this.isExcel=true
}else{
this.isExcel=false
}
// this.previewRow() // this.previewRow()
this.getComment() this.getComment()
this.getReportDetail() this.getReportDetail()
+1 -1
View File
@@ -731,7 +731,7 @@ export default {
// this.content = data.content; // this.content = data.content;
// this.dialogPreview = true; // this.dialogPreview = true;
// }) // })
window.open('/report/detail?id='+this.$route.query.id+'&reportId='+row.id) window.open('/report/detail?id='+this.$route.query.id+'&reportId='+row.id +'&isExecel=1')
// this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, reportId: row.id}}) // this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, reportId: row.id}})
this.reportDateList(); this.reportDateList();
}, },