mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
fix: 修复编辑状态下有查询组件的删除之后图表还是维持过滤状态问题 (#18222)
This commit is contained in:
@@ -183,6 +183,7 @@ import {
|
||||
CommonBackground,
|
||||
ShorthandMode
|
||||
} from '@/components/visualization/component-background/Types'
|
||||
import { checkFilterRemove } from '@/custom-component/v-query/QueryUtils'
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const snapshotStore = snapshotStoreWithOut()
|
||||
@@ -370,6 +371,7 @@ function deleteCur(param) {
|
||||
let len = element.value.propValue.length
|
||||
while (len--) {
|
||||
if (element.value.propValue[len].name === param.name) {
|
||||
const deletedTab = element.value.propValue[len]
|
||||
element.value.propValue.splice(len, 1)
|
||||
const activeIndex =
|
||||
(len - 1 + element.value.propValue.length) % element.value.propValue.length
|
||||
@@ -377,6 +379,9 @@ function deleteCur(param) {
|
||||
state.tabShow = false
|
||||
nextTick(() => {
|
||||
state.tabShow = true
|
||||
deletedTab.componentData?.forEach(tabComponent => {
|
||||
checkFilterRemove(tabComponent)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,22 @@ export const reRenderAll = (oldArr, newArr) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const checkFilterRemove = componentTarget => {
|
||||
if (componentTarget?.component === 'VQuery') {
|
||||
reRenderAfterDelete(componentTarget.propValue)
|
||||
} else if (componentTarget.component === 'Group') {
|
||||
componentTarget.propValue.forEach(groupItem => {
|
||||
checkFilterRemove(groupItem)
|
||||
})
|
||||
} else if (componentTarget.component === 'DeTabs') {
|
||||
componentTarget.propValue.forEach(tabItem => {
|
||||
tabItem.componentData?.forEach(tabComponent => {
|
||||
checkFilterRemove(tabComponent)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const reRenderAfterDelete = oldArr => {
|
||||
const emitterList = (oldArr || []).reduce((pre, next) => {
|
||||
const keyList = getKeyList(next)
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
filterParamsOptions
|
||||
} from '@/utils/componentUtils'
|
||||
import { formatterItem } from '@/views/chart/components/js/formatter'
|
||||
import { reRenderAfterDelete } from '@/custom-component/v-query/QueryUtils'
|
||||
import { checkFilterRemove } from '@/custom-component/v-query/QueryUtils'
|
||||
const { t } = useI18n()
|
||||
|
||||
export const dvMainStore = defineStore('dataVisualization', {
|
||||
@@ -599,7 +599,7 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
this.curComponentIndex = null
|
||||
componentData.splice(index, 1)
|
||||
// VQuery 组件
|
||||
deletedComponent?.component === 'VQuery' && reRenderAfterDelete(deletedComponent.propValue)
|
||||
checkFilterRemove(deletedComponent)
|
||||
}
|
||||
},
|
||||
updateCurDvInfo(dvInfo) {
|
||||
|
||||
Reference in New Issue
Block a user