fix(接口自动化): 场景步骤所属项目显示慢的问题

This commit is contained in:
shiziyuan9527 2021-02-26 10:40:08 +08:00
parent 8ae4743d42
commit 34fc7e8cf6
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%">
<!-- 步骤组件-->
<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"/>
</span>
</el-tree>
@ -300,7 +300,8 @@ export default {
},
response: {},
projectIds: new Set,
projectEnvMap: new Map
projectEnvMap: new Map,
projectList: []
}
},
created() {
@ -309,6 +310,7 @@ export default {
}
this.projectId = getCurrentProjectID();
this.operatingElements = ELEMENTS.get("ALL");
this.getWsProjects();
this.getMaintainerOptions();
this.getApiScenario();
this.addListener(); // ctrl s
@ -1031,7 +1033,12 @@ export default {
},
setProjectEnvMap(projectEnvMap) {
this.projectEnvMap = projectEnvMap;
}
},
getWsProjects() {
this.$get("/project/listAll", res => {
this.projectList = res.data;
})
},
}
}
</script>

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<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"
: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>
</template>
@ -28,6 +28,7 @@
currentEnvironmentId: String,
response: {},
node: {},
projectList: Array
},
data() {
return {