From a628ea36b4e0b8959de3e52cd8a96bb114f3abd5 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 14 Dec 2021 12:37:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20jira=E6=A8=A1=E6=9D=BF=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ext/ExtCustomFieldTemplateMapper.java | 3 ++ .../ext/ExtCustomFieldTemplateMapper.xml | 12 ++++++ .../service/CustomFieldTemplateService.java | 5 +++ .../track/service/IssuesService.java | 7 +++- backend/src/main/java/io/metersphere/xpack | 2 +- .../template/CustomFiledComponent.vue | 13 +----- .../track/issue/IssueEditDetail.vue | 40 ++++++++++--------- frontend/src/common/js/custom_field.js | 1 + 8 files changed, 50 insertions(+), 33 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.java index 117453706e..af2697c45e 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.java @@ -1,6 +1,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.base.domain.CustomFieldTemplate; +import io.metersphere.dto.CustomFieldDao; import io.metersphere.dto.CustomFieldTemplateDao; import org.apache.ibatis.annotations.Param; @@ -10,4 +11,6 @@ public interface ExtCustomFieldTemplateMapper { List getCustomFieldIds(@Param("templateId") String templateId); List list(@Param("request") CustomFieldTemplate request); + + List lisSimple(@Param("request") CustomFieldTemplate request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.xml index e9400677ab..8739a7a80f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtCustomFieldTemplateMapper.xml @@ -19,4 +19,16 @@ where cft.template_id = #{request.templateId} + diff --git a/backend/src/main/java/io/metersphere/service/CustomFieldTemplateService.java b/backend/src/main/java/io/metersphere/service/CustomFieldTemplateService.java index ad3eac645e..c4f6cf5585 100644 --- a/backend/src/main/java/io/metersphere/service/CustomFieldTemplateService.java +++ b/backend/src/main/java/io/metersphere/service/CustomFieldTemplateService.java @@ -7,6 +7,7 @@ import io.metersphere.base.domain.CustomFieldTemplateExample; import io.metersphere.base.mapper.CustomFieldMapper; import io.metersphere.base.mapper.CustomFieldTemplateMapper; import io.metersphere.base.mapper.ext.ExtCustomFieldTemplateMapper; +import io.metersphere.dto.CustomFieldDao; import io.metersphere.dto.CustomFieldTemplateDao; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -51,6 +52,10 @@ public class CustomFieldTemplateService { return extCustomFieldTemplateMapper.list(request); } + public List lisSimple(CustomFieldTemplate request) { + return extCustomFieldTemplateMapper.lisSimple(request); + } + public void deleteByTemplateId(String templateId) { if (StringUtils.isNotBlank(templateId)) { CustomFieldTemplateExample example = new CustomFieldTemplateExample(); 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 bc96fee8e8..0c15cd1dad 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -13,7 +13,7 @@ import io.metersphere.commons.constants.IssuesStatus; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.*; import io.metersphere.controller.request.IntegrationRequest; -import io.metersphere.dto.CustomFieldTemplateDao; +import io.metersphere.dto.CustomFieldDao; import io.metersphere.dto.IssueTemplateDao; import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; @@ -476,8 +476,11 @@ public class IssuesService { IssueTemplateDao template = issueTemplateService.getTemplate(projectId); CustomFieldTemplate request = new CustomFieldTemplate(); request.setTemplateId(template.getId()); - List customFields = customFieldTemplateService.list(request); + List customFields = customFieldTemplateService.lisSimple(request); + return getCustomFieldsValuesString(customFields); + } + public String getCustomFieldsValuesString(List customFields) { JSONArray fields = new JSONArray(); customFields.forEach(item -> { JSONObject field = new JSONObject(true); diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index cf8337c9a6..a41ba52f54 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit cf8337c9a6341d8c9eb7f5c9bef897083b0d2951 +Subproject commit a41ba52f5495bc68f84a07643442d2b0e9524786 diff --git a/frontend/src/business/components/settings/workspace/template/CustomFiledComponent.vue b/frontend/src/business/components/settings/workspace/template/CustomFiledComponent.vue index 56ed29a447..7febad269f 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFiledComponent.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFiledComponent.vue @@ -18,6 +18,7 @@ v-else-if="data.type === 'cascadingSelect'" expand-trigger="hover" @change="handleChange" + :props="{label: 'text'}" :options="data.options" v-model="data[prop]"> @@ -128,9 +129,6 @@ export default { memberOptions: [], }; }, - created() { - this.initOption(this.data.options); - }, mounted() { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.memberOptions = response.data; @@ -145,15 +143,6 @@ export default { this.$set(this.form, this.data.name, this.data[this.prop]); } }, - initOption(options) { - if (options) { - options.forEach(i => { - i.label = i.text; - this.$set(i, 'label', i.text); - this.initOption(i.children); - }); - } - } } }; diff --git a/frontend/src/business/components/track/issue/IssueEditDetail.vue b/frontend/src/business/components/track/issue/IssueEditDetail.vue index 168b826721..0777c8481b 100644 --- a/frontend/src/business/components/track/issue/IssueEditDetail.vue +++ b/frontend/src/business/components/track/issue/IssueEditDetail.vue @@ -179,24 +179,22 @@ export default { }, methods: { open(data) { - let initAddFuc = this.initEdit; - getCurrentProject((responseData) => { - this.currentProject = responseData; - if (hasLicense() && this.currentProject && this.currentProject.thirdPartTemplate && this.currentProject.platform === JIRA) { - getIssueThirdPartTemplate() - .then((template) => { - this.issueTemplate = template; - this.getThirdPartyInfo(); - initAddFuc(data); - }); - } else { - getIssueTemplate() - .then((template) => { - this.issueTemplate = template; - this.getThirdPartyInfo(); - initAddFuc(data); - }); - } + this.result.loading = true; + this.$nextTick(() => { + getCurrentProject((responseData) => { + this.currentProject = responseData; + if (hasLicense() && this.currentProject && this.currentProject.thirdPartTemplate && this.currentProject.platform === JIRA) { + getIssueThirdPartTemplate() + .then((template) => { + this.init(template, data); + }); + } else { + getIssueTemplate() + .then((template) => { + this.init(template, data); + }); + } + }); }); if(data&&data.id){ @@ -216,6 +214,12 @@ export default { currentUser: () => { return getCurrentUser(); }, + init(template, data) { + this.issueTemplate = template; + this.getThirdPartyInfo(); + this.initEdit(data); + this.result.loading = false; + }, getThirdPartyInfo() { let platform = this.issueTemplate.platform; if (platform === 'Zentao') { diff --git a/frontend/src/common/js/custom_field.js b/frontend/src/common/js/custom_field.js index a0d0bdba38..a6854039b3 100644 --- a/frontend/src/common/js/custom_field.js +++ b/frontend/src/common/js/custom_field.js @@ -117,6 +117,7 @@ export function buildCustomFields(data, param, template) { hasField = true; customFields[index].name = item.name; customFields[index].value = item.defaultValue; + customFields[index].type = item.type; break; } }