From fe41b7ad88d65a367253257ba549a7ded68af1c2 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 12 Jul 2024 09:57:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E6=94=AF=E6=8C=81=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/RealTimeListTree.vue | 156 ++++++++++++- .../data-visualization/canvas/CanvasCore.vue | 27 ++- .../canvas/ComponentWrapper.vue | 23 +- .../canvas/ContextMenuDetails.vue | 47 +++- .../data-visualization/canvas/DePreview.vue | 41 +++- .../custom-component/common/CommonEvent.vue | 3 +- .../src/custom-component/common/DeRuler.vue | 6 +- .../custom-component/picture/Component.vue | 11 +- .../src/custom-component/pop-area/Attr.vue | 13 ++ .../custom-component/pop-area/Component.vue | 205 ++++++++++++++++++ .../modules/data-visualization/dvMain.ts | 27 +++ .../store/modules/data-visualization/event.ts | 1 + core/core-frontend/src/utils/canvasUtils.ts | 2 + core/core-frontend/src/utils/components.ts | 6 +- .../editor/util/dataVisualization.ts | 1 + .../src/views/data-visualization/index.vue | 29 ++- 16 files changed, 555 insertions(+), 43 deletions(-) create mode 100644 core/core-frontend/src/custom-component/pop-area/Attr.vue create mode 100644 core/core-frontend/src/custom-component/pop-area/Component.vue diff --git a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue index a445159ac6..636197873e 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue @@ -3,9 +3,9 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { layerStoreWithOut } from '@/store/modules/data-visualization/layer' import { storeToRefs } from 'pinia' -import { ElIcon, ElRow } from 'element-plus-secondary' +import { ElIcon, ElRow, ElSwitch } from 'element-plus-secondary' import Icon from '../icon-custom/src/Icon.vue' -import { nextTick, ref } from 'vue' +import { computed, nextTick, ref } from 'vue' import draggable from 'vuedraggable' import { lockStoreWithOut } from '@/store/modules/data-visualization/lock' import ContextMenuAsideDetails from '@/components/data-visualization/canvas/ContextMenuAsideDetails.vue' @@ -22,7 +22,8 @@ const composeStore = composeStoreWithOut() const { areaData, isCtrlOrCmdDown, isShiftDown, laterIndex } = storeToRefs(composeStore) -const { componentData, curComponent, canvasViewInfo } = storeToRefs(dvMainStore) +const { componentData, canvasStyleData, curComponent, canvasViewInfo, canvasState } = + storeToRefs(dvMainStore) const getComponent = index => { return componentData.value[componentData.value.length - 1 - index] } @@ -34,6 +35,13 @@ const areaDataPush = component => { areaData.value.components.push(component) } } + +const hiddenAreaActive = computed( + () => canvasState.value.curPointArea === 'hidden' && !curComponent.value +) +const baseAreaActive = computed( + () => canvasState.value.curPointArea === 'base' && !curComponent.value +) // shift 选择算法逻辑 // 1.记录上次点击的laterIndex(初始状态laterIndex=0); // 2.获取当前index curClickIndex; @@ -59,6 +67,16 @@ const shiftDataPush = curClickIndex => { dvMainStore.setCurComponent({ component: null, index: null }) } +const hiddenAreaOnClick = (e, element) => { + let indexResult + componentData.value.forEach((component, index) => { + if (element.id === component.id) { + indexResult = index + } + }) + dvMainStore.setCurComponent({ component: element, index: indexResult }) +} + const onClick = (e, index) => { // 初始化点击是 laterIndex=0 if (!curComponent.value) { @@ -149,6 +167,14 @@ const showComponent = () => { }) } +const popComponentData = computed(() => + componentData.value.filter(ele => ele.category && ele.category === 'hidden') +) + +const baseComponentData = computed(() => + componentData.value.filter(ele => ele.category !== 'hidden' && ele.component !== 'GroupArea') +) + const dragOnEnd = ({ oldIndex, newIndex }) => { const source = componentData.value[newIndex] const comLength = componentData.value.length @@ -204,12 +230,94 @@ const handleContextMenu = e => { document.body.removeChild(customContextMenu) }) } + +const areaClick = area => { + dvMainStore.setCurComponent({ component: null, index: null }) + dvMainStore.canvasStateChange({ key: 'curPointArea', value: area }) +}