【修改】调整下载传参

This commit is contained in:
zhoulingpo
2023-05-25 14:10:18 +08:00
parent fdd0c1f108
commit 65c24c1663
4 changed files with 73 additions and 13 deletions
+50 -8
View File
@@ -55,10 +55,16 @@
</div> </div>
<div class="report-download"> <div class="report-download">
<span>报告详情</span> <span>报告详情</span>
<el-button type="primary" v-if="row.downPower==1" @click="downloadRow(row)">报告下载</el-button> <el-button type="primary" v-if="row.downPower==1" @click="downloadRow(file)"
:disabled="showText">报告下载</el-button>
</div> </div>
<div class="preview-box" v-watermark="{ text: watermarkText }"> <div class="preview-box" v-watermark="{ text: watermarkText }">
<div class="preview-content" v-html="content"></div> <div class="preview-list" >
<div class="fileName" v-for="item in row.fileList" :title="item.fileName" @click="handleFile(item)"
:class="{'bgColor':file.fileId==item.fileId}">{{item.fileName}}</div>
</div>
<el-empty class="preview-content" description="描述文字" v-if="showText"></el-empty>
<div class="preview-content" v-html="content" v-else></div>
</div> </div>
<div class="report-jug"> <div class="report-jug">
<div class="report-jug-left"> <div class="report-jug-left">
@@ -126,6 +132,9 @@ export default {
name: 'ReportDetail', name: 'ReportDetail',
data() { data() {
return { return {
showText:false,
pointNum:0,
file:{},
isAdmin: false, //是否是管理员 isAdmin: false, //是否是管理员
report: {}, report: {},
formatDate2, formatDate2,
@@ -248,13 +257,25 @@ export default {
} }
}, },
// 预览 // 预览
previewRow() { previewRow(id) {
// this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}` // this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
// this.row = JSON.parse(this.$route.query.row) // this.row = JSON.parse(this.$route.query.row)
this.$api.report.reportGetReportHtmlId({id: this.row.id}).then(({data}) => { this.$api.report.reportGetReportHtmlId({id: id}).then(({data}) => {
this.content = data.content this.content = data.content
}) })
}, },
handleFile(row){
this.file=row
let lastName=row.fileName.split('.')
let list=['xls','xlsx']
if(list.indexOf(lastName[lastName.length-1])>-1){
this.showText=true
}else{
this.showText=false
this.previewRow(this.file.fileId)
}
},
// 下载 // 下载
downloadRow(row) { downloadRow(row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', { // this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
@@ -262,7 +283,7 @@ export default {
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId, repostId: row.id}).then(res => { this.$api.report.reportDownload({fileId: this.file.fileId, repostId: row.id}).then(res => {
downloadFile(res) downloadFile(res)
}) })
// }) // })
@@ -273,7 +294,7 @@ export default {
this.row = res.data this.row = res.data
this.isAdmin = this.$store.getters.userInfo.usid==this.row.createUserId this.isAdmin = this.$store.getters.userInfo.usid==this.row.createUserId
// 需要给分数/2 // 需要给分数/2
this.previewRow() this.handleFile(this.row.fileList[0])
}) })
}, },
}, },
@@ -362,17 +383,35 @@ export default {
.preview-box { .preview-box {
// 定位使水印不溢出元素 // 定位使水印不溢出元素
display: flex;
position: relative; position: relative;
// 居中 // 居中
width: calc(100% - 13px - 14px); width: calc(100% - 13px - 14px);
margin-left: 13px; margin-left: 13px;
.preview-list{
width: 200px;
margin-top: 10px;
max-height: 500px;
overflow: auto;
.fileName{
width: 100%;
height: 28px;
overflow: hidden;
text-overflow: ellipsis;
word-break: keep-all;
white-space: nowrap;
cursor: pointer;
color: #434343;
padding: 0px 10px;
line-height: 28px;
}
}
.preview-content { .preview-content {
//margin: 0 14px 0 13px; //margin: 0 14px 0 13px;
max-height: 500px; max-height: 500px;
padding-bottom: 11px; padding-bottom: 11px;
overflow: auto; overflow: auto;
width: calc(100% - 200px);
img { img {
max-width: 100% !important; max-width: 100% !important;
} }
@@ -480,4 +519,7 @@ export default {
.showLimit ::v-deep .el-textarea .el-input__count{ .showLimit ::v-deep .el-textarea .el-input__count{
width: 98%; width: 98%;
} }
.bgColor{
background-color: #F2F6FC;
}
</style> </style>
+15 -2
View File
@@ -122,6 +122,8 @@
<vxe-column show-overflow show-header-overflow field="uploader" title="上传人"></vxe-column> <vxe-column show-overflow show-header-overflow field="uploader" title="上传人"></vxe-column>
<vxe-column show-overflow show-header-overflow title="操作" width="200" fixed="right"> <vxe-column show-overflow show-header-overflow title="操作" width="200" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<!-- <el-button type="text" v-if="row.collect" @click="collectReport(row,'y')">收藏</el-button>-->
<!-- <el-button type="text" v-if="!row.collect" @click="collectReport(row,'n')">取消收藏</el-button>-->
<el-button type="text" v-if="row.power == 1 ||row.power == 2" @click="goReportDetail(row)">预览</el-button> <el-button type="text" v-if="row.power == 1 ||row.power == 2" @click="goReportDetail(row)">预览</el-button>
<el-button type="text" v-if="row.power == 3 || row.power == 2 " @click="downloadRow(row)">下载</el-button> <el-button type="text" v-if="row.power == 3 || row.power == 2 " @click="downloadRow(row)">下载</el-button>
<el-button type="text" v-if="row.power !== 2 && !isAdmin" @click="permissionApp(row)">申请权限</el-button> <el-button type="text" v-if="row.power !== 2 && !isAdmin" @click="permissionApp(row)">申请权限</el-button>
@@ -168,7 +170,7 @@
<script> <script>
import {downloadFile} from '@/utils/downloadFile' import {downloadFile} from '@/utils/downloadFile'
import {formatDate} from '@/utils/date' import {formatDate} from '@/utils/date'
import {sendTrackEvent} from '@/utils/quickTracking'
export default { export default {
name: 'ReportList', name: 'ReportList',
data() { data() {
@@ -460,13 +462,24 @@ export default {
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId,repostId:row.id}).then(res => { this.$api.report.reportDownload({reportId:row.id}).then(res => {
downloadFile(res) downloadFile(res)
}) })
// }) // })
}, },
collectReport(row,type){
if(type=='y'){
// 调用收藏
}else{
}
},
// 跳转到详情 // 跳转到详情
goReportDetail(row) { goReportDetail(row) {
sendTrackEvent({
eventName: 'preview_click',
params: {id:row.id,name:row.name}
})
window.open('/report/detail?id='+this.$route.query.id+'&reportId='+row.id) window.open('/report/detail?id='+this.$route.query.id+'&reportId='+row.id)
this.reportList() this.reportList()
// 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}})
+8 -2
View File
@@ -67,7 +67,8 @@
<el-col :span="20" style="padding-left: 15px"> <el-col :span="20" style="padding-left: 15px">
<div class="table"> <div class="table">
<vxe-table ref="xTable" :data="tableData" @checkbox-all="selectAllEvent" @checkbox-change="selectChangeEvent" <vxe-table ref="xTable" :data="tableData" @checkbox-all="selectAllEvent" @checkbox-change="selectChangeEvent"
:empty-render="{name: 'NotData'}" align="center" border stripe v-table-min-height="'calc(100vh - 320px)'"> :empty-render="{name: 'NotData'}" align="center" border stripe
v-table-min-height="'calc(100vh - 320px)'">
<vxe-column type="checkbox" width="60"></vxe-column> <vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column show-overflow show-header-overflow type="seq" title="序号" width="77"> <vxe-column show-overflow show-header-overflow type="seq" title="序号" width="77">
<template #default="{ row, rowIndex }"> <template #default="{ row, rowIndex }">
@@ -198,6 +199,7 @@ import { downloadFile } from "../../utils/downloadFile";
import { formatDate } from '@/utils/date' import { formatDate } from '@/utils/date'
import VueTagsInput from '@johmun/vue-tags-input'; import VueTagsInput from '@johmun/vue-tags-input';
import labelModalVue from './reportManager/labelModal.vue'; import labelModalVue from './reportManager/labelModal.vue';
import {sendTrackEvent} from "@/utils/quickTracking";
export default { export default {
name: "ReportManager", name: "ReportManager",
components: { components: {
@@ -718,6 +720,10 @@ export default {
}, },
// 预览 // 预览
previewRow(row) { previewRow(row) {
sendTrackEvent({
eventName: 'preview_click',
params: {id:row.id,name:row.name}
})
// this.fullscreen = false; // this.fullscreen = false;
// // 更新预览水印的时间戳 // // 更新预览水印的时间戳
// this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`; // this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
@@ -736,7 +742,7 @@ export default {
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId,repostId:row.id }).then(res => { this.$api.report.reportDownload({ reportId:row.id }).then(res => {
downloadFile(res); downloadFile(res);
}) })
// }) // })
@@ -481,7 +481,6 @@ export default {
onSuccess(res, file,fileList){ onSuccess(res, file,fileList){
if(res.ok){ if(res.ok){
// this.fileList.push({url:res.data.fullurl})//以前的错误代码 // this.fileList.push({url:res.data.fullurl})//以前的错误代码
debugger
this.fileList=fileList this.fileList=fileList
this.form.fileList = this.fileList.map(item=>{ this.form.fileList = this.fileList.map(item=>{
return { return {