refactor: 场景默认加载当前项目的环境配置

This commit is contained in:
chenjianxing 2021-05-19 10:51:58 +08:00 committed by BugKing
parent 1b3954fec7
commit 497331f73a
2 changed files with 7 additions and 0 deletions

View File

@ -1019,6 +1019,7 @@
this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => { this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => {
if (res.data) { if (res.data) {
this.projectIds = new Set(res.data.projectIds); this.projectIds = new Set(res.data.projectIds);
this.projectIds.add(this.projectId);
this.isFullUrl = res.data.fullUrl; this.isFullUrl = res.data.fullUrl;
} }
resolve(); resolve();

View File

@ -54,6 +54,11 @@
} }
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
}
},
mounted() { mounted() {
this.envMap = this.projectEnvMap; this.envMap = this.projectEnvMap;
this.getVariableSize(); this.getVariableSize();
@ -124,6 +129,7 @@
return new Promise((resolve) => { return new Promise((resolve) => {
this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => { this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => {
if (res.data) { if (res.data) {
res.data.projectIds.push(this.projectId);
this.$emit("update:projectIds", new Set(res.data.projectIds)); this.$emit("update:projectIds", new Set(res.data.projectIds));
this.$emit("update:isFullUrl", res.data.fullUrl); this.$emit("update:isFullUrl", res.data.fullUrl);
} }