diff --git a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue index 7d87a48331..e4033579da 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue @@ -93,7 +93,9 @@ let nameEdit = ref(false) let editComponentId = ref('') let inputName = ref('') let nameInput = ref(null) +let curEditComponent = null const editComponentName = item => { + curEditComponent = curComponent.value editComponentId.value = `#component-label-${item.id}` nameEdit.value = true inputName.value = item.name @@ -106,11 +108,12 @@ const closeEditComponentName = () => { if (!inputName.value || !inputName.value.trim()) { return } - if (inputName.value.trim() === curComponent.value.name) { + if (inputName.value.trim() === curEditComponent.name) { return } - curComponent.value.name = inputName.value + curEditComponent.name = inputName.value inputName.value = '' + curEditComponent = null } const lock = () => { @@ -221,12 +224,15 @@ const handleContextMenu = e => { areaData.components.includes(getComponent(index)) }" @click="onClick($event, transformIndex(index))" - @dblclick="editComponentName(getComponent(index))" > - + {{ getComponent(index)?.name }}
{ } // 如果没有选中组件 在画布上点击时需要调用 e.preventDefault() 防止触发 drop 事件 if (!curComponent.value || isPreventDrop(curComponent.value.component)) { - e.preventDefault() + // e.preventDefault() } hideArea() const rectInfo = editorMap.value[canvasId.value].getBoundingClientRect() diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 1de352f086..bf14b0aa42 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -385,9 +385,9 @@ const handleMouseDownOnShape = e => { nextTick(() => eventBus.emit('componentClick')) dvMainStore.setInEditorStatus(true) dvMainStore.setClickComponentStatus(true) - if (isPreventDrop(element.value.component)) { - e.preventDefault() - } + // if (isPreventDrop(element.value.component)) { + // e.preventDefault() + // } e.stopPropagation() if (element.value['isLock'] || !isEditMode.value) return diff --git a/core/core-frontend/src/store/modules/data-visualization/copy.ts b/core/core-frontend/src/store/modules/data-visualization/copy.ts index 1e3b468234..7bf6d6f98e 100644 --- a/core/core-frontend/src/store/modules/data-visualization/copy.ts +++ b/core/core-frontend/src/store/modules/data-visualization/copy.ts @@ -107,8 +107,10 @@ export const copyStore = defineStore('copy', { eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent) } }) - //占位优化 整合定位 - eventBus.emit('doCanvasInit-canvas-main') + if (dvInfo.value.type === 'dashboard') { + //占位优化 整合定位 + eventBus.emit('doCanvasInit-canvas-main') + } snapshotStore.recordSnapshotCache() }, cut() { diff --git a/core/core-frontend/src/store/modules/data-visualization/layer.ts b/core/core-frontend/src/store/modules/data-visualization/layer.ts index e44927cbcc..f373e10c8f 100644 --- a/core/core-frontend/src/store/modules/data-visualization/layer.ts +++ b/core/core-frontend/src/store/modules/data-visualization/layer.ts @@ -2,6 +2,7 @@ import { defineStore, storeToRefs } from 'pinia' import { store } from '../../index' import { dvMainStoreWithOut } from './dvMain' import { swap } from '@/utils/utils' +import { useEmitt } from '@/hooks/web/useEmitt' const dvMainStore = dvMainStoreWithOut() const { componentData, curComponentIndex, curComponent } = storeToRefs(dvMainStore) @@ -52,6 +53,11 @@ export const layerStore = defineStore('layer', { // 显示 if (curComponent && curComponent.value) { curComponent.value.isShow = true + if (curComponent.value.innerType.indexOf('table') !== -1) { + setTimeout(() => { + useEmitt().emitter.emit('renderChart-' + curComponent.value.id) + }, 400) + } } } } diff --git a/core/core-frontend/src/utils/DeShortcutKey.ts b/core/core-frontend/src/utils/DeShortcutKey.ts index 2417cc911e..3f264b426b 100644 --- a/core/core-frontend/src/utils/DeShortcutKey.ts +++ b/core/core-frontend/src/utils/DeShortcutKey.ts @@ -97,19 +97,24 @@ const checkDialog = () => { } let isCtrlOrCommandDown = false +let isShiftDown = false // 全局监听按键操作并执行相应命令 export function listenGlobalKeyDown() { window.onkeydown = e => { + console.log('e.keyCode-down=' + e.keyCode) if (!isInEditor || checkDialog()) return const { keyCode } = e if (positionMoveKey[keyCode] && curComponent.value) { positionMoveKey[keyCode](keyCode) e.preventDefault() } else if (keyCode === shiftKey) { + isShiftDown = true composeStore.setIsShiftDownStatus(true) + releaseKeyCheck() } else if (keyCode === ctrlKey || keyCode === commandKey) { isCtrlOrCommandDown = true composeStore.setIsCtrlOrCmdDownStatus(true) + releaseKeyCheck() } else if ((keyCode == deleteKey || keyCode == macDeleteKey) && curComponent.value) { deleteComponent() } else if (isCtrlOrCommandDown) { @@ -124,10 +129,12 @@ export function listenGlobalKeyDown() { } window.onkeyup = e => { + console.log('e.keyCode=' + e.keyCode) if (e.keyCode === ctrlKey || e.keyCode === commandKey) { isCtrlOrCommandDown = false composeStore.setIsCtrlOrCmdDownStatus(false) } else if (e.keyCode === shiftKey) { + isShiftDown = true composeStore.setIsShiftDownStatus(false) } } @@ -137,6 +144,16 @@ export function listenGlobalKeyDown() { } } +//当前不支持同时ctrl + shift操作 +function releaseKeyCheck() { + if (isCtrlOrCommandDown && isShiftDown) { + isCtrlOrCommandDown = false + composeStore.setIsCtrlOrCmdDownStatus(false) + isShiftDown = true + composeStore.setIsShiftDownStatus(false) + } +} + function copy() { copyStore.copy() } diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index 0c29075911..7a46020a24 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -453,8 +453,9 @@ onMounted(() => { return } initTitle() + const viewInfo = val ? val : view.value nextTick(() => { - chartComponent?.value?.renderChart(val) + chartComponent?.value?.renderChart(viewInfo) }) } }) diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index 92c1a4eb0c..d908c04e90 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -113,7 +113,7 @@ const handleDragOver = e => { } const handleMouseDown = e => { - e.stopPropagation() + // e.stopPropagation() dvMainStore.setClickComponentStatus(false) // 点击画布的空区域 提前清空curComponent 防止右击菜单内容抖动 dvMainStore.setCurComponent({ component: null, index: null })