Merge pull request #13261 from dataease/pr@dev-v2@feat_inject

feat(仪表板、数据大屏): 嵌入式支持直接展示Tab、分组,通知支持Tab分组内部图表展示
This commit is contained in:
王嘉豪 2024-11-12 10:56:12 +08:00 committed by GitHub
commit 95f79f1d6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,7 +26,7 @@ const state = reactive({
canvasStylePreview: null,
canvasViewInfoPreview: null,
dvInfo: null,
chartId: null,
dvId: null,
suffixId: 'common',
initState: true
})
@ -41,7 +41,7 @@ const winMsgHandle = event => {
if (
msgInfo &&
msgInfo.type === 'attachParams' &&
msgInfo.targetSourceId === state.chartId + '' &&
msgInfo.targetSourceId === state.dvId + '' &&
(!msgInfo.suffixId || msgInfo.suffixId === state.suffixId)
) {
const attachParams = msgInfo.params
@ -65,7 +65,7 @@ onBeforeMount(async () => {
if (!checkResult) {
return
}
state.chartId = embeddedParams.dvId
state.dvId = embeddedParams.dvId
state.suffixId = embeddedParams.suffixId || 'common'
window.addEventListener('message', winMsgHandle)
@ -112,9 +112,7 @@ onBeforeMount(async () => {
if (ele.id === chartId) {
config.value = ele
return true
}
if (ele.component === 'Group') {
} else if (ele.component === 'Group') {
return (ele.propValue || []).some(itx => {
if (itx.id === chartId) {
config.value = itx
@ -122,6 +120,16 @@ onBeforeMount(async () => {
}
return false
})
} else if (ele.component === 'DeTabs') {
ele.propValue.forEach(tabItem => {
return (tabItem.componentData || []).some(itx => {
if (itx.id === chartId) {
config.value = itx
return true
}
return false
})
})
}
return false
})