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); + } +}