fix: 脑图临时保存后打上用例标签保存报错 #6548

This commit is contained in:
chenjianxing 2021-09-27 14:48:43 +08:00 committed by jianxing
parent 54039fe059
commit 5a28e6d6d3
2 changed files with 13 additions and 3 deletions

View File

@ -129,7 +129,7 @@ name: "TestCaseMinder",
},
save(data) {
let saveCases = [];
let deleteCases = [];
let deleteCases = []; //
let saveExtraNode = {};
this.buildSaveCase(data.root, saveCases, deleteCases, saveExtraNode, undefined);
@ -169,7 +169,7 @@ name: "TestCaseMinder",
buildSaveCase(root, saveCases, deleteCases, saveExtraNode, parent) {
let data = root.data;
if (data.resource && data.resource.indexOf(this.$t('api_test.definition.request.case')) > -1) {
this._buildSaveCase(root, saveCases, parent);
this._buildSaveCase(root, saveCases, deleteCases, parent);
} else {
let deleteChild = data.deleteChild;
if (deleteChild && deleteChild.length > 0
@ -200,11 +200,20 @@ name: "TestCaseMinder",
}
}
},
_buildSaveCase(node, saveCases, parent) {
_buildSaveCase(node, saveCases, deleteCases, parent) {
let data = node.data;
if (!data.text) {
return;
}
if (data.isExtraNode) {
//
let deleteData = {};
Object.assign(deleteData, data);
deleteCases.push(deleteData);
data.id = "";
}
let isChange = false;
let testCase = {
id: data.id,

View File

@ -271,6 +271,7 @@ export function appendExtraNodes(parent, nodes) {
}
function _appendExtraNodes(parent, data) {
data.isExtraNode = true;
let node = appendChildNode(parent, data, true);
if (data.children && data.children.length > 0) {
data.children.forEach(child => {