修改测试跟踪首页

This commit is contained in:
chenjianxing 2020-05-15 17:42:42 +08:00
parent 7eee038ea3
commit 1fc354e556
5 changed files with 29 additions and 17 deletions

View File

@ -12,5 +12,6 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String status; private String status;
private String results; private String results;
private String planId; private String planId;
private String planName;
private String caseId; private String caseId;
} }

View File

@ -321,4 +321,10 @@ public class TestPlanService {
} }
} }
} }
public List<TestPlan> getTestPlanByTestIds(List<String> planIds) {
TestPlanExample example = new TestPlanExample();
example.createCriteria().andIdIn(planIds);
return testPlanMapper.selectByExample(example);
}
} }

View File

@ -1,9 +1,7 @@
package io.metersphere.track.service; package io.metersphere.track.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.TestPlanTestCaseExample;
import io.metersphere.base.domain.User;
import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanTestCaseStatus; import io.metersphere.commons.constants.TestPlanTestCaseStatus;
@ -13,6 +11,7 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -35,6 +34,9 @@ public class TestPlanTestCaseService {
@Resource @Resource
UserService userService; UserService userService;
@Resource
TestPlanService testPlanService;
@Resource @Resource
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
@ -78,7 +80,16 @@ public class TestPlanTestCaseService {
if (request.getPlanIds().isEmpty()) { if (request.getPlanIds().isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
return extTestPlanTestCaseMapper.getRecentTestedTestCase(request); List<TestPlanCaseDTO> recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request);
List<String> planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList());
Map<String, String> testPlanMap = testPlanService.getTestPlanByTestIds(planIds).stream()
.collect(Collectors.toMap(TestPlan::getId, TestPlan::getName));
recentTestedTestCase.forEach(testCase -> {
testCase.setPlanName(testPlanMap.get(testCase.getPlanId()));
});
return recentTestedTestCase;
} }
public List<TestPlanCaseDTO> getPendingTestCases(QueryTestPlanCaseRequest request, int count) { public List<TestPlanCaseDTO> getPendingTestCases(QueryTestPlanCaseRequest request, int count) {

View File

@ -6,14 +6,7 @@
<related-test-plan-list ref="relatedTestPlanList"/> <related-test-plan-list ref="relatedTestPlanList"/>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="9">
<el-row> <test-case-side-list :title="'最近测试'" ref="testCaseRecentList"/>
<el-col>
<test-case-side-list :title="'最近测试'" :type="'recent'" ref="testCaseRecentList"/>
</el-col>
<el-col>
<test-case-side-list :title="'待完成'" :type="'pending'" ref="testCasePendingList"/>
</el-col>
</el-row>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -37,7 +30,6 @@
innitData() { innitData() {
this.$refs.relatedTestPlanList.initTableData(); this.$refs.relatedTestPlanList.initTableData();
this.$refs.testCaseRecentList.initTableData(); this.$refs.testCaseRecentList.initTableData();
this.$refs.testCasePendingList.initTableData();
} }
} }
} }

View File

@ -39,6 +39,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="planName"
:label="$t('test_track.plan.test_plan')">
</el-table-column>
</el-table> </el-table>
</home-base-component> </home-base-component>
@ -60,9 +65,6 @@
} }
}, },
props: { props: {
type: {
type: String
},
title: { title: {
type: String type: String
}, },
@ -72,7 +74,7 @@
}, },
methods: { methods: {
initTableData() { initTableData() {
this.result = this.$post('/test/plan/case/' + this.type + '/5', {}, response => { this.result = this.$post('/test/plan/case/recent/10', {}, response => {
this.tableData = response.data; this.tableData = response.data;
}); });
}, },