Merge pull request #4077 from dataease/pr@dev@fix_panel-watermark-link

fix(仪表板): 修复公共链接中水印导致的控制台异常 #4060
This commit is contained in:
王嘉豪 2022-12-12 17:44:42 +08:00 committed by GitHub
commit 4512094cd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 14 deletions

View File

@ -156,7 +156,7 @@ import bus from '@/utils/bus'
import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil' import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil'
import { hasDataPermission } from '@/utils/permission' import { hasDataPermission } from '@/utils/permission'
import { activeWatermark } from '@/components/canvas/tools/watermark' import { activeWatermark } from '@/components/canvas/tools/watermark'
import { userLoginInfo } from '@/api/systemInfo/userLogin' import { proxyUserLoginInfo, userLoginInfo } from '@/api/systemInfo/userLogin'
import html2canvas from 'html2canvasde' import html2canvas from 'html2canvasde'
import { queryAll } from '@/api/panel/pdfTemplate' import { queryAll } from '@/api/panel/pdfTemplate'
import PDFPreExport from '@/views/panel/export/PDFPreExport' import PDFPreExport from '@/views/panel/export/PDFPreExport'
@ -457,7 +457,8 @@ export default {
if (this.userInfo) { if (this.userInfo) {
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen) activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
} else { } else {
userLoginInfo().then(res => { const method = this.userId ? proxyUserLoginInfo : userLoginInfo
method(this.userId).then(res => {
this.userInfo = res.data this.userInfo = res.data
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen) activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
}) })

View File

@ -165,12 +165,12 @@
v-show=" show &&showIndex===1" v-show=" show &&showIndex===1"
:canvas-id="canvasId" :canvas-id="canvasId"
/> />
<subject-setting v-show=" show &&showIndex===2" /> <subject-setting v-show=" show &&showIndex===2"/>
<assist-component v-show=" show &&showIndex===3" /> <assist-component v-show=" show &&showIndex===3"/>
</div> </div>
</el-drawer> </el-drawer>
<!--PC端画布区域--> <!--PC端画布区域-->
<canvas-opt-bar v-if="!previewVisible&&!mobileLayoutStatus" /> <canvas-opt-bar v-if="!previewVisible&&!mobileLayoutStatus"/>
<de-canvas <de-canvas
v-if="!previewVisible&&!mobileLayoutStatus" v-if="!previewVisible&&!mobileLayoutStatus"
ref="canvasMainRef" ref="canvasMainRef"
@ -196,7 +196,7 @@
:style="customCanvasMobileStyle" :style="customCanvasMobileStyle"
class="this_mobile_canvas" class="this_mobile_canvas"
> >
<el-row class="this_mobile_canvas_top" /> <el-row class="this_mobile_canvas_top"/>
<el-row class="this_mobile_canvas_inner_top"> <el-row class="this_mobile_canvas_inner_top">
{{ panelInfo.name }} {{ panelInfo.name }}
</el-row> </el-row>
@ -205,7 +205,7 @@
class="this_mobile_canvas_main" class="this_mobile_canvas_main"
:style="mobileCanvasStyle" :style="mobileCanvasStyle"
> >
<canvas-opt-bar v-if="!previewVisible&&mobileLayoutStatus" /> <canvas-opt-bar v-if="!previewVisible&&mobileLayoutStatus"/>
<de-canvas <de-canvas
v-if="!previewVisible&&mobileLayoutStatus" v-if="!previewVisible&&mobileLayoutStatus"
ref="canvasMainRef" ref="canvasMainRef"
@ -243,14 +243,14 @@
/> />
</el-col> </el-col>
</el-row> </el-row>
<el-row class="this_mobile_canvas_bottom" /> <el-row class="this_mobile_canvas_bottom"/>
</div> </div>
</el-col> </el-col>
<el-col <el-col
:span="16" :span="16"
class="this_mobile_canvas_cell this_mobile_canvas_wait_cell" class="this_mobile_canvas_cell this_mobile_canvas_wait_cell"
> >
<component-wait /> <component-wait/>
</el-col> </el-col>
</el-row> </el-row>
</de-main-container> </de-main-container>
@ -268,7 +268,7 @@
/> />
</div> </div>
<div v-if="showBatchViewToolsAside"> <div v-if="showBatchViewToolsAside">
<chart-style-batch-set /> <chart-style-batch-set/>
</div> </div>
<div v-if="!showViewToolsAside&&!showBatchViewToolsAside"> <div v-if="!showViewToolsAside&&!showBatchViewToolsAside">
<el-row style="height: 40px"> <el-row style="height: 40px">
@ -287,7 +287,7 @@
>{{ $t('panel.position_adjust') }}</span> >{{ $t('panel.position_adjust') }}</span>
</el-row> </el-row>
<el-row> <el-row>
<position-adjust v-if="curComponent&&!curComponent.auxiliaryMatrix" /> <position-adjust v-if="curComponent&&!curComponent.auxiliaryMatrix"/>
<div <div
v-else v-else
class="view-selected-message-class" class="view-selected-message-class"
@ -565,6 +565,7 @@ export default {
}, },
data() { data() {
return { return {
userInfo: null,
canvasId: 'canvas-main', canvasId: 'canvas-main',
panelCacheExist: false, panelCacheExist: false,
viewData: [], viewData: [],
@ -798,6 +799,18 @@ export default {
this.initWatermark() this.initWatermark()
}, },
deep: true deep: true
},
rightDrawOpen: {
handler(newVal, oldVla) {
this.initWatermark()
},
deep: true
},
outStyle: {
handler(newVal, oldVla) {
this.initWatermark()
},
deep: true
} }
}, },
created() { created() {
@ -831,9 +844,15 @@ export default {
methods: { methods: {
initWatermark() { initWatermark() {
if (this.panelInfo.watermarkInfo) { if (this.panelInfo.watermarkInfo) {
this.$nextTick(() => {
if (this.userInfo) {
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen)
} else {
userLoginInfo().then(res => { userLoginInfo().then(res => {
const userInfo = res.data this.userInfo = res.data
activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen) activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen)
})
}
}) })
} }
}, },