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 88c567a8ef..4057a38ad8 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue @@ -37,8 +37,14 @@ const popComponentDataLength = computed( ) const lock = () => { + if (curComponent.value && !isGroupArea.value) { + lockStore.lock() + } else if (areaData.value.components.length) { + areaData.value.components.forEach(component => { + lockStore.lock(component) + }) + } snapshotStore.recordSnapshotCache() - lockStore.lock() menuOpt('lock') } diff --git a/core/core-frontend/src/store/modules/data-visualization/lock.ts b/core/core-frontend/src/store/modules/data-visualization/lock.ts index 4ab0b44014..2cc5c2e9f2 100644 --- a/core/core-frontend/src/store/modules/data-visualization/lock.ts +++ b/core/core-frontend/src/store/modules/data-visualization/lock.ts @@ -7,19 +7,19 @@ const { curComponent } = storeToRefs(dvMainStore) export const lockStore = defineStore('lock', { actions: { - lock() { - curComponent.value.isLock = true - if (curComponent.value.component === 'Group') { - curComponent.value.propValue.forEach(component => { + lock(optComponent = curComponent.value) { + optComponent.isLock = true + if (optComponent.component === 'Group') { + optComponent.propValue.forEach(component => { component.isLock = true }) } }, - unlock() { - curComponent.value.isLock = false - if (curComponent.value.component === 'Group') { - curComponent.value.propValue.forEach(component => { + unlock(optComponent = curComponent.value) { + optComponent.isLock = false + if (optComponent.component === 'Group') { + optComponent.propValue.forEach(component => { component.isLock = false }) }