fix(测试用例): 评审脑图&执行脑图-评审模块或执行模块后重新渲染子模块
--bug=1047742 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001047742 --bug=1047158 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001047158
This commit is contained in:
parent
ae4494879d
commit
798f094628
|
@ -116,11 +116,13 @@
|
||||||
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 {
|
||||||
|
clearNodeChildren,
|
||||||
clearSelectedNodes,
|
clearSelectedNodes,
|
||||||
createNode,
|
createNode,
|
||||||
expendNodeAndChildren,
|
expendNodeAndChildren,
|
||||||
handleRenderNode,
|
handleRenderNode,
|
||||||
removeFakeNode,
|
removeFakeNode,
|
||||||
|
renderSubModules,
|
||||||
renderSubNodes,
|
renderSubNodes,
|
||||||
setPriorityView,
|
setPriorityView,
|
||||||
} from '@/components/pure/ms-minder-editor/script/tool/utils';
|
} from '@/components/pure/ms-minder-editor/script/tool/utils';
|
||||||
|
@ -516,14 +518,18 @@
|
||||||
// 如果是用例,则status是获取后端的值,可直接替换标签
|
// 如果是用例,则status是获取后端的值,可直接替换标签
|
||||||
if (isCaseTag(node.data)) {
|
if (isCaseTag(node.data)) {
|
||||||
window.minder.execCommand('resource', [statusTagMap[status]]);
|
window.minder.execCommand('resource', [statusTagMap[status]]);
|
||||||
|
} else if (node.data.id === 'NONE') {
|
||||||
|
// 处理根节点,重新渲染整个用例树
|
||||||
|
initCaseTree();
|
||||||
} else if (status !== StartReviewStatus.UNDER_REVIEWED && node.data?.resource?.includes(moduleTag)) {
|
} else if (status !== StartReviewStatus.UNDER_REVIEWED && node.data?.resource?.includes(moduleTag)) {
|
||||||
// 先清空子节点,从后向前遍历时,删除节点不会影响到尚未遍历的节点
|
// 处理模块节点
|
||||||
for (let i = node.children.length - 1; i >= 0; i--) {
|
clearNodeChildren(node);
|
||||||
window.minder.removeNode(node.children[i]);
|
renderSubModules(node, importJson.value.root, modulesCount.value);
|
||||||
}
|
// 重新渲染用例
|
||||||
// 再重新渲染
|
if (node.data.id !== 'NONE') {
|
||||||
initNodeCases(node);
|
initNodeCases(node);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emit('handleReviewDone');
|
emit('handleReviewDone');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,11 +218,13 @@
|
||||||
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 {
|
||||||
|
clearNodeChildren,
|
||||||
clearSelectedNodes,
|
clearSelectedNodes,
|
||||||
createNode,
|
createNode,
|
||||||
expendNodeAndChildren,
|
expendNodeAndChildren,
|
||||||
handleRenderNode,
|
handleRenderNode,
|
||||||
removeFakeNode,
|
removeFakeNode,
|
||||||
|
renderSubModules,
|
||||||
renderSubNodes,
|
renderSubNodes,
|
||||||
setPriorityView,
|
setPriorityView,
|
||||||
} from '@/components/pure/ms-minder-editor/script/tool/utils';
|
} from '@/components/pure/ms-minder-editor/script/tool/utils';
|
||||||
|
@ -675,14 +677,18 @@
|
||||||
initExecuteHistory(node.data);
|
initExecuteHistory(node.data);
|
||||||
}
|
}
|
||||||
window.minder.refresh();
|
window.minder.refresh();
|
||||||
|
} else if (node.data.id === 'NONE') {
|
||||||
|
// 处理根节点,重新渲染整个用例树
|
||||||
|
initCaseTree();
|
||||||
} else if (isModuleOrCollection(node.data)) {
|
} else if (isModuleOrCollection(node.data)) {
|
||||||
// 先清空子节点,从后向前遍历时,删除节点不会影响到尚未遍历的节点
|
// 处理模块节点
|
||||||
for (let i = node.children.length - 1; i >= 0; i--) {
|
clearNodeChildren(node);
|
||||||
window.minder.removeNode(node.children[i]);
|
renderSubModules(node, importJson.value.root, modulesCount.value);
|
||||||
}
|
|
||||||
// 再重新渲染
|
// 再重新渲染
|
||||||
|
if (node.data.id !== 'NONE') {
|
||||||
initNodeCases(node);
|
initNodeCases(node);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emit('refreshPlan');
|
emit('refreshPlan');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import type { MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
|
import type { MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
|
||||||
|
|
||||||
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import type { MinderNodePosition } from '@/store/modules/components/minder-editor/types';
|
import type { MinderNodePosition } from '@/store/modules/components/minder-editor/types';
|
||||||
import { getGenerateId, mapTree } from '@/utils';
|
import { findNodeByKey, getGenerateId, mapTree } from '@/utils';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const moduleTag = t('common.module');
|
||||||
|
|
||||||
export function isDisableNode(minder: any) {
|
export function isDisableNode(minder: any) {
|
||||||
let node: MinderJsonNode;
|
let node: MinderJsonNode;
|
||||||
|
@ -243,3 +247,58 @@ export function clearSelectedNodes() {
|
||||||
window.minder.toggleSelect(currentSelectedNodes);
|
window.minder.toggleSelect(currentSelectedNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清空子节点,从后向前遍历时,删除节点不会影响到尚未遍历的节点
|
||||||
|
export function clearNodeChildren(node: MinderJsonNode) {
|
||||||
|
if (!node.children?.length) return;
|
||||||
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
||||||
|
window.minder.removeNode(node.children[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新递归渲染子模块
|
||||||
|
export function renderSubModules(
|
||||||
|
node: MinderJsonNode,
|
||||||
|
importJsonRoot: MinderJsonNode,
|
||||||
|
modulesCount: Record<string, any>
|
||||||
|
) {
|
||||||
|
const waitingRenderNodes: MinderJsonNode[] = [];
|
||||||
|
const createSubModules = (id: string) => {
|
||||||
|
const curNode: MinderJsonNode | null = findNodeByKey(importJsonRoot.children as MinderJsonNode[], id, 'id', 'data');
|
||||||
|
const minderNode = window.minder.getNodeById(id);
|
||||||
|
if (curNode?.children) {
|
||||||
|
const moduleNode = curNode.children.filter(
|
||||||
|
(child) => child.data?.resource?.includes(moduleTag) || child.data?.type === 'tmpModule'
|
||||||
|
);
|
||||||
|
if (!moduleNode.length) {
|
||||||
|
const newNode = createNode(
|
||||||
|
{
|
||||||
|
id: 'fakeNode',
|
||||||
|
text: t('ms.minders.moreCase'),
|
||||||
|
resource: [''],
|
||||||
|
},
|
||||||
|
minderNode
|
||||||
|
);
|
||||||
|
waitingRenderNodes.push(newNode);
|
||||||
|
} else {
|
||||||
|
moduleNode.forEach((childNode) => {
|
||||||
|
if (!childNode.data) return;
|
||||||
|
const newNode = createNode(
|
||||||
|
{
|
||||||
|
...childNode.data,
|
||||||
|
id: childNode.id || childNode.data?.id || '',
|
||||||
|
text: childNode.name || childNode.data?.text.replace(/<\/?p\b[^>]*>/gi, '') || '',
|
||||||
|
count: modulesCount[childNode.data.id],
|
||||||
|
isLoaded: false,
|
||||||
|
},
|
||||||
|
minderNode
|
||||||
|
);
|
||||||
|
waitingRenderNodes.push(newNode);
|
||||||
|
createSubModules(childNode.data.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
createSubModules(node.data?.id as string);
|
||||||
|
handleRenderNode(node, waitingRenderNodes);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue