fix: 过滤组件逻辑

This commit is contained in:
fit2cloud-chenyw 2021-12-24 18:43:29 +08:00
parent ffb4deb3a9
commit 26047142ea
4 changed files with 12 additions and 96 deletions

View File

@ -9,6 +9,7 @@ import { uuid } from 'vue-uuid'
import { findOne } from '@/api/panel/panel'
import { getPanelAllLinkageInfo } from '@/api/panel/linkage'
import { queryPanelJumpInfo, queryTargetPanelJumpInfo } from '@/api/panel/linkJump'
import { panelInit } from '@/components/canvas/utils/utils'
export default {
components: { Preview },
@ -43,8 +44,10 @@ export default {
}
//
findOne(this.panelId).then(response => {
const componentDatas = JSON.parse(response.data.panelData)
panelInit(componentDatas)
this.dataLoading = false
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
this.$store.commit('setComponentData', this.resetID(componentDatas))
this.$store.commit('setCanvasStyle', JSON.parse(response.data.panelStyle))
const data = {
id: response.data.id,

View File

@ -75,7 +75,6 @@ import { deepCopy, mobile2MainCanvas } from '@/components/canvas/utils/utils'
import { panelSave } from '@/api/panel/panel'
import { saveLinkage, getPanelAllLinkageInfo } from '@/api/panel/linkage'
import bus from '@/utils/bus'
import {
DEFAULT_COMMON_CANVAS_STYLE_STRING
} from '@/views/panel/panel'
@ -266,6 +265,12 @@ export default {
panelStyle: JSON.stringify(this.canvasStyleData),
panelData: JSON.stringify(this.componentData)
}
const components = deepCopy(this.componentData)
components.forEach(view => {
if (view.filters && view.filters.length > 0) { view.filters = [] }
})
//
requestInfo.panelData = JSON.stringify(components)
panelSave(requestInfo).then(response => {
this.$store.commit('refreshSaveStatus')
this.$message({

View File

@ -1,93 +0,0 @@
<template>
<div v-loading="dataLoading" class="bg">
<Preview v-if="!dataLoading" />
</div>
</template>
<script>
import Preview from './Preview'
import { uuid } from 'vue-uuid'
import { findOne } from '@/api/panel/panel'
import { getPanelAllLinkageInfo } from '@/api/panel/linkage'
import { queryPanelJumpInfo, queryTargetPanelJumpInfo } from '@/api/panel/linkJump'
export default {
components: { Preview },
props: {
panelId: {
type: String,
require: true
}
},
data() {
return {
dataLoading: false
}
},
mounted() {
this.restore()
},
methods: {
restore() {
this.dataLoading = true
//
findOne(this.panelId).then(response => {
this.dataLoading = false
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
this.$store.commit('setCanvasStyle', JSON.parse(response.data.panelStyle))
const data = {
id: response.data.id,
name: response.data.name
}
//
getPanelAllLinkageInfo(this.panelId).then(rsp => {
this.$store.commit('setNowPanelTrackInfo', rsp.data)
})
//
queryPanelJumpInfo(this.panelId).then(rsp => {
this.$store.commit('setNowPanelJumpInfo', rsp.data)
})
//
const tempParam = localStorage.getItem('jumpInfoParam')
if (tempParam) {
localStorage.removeItem('jumpInfoParam')
const jumpParam = JSON.parse(tempParam)
const jumpRequestParam = {
sourcePanelId: jumpParam.sourcePanelId,
sourceViewId: jumpParam.sourceViewId,
sourceFieldId: jumpParam.sourceFieldId,
targetPanelId: this.panelId
}
this.dataLoading = true
//
queryTargetPanelJumpInfo(jumpRequestParam).then(rsp => {
this.dataLoading = false
this.$store.commit('setNowTargetPanelJumpInfo', rsp.data)
this.$store.commit('addViewTrackFilter', jumpParam)
})
}
this.$store.dispatch('panel/setPanelInfo', data)
})
},
resetID(data) {
if (data) {
data.forEach(item => {
item.type !== 'custom' && (item.id = uuid.v1())
})
}
return data
}
}
}
</script>
<style lang="scss" scoped>
.bg {
width: 100%;
height: 100vh!important;
min-width: 800px;
min-height: 600px;
background-color: #f7f8fa;
}
</style>

View File

@ -60,7 +60,8 @@ export function mobile2MainCanvas(mainSource, mobileSource) {
export function panelInit(componentDatas) {
componentDatas.forEach(item => {
item.filters = (item.filters || [])
/* item.filters = (item.filters || []) */
item.filters = []
item.linkageFilters = (item.linkageFilters || [])
item.auxiliaryMatrix = (item.auxiliaryMatrix || false)
item.x = (item.x || 1)