fix(接口测试): 修复api测试后更新接口刷新问题
--bug=1009997 --user=赵勇 【接口测试】接口定义-test,更新接口没有及时刷新 https://www.tapd.cn/55049933/s/1099254
This commit is contained in:
parent
e1c614b6d7
commit
4374f42aa3
|
@ -108,19 +108,19 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiConfig from "./ApiConfig";
|
import MsApiConfig from "./ApiConfig";
|
||||||
import MsRunTestHttpPage from "./runtest/RunTestHTTPPage";
|
import MsRunTestHttpPage from "./runtest/RunTestHTTPPage";
|
||||||
import MsRunTestTcpPage from "./runtest/RunTestTCPPage";
|
import MsRunTestTcpPage from "./runtest/RunTestTCPPage";
|
||||||
import MsRunTestSqlPage from "./runtest/RunTestSQLPage";
|
import MsRunTestSqlPage from "./runtest/RunTestSQLPage";
|
||||||
import MsRunTestDubboPage from "./runtest/RunTestDubboPage";
|
import MsRunTestDubboPage from "./runtest/RunTestDubboPage";
|
||||||
import MockTab from "@/business/components/api/definition/components/mock/MockTab";
|
import MockTab from "@/business/components/api/definition/components/mock/MockTab";
|
||||||
import TcpMockConfig from "@/business/components/api/definition/components/mock/TcpMockConfig";
|
import TcpMockConfig from "@/business/components/api/definition/components/mock/TcpMockConfig";
|
||||||
import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
|
import ApiCaseSimpleList from "./list/ApiCaseSimpleList";
|
||||||
import MsApiCaseList from "./case/ApiCaseList";
|
import MsApiCaseList from "./case/ApiCaseList";
|
||||||
import {getUUID} from "@/common/js/utils";
|
import {getUUID} from "@/common/js/utils";
|
||||||
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
|
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditCompleteContainer",
|
name: "EditCompleteContainer",
|
||||||
components: {
|
components: {
|
||||||
MsApiConfig,
|
MsApiConfig,
|
||||||
|
@ -329,38 +329,62 @@
|
||||||
this.showMock = true;
|
this.showMock = true;
|
||||||
this.$store.state.currentApiCase = undefined;
|
this.$store.state.currentApiCase = undefined;
|
||||||
} else {
|
} else {
|
||||||
|
this.syncApi();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeApi() {
|
||||||
this.showApiList = true;
|
this.showApiList = true;
|
||||||
this.showTestCaseList = false;
|
this.showTestCaseList = false;
|
||||||
this.showTest = false;
|
this.showTest = false;
|
||||||
this.showMock = false;
|
this.showMock = false;
|
||||||
this.$store.state.currentApiCase = undefined;
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.active {
|
.active {
|
||||||
border: solid 1px #6d317c !important;
|
border: solid 1px #6d317c !important;
|
||||||
background-color: var(--primary_color) !important;
|
background-color: var(--primary_color) !important;
|
||||||
color: #FFFFFF !important;
|
color: #FFFFFF !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.case-button {
|
.case-button {
|
||||||
border-left: solid 1px var(--primary_color);
|
border-left: solid 1px var(--primary_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
border: solid 1px var(--primary_color);
|
border: solid 1px var(--primary_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.api-case-simple-list >>> .el-table {
|
.api-case-simple-list >>> .el-table {
|
||||||
height: calc(100vh - 262px) !important;
|
height: calc(100vh - 262px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .ms-opt-btn {
|
/deep/ .ms-opt-btn {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 50px;
|
right: 50px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
@ -368,5 +392,5 @@
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue