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 = {};