fix(接口测试): 用例列表切换分页卡顿问题
--bug=1009377 --user=lyh 接口定义case列表使用多条分页时,需要等待好久才能顺利滑动 https://www.tapd.cn/55049933/s/1089521
This commit is contained in:
parent
9f7e35cbd5
commit
b5cc0dd4a7
|
@ -70,6 +70,7 @@ public class ApiTestCaseController {
|
|||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
request.setSelectEnvironment(true);
|
||||
return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ public class ApiTestCaseDTO extends ApiTestCase {
|
|||
private String apiName;
|
||||
private String passRate;
|
||||
private String projectName;
|
||||
private String environment;
|
||||
private String execResult;
|
||||
private String versionName;
|
||||
}
|
||||
|
|
|
@ -39,4 +39,8 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
|
|||
* 检查待更新的(近三天有更新的或者状态为error的)
|
||||
*/
|
||||
private boolean toUpdate;
|
||||
/**
|
||||
* 是否需要查询环境字段
|
||||
*/
|
||||
private boolean selectEnvironment = false;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import io.metersphere.service.UserService;
|
|||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
import io.metersphere.track.service.TestPlanService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
@ -129,10 +130,22 @@ public class ApiTestCaseService {
|
|||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||
return apiTestCases;
|
||||
}
|
||||
if (BooleanUtils.isTrue(request.isSelectEnvironment())) {
|
||||
setCaseEnvironment(apiTestCases);
|
||||
}
|
||||
buildUserInfo(apiTestCases);
|
||||
return apiTestCases;
|
||||
}
|
||||
|
||||
public void setCaseEnvironment(List<ApiTestCaseDTO> apiTestCases) {
|
||||
for (ApiTestCaseDTO apiCase : apiTestCases) {
|
||||
ApiTestEnvironment environment = getApiCaseEnvironment(apiCase.getId());
|
||||
if (environment != null) {
|
||||
apiCase.setEnvironment(environment.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> idSimple(ApiTestCaseRequest request) {
|
||||
request = this.initRequest(request, true, true);
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
prop="environment"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="'运行环境'"
|
||||
:label="$t('commons.environment')"
|
||||
>
|
||||
</ms-table-column>
|
||||
|
||||
|
@ -162,7 +162,7 @@
|
|||
prop="createUser"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="'创建人'"/>
|
||||
:label="$t('commons.create_user')"/>
|
||||
|
||||
<ms-table-column
|
||||
sortable="updateTime"
|
||||
|
@ -633,10 +633,6 @@ export default {
|
|||
if (item.status === 'Running') {
|
||||
isNext = true;
|
||||
}
|
||||
this.$get('/api/testcase/get/env/' + item.id, res => {
|
||||
let environment = res.data ? res.data.name : '-';
|
||||
this.$set(item, 'environment', environment);
|
||||
})
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.caseTable) {
|
||||
|
|
Loading…
Reference in New Issue