fix: 脑图新建模块后保存在改模块下创建用例保存报错
--bug=1009498 --user=陈建星 [ github#9020]脑图编写用例的时候,不能修改模块下面的用例,修改后会报错 https://www.tapd.cn/55049933/s/1093818
This commit is contained in:
parent
7b37283303
commit
9443960c61
|
@ -92,7 +92,7 @@ export default {
|
||||||
id: "root",
|
id: "root",
|
||||||
type: 'node',
|
type: 'node',
|
||||||
level: 0,
|
level: 0,
|
||||||
resource: this.showModuleTag ? ['模块'] : [],
|
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
|
||||||
path: "",
|
path: "",
|
||||||
tagEnable: this.tagEnable
|
tagEnable: this.tagEnable
|
||||||
},
|
},
|
||||||
|
@ -165,7 +165,7 @@ export default {
|
||||||
disable: this.moduleDisable,
|
disable: this.moduleDisable,
|
||||||
type: 'node',
|
type: 'node',
|
||||||
level: item.level,
|
level: item.level,
|
||||||
resource: this.showModuleTag ? ['模块'] : [],
|
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
|
||||||
caseNum: item.caseNum,
|
caseNum: item.caseNum,
|
||||||
path: root.data.path + "/" + item.name,
|
path: root.data.path + "/" + item.name,
|
||||||
expandState:"collapse"
|
expandState:"collapse"
|
||||||
|
@ -223,7 +223,7 @@ export default {
|
||||||
tagEnable: this.tagEnable,
|
tagEnable: this.tagEnable,
|
||||||
type: 'node',
|
type: 'node',
|
||||||
level: nodeData.level,
|
level: nodeData.level,
|
||||||
resource: this.showModuleTag ? ['模块'] : [],
|
resource: this.showModuleTag ? [this.$t('test_track.module.module')] : [],
|
||||||
},
|
},
|
||||||
children: []
|
children: []
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,8 +28,15 @@ import MsModuleMinder from "@/business/components/common/components/MsModuleMind
|
||||||
import {
|
import {
|
||||||
getChildNodeId,
|
getChildNodeId,
|
||||||
handleAfterSave,
|
handleAfterSave,
|
||||||
handleExpandToLevel, handleMinderIssueDelete, handleTestCaseAdd, handTestCaeEdit, isModuleNode, isModuleNodeData,
|
handleExpandToLevel,
|
||||||
listenBeforeExecCommand, listenDblclick,
|
handleMinderIssueDelete,
|
||||||
|
handleTestCaseAdd,
|
||||||
|
handTestCaeEdit,
|
||||||
|
isCaseNodeData,
|
||||||
|
isModuleNode,
|
||||||
|
isModuleNodeData,
|
||||||
|
listenBeforeExecCommand,
|
||||||
|
listenDblclick,
|
||||||
listenNodeSelected,
|
listenNodeSelected,
|
||||||
loadSelectNodes,
|
loadSelectNodes,
|
||||||
priorityDisableCheck,
|
priorityDisableCheck,
|
||||||
|
@ -201,24 +208,25 @@ name: "TestCaseMinder",
|
||||||
},
|
},
|
||||||
buildSaveParam(root, parent, preNode, nextNode) {
|
buildSaveParam(root, parent, preNode, nextNode) {
|
||||||
let data = root.data;
|
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);
|
this.buildSaveCase(root, parent, preNode, nextNode);
|
||||||
} else {
|
} else {
|
||||||
let deleteChild = data.deleteChild;
|
let deleteChild = data.deleteChild;
|
||||||
if (deleteChild && deleteChild.length > 0 && data.type === 'node') {
|
if (deleteChild && deleteChild.length > 0 && isModuleNodeData(data)) {
|
||||||
this.deleteNodes.push(...deleteChild);
|
this.deleteNodes.push(...deleteChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.type !== 'tmp' && data.changed) {
|
if (data.type !== 'tmp' && data.changed) {
|
||||||
if (data.contextChanged && data.resource &&
|
if (isModuleNodeData(data)) {
|
||||||
(data.resource.indexOf(this.$t('test_track.module.module')) > -1 || data.resource.indexOf("模块") > -1)) {
|
if (data.contextChanged) {
|
||||||
this.buildSaveModules(root, data, parent);
|
this.buildSaveModules(root, data, parent);
|
||||||
root.children && root.children.forEach(i => {
|
root.children && root.children.forEach(i => {
|
||||||
if (isModuleNode(i)) {
|
if (isModuleNode(i)) {
|
||||||
i.data.changed = true;
|
i.data.changed = true;
|
||||||
i.data.contextChanged = true; // 如果当前节点有变化,下面的模块节点也需要level也可能需要变化
|
i.data.contextChanged = true; // 如果当前节点有变化,下面的模块节点也需要level也可能需要变化
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 保存临时节点
|
// 保存临时节点
|
||||||
this.buildExtraNode(data, parent, root);
|
this.buildExtraNode(data, parent, root);
|
||||||
|
@ -284,8 +292,7 @@ name: "TestCaseMinder",
|
||||||
this.saveModules.push(module);
|
this.saveModules.push(module);
|
||||||
},
|
},
|
||||||
buildExtraNode(data, parent, root) {
|
buildExtraNode(data, parent, root) {
|
||||||
if (data.type !== 'node' && data.type !== 'tmp'
|
if (data.type !== 'node' && data.type !== 'tmp' && parent && isModuleNodeData(parent.data) && data.changed === true) {
|
||||||
&& parent && parent.type === 'node' && data.changed === true) {
|
|
||||||
// 保存额外信息,只保存模块下的一级子节点
|
// 保存额外信息,只保存模块下的一级子节点
|
||||||
let nodes = this.saveExtraNode[parent.id];
|
let nodes = this.saveExtraNode[parent.id];
|
||||||
if (!nodes) {
|
if (!nodes) {
|
||||||
|
|
Loading…
Reference in New Issue