fix(测试跟踪): 自定义字段数值型,无法设置空的默认值

--bug=1027324 --user=陈建星 [测试跟踪]github #25007 对接禅道配置解决方案和重复ID字段后,MS能正常同步解决方案和重复ID,但是MS无法正常提交bug了 https://www.tapd.cn/55049933/s/1386688
This commit is contained in:
jianxing 2023-06-27 10:15:29 +08:00 committed by f2c-ci-robot[bot]
parent e901a35105
commit 2969f6f15f
4 changed files with 24 additions and 1 deletions

View File

@ -105,6 +105,10 @@ export function parseCustomField(data, template, rules, oldFields) {
}
}
if (item.type === 'int' && item.defaultValue === null) {
// el-input-number 需要设置成 undefined默认值才能设置为空
item.defaultValue = undefined;
}
customFieldForm[item.name] = item.defaultValue;
});
@ -210,6 +214,10 @@ export function parseCustomFieldForId(data, template, rules, oldFields) {
}
}
if (item.type === 'int' && item.defaultValue === null) {
// el-input-number 需要设置成 undefined默认值才能设置为空
item.defaultValue = undefined;
}
customFieldForm[item.id] = item.defaultValue;
});

View File

@ -535,7 +535,12 @@ export function getCustomFieldValue(row, field, members) {
for (let i = 0; i < row.fields.length; i++) {
let item = row.fields[i];
if (item.id === field.id) {
if (!item.value) return '';
if (item.value === 0) {
return '0';
}
if (!item.value) {
return '';
}
if (item.textValue && item.textValue.startsWith(OPTION_LABEL_PREFIX) && field.options) {
// 处理 jira 远程搜索字段

View File

@ -208,6 +208,10 @@ export default {
} else if (item.type === 'checkbox') {
item.defaultValue = [];
}
if (item.type === 'int' && item.defaultValue === null) {
// el-input-number undefined
item.defaultValue = undefined;
}
this.templateContainIds.add(item.fieldId);
});
this.$refs.customFieldFormList.refreshTable();

View File

@ -175,6 +175,9 @@ public class IssuesService {
JSON.parseObject(JSON.toJSONString(issuesRequest), PlatformIssuesUpdateRequest.class);
List<PlatformCustomFieldItemDTO> customFieldItemDTOS =
JSON.parseArray(JSON.toJSONString(issuesRequest.getRequestFields()), PlatformCustomFieldItemDTO.class);
customFieldItemDTOS = customFieldItemDTOS.stream()
.filter(item -> item != null && item.getValue() != null)
.toList();
platformIssuesUpdateRequest.setCustomFieldList(customFieldItemDTOS); // todo 全部插件化后去掉
platformIssuesUpdateRequest.setUserPlatformUserConfig(userService.getCurrentPlatformInfoStr(SessionUtils.getCurrentWorkspaceId()));
platformIssuesUpdateRequest.setProjectConfig(PlatformPluginService.getCompatibleProjectConfig(project));
@ -381,6 +384,9 @@ public class IssuesService {
}
List<PlatformCustomFieldItemDTO> customFieldItemDTOS = JSON.parseArray(JSON.toJSONString(issuesRequest.getRequestFields()), PlatformCustomFieldItemDTO.class);
customFieldItemDTOS = customFieldItemDTOS.stream()
.filter(item -> item != null && item.getValue() != null)
.toList();
platformIssuesUpdateRequest.setCustomFieldList(customFieldItemDTOS); // todo 全部插件化后去掉
platformIssuesUpdateRequest.setUserPlatformUserConfig(userService.getCurrentPlatformInfoStr(SessionUtils.getCurrentWorkspaceId()));
platformIssuesUpdateRequest.setProjectConfig(PlatformPluginService.getCompatibleProjectConfig(project));