From 5800b41ba218a84da25047878973be58aa4bebaf Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 18 Aug 2021 18:25:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8F=91=E9=80=81=E7=AB=99?= =?UTF-8?q?=E5=86=85=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/constants/NoticeConstants.java | 1 + .../notice/sender/AbstractNoticeSender.java | 30 ++-- .../sender/impl/InSiteNoticeSender.java | 37 ++++ .../notice/service/NoticeSendService.java | 60 ++----- .../organization/TaskNotification.vue | 46 +++-- .../api/ApiAutomationNotification.vue | 9 +- .../api/ApiDefinitionNotification.vue | 9 +- .../components/api/ApiHomeNotification.vue | 9 +- .../components/api/ApiReportNotification.vue | 9 +- .../jenkins/JenkinsNotification.vue | 9 +- .../PerformanceReportNotification.vue | 9 +- .../PerformanceTestNotification.vue | 9 +- .../track/DefectTaskNotification.vue | 10 +- .../components/track/TestCaseNotification.vue | 9 +- .../track/TestPlanTaskNotification.vue | 9 +- .../track/TestReviewNotification.vue | 10 +- .../track/TrackHomeNotification.vue | 159 +++++++++--------- .../track/TrackReportNotification.vue | 9 +- frontend/src/i18n/zh-CN.js | 13 +- 19 files changed, 218 insertions(+), 238 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java diff --git a/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java b/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java index fe99c05bf8..82fd746591 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java +++ b/backend/src/main/java/io/metersphere/commons/constants/NoticeConstants.java @@ -29,6 +29,7 @@ public interface NoticeConstants { String NAIL_ROBOT = "NAIL_ROBOT"; String WECHAT_ROBOT = "WECHAT_ROBOT"; String LARK = "LARK"; + String IN_SITE = "IN_SITE"; } interface Event { diff --git a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java index c010806f88..e9f8b666bd 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java @@ -24,14 +24,14 @@ public abstract class AbstractNoticeSender implements NoticeSender { private UserService userService; protected String getContext(MessageDetail messageDetail, NoticeModel noticeModel) { + + // 处理 userIds 中包含的特殊值 + handleRealUserIds(messageDetail, noticeModel); + // 如果配置了模版就直接使用模版 if (StringUtils.isNotBlank(messageDetail.getTemplate())) { return getContent(messageDetail.getTemplate(), noticeModel.getParamMap()); } - // 处理 userIds 中包含的特殊值 - List realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel, messageDetail.getEvent()); - messageDetail.setUserIds(realUserIds); - // 处理 WeCom Ding context String context = ""; switch (messageDetail.getEvent()) { @@ -54,13 +54,13 @@ public abstract class AbstractNoticeSender implements NoticeSender { } protected String getHtmlContext(MessageDetail messageDetail, NoticeModel noticeModel) { + // 处理 userIds 中包含的特殊值 + handleRealUserIds(messageDetail, noticeModel); + // 如果配置了模版就直接使用模版 if (StringUtils.isNotBlank(messageDetail.getTemplate())) { return getContent(messageDetail.getTemplate(), noticeModel.getParamMap()); } - // 处理 userIds 中包含的特殊值 - List realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel, messageDetail.getEvent()); - messageDetail.setUserIds(realUserIds); // 处理 mail context String context = ""; @@ -96,6 +96,14 @@ public abstract class AbstractNoticeSender implements NoticeSender { return getContent(context, noticeModel.getParamMap()); } + private void handleRealUserIds(MessageDetail messageDetail, NoticeModel noticeModel) { + List realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel, messageDetail.getEvent()); + // 排除自己操作的 + String operator = noticeModel.getOperator(); + realUserIds.remove(operator); + messageDetail.setUserIds(realUserIds); + } + protected String getContent(String template, Map context) { if (MapUtils.isNotEmpty(context)) { for (String k : context.keySet()) { @@ -110,10 +118,6 @@ public abstract class AbstractNoticeSender implements NoticeSender { } protected List getUserPhones(NoticeModel noticeModel, List userIds) { - // 排除自己操作的 - String operator = noticeModel.getOperator(); - userIds.remove(operator); - List list = userService.queryTypeByIds(userIds); List phoneList = new ArrayList<>(); list.forEach(u -> phoneList.add(u.getPhone())); @@ -122,10 +126,6 @@ public abstract class AbstractNoticeSender implements NoticeSender { } protected List getUserEmails(NoticeModel noticeModel, List userIds) { - // 排除自己操作的 - String operator = noticeModel.getOperator(); - userIds.remove(operator); - List list = userService.queryTypeByIds(userIds); List phoneList = new ArrayList<>(); list.forEach(u -> phoneList.add(u.getEmail())); diff --git a/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java new file mode 100644 index 0000000000..184e0fbd04 --- /dev/null +++ b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java @@ -0,0 +1,37 @@ +package io.metersphere.notice.sender.impl; + +import io.metersphere.commons.utils.LogUtil; +import io.metersphere.notice.domain.MessageDetail; +import io.metersphere.notice.sender.AbstractNoticeSender; +import io.metersphere.notice.sender.NoticeModel; +import io.metersphere.notice.service.NotificationService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +@Component +public class InSiteNoticeSender extends AbstractNoticeSender { + + @Resource + private NotificationService notificationService; + + public void sendAnnouncement(MessageDetail messageDetail, NoticeModel noticeModel, String context) { + List userIds = messageDetail.getUserIds(); + if (CollectionUtils.isEmpty(userIds)) { + return; + } + + userIds.forEach(receiver -> { + LogUtil.debug("发送站内通知: {}, 内容: {}", receiver, context); + notificationService.sendAnnouncement(noticeModel.getSubject(), context, receiver); + }); + } + + @Override + public void send(MessageDetail messageDetail, NoticeModel noticeModel) { + String context = super.getContext(messageDetail, noticeModel); + sendAnnouncement(messageDetail, noticeModel, context); + } +} diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java index 0ef42fbdc0..dd31639d2f 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java @@ -1,27 +1,16 @@ package io.metersphere.notice.service; import com.alibaba.nacos.client.utils.StringUtils; -import io.metersphere.base.domain.User; import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.utils.LogUtil; -import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.sender.AbstractNoticeSender; import io.metersphere.notice.sender.NoticeModel; -import io.metersphere.notice.sender.impl.DingNoticeSender; -import io.metersphere.notice.sender.impl.LarkNoticeSender; -import io.metersphere.notice.sender.impl.MailNoticeSender; -import io.metersphere.notice.sender.impl.WeComNoticeSender; -import io.metersphere.service.UserService; -import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang3.RegExUtils; -import org.springframework.scheduling.annotation.Async; +import io.metersphere.notice.sender.impl.*; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.List; -import java.util.Map; @Component public class NoticeSendService { @@ -36,9 +25,8 @@ public class NoticeSendService { @Resource private NoticeService noticeService; @Resource - private NotificationService notificationService; - @Resource - private UserService userService; + private InSiteNoticeSender inSiteNoticeSender; + private AbstractNoticeSender getNoticeSender(MessageDetail messageDetail) { AbstractNoticeSender noticeSender = null; @@ -54,6 +42,10 @@ public class NoticeSendService { break; case NoticeConstants.Type.LARK: noticeSender = larkNoticeSender; + break; + case NoticeConstants.Type.IN_SITE: + noticeSender = inSiteNoticeSender; + break; default: break; } @@ -76,46 +68,16 @@ public class NoticeSendService { messageDetails = noticeService.searchMessageByType(taskType); break; } - QueryOrgMemberRequest request = new QueryOrgMemberRequest(); - request.setOrganizationId(SessionUtils.getCurrentOrganizationId()); - List orgAllMember = userService.getOrgAllMember(request); - - // 异步发送实体通知 + // 异步发送通知 messageDetails.stream() .filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) - .forEach(messageDetail -> this.getNoticeSender(messageDetail).send(messageDetail, noticeModel)); + .forEach(messageDetail -> { + this.getNoticeSender(messageDetail).send(messageDetail, noticeModel); + }); - // 异步发送站内通知 - sendAnnouncement(noticeModel, orgAllMember); } catch (Exception e) { LogUtil.error(e.getMessage(), e); } } - - @Async - public void sendAnnouncement(NoticeModel noticeModel, List orgAllMember) { - // 替换变量 - noticeModel.setContext(getContent(noticeModel)); - orgAllMember.forEach(receiver -> { - String context = noticeModel.getContext(); - LogUtil.debug("发送站内通知: {}, 内容: {}", receiver.getName(), context); - notificationService.sendAnnouncement(noticeModel.getSubject(), context, receiver.getId()); - }); - } - - private String getContent(NoticeModel noticeModel) { - String template = noticeModel.getContext(); - Map paramMap = noticeModel.getParamMap(); - if (MapUtils.isNotEmpty(paramMap)) { - for (String k : paramMap.keySet()) { - if (paramMap.get(k) != null) { - template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", paramMap.get(k).toString()); - } else { - template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", ""); - } - } - } - return template; - } } diff --git a/frontend/src/business/components/settings/organization/TaskNotification.vue b/frontend/src/business/components/settings/organization/TaskNotification.vue index 74ced0f4c9..0c2e37d487 100644 --- a/frontend/src/business/components/settings/organization/TaskNotification.vue +++ b/frontend/src/business/components/settings/organization/TaskNotification.vue @@ -15,12 +15,18 @@ 通知数: {{ trackNoticeSize }} - - - - - - + + + + + + - - - - + + + + - - + + - + @@ -119,6 +132,13 @@ export default { reviewReceiverOptions: [], //缺陷 defectReceiverOptions: [], + receiveTypeOptions: [ + {value: 'IN_SITE', label: this.$t('organization.message.in_site')}, + {value: 'EMAIL', label: this.$t('organization.message.mail')}, + {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, + {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, + {value: 'LARK', label: this.$t('organization.message.lark')} + ], result: {} }; }, diff --git a/frontend/src/business/components/settings/organization/components/api/ApiAutomationNotification.vue b/frontend/src/business/components/settings/organization/components/api/ApiAutomationNotification.vue index d073e32dd9..59ff2694c8 100644 --- a/frontend/src/business/components/settings/organization/components/api/ApiAutomationNotification.vue +++ b/frontend/src/business/components/settings/organization/components/api/ApiAutomationNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -193,12 +196,6 @@ export default { {value: 'UPDATE', label: this.$t('commons.update')}, {value: 'DELETE', label: this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/api/ApiDefinitionNotification.vue b/frontend/src/business/components/settings/organization/components/api/ApiDefinitionNotification.vue index fe8eb1cb00..c421b4432f 100644 --- a/frontend/src/business/components/settings/organization/components/api/ApiDefinitionNotification.vue +++ b/frontend/src/business/components/settings/organization/components/api/ApiDefinitionNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -196,12 +199,6 @@ export default { {value: 'CASE_UPDATE', label: 'CASE ' + this.$t('commons.update')}, {value: 'CASE_DELETE', label: 'CASE ' + this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/api/ApiHomeNotification.vue b/frontend/src/business/components/settings/organization/components/api/ApiHomeNotification.vue index 2fc35a891f..d2a414bac0 100644 --- a/frontend/src/business/components/settings/organization/components/api/ApiHomeNotification.vue +++ b/frontend/src/business/components/settings/organization/components/api/ApiHomeNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -191,12 +194,6 @@ export default { eventOptions: [ {value: 'CLOSE_SCHEDULE', label: '关闭定时任务'}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, activated() { diff --git a/frontend/src/business/components/settings/organization/components/api/ApiReportNotification.vue b/frontend/src/business/components/settings/organization/components/api/ApiReportNotification.vue index 2ba6a99473..fa08e5b3e1 100644 --- a/frontend/src/business/components/settings/organization/components/api/ApiReportNotification.vue +++ b/frontend/src/business/components/settings/organization/components/api/ApiReportNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -191,12 +194,6 @@ export default { eventOptions: [ {value: 'DELETE', label: this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/jenkins/JenkinsNotification.vue b/frontend/src/business/components/settings/organization/components/jenkins/JenkinsNotification.vue index 5f20885c49..36c7effd28 100644 --- a/frontend/src/business/components/settings/organization/components/jenkins/JenkinsNotification.vue +++ b/frontend/src/business/components/settings/organization/components/jenkins/JenkinsNotification.vue @@ -163,6 +163,9 @@ export default { props: { jenkinsReceiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -216,12 +219,6 @@ export default { {value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')}, {value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')} ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, activated() { diff --git a/frontend/src/business/components/settings/organization/components/performance/PerformanceReportNotification.vue b/frontend/src/business/components/settings/organization/components/performance/PerformanceReportNotification.vue index c6fabec6c1..6b1d0a1f11 100644 --- a/frontend/src/business/components/settings/organization/components/performance/PerformanceReportNotification.vue +++ b/frontend/src/business/components/settings/organization/components/performance/PerformanceReportNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -191,12 +194,6 @@ export default { eventOptions: [ {value: 'DELETE', label: this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/performance/PerformanceTestNotification.vue b/frontend/src/business/components/settings/organization/components/performance/PerformanceTestNotification.vue index 0f17f12eae..87e933f551 100644 --- a/frontend/src/business/components/settings/organization/components/performance/PerformanceTestNotification.vue +++ b/frontend/src/business/components/settings/organization/components/performance/PerformanceTestNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -193,12 +196,6 @@ export default { {value: 'UPDATE', label: this.$t('commons.update')}, {value: 'DELETE', label: this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/track/DefectTaskNotification.vue b/frontend/src/business/components/settings/organization/components/track/DefectTaskNotification.vue index 129d5bbb5f..517b8578ef 100644 --- a/frontend/src/business/components/settings/organization/components/track/DefectTaskNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/DefectTaskNotification.vue @@ -160,6 +160,9 @@ export default { props: { defectReceiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -194,13 +197,6 @@ export default { {value: 'DELETE', label: this.$t('commons.delete')}, {value: 'STATUS_CHANGE', label: '状态变更'}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/track/TestCaseNotification.vue b/frontend/src/business/components/settings/organization/components/track/TestCaseNotification.vue index d2c57c7b9c..a77fdf9a69 100644 --- a/frontend/src/business/components/settings/organization/components/track/TestCaseNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/TestCaseNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -194,12 +197,6 @@ export default { {value: 'DELETE', label: this.$t('commons.delete')}, {value: 'COMMENT', label: this.$t('commons.comment')} ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/track/TestPlanTaskNotification.vue b/frontend/src/business/components/settings/organization/components/track/TestPlanTaskNotification.vue index 121135177b..7086a62d94 100644 --- a/frontend/src/business/components/settings/organization/components/track/TestPlanTaskNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/TestPlanTaskNotification.vue @@ -159,6 +159,9 @@ export default { props: { testPlanReceiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -203,12 +206,6 @@ export default { // {value: 'SUCCESS_ONE_BY_ONE', label: '逐条成功(接口)'}, // {value: 'FAIL_ONE_BY_ONE', label: '逐条失败(接口)'}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/track/TestReviewNotification.vue b/frontend/src/business/components/settings/organization/components/track/TestReviewNotification.vue index da31611e17..fd1b049b88 100644 --- a/frontend/src/business/components/settings/organization/components/track/TestReviewNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/TestReviewNotification.vue @@ -159,6 +159,9 @@ export default { props: { reviewReceiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -201,13 +204,6 @@ export default { {value: 'COMMENT', label: this.$t('commons.comment')}, {value: 'COMPLETE', label: '评审完成'} ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - - ], }; }, methods: { diff --git a/frontend/src/business/components/settings/organization/components/track/TrackHomeNotification.vue b/frontend/src/business/components/settings/organization/components/track/TrackHomeNotification.vue index 753751c3d9..fafc31afea 100644 --- a/frontend/src/business/components/settings/organization/components/track/TrackHomeNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/TrackHomeNotification.vue @@ -8,21 +8,21 @@ {{ $t('organization.message.create_new_notification') }} + placement="right-end" + title="示例" + width="600" + trigger="click"> {{ $t('organization.message.mail_template_example') }} + placement="right-end" + title="示例" + width="400" + trigger="click" + :content="robotTitle"> {{ $t('organization.message.robot_template') }} @@ -33,11 +33,11 @@ @@ -59,10 +59,10 @@ :placeholder="$t('commons.please_select')" style="width: 100%;" :disabled="!row.isSet"> + v-for="item in row.receiverOptions" + :key="item.id" + :label="item.name" + :value="item.id"> @@ -73,10 +73,10 @@ size="mini" :disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"> + v-for="item in receiveTypeOptions" + :key="item.value" + :label="item.label" + :value="item.value"> @@ -90,48 +90,48 @@ @@ -160,23 +160,26 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { return { modes: ['text', 'html'], title: "\n" + - "\n" + - "\n" + - " \n" + - " MeterSphere\n" + - "\n" + - "\n" + - "
\n" + - "

${operator}关闭了定时任务

\n" + - "
\n" + - "\n" + - "", + "\n" + + "\n" + + " \n" + + " MeterSphere\n" + + "\n" + + "\n" + + "
\n" + + "

${operator}关闭了定时任务

\n" + + "
\n" + + "\n" + + "", robotTitle: "【任务通知】:${operator}发起了一个缺陷:${name},请跟进", defectTask: [{ taskType: "defectTask", @@ -191,12 +194,6 @@ export default { eventOptions: [ {value: 'CLOSE_SCHEDULE', label: '关闭定时任务'}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, activated() { diff --git a/frontend/src/business/components/settings/organization/components/track/TrackReportNotification.vue b/frontend/src/business/components/settings/organization/components/track/TrackReportNotification.vue index b970652f07..da671960a2 100644 --- a/frontend/src/business/components/settings/organization/components/track/TrackReportNotification.vue +++ b/frontend/src/business/components/settings/organization/components/track/TrackReportNotification.vue @@ -160,6 +160,9 @@ export default { props: { receiverOptions: { type: Array + }, + receiveTypeOptions: { + type: Array } }, data() { @@ -191,12 +194,6 @@ export default { eventOptions: [ {value: 'DELETE', label: this.$t('commons.delete')}, ], - receiveTypeOptions: [ - {value: 'EMAIL', label: this.$t('organization.message.mail')}, - {value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')}, - {value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}, - {value: 'LARK', label: this.$t('organization.message.lark')} - ], }; }, diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index af4030ec5f..0d4f952316 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -386,6 +386,7 @@ export default { defect_task_notification: '缺陷任务通知', select_receiving_method: '选择接收方式', mail: '邮件', + in_site: '站内通知', nail_robot: '钉钉机器人', enterprise_wechat_robot: '企业微信机器人', lark: '飞书机器人', @@ -436,12 +437,12 @@ export default { azure_storytype: '需求类型', input_azure_issuetype: '请输入问题类型', input_azure_storytype: '请输入需求类型', - azure_pat:'PersonalAccessTokens', - azure_devops_url:'Azure Devops 地址', - azure_organization_id:'Azure 组织ID', - input_azure_pat:'请输入 Personal Access Token', - input_azure_url:'请输入 Azure Devops 地址', - input_azure_organization_id:'请输入 Azure 组织ID', + azure_pat: 'PersonalAccessTokens', + azure_devops_url: 'Azure Devops 地址', + azure_organization_id: 'Azure 组织ID', + input_azure_pat: '请输入 Personal Access Token', + input_azure_url: '请输入 Azure Devops 地址', + input_azure_organization_id: '请输入 Azure 组织ID', use_tip_azure: 'Azure Devops 地址+令牌(账户设置-个人访问令牌-创建令牌)', } },