This commit is contained in:
fit2-zhao 2021-02-26 11:34:27 +08:00
commit c3466d5ca7
4 changed files with 21 additions and 29 deletions

View File

@ -149,7 +149,7 @@
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%"> <span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
<!-- 步骤组件--> <!-- 步骤组件-->
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario" <ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId" :node="node" :currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="reload"/> @remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="reload"/>
</span> </span>
</el-tree> </el-tree>
@ -300,7 +300,8 @@ export default {
}, },
response: {}, response: {},
projectIds: new Set, projectIds: new Set,
projectEnvMap: new Map projectEnvMap: new Map,
projectList: []
} }
}, },
created() { created() {
@ -309,6 +310,7 @@ export default {
} }
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
this.operatingElements = ELEMENTS.get("ALL"); this.operatingElements = ELEMENTS.get("ALL");
this.getWsProjects();
this.getMaintainerOptions(); this.getMaintainerOptions();
this.getApiScenario(); this.getApiScenario();
this.addListener(); // ctrl s this.addListener(); // ctrl s
@ -1031,7 +1033,12 @@ export default {
}, },
setProjectEnvMap(projectEnvMap) { setProjectEnvMap(projectEnvMap) {
this.projectEnvMap = projectEnvMap; this.projectEnvMap = projectEnvMap;
} },
getWsProjects() {
this.$get("/project/listAll", res => {
this.projectList = res.data;
})
},
} }
} }
</script> </script>

View File

@ -84,6 +84,7 @@
default: false, default: false,
}, },
currentEnvironmentId: String, currentEnvironmentId: String,
projectList: Array
}, },
components: { components: {
CustomizeReqInfo, CustomizeReqInfo,
@ -96,7 +97,6 @@
reportId: "", reportId: "",
runData: [], runData: [],
isShowInput: false, isShowInput: false,
projects: []
} }
}, },
created() { created() {
@ -106,7 +106,6 @@
this.request.projectId = getCurrentProjectID(); this.request.projectId = getCurrentProjectID();
// //
this.getApiInfo(); this.getApiInfo();
this.getWsProjects();
if (this.request.protocol === 'HTTP') { if (this.request.protocol === 'HTTP') {
this.setUrl(this.request.url); this.setUrl(this.request.url);
this.setUrl(this.request.path); this.setUrl(this.request.path);
@ -279,17 +278,9 @@
this.loading = false this.loading = false
}) })
}, },
getWsProjects() {
this.$get("/project/listAll", res => {
this.projects = res.data;
})
},
getProjectName(id) { getProjectName(id) {
const project = this.projects.find(p => p.id === id); const project = this.projectList.find(p => p.id === id);
if (project) { return project ? project.name : "";
return project.name;
}
return '';
} }
} }
} }

View File

@ -42,11 +42,13 @@
default: false, default: false,
}, },
currentEnvironmentId: String, currentEnvironmentId: String,
projectList: Array
}, },
watch: {}, watch: {},
created() { created() {
this.getWsProjects(); if (!this.scenario.projectId) {
this.scenario.projectId = getCurrentProjectID(); this.scenario.projectId = getCurrentProjectID();
}
getProject.$emit('addProjectEnv', this.scenario.projectId, this.currentEnvironmentId); getProject.$emit('addProjectEnv', this.scenario.projectId, this.currentEnvironmentId);
if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) { if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) {
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => { this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
@ -76,7 +78,6 @@
return { return {
loading: false, loading: false,
isShowInput: false, isShowInput: false,
projects: []
} }
}, },
computed: { computed: {
@ -122,17 +123,9 @@
} }
} }
}, },
getWsProjects() {
this.$get("/project/listAll", res => {
this.projects = res.data;
})
},
getProjectName(id) { getProjectName(id) {
const project = this.projects.find(p => p.id === id); const project = this.projectList.find(p => p.id === id) ;
if (project) { return project ? project.name : "";
return project.name;
}
return '';
} }
} }
} }

View File

@ -2,7 +2,7 @@
<div class="request-form"> <div class="request-form">
<component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node" <component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
:draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response" :draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
@remove="remove" @copyRow="copyRow" @refReload="refReload"/> @remove="remove" @copyRow="copyRow" @refReload="refReload" :project-list="projectList"/>
</div> </div>
</template> </template>
@ -28,6 +28,7 @@
currentEnvironmentId: String, currentEnvironmentId: String,
response: {}, response: {},
node: {}, node: {},
projectList: Array
}, },
data() { data() {
return { return {