From fcadf129e1034c5c13a57e07287d50c02398434a Mon Sep 17 00:00:00 2001 From: teukkk Date: Fri, 2 Aug 2024 14:29:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=91=E5=9B=BE):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=A8=A1=E5=9D=97=E5=92=8C=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=A4=9A=E9=80=89=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ms-minders/caseReviewMinder/index.vue | 2 ++ .../business/ms-minders/featureCaseMinder/index.vue | 12 ++++++------ .../ms-minders/testPlanFeatureCaseMinder/index.vue | 2 ++ .../pure/ms-minder-editor/script/tool/utils.ts | 8 ++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/business/ms-minders/caseReviewMinder/index.vue b/frontend/src/components/business/ms-minders/caseReviewMinder/index.vue index cb9ea05ea0..e782862b81 100644 --- a/frontend/src/components/business/ms-minders/caseReviewMinder/index.vue +++ b/frontend/src/components/business/ms-minders/caseReviewMinder/index.vue @@ -105,6 +105,7 @@ import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; import { + clearSelectedNodes, createNode, expendNodeAndChildren, handleRenderNode, @@ -219,6 +220,7 @@ }, }; importJson.value.treePath = []; + clearSelectedNodes(); window.minder.importJson(importJson.value); if (props.moduleId !== 'all') { // 携带具体的模块 ID 加载时,进入该模块内 diff --git a/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue b/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue index 21f1dc77a3..057ba3c84f 100644 --- a/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue +++ b/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue @@ -77,7 +77,11 @@ import MsButton from '@/components/pure/ms-button/index.vue'; import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; - import { expendNodeAndChildren, setPriorityView } from '@/components/pure/ms-minder-editor/script/tool/utils'; + import { + clearSelectedNodes, + expendNodeAndChildren, + setPriorityView, + } from '@/components/pure/ms-minder-editor/script/tool/utils'; import { MsFileItem } from '@/components/pure/ms-upload/types'; import attachment from './attachment.vue'; import baseInfo from './basInfo.vue'; @@ -207,11 +211,7 @@ }, }; importJson.value.treePath = []; - const currentSelectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); - if (currentSelectedNodes && currentSelectedNodes.length > 0) { - // 重置选中状态 - window.minder.toggleSelect(currentSelectedNodes); - } + clearSelectedNodes(); window.minder.importJson(importJson.value); if (props.moduleId !== 'all') { // 携带具体的模块 ID 加载时,进入该模块内 diff --git a/frontend/src/components/business/ms-minders/testPlanFeatureCaseMinder/index.vue b/frontend/src/components/business/ms-minders/testPlanFeatureCaseMinder/index.vue index d3d848671b..88ae71c77a 100644 --- a/frontend/src/components/business/ms-minders/testPlanFeatureCaseMinder/index.vue +++ b/frontend/src/components/business/ms-minders/testPlanFeatureCaseMinder/index.vue @@ -166,6 +166,7 @@ import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; import { + clearSelectedNodes, createNode, expendNodeAndChildren, handleRenderNode, @@ -284,6 +285,7 @@ }, }; importJson.value.treePath = []; + clearSelectedNodes(); window.minder.importJson(importJson.value); if (props.activeModule !== 'all') { // 携带具体的模块 ID 加载时,进入该模块内 diff --git a/frontend/src/components/pure/ms-minder-editor/script/tool/utils.ts b/frontend/src/components/pure/ms-minder-editor/script/tool/utils.ts index 32852cc832..6981d39782 100644 --- a/frontend/src/components/pure/ms-minder-editor/script/tool/utils.ts +++ b/frontend/src/components/pure/ms-minder-editor/script/tool/utils.ts @@ -232,3 +232,11 @@ export function renderSubNodes(parentNode: MinderJsonNode, children?: MinderJson }) || [] ); } + +// 清空选中状态 +export function clearSelectedNodes() { + const currentSelectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); + if (currentSelectedNodes && currentSelectedNodes.length > 0) { + window.minder.toggleSelect(currentSelectedNodes); + } +}