fix(测试跟踪): 测试计划执行样式优化

--story=1008184 --user=陈建星 测试计划优化 https://www.tapd.cn/55049933/s/1204407
This commit is contained in:
chenjianxing 2022-07-19 16:24:15 +08:00 committed by jianxing
parent dd3b126381
commit 14c21e4896
8 changed files with 86 additions and 34 deletions

View File

@ -369,14 +369,12 @@
test_plan_test_case.id as id,
test_plan_test_case.*,
test_case.*,
if(pa.type_value = 'false', cast(test_case.num as char), test_case.custom_num) as customNum,
test_case_node.name as model,
project.name as projectName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
inner join project_application pa on project.id = pa.project_id and pa.type = 'CASE_CUSTOM_NUM'
where test_plan_test_case.id = #{testPlanTestCaseId}
</select>

View File

@ -372,22 +372,38 @@ public class ServiceUtils {
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
Map<String, String> customNumMap = projectApplicationService.getCustomNumMapByProjectIds(projectIds);
list.forEach(i -> {
Class<?> clazz = i.getClass();
try {
Method setIsCustomNum = clazz.getMethod("setCustomNum", String.class);
Method getNum = clazz.getMethod("getNum");
Method getProjectId = clazz.getMethod("getProjectId");
Object projectId = getProjectId.invoke(i);
String isCustomNum = customNumMap.get(projectId);
if (isCustomNum == null) {
setIsCustomNum.invoke(i, String.valueOf(getNum.invoke(i)));
}
} catch (Exception e) {
LogUtil.error(e);
}
buildCustomNumInfo(customNumMap, i);
});
}
public static void buildCustomNumInfo(Object data) {
try {
Method getProjectId = data.getClass().getMethod("getProjectId");
String projectId = getProjectId.invoke(data).toString();
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
Map<String, String> customNumMap = projectApplicationService.getCustomNumMapByProjectIds(Arrays.asList(projectId));
buildCustomNumInfo(customNumMap, data);
} catch (Exception e) {
LogUtil.error(e);
}
}
private static void buildCustomNumInfo(Map<String, String> customNumMap, Object data) {
Class<?> clazz = data.getClass();
try {
Method setIsCustomNum = clazz.getMethod("setCustomNum", String.class);
Method getNum = clazz.getMethod("getNum");
Method getProjectId = clazz.getMethod("getProjectId");
Object projectId = getProjectId.invoke(data);
String isCustomNum = customNumMap.get(projectId);
if (isCustomNum == null) {
setIsCustomNum.invoke(data, String.valueOf(getNum.invoke(data)));
}
} catch (Exception e) {
LogUtil.error(e);
}
}
private static List<String> getFieldListByMethod(List<?> list, String field) {
return list.stream()
.map(i -> {

View File

@ -248,8 +248,9 @@ public class TestPlanTestCaseService {
request.setExecutor(user.getId());
}
public TestPlanCaseDTO get(String testplanTestCaseId) {
TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(testplanTestCaseId);
public TestPlanCaseDTO get(String id) {
TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(id);
ServiceUtils.buildCustomNumInfo(testPlanCaseDTO);
List<TestCaseTestDTO> testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testPlanCaseDTO.getCaseId());
testCaseTestDTOS.forEach(dto -> {
setTestName(dto);

View File

@ -599,4 +599,8 @@ p {
/deep/ .el-drawer__body {
overflow: unset;
}
.comment-card >>> .executeCard {
margin-bottom: 5px;
}
</style>

View File

@ -1,21 +1,26 @@
<template>
<el-form class="comment-form clearfix">
<el-form-item
:label="'评论'">
<ms-mark-down-text
default-open="edit"
prop="comment"
custom-min-height="100"
:class="{inputWarning: inputWarning}"
:data="data"
:toolbars="toolbars"
ref="md"/>
<el-form-item>
<template v-slot:label>
<div class="icon-title">
{{ userName.substring(0, 1) }}
</div>
</template>
<ms-mark-down-text
default-open="edit"
prop="comment"
custom-min-height="100"
:class="{inputWarning: inputWarning}"
:data="data"
:toolbars="toolbars"
ref="md"/>
</el-form-item>
</el-form>
</template>
<script>
import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText";
import {getCurrentUser} from "@/common/js/utils";
export default {
name: "TestPlanCommentInput",
components: {MsMarkDownText},
@ -41,6 +46,11 @@ export default {
}
}
},
computed: {
userName() {
return getCurrentUser().name;
}
},
data() {
return {
toolbars: {
@ -98,8 +108,28 @@ export default {
margin-top: 100px;
}
.inputWarning {
-webkit-box-shadow: 0 0 8px rgb(205,51,43) !important;
.inputWarning >>> .v-note-panel {
-webkit-box-shadow: 1px 1px 5px rgb(205,51,43) !important;
}
.comment-form >>> .v-note-wrapper .v-note-panel {
border: #EBEEF5 solid 2px !important;
}
.comment-form >>> .v-note-wrapper {
position: initial;
box-shadow: 0px 0px 0px 0px !important;
}
.icon-title {
color: #fff;
width: 30px;
background-color: #72dc91;
height: 30px;
line-height: 30px;
text-align: center;
border-radius: 30px;
font-size: 14px;
margin-top: 5px;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<el-card>
<el-card class="executeCard">
<test-plan-test-case-status-button class="status-button"
@statusChange="statusChange"
:is-read-only="statusReadOnly"
@ -48,9 +48,8 @@ export default {
</script>
<style scoped>
.status-button {
padding-left: 4%;
padding-right: 4%;
.status-button >>> .el-col {
padding-right: 0px !important;
}
.status-button {

View File

@ -1,5 +1,5 @@
<template>
<el-card>
<el-card class="executeCard">
<div class="status-bnt">
<el-button type="success" size="mini"
:disabled="isReadOnly" :icon="testCase.reviewStatus === 'Pass' ? 'el-icon-check' : ''"

View File

@ -547,4 +547,8 @@ export default {
/deep/ .el-drawer__body {
overflow: unset;
}
.comment-card >>> .executeCard {
margin-bottom: 5px;
}
</style>