refactor(仪表板、数据大屏): 优化页面打开方式

This commit is contained in:
wangjiahao 2024-11-24 19:56:31 +08:00
parent 7d03a3822d
commit d145101de8
2 changed files with 10 additions and 3 deletions

View File

@ -227,7 +227,7 @@ export function historyAdaptor(
canvasVersion canvasVersion
) { ) {
const curVersion = wsCache.get('x-de-execute-version') const curVersion = wsCache.get('x-de-execute-version')
if (canvasInfo['checkVersion'] === curVersion) { if (canvasInfo?.checkVersion === curVersion) {
return return
} }
//历史字段适配 //历史字段适配
@ -262,7 +262,9 @@ export function historyAdaptor(
canvasDataResult.forEach(componentItem => { canvasDataResult.forEach(componentItem => {
historyItemAdaptor(componentItem, reportFilterInfo, attachInfo, canvasVersion, canvasInfo) historyItemAdaptor(componentItem, reportFilterInfo, attachInfo, canvasVersion, canvasInfo)
}) })
updateCheckVersion(canvasInfo.id) if (canvasInfo && canvasInfo.id) {
updateCheckVersion(canvasInfo.id)
}
} }
// 重置仪表板大屏中的其他组件 // 重置仪表板大屏中的其他组件

View File

@ -46,6 +46,7 @@ import { useCache } from '@/hooks/web/useCache'
import { findParentIdByChildIdRecursive } from '@/utils/canvasUtils' import { findParentIdByChildIdRecursive } from '@/utils/canvasUtils'
import { XpackComponent } from '@/components/plugin' import { XpackComponent } from '@/components/plugin'
import treeSort from '@/utils/treeSortUtils' import treeSort from '@/utils/treeSortUtils'
import router from '@/router'
const { wsCache } = useCache() const { wsCache } = useCache()
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
@ -186,11 +187,14 @@ const menuList = computed(() => {
}) })
const infoId = wsCache.get(curCanvasType.value === 'dashboard' ? 'db-info-id' : 'dv-info-id') const infoId = wsCache.get(curCanvasType.value === 'dashboard' ? 'db-info-id' : 'dv-info-id')
const dvId = embeddedStore.dvId || infoId const routerDvId = router.currentRoute.value.query.dvId
const dvId = embeddedStore.dvId || infoId || routerDvId
wsCache.delete(curCanvasType.value === 'dashboard' ? 'db-info-id' : 'dv-info-id') wsCache.delete(curCanvasType.value === 'dashboard' ? 'db-info-id' : 'dv-info-id')
console.log('==test===0' + selectedNodeKey.value)
if (dvId && showPosition.value === 'preview') { if (dvId && showPosition.value === 'preview') {
selectedNodeKey.value = dvId selectedNodeKey.value = dvId
returnMounted.value = true returnMounted.value = true
console.log('==test==1=' + selectedNodeKey.value)
} }
const nodeExpand = data => { const nodeExpand = data => {
if (data.id) { if (data.id) {
@ -270,6 +274,7 @@ const afterTreeInit = () => {
returnMounted.value = false returnMounted.value = false
} }
nextTick(() => { nextTick(() => {
console.log('==test==2=' + selectedNodeKey.value)
resourceListTree.value.setCurrentKey(selectedNodeKey.value) resourceListTree.value.setCurrentKey(selectedNodeKey.value)
nextTick(() => { nextTick(() => {
if (selectedNodeKey.value) { if (selectedNodeKey.value) {