perf(X-Pack): 嵌入式 Token 参数作用于视图

This commit is contained in:
fit2cloud-chenyw
2025-04-09 17:51:28 +08:00
committed by fit2cloud-chenyw
parent 2ab7db3345
commit 9061292969

View File

@@ -11,6 +11,7 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { useI18n } from '@/hooks/web/useI18n'
import { XpackComponent } from '@/components/plugin'
import EmptyBackground from '../../components/empty-background/src/EmptyBackground.vue'
import exeRequest from '@/config/axios'
const { wsCache } = useCache()
const interactiveStore = interactiveStoreWithOut()
const embeddedStore = useEmbedded()
@@ -69,6 +70,13 @@ onBeforeMount(async () => {
state.suffixId = embeddedParams.suffixId || 'common'
window.addEventListener('message', winMsgHandle)
let tokenInfo = null
if (embeddedStore.getToken && !Object.keys((tokenInfo = embeddedStore.getTokenInfo)).length) {
const res = await exeRequest.get({ url: '/embedded/getTokenArgs' })
embeddedStore.setTokenInfo(res.data)
tokenInfo = embeddedStore.getTokenInfo
}
// 添加外部参数
let attachParams
await getOuterParamsInfo(embeddedParams.dvId).then(rsp => {
@@ -87,6 +95,9 @@ onBeforeMount(async () => {
return
}
}
if (tokenInfo && Object.keys(tokenInfo).length) {
attachParams = Object.assign({}, attachParams, tokenInfo)
}
const chartId = embeddedParams?.chartId
initCanvasData(