fix(测试跟踪): 测试计划功能用例不展示自定义字段

--bug=1016573 --user=陈建星 【测试跟踪】github #17657,功能用例自定义字段已经输入值并保存,在任务计划中关联用例后自定义字段值消失 https://www.tapd.cn/55049933/s/1239713
This commit is contained in:
AnAngle 2022-09-07 11:26:56 +08:00 committed by jianxing
parent 1a017e8274
commit 1acb119ddf
4 changed files with 19 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.track.dto;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.dto.CustomFieldDao;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@ -28,4 +29,5 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private List<TestCaseTestDTO> list;
private List<IssuesDao> issueList;
private List<CustomFieldDao> fields;
}

View File

@ -754,8 +754,13 @@ public class TestCaseService {
}
private void buildCustomField(TestCaseDTO data) {
List<CustomFieldDao> fields = getCustomFiledById(data.getId());
data.setFields(fields);
}
public List<CustomFieldDao> getCustomFiledById(String id) {
CustomFieldTestCaseExample example = new CustomFieldTestCaseExample();
example.createCriteria().andResourceIdEqualTo(data.getId());
example.createCriteria().andResourceIdEqualTo(id);
List<CustomFieldTestCase> customFieldTestCases = customFieldTestCaseMapper.selectByExampleWithBLOBs(example);
List<CustomFieldDao> fields = new ArrayList<>();
customFieldTestCases.forEach(i -> {
@ -765,7 +770,7 @@ public class TestCaseService {
customFieldDao.setTextValue(i.getTextValue());
fields.add(customFieldDao);
});
data.setFields(fields);
return fields;
}
private void buildProjectInfoWidthoutProject(List<TestCaseDTO> resList) {

View File

@ -14,6 +14,7 @@ import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
@ -275,6 +276,8 @@ public class TestPlanTestCaseService {
testCaseTestDTOS.forEach(dto -> {
setTestName(dto);
});
List<CustomFieldDao> fields = testCaseService.getCustomFiledById(testPlanCaseDTO.getCaseId());
testPlanCaseDTO.setFields(fields);
testPlanCaseDTO.setList(testCaseTestDTOS);
return testPlanCaseDTO;
}

View File

@ -417,6 +417,13 @@ export default {
this.testCase = item;
this.originalStatus = this.testCase.status;
parseCustomField(this.testCase, this.testCaseTemplate, null, buildTestCaseOldFields(this.testCase));
this.testCaseTemplate.customFields.forEach(item => {
try {
item.defaultValue = JSON.parse(item.defaultValue);
} catch (e) {
// nothing
}
});
this.isCustomFiledActive = true;
if (!this.testCase.actualResult) {
// ,使