feat(场景自动化,测试用例): 默认选中树节点添加对应功能

This commit is contained in:
fit2-zhao 2021-03-29 15:01:18 +08:00
parent d3fccb25d6
commit a3b1c4f4d5
3 changed files with 18 additions and 4 deletions

View File

@ -127,7 +127,6 @@
'$route'(to, from) { // ctrl s '$route'(to, from) { // ctrl s
if (to.path.indexOf('/api/automation') == -1) { if (to.path.indexOf('/api/automation') == -1) {
if (this.$refs && this.$refs.autoScenarioConfig) { if (this.$refs && this.$refs.autoScenarioConfig) {
// console.log(this.$refs.autoScenarioConfig);
this.$refs.autoScenarioConfig.forEach(item => { this.$refs.autoScenarioConfig.forEach(item => {
item.removeListener(); item.removeListener();
}); });
@ -189,7 +188,15 @@
let label = this.$t('api_test.automation.add_scenario'); let label = this.$t('api_test.automation.add_scenario');
let name = getUUID().substring(0, 8); let name = getUUID().substring(0, 8);
this.activeName = name; this.activeName = name;
this.tabs.push({label: label, name: name, currentScenario: {apiScenarioModuleId: "root", id: getUUID()}}); let currentScenario = {
apiScenarioModuleId: "root", id: getUUID(),
modulePath: "/" + this.$t("commons.module_title")
};
if (this.nodeTree && this.nodeTree.length > 0) {
currentScenario.apiScenarioModuleId = this.nodeTree[0].id;
currentScenario.modulePath = this.nodeTree[0].path;
}
this.tabs.push({label: label, name: name, currentScenario: currentScenario});
} }
if (tab.name === 'edit') { if (tab.name === 'edit') {
let label = this.$t('api_test.automation.add_scenario'); let label = this.$t('api_test.automation.add_scenario');

View File

@ -296,8 +296,12 @@
} }
let api = { let api = {
status: "Underway", method: "GET", userId: getCurrentUser().id, status: "Underway", method: "GET", userId: getCurrentUser().id,
url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'root', url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'root', modulePath: "/" + this.$t("commons.module_title")
}; };
if (this.nodeTree && this.nodeTree.length > 0) {
api.moduleId = this.nodeTree[0].id;
api.modulePath = this.nodeTree[0].path;
}
this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api); this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api);
}, },
handleTabClose() { handleTabClose() {

View File

@ -415,6 +415,10 @@ export default {
}; };
}); });
}, 1000); }, 1000);
if(this.selectNode && this.selectNode.data){
this.form.module = this.selectNode.data.id;
this.form.nodePath = this.selectNode.data.path;
}
}, },
watch: { watch: {
treeNodes() { treeNodes() {
@ -738,7 +742,6 @@ export default {
}*/ }*/
this.tableType='edit'; this.tableType='edit';
this.$emit("refresh",this.form); this.$emit("refresh",this.form);
console.log(response.data)
this.form.id=response.data this.form.id=response.data
if (this.type === 'add' || this.type === 'copy') { if (this.type === 'add' || this.type === 'copy') {
param.id = response.data; param.id = response.data;