fix(测试计划): 修复功能案例导出文件名含有null的缺陷

修复功能案例导出文件名含有null的缺陷
This commit is contained in:
song-tianyang 2021-07-01 18:23:51 +08:00 committed by 刘瑞斌
parent a11c6add15
commit 5e49c359fc
1 changed files with 13 additions and 1 deletions

View File

@ -217,6 +217,7 @@ export default {
},
data() {
return {
projectName:"",
type: TEST_CASE_LIST,
tableHeaderKey:"TRACK_TEST_CASE",
screenHeight: 'calc(100vh - 250px)',
@ -326,6 +327,9 @@ export default {
this.initTableData();
let redirectParam = this.$route.query.dataSelectRange;
this.checkRedirectEditPage(redirectParam);
if(!this.projectName || this.projectName === ""){
this.getProjectName();
}
},
activated() {
this.getTemplateField();
@ -385,6 +389,14 @@ export default {
});
}
},
getProjectName (){
this.$get('project/get/' + this.projectId, response => {
let project = response.data;
if(project){
this.projectName = project.name;
}
});
},
customHeader() {
const list = deepClone(this.tableLabel);
this.$refs.headerCustom.open(list);
@ -552,7 +564,7 @@ export default {
}
this.page.result = this.$request(config).then(response => {
const filename = "Metersphere_case_" + localStorage.getItem(PROJECT_NAME) + ".xlsx";
const filename = "Metersphere_case_" + this.projectName+ ".xlsx";
const blob = new Blob([response.data]);
if ("download" in document.createElement("a")) {
let aTag = document.createElement('a');