fix(测试跟踪): 选中模块创建用例,保存后显示的未规划模块
--bug=1023998 --user=陈建星 【测试跟踪】github#22413,无法在新的模块下新增功能用例 https://www.tapd.cn/55049933/s/1346501
This commit is contained in:
parent
d68ac65a25
commit
c7a444f389
|
@ -607,9 +607,6 @@ export default {
|
||||||
routeProjectId() {
|
routeProjectId() {
|
||||||
return this.$route.query.projectId;
|
return this.$route.query.projectId;
|
||||||
},
|
},
|
||||||
moduleOptions() {
|
|
||||||
return store.testCaseModuleOptions;
|
|
||||||
},
|
|
||||||
isCustomNum() {
|
isCustomNum() {
|
||||||
return store.currentProjectIsCustomNum;
|
return store.currentProjectIsCustomNum;
|
||||||
},
|
},
|
||||||
|
@ -802,8 +799,11 @@ export default {
|
||||||
this.treeNodes.forEach(node => {
|
this.treeNodes.forEach(node => {
|
||||||
node.name = node.name === '未规划用例' ? this.$t('api_test.unplanned_case') : node.name
|
node.name = node.name === '未规划用例' ? this.$t('api_test.unplanned_case') : node.name
|
||||||
buildTree(node, {path: ''});
|
buildTree(node, {path: ''});
|
||||||
this.setNodeModule();
|
|
||||||
});
|
});
|
||||||
|
if (!this.caseId) {
|
||||||
|
// 创建时设置模块ID
|
||||||
|
this.setDefaultModule();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,19 +903,6 @@ export default {
|
||||||
"TRACK_TEST_CASE",
|
"TRACK_TEST_CASE",
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
setNodeModule() {
|
|
||||||
if (this.caseId) {
|
|
||||||
this.form.module = this.currentTestCaseInfo.nodeId;
|
|
||||||
this.form.nodePath = this.currentTestCaseInfo.nodePath;
|
|
||||||
}
|
|
||||||
if ((!this.form.module ||
|
|
||||||
this.form.module === "default-module" ||
|
|
||||||
this.form.module === "root")
|
|
||||||
&& this.treeNodes.length > 0) {
|
|
||||||
this.form.module = this.treeNodes[0].id;
|
|
||||||
this.form.nodePath = this.treeNodes[0].path;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setDefaultValue() {
|
setDefaultValue() {
|
||||||
if (!this.form.prerequisite) {
|
if (!this.form.prerequisite) {
|
||||||
this.form.prerequisite = "";
|
this.form.prerequisite = "";
|
||||||
|
@ -1022,9 +1009,7 @@ export default {
|
||||||
|
|
||||||
// add
|
// add
|
||||||
document.title = this.$t('test_track.case.create_case');
|
document.title = this.$t('test_track.case.create_case');
|
||||||
if (this.moduleOptions.length > 0) {
|
|
||||||
this.form.module = this.moduleOptions[0].id;
|
|
||||||
}
|
|
||||||
let user = JSON.parse(localStorage.getItem(TokenKey));
|
let user = JSON.parse(localStorage.getItem(TokenKey));
|
||||||
this.form.priority = "P3";
|
this.form.priority = "P3";
|
||||||
this.form.type = "functional";
|
this.form.type = "functional";
|
||||||
|
@ -1045,6 +1030,11 @@ export default {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setDefaultModule() {
|
||||||
|
if (this.$refs.testCaseBaseInfo) {
|
||||||
|
this.$refs.testCaseBaseInfo.doSetDefaultModule(this.treeNodes);
|
||||||
|
}
|
||||||
|
},
|
||||||
async checkCurrentProject() {
|
async checkCurrentProject() {
|
||||||
if (this.isPublicShow) {
|
if (this.isPublicShow) {
|
||||||
// 用例库查看用例
|
// 用例库查看用例
|
||||||
|
@ -1154,7 +1144,10 @@ export default {
|
||||||
this.form.stepModel = "STEP";
|
this.form.stepModel = "STEP";
|
||||||
}
|
}
|
||||||
this.casePublic = tmp.casePublic;
|
this.casePublic = tmp.casePublic;
|
||||||
|
|
||||||
this.form.module = testCase.nodeId;
|
this.form.module = testCase.nodeId;
|
||||||
|
|
||||||
|
this.$refs.testCaseBaseInfo.setDefaultModule();
|
||||||
//设置自定义熟悉默认值
|
//设置自定义熟悉默认值
|
||||||
this.customFieldForm = parseCustomField(
|
this.customFieldForm = parseCustomField(
|
||||||
this.form,
|
this.form,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="name title-wrap">ID</div>
|
<div class="name title-wrap">ID</div>
|
||||||
<div class="required required-item"></div>
|
<div class="required required-item"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-content">
|
<div class="side-content">
|
||||||
<base-edit-item-component
|
<base-edit-item-component
|
||||||
:editable="editable"
|
:editable="editable"
|
||||||
:auto-save="!readOnly"
|
:auto-save="!readOnly"
|
||||||
|
@ -113,14 +113,15 @@
|
||||||
<ms-select-tree
|
<ms-select-tree
|
||||||
:disabled="readOnly"
|
:disabled="readOnly"
|
||||||
:data="treeNodes"
|
:data="treeNodes"
|
||||||
:defaultKey="defaultModuleKey"
|
|
||||||
:obj="moduleObj"
|
:obj="moduleObj"
|
||||||
@getValue="(id, data) => setModule(id, data)"
|
:default-key="defaultModuleKey"
|
||||||
|
@getValue="setModule"
|
||||||
clearable
|
clearable
|
||||||
checkStrictly
|
checkStrictly
|
||||||
size="small"
|
size="small"
|
||||||
@selectClick="onClick"
|
@selectClick="onClick"
|
||||||
@clean="onClick"
|
@clean="onClick"
|
||||||
|
ref="moduleTree"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
@ -447,6 +448,7 @@ export default {
|
||||||
demandOptions: [],
|
demandOptions: [],
|
||||||
versionFilters: [],
|
versionFilters: [],
|
||||||
demandList: [],
|
demandList: [],
|
||||||
|
defaultModuleKey: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -471,36 +473,38 @@ export default {
|
||||||
isCustomNum() {
|
isCustomNum() {
|
||||||
return useStore().currentProjectIsCustomNum;
|
return useStore().currentProjectIsCustomNum;
|
||||||
},
|
},
|
||||||
defaultModuleKey() {
|
createNodeId() {
|
||||||
if (this.editable && !this.editableState) {
|
return this.$route.query.createNodeId;
|
||||||
let defaultNodeKey = '';
|
|
||||||
if (this.$route.query.createNodeId) {
|
|
||||||
defaultNodeKey = this.$route.query.createNodeId;
|
|
||||||
} else {
|
|
||||||
this.treeNodes.forEach(node => {
|
|
||||||
if (node.label === '未规划用例') {
|
|
||||||
defaultNodeKey = node.id;
|
|
||||||
this.form.module = defaultNodeKey;
|
|
||||||
this.form.nodePath = node.path;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return defaultNodeKey;
|
|
||||||
} else {
|
|
||||||
return this.form.module
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getDemandOptions();
|
this.getDemandOptions();
|
||||||
this.getVersionOptions();
|
this.getVersionOptions();
|
||||||
if (this.$route.query.createNodeId) {
|
|
||||||
this.form.module = this.$route.query.createNodeId;
|
|
||||||
let node = this.findTreeNode(this.treeNodes);
|
|
||||||
this.form.nodePath = node.path;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setDefaultModule() {
|
||||||
|
this.doSetDefaultModule(this.treeNodes);
|
||||||
|
},
|
||||||
|
doSetDefaultModule(treeNodes) {
|
||||||
|
if (treeNodes && treeNodes.length > 0) {
|
||||||
|
if (this.createNodeId) {
|
||||||
|
// 创建时设置选中的模块
|
||||||
|
this.form.module = this.createNodeId;
|
||||||
|
let node = this.findTreeNode(treeNodes);
|
||||||
|
this.form.nodePath = node.path;
|
||||||
|
} else if (this.form.module) {
|
||||||
|
// 编辑重新设置下 nodePath
|
||||||
|
let node = this.findTreeNode(treeNodes);
|
||||||
|
this.form.nodePath = node ? node.path : '';
|
||||||
|
} else {
|
||||||
|
// 创建不带模块ID,设置成为规划模块
|
||||||
|
this.form.module = treeNodes[0].id;
|
||||||
|
this.form.nodePath = treeNodes[0].path;
|
||||||
|
}
|
||||||
|
this.defaultModuleKey = this.form.module;
|
||||||
|
this.$refs.moduleTree.setData(this.form.module);
|
||||||
|
}
|
||||||
|
},
|
||||||
handleDemandOptionPlatform(data){
|
handleDemandOptionPlatform(data){
|
||||||
if(data.platform){
|
if(data.platform){
|
||||||
return data.platform
|
return data.platform
|
||||||
|
@ -586,8 +590,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setModule(id, data) {
|
setModule(id, data) {
|
||||||
this.form.module = id;
|
if (data) {
|
||||||
this.form.nodePath = data.path;
|
this.form.module = id;
|
||||||
|
this.form.nodePath = data.path;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mouseLeaveEvent(refName) {
|
mouseLeaveEvent(refName) {
|
||||||
if (!this.editable && this.$refs[refName]) {
|
if (!this.editable && this.$refs[refName]) {
|
||||||
|
|
Loading…
Reference in New Issue