fix(测试跟踪): 自定义字段显示问题

story 1004114
This commit is contained in:
shiziyuan9527 2022-05-19 16:53:34 +08:00 committed by 刘瑞斌
parent c1330135f3
commit 0140f07bad
3 changed files with 11 additions and 3 deletions

View File

@ -218,7 +218,9 @@ public class TestCaseService {
testCaseMapper.insert(request);
saveFollows(request.getId(), request.getFollows());
customFieldTestCaseService.addFields(request.getId(), request.getAddFields());
List<CustomFieldResource> addFields = request.getAddFields();
addFields.addAll(request.getEditFields());
customFieldTestCaseService.addFields(request.getId(), addFields);
return request;
}

View File

@ -57,7 +57,7 @@ export default {
let total = 0;//total
let customFields = this.issueTemplate.customFields;
for (let i = 0; total < customFields.length; total++) {
if (customFields[i].type === 'input' && typeof (customFields[i].defaultValue) === 'string' || customFields[i].defaultValue instanceof String) {
if (typeof (customFields[i].defaultValue) === 'string' || customFields[i].defaultValue instanceof String) {
try {
customFields[i].defaultValue = JSON.parse(customFields[i].defaultValue);
} catch (e) {

View File

@ -28,7 +28,13 @@ export function parseCustomField(data, template, rules, oldFields) {
template.customFields.forEach(item => {
if (item.defaultValue && !item.hasParse) {
setDefaultValue(item, JSON.parse(item.defaultValue));
let val = item.defaultValue;
try {
val = JSON.parse(item.defaultValue);
} catch (e) {
//
}
setDefaultValue(item, val);
}
// 添加自定义字段必填校验