提交 91a76966 authored 作者: wangjiahao's avatar wangjiahao

feat:合并bug修复

上级 53c1d36c
...@@ -67,13 +67,10 @@ export default { ...@@ -67,13 +67,10 @@ export default {
// 监听div变动事件 // 监听div变动事件
erd.listenTo(document.getElementById('canvasInfo'), element => { erd.listenTo(document.getElementById('canvasInfo'), element => {
_this.$nextTick(() => { _this.$nextTick(() => {
debugger
_this.restore() _this.restore()
}) })
}) })
// 监听数据变动事件
eventBus.$on('componentDataChange', () => {
_this.restore()
})
}, },
methods: { methods: {
changeStyleWithScale, changeStyleWithScale,
......
...@@ -174,6 +174,7 @@ export default { ...@@ -174,6 +174,7 @@ export default {
} }
}, },
panelInfo(newVal, oldVal) { panelInfo(newVal, oldVal) {
debugger
this.init(newVal.id) this.init(newVal.id)
} }
}, },
...@@ -195,6 +196,7 @@ export default { ...@@ -195,6 +196,7 @@ export default {
}, },
methods: { methods: {
init(panelId) { init(panelId) {
debugger
// 如果临时画布有数据 则使用临时画布数据(视图编辑的时候 会保存临时画布数据) // 如果临时画布有数据 则使用临时画布数据(视图编辑的时候 会保存临时画布数据)
const componentDataTemp = this.$store.state.panel.componentDataTemp const componentDataTemp = this.$store.state.panel.componentDataTemp
const canvasStyleDataTemp = this.$store.state.panel.canvasStyleDataTemp const canvasStyleDataTemp = this.$store.state.panel.canvasStyleDataTemp
...@@ -203,8 +205,8 @@ export default { ...@@ -203,8 +205,8 @@ export default {
this.$store.commit('setCanvasStyle', JSON.parse(canvasStyleDataTemp)) this.$store.commit('setCanvasStyle', JSON.parse(canvasStyleDataTemp))
} else if (panelId) { } else if (panelId) {
get('panel/group/findOne/' + panelId).then(response => { get('panel/group/findOne/' + panelId).then(response => {
this.$store.commit('setComponentData', this.resetID(response.data.panelData)) this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
this.$store.commit('setCanvasStyle', response.data.panelStyle) this.$store.commit('setCanvasStyle', JSON.parse(response.data.panelStyle))
}) })
} }
}, },
......
...@@ -424,7 +424,6 @@ export default { ...@@ -424,7 +424,6 @@ export default {
this.$store.commit('setCanvasStyle', JSON.parse(response.data.panelStyle)) this.$store.commit('setCanvasStyle', JSON.parse(response.data.panelStyle))
this.$store.dispatch('panel/setPanelInfo', data) this.$store.dispatch('panel/setPanelInfo', data)
this.currGroup = data this.currGroup = data
eventBus.$emit('componentDataChange', '')
}) })
} }
if (node.expanded) { if (node.expanded) {
...@@ -517,7 +516,6 @@ export default { ...@@ -517,7 +516,6 @@ export default {
this.authVisible = false this.authVisible = false
}, },
edit(data) { edit(data) {
// 清空临时画布
this.$store.dispatch('panel/setPanelInfo', data) this.$store.dispatch('panel/setPanelInfo', data)
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' }) bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
}, },
......
<template> <template>
<el-row v-if="showMain" style="height: 100%;width: 100%;"> <el-row style="height: 100%;width: 100%;">
<el-col v-if="panelInfo.name.length>0" class="panel-design"> <el-col v-if="panelInfo.name.length>0" class="panel-design">
<el-row class="panel-design-head"> <el-row class="panel-design-head">
<!--TODO 仪表盘头部区域--> <!--TODO 仪表盘头部区域-->
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</el-row> </el-row>
<!--TODO 仪表盘预览区域--> <!--TODO 仪表盘预览区域-->
<el-row class="panel-design-preview"> <el-row class="panel-design-preview">
<Preview /> <Preview v-if="showMain" />
</el-row> </el-row>
</el-col> </el-col>
<el-col v-if="panelInfo.name.length===0" style="height: 100%;"> <el-col v-if="panelInfo.name.length===0" style="height: 100%;">
...@@ -25,14 +25,13 @@ ...@@ -25,14 +25,13 @@
<script> <script>
import Preview from '@/components/canvas/components/Editor/Preview' import Preview from '@/components/canvas/components/Editor/Preview'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import eventBus from '@/components/canvas/utils/eventBus'
export default { export default {
name: 'PanelViewShow', name: 'PanelViewShow',
components: { Preview }, components: { Preview },
data() { data() {
return { return {
showMain: false showMain: true
} }
}, },
...@@ -45,15 +44,14 @@ export default { ...@@ -45,15 +44,14 @@ export default {
'canvasStyleData' 'canvasStyleData'
]) ])
}, },
mounted() { watch: {
// 监听数据变动事件 刷新清楚历史样式 panelInfo(newVal, oldVla) {
eventBus.$on('componentDataChange', () => { // 刷新 进行重新渲染
// 刷新
this.showMain = false this.showMain = false
this.$nextTick(() => { this.$nextTick(() => { this.showMain = true })
this.showMain = true }
}) },
}) mounted() {
}, },
methods: { methods: {
clickPreview() { clickPreview() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论