feat(查询组件): 查询组件允许配置组合里的视图 #10247

This commit is contained in:
dataeaseShu 2024-07-05 11:30:07 +08:00
parent ccee171ab6
commit b5d204dbd9

View File

@ -70,23 +70,57 @@ const snapshotStore = snapshotStoreWithOut()
const dfsComponentData = () => {
const isMain = componentData.value.some(ele => ele.id === queryElement.value.id)
let arr = componentData.value.filter(com => !['VQuery', 'DeTabs'].includes(com.innerType))
let isGroup = false
let arr = componentData.value.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
let tabArr = []
let groupArr = []
componentData.value.forEach(ele => {
if (ele.innerType === 'DeTabs') {
ele.propValue.forEach(itx => {
if (itx.componentData.some(item => item.id === queryElement.value.id) && !isMain) {
tabArr = itx.componentData.filter(com => !['VQuery', 'DeTabs'].includes(com.innerType))
tabArr = itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
} else {
arr = [
...arr,
...itx.componentData.filter(com => !['VQuery', 'DeTabs'].includes(com.innerType))
...itx.componentData.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
]
}
})
} else if (ele.component === 'Group') {
isGroup = ele.propValue.some(item => item.id === queryElement.value.id)
groupArr = [
ele.propValue.filter(
com => !['VQuery', 'DeTabs'].includes(com.innerType) && com.component !== 'Group'
)
]
ele.propValue.forEach(element => {
if (element.innerType === 'DeTabs') {
element.propValue.forEach(itx => {
if (itx.componentData.some(item => item.id === queryElement.value.id) && !isMain) {
tabArr = itx.componentData.filter(
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 ? arr : tabArr
return isMain || isGroup ? [...arr, ...groupArr].flat() : tabArr
}
const datasetFieldList = computed(() => {