fix(接口测试): 修复api测试后更新接口刷新问题

--bug=1009997 --user=赵勇 【接口测试】接口定义-test,更新接口没有及时刷新 https://www.tapd.cn/55049933/s/1099254
This commit is contained in:
fit2-zhao 2022-01-26 15:52:46 +08:00 committed by song-tianyang
parent 7e047049bc
commit 9f0614f030
1 changed files with 260 additions and 236 deletions

View File

@ -108,19 +108,19 @@
</template>
<script>
import MsApiConfig from "./ApiConfig";
import MsRunTestHttpPage from "./runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./runtest/RunTestDubboPage";
import MockTab from "@/business/components/api/definition/components/mock/MockTab";
import TcpMockConfig from "@/business/components/api/definition/components/mock/TcpMockConfig";
import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
import MsApiCaseList from "./case/ApiCaseList";
import {getUUID} from "@/common/js/utils";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsApiConfig from "./ApiConfig";
import MsRunTestHttpPage from "./runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./runtest/RunTestDubboPage";
import MockTab from "@/business/components/api/definition/components/mock/MockTab";
import TcpMockConfig from "@/business/components/api/definition/components/mock/TcpMockConfig";
import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
import MsApiCaseList from "./case/ApiCaseList";
import {getUUID} from "@/common/js/utils";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
export default {
export default {
name: "EditCompleteContainer",
components: {
MsApiConfig,
@ -329,38 +329,62 @@
this.showMock = true;
this.$store.state.currentApiCase = undefined;
} else {
this.syncApi();
}
},
changeApi() {
this.showApiList = true;
this.showTestCaseList = false;
this.showTest = false;
this.showMock = false;
this.$store.state.currentApiCase = undefined;
}
}
},
};
syncApi() {
if (this.syncTabs && this.syncTabs.length > 0 && this.syncTabs.includes(this.currentApi.id)) {
//
let url = "/api/definition/get/";
this.$get(url + this.currentApi.id, response => {
if (response.data) {
let request = JSON.parse(response.data.request);
let index = this.syncTabs.findIndex(item => {
if (item === this.currentApi.id) {
return true;
}
});
this.syncTabs.splice(index, 1);
this.currentApi.request = request;
this.changeApi();
}
});
} else {
this.changeApi();
}
}
}
};
</script>
<style scoped>
.active {
.active {
border: solid 1px #6d317c !important;
background-color: var(--primary_color) !important;
color: #FFFFFF !important;
}
}
.case-button {
.case-button {
border-left: solid 1px var(--primary_color);
}
}
.item {
.item {
border: solid 1px var(--primary_color);
}
}
.api-case-simple-list >>> .el-table {
.api-case-simple-list >>> .el-table {
height: calc(100vh - 262px) !important;
}
}
/deep/ .ms-opt-btn {
/deep/ .ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
@ -368,5 +392,5 @@
float: right;
margin-right: 20px;
margin-top: 5px;
}
}
</style>