fix(测试跟踪): 脑图提示错误信息后,再次保存会导致用例丢失

--bug=1021999 --user=陈建星 【测试跟踪】github#21368,用例在脑图模式下,将已经带有case的模块B1拖动到新建的非模块脑图分支B2下保存,会导致B1下的用例丢失 https://www.tapd.cn/55049933/s/1328907
This commit is contained in:
chenjianxing 2023-01-30 14:45:34 +08:00 committed by jianxing
parent cd1764bac4
commit 401a17eedc
2 changed files with 18 additions and 1 deletions

View File

@ -45,7 +45,7 @@ import {
getChildNodeId,
handleAfterSave,
handleExpandToLevel,
handleMinderIssueDelete,
handleMinderIssueDelete, handleSaveError,
handleTestCaseAdd,
handTestCaeEdit,
isCaseNodeData,
@ -582,6 +582,7 @@ name: "TestCaseMinder",
id: data.id,
resource: data.resource,
};
data.originId = data.id;
if (nodeData.id && nodeData.id.length > 20) {
nodeData.isEdit = true; //
} else {
@ -600,6 +601,7 @@ name: "TestCaseMinder",
},
throwError(tip) {
this.$error(tip)
handleSaveError(window.minder.getRoot());
throw new Error(tip);
},
tagEditCheck() {

View File

@ -527,8 +527,10 @@ export function handleAfterSave(rootNode) {
rootNode.data.newId = null;
}
rootNode.data.deleteChild = null;
rootNode.data.originId = null;
rootNode.data.changed = false;
rootNode.data.contextChanged = false;
rootNode.data.isExtraNode = false;
if (isModuleNode(rootNode)) {
rootNode.data.type = 'node';
} else if (isCaseNodeData(rootNode.data)) {
@ -541,6 +543,19 @@ export function handleAfterSave(rootNode) {
}
}
export function handleSaveError(rootNode) {
if (rootNode.data.originId) {
rootNode.data.id = rootNode.data.originId;
}
rootNode.data.originId = null;
rootNode.data.isExtraNode = false;
if (rootNode.children) {
for (let i = 0; i < rootNode.children.length; i++) {
handleSaveError(rootNode.children[i]);
}
}
}
export function getChildNodeId(rootNode, nodeIds) {
//递归获取所有子节点ID
if (rootNode.data.id) {