fix(系统设置):导入环境选择其他内容的json格式文件时有错误提示
This commit is contained in:
parent
e0a6707bfb
commit
7acd0a3f88
|
@ -87,18 +87,22 @@ export default {
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
|
|
||||||
reader.readAsText(file.raw)
|
reader.readAsText(file.raw)
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
let fileString = e.target.result;
|
let fileString = e.target.result;
|
||||||
JSON.parse(fileString).map(env => {
|
try {
|
||||||
//projectId为空字符串要转换为null,空字符串会被认为有projectId
|
JSON.parse(fileString).map(env => {
|
||||||
env.projectId = this.currentProjectId === '' ? null : this.currentProjectId;
|
//projectId为空字符串要转换为null,空字符串会被认为有projectId
|
||||||
this.$post('/api/environment/add', env, response => {
|
env.projectId = this.currentProjectId === '' ? null : this.currentProjectId;
|
||||||
this.$emit('refresh');
|
this.$post('/api/environment/add', env, response => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$emit('refresh');
|
||||||
})
|
this.$success(this.$t('commons.save_success'));
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
} catch (exception) {
|
||||||
|
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue