fix: 脑图新建模块后保存在改模块下创建用例保存报错

--bug=1009498 --user=陈建星 [ github#9020]脑图编写用例的时候,不能修改模块下面的用例,修改后会报错 https://www.tapd.cn/55049933/s/1093818
This commit is contained in:
chenjianxing 2022-01-19 11:10:49 +08:00 committed by 刘瑞斌
parent 7b37283303
commit 9443960c61
2 changed files with 25 additions and 18 deletions

View File

@ -92,7 +92,7 @@ export default {
id: "root",
type: 'node',
level: 0,
resource: this.showModuleTag ? ['模块'] : [],
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
path: "",
tagEnable: this.tagEnable
},
@ -165,7 +165,7 @@ export default {
disable: this.moduleDisable,
type: 'node',
level: item.level,
resource: this.showModuleTag ? ['模块'] : [],
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
caseNum: item.caseNum,
path: root.data.path + "/" + item.name,
expandState:"collapse"
@ -223,7 +223,7 @@ export default {
tagEnable: this.tagEnable,
type: 'node',
level: nodeData.level,
resource: this.showModuleTag ? ['模块'] : [],
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
},
children: []
},

View File

@ -28,8 +28,15 @@ import MsModuleMinder from "@/business/components/common/components/MsModuleMind
import {
getChildNodeId,
handleAfterSave,
handleExpandToLevel, handleMinderIssueDelete, handleTestCaseAdd, handTestCaeEdit, isModuleNode, isModuleNodeData,
listenBeforeExecCommand, listenDblclick,
handleExpandToLevel,
handleMinderIssueDelete,
handleTestCaseAdd,
handTestCaeEdit,
isCaseNodeData,
isModuleNode,
isModuleNodeData,
listenBeforeExecCommand,
listenDblclick,
listenNodeSelected,
loadSelectNodes,
priorityDisableCheck,
@ -201,24 +208,25 @@ name: "TestCaseMinder",
},
buildSaveParam(root, parent, preNode, nextNode) {
let data = root.data;
if (data.resource && data.resource.indexOf(this.$t('api_test.definition.request.case')) > -1) {
if (isCaseNodeData(data)) {
this.buildSaveCase(root, parent, preNode, nextNode);
} else {
let deleteChild = data.deleteChild;
if (deleteChild && deleteChild.length > 0 && data.type === 'node') {
if (deleteChild && deleteChild.length > 0 && isModuleNodeData(data)) {
this.deleteNodes.push(...deleteChild);
}
if (data.type !== 'tmp' && data.changed) {
if (data.contextChanged && data.resource &&
(data.resource.indexOf(this.$t('test_track.module.module')) > -1 || data.resource.indexOf("模块") > -1)) {
this.buildSaveModules(root, data, parent);
root.children && root.children.forEach(i => {
if (isModuleNode(i)) {
i.data.changed = true;
i.data.contextChanged = true; // level
}
});
if (isModuleNodeData(data)) {
if (data.contextChanged) {
this.buildSaveModules(root, data, parent);
root.children && root.children.forEach(i => {
if (isModuleNode(i)) {
i.data.changed = true;
i.data.contextChanged = true; // level
}
});
}
} else {
//
this.buildExtraNode(data, parent, root);
@ -284,8 +292,7 @@ name: "TestCaseMinder",
this.saveModules.push(module);
},
buildExtraNode(data, parent, root) {
if (data.type !== 'node' && data.type !== 'tmp'
&& parent && parent.type === 'node' && data.changed === true) {
if (data.type !== 'node' && data.type !== 'tmp' && parent && isModuleNodeData(parent.data) && data.changed === true) {
//
let nodes = this.saveExtraNode[parent.id];
if (!nodes) {