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.id as id,
test_plan_test_case.*, test_plan_test_case.*,
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, test_case_node.name as model,
project.name as projectName project.name as projectName
from test_plan_test_case from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id 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 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 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} where test_plan_test_case.id = #{testPlanTestCaseId}
</select> </select>

View File

@ -372,22 +372,38 @@ public class ServiceUtils {
ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class); ProjectApplicationService projectApplicationService = CommonBeanFactory.getBean(ProjectApplicationService.class);
Map<String, String> customNumMap = projectApplicationService.getCustomNumMapByProjectIds(projectIds); Map<String, String> customNumMap = projectApplicationService.getCustomNumMapByProjectIds(projectIds);
list.forEach(i -> { list.forEach(i -> {
Class<?> clazz = i.getClass(); buildCustomNumInfo(customNumMap, i);
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);
}
}); });
} }
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) { private static List<String> getFieldListByMethod(List<?> list, String field) {
return list.stream() return list.stream()
.map(i -> { .map(i -> {

View File

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

View File

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

View File

@ -1,21 +1,26 @@
<template> <template>
<el-form class="comment-form clearfix"> <el-form class="comment-form clearfix">
<el-form-item <el-form-item>
:label="'评论'"> <template v-slot:label>
<ms-mark-down-text <div class="icon-title">
default-open="edit" {{ userName.substring(0, 1) }}
prop="comment" </div>
custom-min-height="100" </template>
:class="{inputWarning: inputWarning}" <ms-mark-down-text
:data="data" default-open="edit"
:toolbars="toolbars" prop="comment"
ref="md"/> custom-min-height="100"
:class="{inputWarning: inputWarning}"
:data="data"
:toolbars="toolbars"
ref="md"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<script> <script>
import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText"; import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText";
import {getCurrentUser} from "@/common/js/utils";
export default { export default {
name: "TestPlanCommentInput", name: "TestPlanCommentInput",
components: {MsMarkDownText}, components: {MsMarkDownText},
@ -41,6 +46,11 @@ export default {
} }
} }
}, },
computed: {
userName() {
return getCurrentUser().name;
}
},
data() { data() {
return { return {
toolbars: { toolbars: {
@ -98,8 +108,28 @@ export default {
margin-top: 100px; margin-top: 100px;
} }
.inputWarning { .inputWarning >>> .v-note-panel {
-webkit-box-shadow: 0 0 8px rgb(205,51,43) !important; -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> </style>

View File

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

View File

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

View File

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