diff --git a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue index 35f63c43f5..2a3dfd4715 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue @@ -187,7 +187,7 @@ const popComponentData = computed(() => ) const baseComponentData = computed(() => - componentData.value.filter(ele => ele.category !== 'hidden' && ele.component !== 'GroupArea') + componentData.value.filter(ele => ele?.category !== 'hidden' && ele.component !== 'GroupArea') ) const dragOnEnd = ({ oldIndex, newIndex }) => { diff --git a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue index 0f2679534c..88c567a8ef 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue @@ -9,7 +9,7 @@ import { storeToRefs } from 'pinia' import { computed, toRefs } from 'vue' import { ElDivider } from 'element-plus-secondary' import eventBus from '@/utils/eventBus' -import { getCurInfo } from '@/store/modules/data-visualization/common' +import { componentArraySort, getCurInfo } from '@/store/modules/data-visualization/common' import { useEmitt } from '@/hooks/web/useEmitt' import { XpackComponent } from '@/components/plugin' const dvMainStore = dvMainStoreWithOut() @@ -122,6 +122,7 @@ const upComponent = () => { if (curComponent.value && !isGroupArea.value) { layerStore.upComponent(curComponent.value.id) } else if (areaData.value.components.length) { + componentArraySort(areaData.value.components) areaData.value.components.forEach(component => { layerStore.upComponent(component.id) }) @@ -131,7 +132,14 @@ const upComponent = () => { } const downComponent = () => { - layerStore.downComponent() + if (curComponent.value && !isGroupArea.value) { + layerStore.downComponent(curComponent.value.id) + } else if (areaData.value.components.length) { + componentArraySort(areaData.value.components, 'top') + areaData.value.components.forEach(component => { + layerStore.downComponent(component.id) + }) + } snapshotStore.recordSnapshotCache('downComponent') menuOpt('downComponent') } @@ -140,6 +148,7 @@ const topComponent = () => { if (curComponent.value && !isGroupArea.value) { layerStore.topComponent(curComponent.value.id) } else if (areaData.value.components.length) { + componentArraySort(areaData.value.components, 'top') areaData.value.components.forEach(component => { layerStore.topComponent(component.id) }) @@ -152,6 +161,7 @@ const bottomComponent = () => { if (curComponent.value && !isGroupArea.value) { layerStore.bottomComponent(curComponent.value.id) } else if (areaData.value.components.length) { + componentArraySort(areaData.value.components) areaData.value.components.forEach(component => { layerStore.bottomComponent(component.id) }) @@ -260,7 +270,6 @@ const editQueryCriteria = () => {