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 16:21:37 +08:00 committed by jianxing
parent 12498f9691
commit bfc45a1dd7
2 changed files with 18 additions and 1 deletions

View File

@ -44,7 +44,7 @@ import {
getChildNodeId,
handleAfterSave,
handleExpandToLevel,
handleMinderIssueDelete,
handleMinderIssueDelete, handleSaveError,
handleTestCaseAdd,
handTestCaeEdit,
isCaseNodeData,
@ -590,6 +590,7 @@ export default {
id: data.id,
resource: data.resource,
};
data.originId = data.id;
if (nodeData.id && nodeData.id.length > 20) {
nodeData.isEdit = true; //
} else {
@ -608,6 +609,7 @@ export default {
},
throwError(tip) {
this.$error(tip)
handleSaveError(window.minder.getRoot());
throw new Error(tip);
},
tagEditCheck() {

View File

@ -531,6 +531,8 @@ export function handleAfterSave(rootNode) {
rootNode.data.deleteChild = null;
rootNode.data.changed = false;
rootNode.data.contextChanged = false;
rootNode.data.originId = null;
rootNode.data.isExtraNode = false;
if (isModuleNode(rootNode)) {
rootNode.data.type = 'node';
} else if (isCaseNodeData(rootNode.data)) {
@ -543,6 +545,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) {