forked from github/dataease
Merge pull request #11757 from dataease/pr@dev-v2@refactor_outer-params
refactor(数据大屏): 外部参数优化,支持设置Tab和分组内的过滤组件
This commit is contained in:
commit
b681228a49
@ -378,6 +378,20 @@ const initParams = async () => {
|
||||
componentData.value.forEach(componentItem => {
|
||||
if (componentItem.component === 'VQuery') {
|
||||
state.baseFilterInfo.push(componentItem)
|
||||
} else if (componentItem.component === 'Group') {
|
||||
componentItem.propValue.forEach(groupItem => {
|
||||
if (groupItem.component === 'VQuery') {
|
||||
state.baseFilterInfo.push(groupItem)
|
||||
}
|
||||
})
|
||||
} else if (componentItem.component === 'DeTabs') {
|
||||
componentItem.propValue.forEach(tabItem => {
|
||||
tabItem.componentData.forEach(tabComponent => {
|
||||
if (tabComponent.component === 'VQuery') {
|
||||
state.baseFilterInfo.push(tabComponent)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
// 同步基础数据集信息
|
||||
|
@ -939,9 +939,42 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
const trackInfo = this.nowPanelOuterParamsInfo
|
||||
for (let index = 0; index < curComponentData.length; index++) {
|
||||
const element = curComponentData[index]
|
||||
if (!['UserView', 'VQuery'].includes(element.component)) continue
|
||||
if (['UserView', 'VQuery'].includes(element.component)) {
|
||||
this.trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source)
|
||||
this.componentData[index] = element
|
||||
} else if (element.component === 'Group') {
|
||||
element.propValue.forEach((groupItem, index) => {
|
||||
this.trackOuterFilterCursor(
|
||||
groupItem,
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source
|
||||
)
|
||||
element.propValue[index] = groupItem
|
||||
})
|
||||
} else if (element.component === 'DeTabs') {
|
||||
element.propValue.forEach(tabItem => {
|
||||
tabItem.componentData.forEach((tabComponent, index) => {
|
||||
this.trackOuterFilterCursor(
|
||||
tabComponent,
|
||||
params,
|
||||
preActiveComponentIds,
|
||||
trackInfo,
|
||||
source
|
||||
)
|
||||
tabItem.componentData[index] = tabComponent
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
trackOuterFilterCursor(element, params, preActiveComponentIds, trackInfo, source) {
|
||||
if (!['UserView', 'VQuery'].includes(element.component)) {
|
||||
return
|
||||
}
|
||||
const currentFilters = element.outerParamsFilters || [] // 外部参数信息
|
||||
|
||||
// 外部参数 可能会包含多个参数
|
||||
Object.keys(params).forEach(function (sourceInfo) {
|
||||
// 获取外部参数的值 sourceInfo 是外部参数名称 支持数组传入
|
||||
@ -1028,18 +1061,15 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
if (element.component === 'UserView') {
|
||||
element['outerParamsFilters'] = currentFilters
|
||||
}
|
||||
curComponentData[index] = element
|
||||
})
|
||||
}
|
||||
if (source === 'outer') {
|
||||
preActiveComponentIds.forEach(viewId => {
|
||||
useEmitt().emitter.emit('query-data-' + viewId)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
trackFilterCursor(element, checkQDList, trackInfo, preActiveComponentIds, viewId) {
|
||||
let currentFilters = element.linkageFilters || [] // 当前联动filter
|
||||
|
Loading…
Reference in New Issue
Block a user