fix(脑图): 修复切换模块和进入节点多选节点的缺陷

This commit is contained in:
teukkk 2024-08-02 14:29:09 +08:00 committed by 刘瑞斌
parent 279384539d
commit fcadf129e1
4 changed files with 18 additions and 6 deletions

View File

@ -105,6 +105,7 @@
import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue';
import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
import { import {
clearSelectedNodes,
createNode, createNode,
expendNodeAndChildren, expendNodeAndChildren,
handleRenderNode, handleRenderNode,
@ -219,6 +220,7 @@
}, },
}; };
importJson.value.treePath = []; importJson.value.treePath = [];
clearSelectedNodes();
window.minder.importJson(importJson.value); window.minder.importJson(importJson.value);
if (props.moduleId !== 'all') { if (props.moduleId !== 'all') {
// ID // ID

View File

@ -77,7 +77,11 @@
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue';
import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; 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 { MsFileItem } from '@/components/pure/ms-upload/types';
import attachment from './attachment.vue'; import attachment from './attachment.vue';
import baseInfo from './basInfo.vue'; import baseInfo from './basInfo.vue';
@ -207,11 +211,7 @@
}, },
}; };
importJson.value.treePath = []; importJson.value.treePath = [];
const currentSelectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes(); clearSelectedNodes();
if (currentSelectedNodes && currentSelectedNodes.length > 0) {
//
window.minder.toggleSelect(currentSelectedNodes);
}
window.minder.importJson(importJson.value); window.minder.importJson(importJson.value);
if (props.moduleId !== 'all') { if (props.moduleId !== 'all') {
// ID // ID

View File

@ -166,6 +166,7 @@
import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue';
import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
import { import {
clearSelectedNodes,
createNode, createNode,
expendNodeAndChildren, expendNodeAndChildren,
handleRenderNode, handleRenderNode,
@ -284,6 +285,7 @@
}, },
}; };
importJson.value.treePath = []; importJson.value.treePath = [];
clearSelectedNodes();
window.minder.importJson(importJson.value); window.minder.importJson(importJson.value);
if (props.activeModule !== 'all') { if (props.activeModule !== 'all') {
// ID // ID

View File

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