提交 0a49003c authored 作者: wangjiahao's avatar wangjiahao

refactor: 画布优化

上级 99a08ba7
<template> <template>
<div id="canvasInfoTemp" ref="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown"> <div id="canvasInfoMain" ref="canvasInfoMain" class="main-class">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position"> <div id="canvasInfoTemp" ref="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown">
{{ $t('panel.panelNull') }} <el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
</el-row> {{ $t('panel.panelNull') }}
<canvas-opt-bar /> </el-row>
<ComponentWrapper <canvas-opt-bar />
v-for="(item, index) in componentDataInfo" <ComponentWrapper
:key="index" v-for="(item, index) in componentDataInfo"
:config="item" :key="index"
:search-count="searchCount" :config="item"
:in-screen="inScreen" :search-count="searchCount"
/> :in-screen="inScreen"
<!--视图详情--> />
<el-dialog <!--视图详情-->
:title="'['+showChartInfo.name+']'+$t('chart.chart_details')" <el-dialog
:visible.sync="chartDetailsVisible" :title="'['+showChartInfo.name+']'+$t('chart.chart_details')"
width="70%" :visible.sync="chartDetailsVisible"
class="dialog-css" width="70%"
:destroy-on-close="true" class="dialog-css"
> :destroy-on-close="true"
<span style="position: absolute;right: 70px;top:15px"> >
<el-button size="mini" @click="exportExcel"> <span style="position: absolute;right: 70px;top:15px">
<svg-icon icon-class="ds-excel" class="ds-icon-excel" /> <el-button size="mini" @click="exportExcel">
{{ $t('chart.export_details') }} <svg-icon icon-class="ds-excel" class="ds-icon-excel" />
</el-button> {{ $t('chart.export_details') }}
</span> </el-button>
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" /> </span>
</el-dialog> <UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />
</el-dialog>
</div>
</div> </div>
</template> </template>
...@@ -155,7 +157,7 @@ export default { ...@@ -155,7 +157,7 @@ export default {
erd.listenTo(tempDom, element => { erd.listenTo(tempDom, element => {
_this.$nextTick(() => { _this.$nextTick(() => {
_this.restore() _this.restore()
//将mainHeight 修改为px 临时解决html2canvas 截图不全的问题 // 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题
_this.mainHeight = tempDom.scrollHeight + 'px!important' _this.mainHeight = tempDom.scrollHeight + 'px!important'
}) })
}) })
...@@ -182,12 +184,14 @@ export default { ...@@ -182,12 +184,14 @@ export default {
changeStyleWithScale, changeStyleWithScale,
getStyle, getStyle,
restore() { restore() {
const canvasHeight = document.getElementById('canvasInfoTemp').offsetHeight const canvasHeight = document.getElementById('canvasInfoMain').offsetHeight
const canvasWidth = document.getElementById('canvasInfoTemp').offsetWidth const canvasWidth = document.getElementById('canvasInfoMain').offsetWidth
this.scaleWidth = canvasWidth * 100 / parseInt(this.canvasStyleData.width)// 获取宽度比 this.scaleWidth = canvasWidth * 100 / parseInt(this.canvasStyleData.width)// 获取宽度比
this.scaleHeight = canvasHeight * 100 / parseInt(this.canvasStyleData.height)// 获取高度比 this.scaleHeight = canvasHeight * 100 / parseInt(this.canvasStyleData.height)// 获取高度比
this.scaleHeight = this.scaleWidth console.log('scaleHeight:' + this.scaleHeight + ';ch:' + this.canvasStyleData.height)
// this.scaleHeight = this.scaleWidth
// this.mainHeight = this.canvasStyleData.height * this.scaleHeight / 100 + 'px' // this.mainHeight = this.canvasStyleData.height * this.scaleHeight / 100 + 'px'
// if (this.showType === 'width') { // if (this.showType === 'width') {
// this.scaleHeight = this.scaleWidth // this.scaleHeight = this.scaleWidth
...@@ -263,6 +267,10 @@ export default { ...@@ -263,6 +267,10 @@ export default {
} }
} }
} }
.main-class {
width: 100%;
height: 100%;
}
.custom-position { .custom-position {
flex: 1; flex: 1;
display: flex; display: flex;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论