From 7a167d44547ba68a17d8ca7cbd721d76fca6c1f2 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 25 Oct 2021 16:19:58 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=8F=A6=E5=AD=98=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E7=BC=BA=E9=99=B7=20--bug=3D1007392=20--user=3D?= =?UTF-8?q?=E8=B5=B5=E5=8B=87=20=E3=80=90=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E3=80=91-=E7=BC=96=E8=BE=91=E6=8E=A5=E5=8F=A3-TEST-?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE=E5=90=8E?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E2=80=9D=E5=8F=A6=E5=AD=98=E4=B8=BA=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E2=80=9C=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=8D=95?= =?UTF-8?q?=E5=87=BB=E6=B2=A1=E5=8F=8D=E5=BA=94=20https://www.tapd.cn/5504?= =?UTF-8?q?9933/s/1058509?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EditCompleteContainer.vue | 26 ++++++++++++++----- .../components/case/ApiCaseItem.vue | 10 ++++--- .../components/case/ApiCaseList.vue | 4 +++ .../components/list/ApiCaseSimpleList.vue | 2 +- .../components/runtest/RunTestDubboPage.vue | 2 +- .../components/runtest/RunTestHTTPPage.vue | 2 +- .../components/runtest/RunTestSQLPage.vue | 2 +- .../components/runtest/RunTestTCPPage.vue | 2 +- 8 files changed, 34 insertions(+), 16 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/EditCompleteContainer.vue b/frontend/src/business/components/api/definition/components/EditCompleteContainer.vue index 5f9c036e6a..e3179af45c 100644 --- a/frontend/src/business/components/api/definition/components/EditCompleteContainer.vue +++ b/frontend/src/business/components/api/definition/components/EditCompleteContainer.vue @@ -41,6 +41,7 @@ :api-data="currentApi" :project-id="projectId" @saveAsApi="editApi" + @saveAsCase="saveAsCase" @refresh="refresh" v-if="currentProtocol==='HTTP'" /> @@ -50,6 +51,7 @@ :api-data="currentApi" :project-id="projectId" @saveAsApi="editApi" + @saveAsCase="saveAsCase" @refresh="refresh" v-if="currentProtocol==='TCP'" /> @@ -59,6 +61,7 @@ :api-data="currentApi" :project-id="projectId" @saveAsApi="editApi" + @saveAsCase="saveAsCase" @refresh="refresh" v-if="currentProtocol==='SQL'" /> @@ -68,18 +71,19 @@ :api-data="currentApi" :project-id="projectId" @saveAsApi="editApi" + @saveAsCase="saveAsCase" @refresh="refresh" v-if="currentProtocol==='DUBBO'" />
- +
- +
@@ -96,6 +100,7 @@ @@ -178,6 +183,9 @@ export default { } }, methods: { + reLoadCase() { + this.$refs.trashCaseList.initTable(); + }, sort(stepArray) { if (stepArray) { for (let i in stepArray) { @@ -281,17 +289,21 @@ export default { this.loading = false }); }, + saveAsCase(api) { + this.showApiList = false; + this.showTestCaseList = true; + this.showTest = false; + this.showMock = false; + this.createCase = getUUID(); + this.api = api; + this.$refs.caseList.open(); + }, refreshButtonActiveClass(tabType) { if (tabType === "testCase") { this.showApiList = false; this.showTestCaseList = true; this.showTest = false; this.showMock = false; - if (this.$store.state.currentApiCase && this.$store.state.currentApiCase.api) { - this.createCase = getUUID(); - this.api = this.$store.state.currentApiCase.api; - this.$refs.caseList.open(); - } this.$store.state.currentApiCase = {case: true}; } else if (tabType === "test") { this.showApiList = false; diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index ec77172bba..c58b1e134f 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -280,9 +280,11 @@ export default { if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') { this.showXpackCompnent = true; } - this.$get('/api/testcase/follow/' + this.apiCase.id, response => { - this.apiCase.follows = response.data; - }); + if (this.apiCase && this.apiCase.id) { + this.$get('/api/testcase/follow/' + this.apiCase.id, response => { + this.apiCase.follows = response.data; + }); + } }, watch: { 'apiCase.selected'() { @@ -463,7 +465,7 @@ export default { this.reload(); // 刷新编辑后用例列表 if (this.api.source === "editCase") { - this.$store.state.currentApiCase = {refresh: "true"}; + this.$emit('reLoadCase'); } if (!hideAlert) { this.$emit('refresh'); diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 9686fbace5..45f4f1035f 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -33,6 +33,7 @@ @batchRun="batchRun" @apiCaseSelected="apiCaseSelected" @showHistory="showHistory" + @reLoadCase="reLoadCase" :environment="environment" :select-size="selectSize" :is-case-edit="isCaseEdit" @@ -268,6 +269,9 @@ export default { refresh() { this.$emit('refresh'); }, + reLoadCase(){ + this.$emit('reLoadCase'); + }, selectAll(isSelectAll) { this.apiCaseList.forEach(item => { this.$set(item, 'selected', isSelectAll); diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 46017d8f42..e3375a2853 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -194,7 +194,7 @@
+ @stop="stop" @reLoadCase="initTable"/> diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue index 56d5393c66..6ebdd9d9c7 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue @@ -166,7 +166,7 @@ export default { }, saveAsCase() { //用于触发创建操作 - this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; + this.$emit('saveAsCase', this.api); }, saveAsApi() { let data = {}; diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue index 30419f9688..53074119b7 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue @@ -204,7 +204,7 @@ export default { }, saveAsCase() { //用于触发创建操作 - this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; + this.$emit('saveAsCase', this.api); }, saveAsApi() { let data = {}; diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestSQLPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestSQLPage.vue index 7ddf332a98..a36ecffcd5 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestSQLPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestSQLPage.vue @@ -164,7 +164,7 @@ export default { return bodyUploadFiles; }, saveAsCase() { - this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; + this.$emit('saveAsCase', this.api); }, saveAsApi() { let data = {}; diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestTCPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestTCPPage.vue index 9f9dd811ed..b92b06881b 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestTCPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestTCPPage.vue @@ -195,7 +195,7 @@ export default { return bodyUploadFiles; }, saveAsCase() { - this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; + this.$emit('saveAsCase', this.api); }, saveAsApi() { let data = {};