From 2969f6f15f0bb7059e58e4c59bb3e9104488537b Mon Sep 17 00:00:00 2001 From: jianxing Date: Tue, 27 Jun 2023 10:15:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E6=97=A0=E6=B3=95=E8=AE=BE=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1027324 --user=陈建星 [测试跟踪]github #25007 对接禅道配置解决方案和重复ID字段后,MS能正常同步解决方案和重复ID,但是MS无法正常提交bug了 https://www.tapd.cn/55049933/s/1386688 --- framework/sdk-parent/frontend/src/utils/custom_field.js | 8 ++++++++ framework/sdk-parent/frontend/src/utils/tableUtils.js | 7 ++++++- .../src/business/menu/template/FieldTemplateEdit.vue | 4 ++++ .../main/java/io/metersphere/service/IssuesService.java | 6 ++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/framework/sdk-parent/frontend/src/utils/custom_field.js b/framework/sdk-parent/frontend/src/utils/custom_field.js index 807efca394..cb2460c22b 100644 --- a/framework/sdk-parent/frontend/src/utils/custom_field.js +++ b/framework/sdk-parent/frontend/src/utils/custom_field.js @@ -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; }); diff --git a/framework/sdk-parent/frontend/src/utils/tableUtils.js b/framework/sdk-parent/frontend/src/utils/tableUtils.js index 452ef7145a..f0bb4e070a 100644 --- a/framework/sdk-parent/frontend/src/utils/tableUtils.js +++ b/framework/sdk-parent/frontend/src/utils/tableUtils.js @@ -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 远程搜索字段 diff --git a/project-management/frontend/src/business/menu/template/FieldTemplateEdit.vue b/project-management/frontend/src/business/menu/template/FieldTemplateEdit.vue index 68aebdadf7..eb7086d2da 100644 --- a/project-management/frontend/src/business/menu/template/FieldTemplateEdit.vue +++ b/project-management/frontend/src/business/menu/template/FieldTemplateEdit.vue @@ -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(); diff --git a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java index f839aea39a..ad897f9806 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/IssuesService.java @@ -175,6 +175,9 @@ public class IssuesService { JSON.parseObject(JSON.toJSONString(issuesRequest), PlatformIssuesUpdateRequest.class); List 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 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));