加入全屏查看的按钮

This commit is contained in:
lixuetao
2023-12-13 21:03:53 +08:00
parent 6e9eaa8b7d
commit 1382f69759
3 changed files with 314 additions and 4 deletions
+7 -1
View File
@@ -33,7 +33,13 @@ const routes = [
}
}
]
}
},
// 全屏报告
{
path: '/report/fullscreen',
name: 'fullscreen',
component: () => import('../../views/Report/ReportFullscreenView.vue')
},
]
export default routes
+9 -3
View File
@@ -55,8 +55,11 @@
<!-- </div>-->
<div class="report-download">
<span>报告详情</span>
<el-button v-if="row.downPower==1" @click="downloadRow(file)"
:disabled="showText && !isExcel" size="mini" class="checkBtn">报告下载</el-button>
<div>
<el-button @click="fullscreenView(file)" size="mini" class="checkBtn">全屏查看</el-button>
<el-button v-if="row.downPower==1" @click="downloadRow(file)"
:disabled="showText && !isExcel" size="mini" class="checkBtn">报告下载</el-button>
</div>
</div>
<div class="preview-box" v-watermark="{ text: watermarkText }">
<div class="preview-list scroll-myself" >
@@ -278,6 +281,10 @@ export default {
}
},
// 跳转到新页签单独查看pdf
fullscreenView(){
window.open('/report/fullscreen?id='+this.$route.query.id+'&reportId='+ this.row.id)
},
// 下载
downloadRow(row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
@@ -302,7 +309,6 @@ export default {
this.$api.report.getReportDetail(this.reportId).then(res => {
this.row = res.data
this.isAdmin = this.$store.getters.userInfo.usid==this.row.createUserId
// 需要给分数/2
this.handleFile(this.row.fileList[0])
})
},
+298
View File
@@ -0,0 +1,298 @@
<template>
<div class="content-height report-detail">
<div class="preview-box" v-watermark="{ text: watermarkText }">
<div class="preview-list scroll-myself" >
<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="excel不可预览" v-if="showText"></el-empty>
<div class="preview-content" v-html="content" v-else></div>
</div>
</div>
</template>
<script>
export default {
name: 'ReportDetail',
data() {
return {
showText:false,
file:{},
report: {},
watermarkText: '', // 水印
content: '',
row: {},
reportId: ''
}
},
methods: {
// 预览
previewRow(fileId,reportId) {
// 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.$api.report.reportGetReportHtmlId({fileId: fileId,reportId:reportId}).then(({data}) => {
this.content = data.content
})
},
handleFile(row){
this.file=row
let lastName=row.fileName.split('.')
let list=['xls','xlsx','XLS','XLSX']
if(list.indexOf(lastName[lastName.length-1])>-1){
this.showText=true
}else{
this.showText=false
this.previewRow(this.file.fileId,this.row.id)
}
},
// 跳转到新页签单独查看pdf
fullscreenView(row){
},
// 获取详情
getReportDetail() {
this.$api.report.getReportDetail(this.reportId).then(res => {
this.row = res.data
this.handleFile(this.row.fileList[0])
})
},
},
mounted() {
this.reportId = this.$route.query.reportId
this.getReportDetail()
}
}
</script>
<style lang="scss" scoped>
.report-detail {
overflow: hidden;
.title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-bottom: 1px solid #EBEEF5;
height: 42px;
line-height: 42px;
margin: 0 18px 0 22px;
text-align: center;
span {
font-size: 16px;
font-weight: 600;
color: #262626;
}
}
.desc {
padding: 11px 26px 6px 48px;
.desc-item {
display: flex;
justify-content: flex-start;
align-items: flex-start;
margin-bottom: 12px;
label {
display: inline-block;
height: 19px;
line-height: 19px;
font-size: 14px;
font-weight: 400;
color: #595959;
width: 85px;
margin-right: 9px;
}
div, p {
flex: 1;
font-size: 14px;
font-weight: 400;
color: #434343;
word-break: break-all;
}
p {
line-height: 20px;
text-align: justify;
}
}
}
.report-download {
height: 40px;
background: #F2F6FC;
border: 1px solid #EBEEF5;
margin: 10px 14px 0 13px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 7px 0 9px;
span {
font-size: 16px;
font-weight: 500;
color: #262626;
}
}
.preview-box {
// 定位使水印不溢出元素
display: flex;
position: relative;
// 居中
//max-height: 800px;
width: calc(100% - 13px - 14px);
margin-left: 13px;
//min-height: 500px;
.preview-list{
width: 200px;
margin-top: 10px;
//padding-right: 5px;
max-height: 700px;
overflow: auto;
.fileName{
width: 100%;
height: 30px;
overflow: hidden;
text-overflow: ellipsis;
word-break: keep-all;
white-space: nowrap;
cursor: pointer;
color: #434343;
padding: 0px 10px;
line-height: 28px;
}
}
.preview-content {
//margin: 0 14px 0 13px;
border-left: 2px solid #ccc;
//max-height: 700px;
height: calc(100vh);
padding-bottom: 11px;
overflow: auto;
width: calc(100% - 200px);
img {
max-width: 100% !important;
}
table {
margin: 0 auto;
}
}
}
.report-jug {
display: flex;
justify-content: space-between;
padding: 10px;
.report-jug-left {
display: flex;
&>div{
margin-right: 10px;
}
::v-deep .el-rate__item{
vertical-align: inherit;
}
}
}
.juggle_box {
padding: 10px;
.all_juggle {
margin-top: 20px;
display: flex;
width: 100%;
border: 1px solid #e6f6fe;
min-height: 150px;
.juggle_left {
width: 15%;
text-align: center;
border-right: 1px solid #e6f6fe;
color: #434343;
.nameCir {
background-color: pink;
width: 60px;
height: 60px;
border-radius: 50%;
text-align: center;
line-height: 60px;
color: #fff;
font-size: 18px;
margin: 20px calc(50% - 30px);
}
}
.juggle_right {
position: relative;
width: 85%;
padding: 10px 10px 40px;
.content {
width: 100%;
color: #434343;
margin-bottom: 5px;
word-break: break-all;
}
.bottom {
position: absolute;
display: flex;
justify-content: space-between;
width: calc(100% - 40px);
bottom: 10px;
left: 20px;
height: 35px;
color: #434343;
.time {
line-height: 35px;
color: #858585;
}
.delbtn {
//vertical-align: center;
}
}
}
}
.fabiaoBtn {
margin-left: 20px;
height: 100%;
}
}
.isBackground {
background-color: pink;
}
}
.pointclick {
cursor: pointer;
}
.showLimit ::v-deep .el-textarea .el-input__count{
width: 98%;
}
.bgColor{
background-color: #F2F6FC;
}
.checkBtn {
padding: 5px 20px !important;
background-color:#1890FF;
color: #fff;
}
.el-button.is-disabled, .el-button.is-disabled:hover, .el-button.is-disabled:focus{
background-color: #82bffc;
color: #fff;
}
</style>