From 122c54691ac568533618452c9bb3c7797854949f Mon Sep 17 00:00:00 2001 From: baiqi Date: Thu, 1 Aug 2024 10:45:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=91=E5=9B=BE):=20=E8=84=91=E5=9B=BE?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-minders/testPlanMinder/index.vue | 32 ++++++++++++++++--- .../pure/ms-minder-editor/menu/batchMenu.vue | 14 ++++++-- .../pure/ms-minder-editor/minderEditor.vue | 9 ++---- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue index a26be072e4..787636a64a 100644 --- a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue +++ b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue @@ -15,8 +15,7 @@ :can-show-float-menu="canShowFloatMenu" :can-show-delete-menu="canShowDeleteMenu" :disabled="!hasEditPermission" - :can-show-batch-delete="true" - can-show-more-batch-menu + :can-show-batch-delete="canShowBatchDelete" custom-priority single-tag tag-enable @@ -346,8 +345,10 @@ canShowDeleteMenu.value = true; } } else { - canShowFloatMenu.value = data.id === 'root'; - canShowExecuteMethodMenu.value = data.id === 'root'; + nextTick(() => { + canShowFloatMenu.value = node.data.id === 'root'; + canShowExecuteMethodMenu.value = node.data.id === 'root'; + }); showAssociateCaseMenu.value = false; showConfigMenu.value = false; extraVisible.value = false; @@ -663,6 +664,29 @@ configFormUnsaved.value = false; } + /** + * 是否可以显示批量删除 + */ + const canShowBatchDelete = ref(false); + watch( + () => minderStore.event.eventId, + async () => { + if (window.minder) { + const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); + if ( + minderStore.event.name === MinderEventName.DRAG_FINISH || + minderStore.event.name === MinderEventName.NODE_UNSELECT || + minderStore.event.name === MinderEventName.NODE_SELECT + ) { + canShowBatchDelete.value = selectedNodes.every((node) => node.data?.level === 2); + } + } + }, + { + immediate: true, + } + ); + /** * 处理节点选中 * @param node 节点 diff --git a/frontend/src/components/pure/ms-minder-editor/menu/batchMenu.vue b/frontend/src/components/pure/ms-minder-editor/menu/batchMenu.vue index 3292543705..3b7ceb5d6a 100644 --- a/frontend/src/components/pure/ms-minder-editor/menu/batchMenu.vue +++ b/frontend/src/components/pure/ms-minder-editor/menu/batchMenu.vue @@ -41,8 +41,13 @@ + + + + + 1; } @@ -144,6 +150,10 @@ } ); + const onlyDelete = computed(() => { + return props.canShowBatchDelete && !props.canShowBatchCopy && !props.canShowBatchCut && !props.canShowBatchExpand; + }); + /** * 处理快捷菜单选择 * @param type 选择的菜单项 diff --git a/frontend/src/components/pure/ms-minder-editor/minderEditor.vue b/frontend/src/components/pure/ms-minder-editor/minderEditor.vue index 7ef17f3bad..ee21c33933 100644 --- a/frontend/src/components/pure/ms-minder-editor/minderEditor.vue +++ b/frontend/src/components/pure/ms-minder-editor/minderEditor.vue @@ -134,13 +134,8 @@ } }, delete: () => { - if ( - (props.canShowDeleteMenu || (props.canShowMoreMenu && props.canShowMoreMenuNodeOperation)) && - !props.disabled - ) { - const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); - minderDelete(selectedNodes); - } + const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); + minderDelete(selectedNodes); }, expand: () => { const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();