fix(接口定义、接口自动化): 修复接口定义、接口自动化导出文件中项目名为null的问题

修复接口定义、接口自动化导出文件中项目名为null的问题
This commit is contained in:
song-tianyang 2021-07-02 14:18:51 +08:00 committed by 刘瑞斌
parent c7cb74be3a
commit d81cb28bfb
2 changed files with 27 additions and 3 deletions

View File

@ -286,6 +286,7 @@ export default {
},
data() {
return {
projectName:"",
result: {},
tableHeaderKey:"API_SCENARIO",
type: API_SCENARIO_LIST,
@ -436,6 +437,9 @@ export default {
};
},
created() {
if(!this.projectName || this.projectName === ""){
this.getProjectName();
}
this.operators = this.unTrashOperators;
this.buttons = this.unTrashButtons;
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
@ -481,6 +485,14 @@ export default {
},
},
methods: {
getProjectName (){
this.$get('project/get/' + this.projectId, response => {
let project = response.data;
if(project){
this.projectName = project.name;
}
});
},
selectByParam() {
this.changeSelectDataRangeAll();
this.search();
@ -811,7 +823,7 @@ export default {
this.result.loading = false;
let obj = response.data;
this.buildApiPath(obj.data);
downloadFile("Metersphere_Scenario_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
downloadFile("Metersphere_Scenario_" + this.projectName + ".json", JSON.stringify(obj));
});
},
exportJmx() {

View File

@ -361,6 +361,7 @@ export default {
screenHeight: 'calc(100vh - 250px)',//,
environmentId: undefined,
selectDataCounts: 0,
projectName:"",
};
},
props: {
@ -411,6 +412,9 @@ export default {
}
},
created: function () {
if(!this.projectName || this.projectName === ""){
this.getProjectName();
}
if (this.trashEnable) {
this.tableOperatorButtons = this.tableTrashOperatorButtons;
this.condition.filters = {status: ["Trash"]};
@ -455,6 +459,14 @@ export default {
}
},
methods: {
getProjectName (){
this.$get('project/get/' + this.projectId, response => {
let project = response.data;
if(project){
this.projectName = project.name;
}
});
},
handleBatchMove() {
this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions);
},
@ -773,9 +785,9 @@ export default {
if (type == 'MS') {
obj.protocol = this.currentProtocol;
this.buildApiPath(obj.data);
downloadFile("Metersphere_Api_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
downloadFile("Metersphere_Api_" + this.projectName + ".json", JSON.stringify(obj));
} else {
downloadFile("Swagger_Api_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
downloadFile("Swagger_Api_" + this.projectName+ ".json", JSON.stringify(obj));
}
});
},