From 66b99629193e2b44945866c537ef391230a0237e Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 15 Dec 2020 15:08:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=9B=E5=BB=BA=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=97=B6=E9=80=89=E4=B8=AD=E9=BB=98=E8=AE=A4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/test/ApiTestConfig.vue | 18 +++---------- .../performance/test/EditPerformanceTest.vue | 27 ++++--------------- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/frontend/src/business/components/api/test/ApiTestConfig.vue b/frontend/src/business/components/api/test/ApiTestConfig.vue index 504b3f3d38..18d2e77885 100644 --- a/frontend/src/business/components/api/test/ApiTestConfig.vue +++ b/frontend/src/business/components/api/test/ApiTestConfig.vue @@ -8,10 +8,7 @@ - - - + { - this.projects = response.data; - // 等待项目列表加载完 - if (projectId) this.test.projectId = projectId; - }) + this.test.projectId = getCurrentProjectID(); }, updateReference() { let updateIds = []; @@ -318,7 +307,6 @@ export default { break; case "performance": this.$store.commit('setTest', { - projectId: this.test.projectId, name: this.test.name, jmx: this.test.toJMX() }) diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index baf4c660ca..2e2769f1a1 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -8,17 +8,7 @@ class="input-with-select" maxlength="30" show-word-limit > - + @@ -59,7 +49,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig"; import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig"; import MsContainer from "../../common/components/MsContainer"; import MsMainContainer from "../../common/components/MsMainContainer"; -import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; +import {checkoutTestManagerOrTestUser, getCurrentProjectID} from "@/common/js/utils"; import MsScheduleConfig from "../../common/components/MsScheduleConfig"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; @@ -77,7 +67,6 @@ export default { return { result: {}, test: {schedule: {}}, - listProjectPath: "/project/listAll", savePath: "/performance/save", editPath: "/performance/edit", runPath: "/performance/run", @@ -127,9 +116,6 @@ export default { } this.getTest(this.$route.params.testId); }, - activated() { - this.listProjects(); - }, mounted() { this.importAPITest(); }, @@ -137,7 +123,6 @@ export default { importAPITest() { let apiTest = this.$store.state.api.test; if (apiTest && apiTest.name) { - this.$set(this.test, "projectId", apiTest.projectId); this.$set(this.test, "name", apiTest.name); let blob = new Blob([apiTest.jmx.xml], {type: "application/octet-stream"}); let file = new File([blob], apiTest.jmx.name); @@ -160,11 +145,6 @@ export default { }); } }, - listProjects() { - this.result = this.$get(this.listProjectPath, response => { - this.projects = response.data; - }) - }, save() { if (!this.validTest()) { return; @@ -237,6 +217,9 @@ export default { this.$router.push({path: '/performance/test/all'}) }, validTest() { + let currentProjectId = getCurrentProjectID(); + this.test.projectId = currentProjectId; + if (!this.test.name) { this.$error(this.$t('load_test.test_name_is_null')); return false;