fix(仪表板): tab组件中过滤组件数值规则可以过滤tab组件外的图表

This commit is contained in:
dataeaseShu 2024-07-11 15:29:50 +08:00
parent 058f630956
commit ad79d63dc5
2 changed files with 12 additions and 27 deletions

View File

@ -69,32 +69,22 @@ const datasetMap = {}
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
const dfsComponentData = () => { const dfsComponentData = () => {
const isMain = componentData.value.some(ele => ele.id === queryElement.value.id)
let isGroup = false
let arr = componentData.value.filter( let arr = componentData.value.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group' com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
) )
let tabArr = []
let groupArr = []
componentData.value.forEach(ele => { componentData.value.forEach(ele => {
if (ele.innerType === 'DeTabs') { if (ele.innerType === 'DeTabs') {
ele.propValue.forEach(itx => { ele.propValue.forEach(itx => {
if (itx.componentData.some(item => item.id === queryElement.value.id) && !isMain) { arr = [
tabArr = itx.componentData.filter( ...arr,
...itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group' com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
) )
} else { ]
arr = [
...arr,
...itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
]
}
}) })
} else if (ele.component === 'Group') { } else if (ele.component === 'Group') {
isGroup = ele.propValue.some(item => item.id === queryElement.value.id) arr = [
groupArr = [ ...arr,
ele.propValue.filter( ele.propValue.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group' com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
) )
@ -102,25 +92,19 @@ const dfsComponentData = () => {
ele.propValue.forEach(element => { ele.propValue.forEach(element => {
if (element.innerType === 'DeTabs') { if (element.innerType === 'DeTabs') {
element.propValue.forEach(itx => { element.propValue.forEach(itx => {
if (itx.componentData.some(item => item.id === queryElement.value.id) && !isMain) { arr = [
tabArr = itx.componentData.filter( ...arr,
...itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group' com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
) )
} else { ]
groupArr = [
...groupArr,
...itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
]
}
}) })
} }
}) })
} }
}) })
return isMain || isGroup ? [...arr, ...groupArr].flat() : tabArr return arr.flat()
} }
const datasetFieldList = computed(() => { const datasetFieldList = computed(() => {

View File

@ -473,6 +473,7 @@ const queryAnswer = () => {
.label-tooltip { .label-tooltip {
margin-left: 5.33px; margin-left: 5.33px;
width: 70%; width: 70%;
font-size: 14px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;