fix(测试计划): 执行脑图-用例的实际结果只更新不新增

This commit is contained in:
teukkk 2024-08-09 15:32:15 +08:00 committed by Craftsman
parent d44c59b80f
commit 97e38804a8
1 changed files with 7 additions and 15 deletions

View File

@ -543,21 +543,13 @@
// //
const executeVisible = ref(false); const executeVisible = ref(false);
// //
function updateCaseActualResultNode(node: MinderJsonNode, content: string) { function updateCaseActualResultNode(node: MinderJsonNode, content: string) {
let actualResultNode; const actualResultNode = node.children?.find((item: MinderJsonNode) =>
actualResultNode = node.children?.find((item: MinderJsonNode) => item.data?.id === `actualResult-${node.data?.id}`); item.data?.resource?.includes(actualResultTag)
);
if (actualResultNode) { if (actualResultNode) {
actualResultNode actualResultNode.setData('text', content ?? '').render();
.setData('resource', [actualResultTag])
.setData('text', content ?? '')
.render();
} else {
actualResultNode = createNode(
{ resource: [actualResultTag], text: content ?? '', id: `actualResult-${node.data?.id}` },
node
);
handleRenderNode(node, [actualResultNode]);
} }
} }
// / // /
@ -567,7 +559,7 @@
if (resource?.includes(caseTag)) { if (resource?.includes(caseTag)) {
// //
window.minder.execCommand('resource', [executionResultMap[status].statusText, caseTag]); window.minder.execCommand('resource', [executionResultMap[status].statusText, caseTag]);
// //
updateCaseActualResultNode(selectNode.value, content); updateCaseActualResultNode(selectNode.value, content);
// //
if (extraVisible.value && activeExtraKey.value === 'history') { if (extraVisible.value && activeExtraKey.value === 'history') {
@ -638,7 +630,7 @@
function submitStepExecuteDone(status: string, content: string) { function submitStepExecuteDone(status: string, content: string) {
// //
caseNodeAboveSelectStep.value.setData('resource', [executionResultMap[status].statusText, caseTag]).render(); caseNodeAboveSelectStep.value.setData('resource', [executionResultMap[status].statusText, caseTag]).render();
// //
updateCaseActualResultNode(caseNodeAboveSelectStep.value, content); updateCaseActualResultNode(caseNodeAboveSelectStep.value, content);
// //
caseNodeAboveSelectStep.value.children.forEach((child: MinderJsonNode) => { caseNodeAboveSelectStep.value.children.forEach((child: MinderJsonNode) => {