From d4e1ffb578158269f46e00bf87ea269c5a0d3894 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 22 Apr 2021 18:18:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BC=96=E8=BE=91=E6=A8=A1=E6=9D=BF-?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CustomFieldController.java | 4 ++-- .../metersphere/service/CustomFieldService.java | 3 ++- .../metersphere/track/service/IssuesService.java | 2 +- .../workspace/template/CustomFieldEdit.vue | 14 ++++++++++++-- .../workspace/template/FieldTemplateEdit.vue | 15 ++++++++++++++- .../workspace/template/IssuesTemplateList.vue | 1 + 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/CustomFieldController.java b/backend/src/main/java/io/metersphere/controller/CustomFieldController.java index bce44eed17..2dbbc238ec 100644 --- a/backend/src/main/java/io/metersphere/controller/CustomFieldController.java +++ b/backend/src/main/java/io/metersphere/controller/CustomFieldController.java @@ -24,8 +24,8 @@ public class CustomFieldController { private CustomFieldService customFieldService; @PostMapping("/add") - public void add(@RequestBody CustomField customField) { - customFieldService.add(customField); + public String add(@RequestBody CustomField customField) { + return customFieldService.add(customField); } @PostMapping("/list/{goPage}/{pageSize}") diff --git a/backend/src/main/java/io/metersphere/service/CustomFieldService.java b/backend/src/main/java/io/metersphere/service/CustomFieldService.java index c41d83b1be..bb4ce16b36 100644 --- a/backend/src/main/java/io/metersphere/service/CustomFieldService.java +++ b/backend/src/main/java/io/metersphere/service/CustomFieldService.java @@ -48,13 +48,14 @@ public class CustomFieldService { @Resource CustomFieldTemplateService customFieldTemplateService; - public void add(CustomField customField) { + public String add(CustomField customField) { checkExist(customField); customField.setId(UUID.randomUUID().toString()); customField.setCreateTime(System.currentTimeMillis()); customField.setUpdateTime(System.currentTimeMillis()); customField.setGlobal(false); customFieldMapper.insert(customField); + return customField.getId(); } /** diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index f79065bead..1afdab5c94 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -110,7 +110,7 @@ public class IssuesService { } if (CollectionUtils.isEmpty(platforms)) { - platforms.add("LOCAL"); + platforms.add(IssuesManagePlatform.Local.toString()); } IssuesRequest issuesRequest = new IssuesRequest(); issuesRequest.setTestCaseId(updateRequest.getTestCaseId()); diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue index 34f667bf07..8fc386896b 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue @@ -4,6 +4,7 @@ :visible.sync="visible" @confirm="save" :title="'创建字段'" + append-to-body ref="msEditDialog"> @@ -17,7 +18,7 @@ - + { + this.result = this.$post(this.url, param, (response) => { this.visible = false; + param.id = response.data; this.$success(this.$t('commons.save_success')); this.$emit('refresh'); + this.$emit('save', param); }); } }); diff --git a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue index 5bf6e9e13f..c9730d3a33 100644 --- a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue @@ -34,7 +34,7 @@ 添加字段 - 设置自定义字段 + 设置自定义字段 @@ -56,6 +56,8 @@ :scene="scene" ref="customFieldRelateList"/> + + @@ -71,10 +73,12 @@ import MsFormDivider from "@/business/components/common/components/MsFormDivider import CustomFieldFormList from "@/business/components/settings/workspace/template/CustomFieldFormList"; import CustomFieldRelateList from "@/business/components/settings/workspace/template/CustomFieldRelateList"; import {getCurrentWorkspaceId} from "@/common/js/utils"; +import CustomFieldEdit from "@/business/components/settings/workspace/template/CustomFieldEdit"; export default { name: "FieldTemplateEdit", components: { + CustomFieldEdit, CustomFieldRelateList, CustomFieldFormList, MsFormDivider, @@ -151,9 +155,18 @@ export default { } }); }, + handleCustomFieldAdd(data) { + this.templateContainIds.add(data.id); + data.fieldId = data.id; + data.id = null; + this.relateFields.push(data); + }, relateField() { this.$refs.customFieldRelateList.open(); }, + addField() { + this.$refs.customFieldEdit.open(); + }, getRelateFields() { let condition = {}; condition.templateId = this.form.id; diff --git a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue index e38900ca4d..d415c35bf9 100644 --- a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue +++ b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue @@ -103,6 +103,7 @@ export default { issuePlatformMap:{ metersphere: 'Metersphere', jira: 'JIRA', + Tapd: 'Tapd', zentao: '禅道', }, operators: [