forked from github/dataease
refactor: 优化PC移动端布局切换,防止出现错误仪表板布局
Co-authored-by: wangjiahao <1522128093@qq.com>
This commit is contained in:
parent
ffb4deb3a9
commit
787ef75b06
@ -376,6 +376,7 @@ export default {
|
|||||||
mobileDataObj[item.id] = item
|
mobileDataObj[item.id] = item
|
||||||
})
|
})
|
||||||
const sourceComponentData = JSON.parse(this.componentDataCache)
|
const sourceComponentData = JSON.parse(this.componentDataCache)
|
||||||
|
this.$store.commit('setComponentDataCache', null)
|
||||||
sourceComponentData.forEach(item => {
|
sourceComponentData.forEach(item => {
|
||||||
if (mobileDataObj[item.id]) {
|
if (mobileDataObj[item.id]) {
|
||||||
mobile2MainCanvas(item, mobileDataObj[item.id])
|
mobile2MainCanvas(item, mobileDataObj[item.id])
|
||||||
|
@ -348,6 +348,7 @@ const data = {
|
|||||||
},
|
},
|
||||||
// 启用移动端布局
|
// 启用移动端布局
|
||||||
openMobileLayout(state) {
|
openMobileLayout(state) {
|
||||||
|
state.componentDataCache = null
|
||||||
state.componentDataCache = JSON.stringify(state.componentData)
|
state.componentDataCache = JSON.stringify(state.componentData)
|
||||||
state.pcComponentData = state.componentData
|
state.pcComponentData = state.componentData
|
||||||
const mainComponentData = []
|
const mainComponentData = []
|
||||||
|
@ -645,6 +645,8 @@ export default {
|
|||||||
this.lastActiveNodeData = data
|
this.lastActiveNodeData = data
|
||||||
this.activeTree = data.panelType
|
this.activeTree = data.panelType
|
||||||
if (data.nodeType === 'panel') {
|
if (data.nodeType === 'panel') {
|
||||||
|
// 清理pc布局缓存
|
||||||
|
this.$store.commit('setComponentDataCache', null)
|
||||||
// 加载视图数据
|
// 加载视图数据
|
||||||
findOne(data.id).then(response => {
|
findOne(data.id).then(response => {
|
||||||
const componentDatas = JSON.parse(response.data.panelData)
|
const componentDatas = JSON.parse(response.data.panelData)
|
||||||
|
@ -130,13 +130,11 @@ import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
|
|||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { queryAll } from '@/api/panel/pdfTemplate'
|
import { queryAll } from '@/api/panel/pdfTemplate'
|
||||||
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
|
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
|
||||||
import JsPDF from 'jspdf'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PanelViewShow',
|
name: 'PanelViewShow',
|
||||||
components: { Preview, SaveToTemplate, PDFPreExport, ShareHead },
|
components: { Preview, SaveToTemplate, PDFPreExport, ShareHead },
|
||||||
props: {
|
props: {
|
||||||
// eslint-disable-next-line vue/require-default-prop
|
|
||||||
activeTab: {
|
activeTab: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false
|
||||||
@ -208,7 +206,6 @@ export default {
|
|||||||
bus.$on('set-panel-show-type', type => {
|
bus.$on('set-panel-show-type', type => {
|
||||||
this.showType = type || 0
|
this.showType = type || 0
|
||||||
})
|
})
|
||||||
|
|
||||||
this.initPdfTemplate()
|
this.initPdfTemplate()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
Reference in New Issue
Block a user