refactor: 发送站内通知
This commit is contained in:
parent
51db39b341
commit
5800b41ba2
|
@ -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 {
|
||||
|
|
|
@ -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<String> 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<String> 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<String> realUserIds = getRealUserIds(messageDetail.getUserIds(), noticeModel, messageDetail.getEvent());
|
||||
// 排除自己操作的
|
||||
String operator = noticeModel.getOperator();
|
||||
realUserIds.remove(operator);
|
||||
messageDetail.setUserIds(realUserIds);
|
||||
}
|
||||
|
||||
protected String getContent(String template, Map<String, Object> context) {
|
||||
if (MapUtils.isNotEmpty(context)) {
|
||||
for (String k : context.keySet()) {
|
||||
|
@ -110,10 +118,6 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
|||
}
|
||||
|
||||
protected List<String> getUserPhones(NoticeModel noticeModel, List<String> userIds) {
|
||||
// 排除自己操作的
|
||||
String operator = noticeModel.getOperator();
|
||||
userIds.remove(operator);
|
||||
|
||||
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||
List<String> phoneList = new ArrayList<>();
|
||||
list.forEach(u -> phoneList.add(u.getPhone()));
|
||||
|
@ -122,10 +126,6 @@ public abstract class AbstractNoticeSender implements NoticeSender {
|
|||
}
|
||||
|
||||
protected List<String> getUserEmails(NoticeModel noticeModel, List<String> userIds) {
|
||||
// 排除自己操作的
|
||||
String operator = noticeModel.getOperator();
|
||||
userIds.remove(operator);
|
||||
|
||||
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||
List<String> phoneList = new ArrayList<>();
|
||||
list.forEach(u -> phoneList.add(u.getEmail()));
|
||||
|
|
|
@ -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<String> 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);
|
||||
}
|
||||
}
|
|
@ -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<User> 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<User> 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<String, Object> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,18 @@
|
|||
</span>
|
||||
<span>通知数: <span style="color: #783887;">{{ trackNoticeSize }}</span></span>
|
||||
</template>
|
||||
<track-home-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<test-case-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<test-review-notification @noticeSize="getNoticeSize" :review-receiver-options="reviewReceiverOptions"/>
|
||||
<test-plan-task-notification @noticeSize="getNoticeSize" :test-plan-receiver-options="testPlanReceiverOptions"/>
|
||||
<defect-task-notification @noticeSize="getNoticeSize" :defect-receiver-options="defectReceiverOptions"/>
|
||||
<track-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<track-home-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<test-case-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<test-review-notification @noticeSize="getNoticeSize" :review-receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<test-plan-task-notification @noticeSize="getNoticeSize" :test-plan-receiver-options="testPlanReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<defect-task-notification @noticeSize="getNoticeSize" :defect-receiver-options="defectReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<track-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="3">
|
||||
<template v-slot:title>
|
||||
|
@ -29,10 +35,14 @@
|
|||
</span>
|
||||
<span>通知数: <span style="color: #783887;">{{ apiNoticeSize }}</span></span>
|
||||
</template>
|
||||
<api-home-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<api-definition-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<api-automation-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<api-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<api-home-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<api-definition-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<api-automation-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<api-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="4">
|
||||
<template v-slot:title>
|
||||
|
@ -41,15 +51,18 @@
|
|||
</span>
|
||||
<span>通知数: <span style="color: #783887;">{{ performanceNoticeSize }}</span></span>
|
||||
</template>
|
||||
<performance-test-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<performance-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"/>
|
||||
<performance-test-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
<performance-report-notification @noticeSize="getNoticeSize" :receiver-options="reviewReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="1">
|
||||
<template v-slot:title>
|
||||
<span style="width: 200px">{{ $t('organization.message.jenkins_task_notification') }}</span>
|
||||
<span>通知数: <span style="color: #783887;">{{ jenkinsNoticeSize }}</span></span>
|
||||
</template>
|
||||
<jenkins-notification @noticeSize="getNoticeSize" :jenkins-receiver-options="jenkinsReceiverOptions"/>
|
||||
<jenkins-notification @noticeSize="getNoticeSize" :jenkins-receiver-options="jenkinsReceiverOptions"
|
||||
:receive-type-options="receiveTypeOptions"/>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</div>
|
||||
|
@ -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: {}
|
||||
};
|
||||
},
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
{{ $t('organization.message.create_new_notification') }}
|
||||
</el-button>
|
||||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="600"
|
||||
trigger="click">
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
</el-popover>
|
||||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
|
@ -33,11 +33,11 @@
|
|||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-table
|
||||
:data="defectTask"
|
||||
class="tb-edit"
|
||||
border
|
||||
:cell-style="rowClass"
|
||||
:header-cell-style="headClass"
|
||||
:data="defectTask"
|
||||
class="tb-edit"
|
||||
border
|
||||
:cell-style="rowClass"
|
||||
:header-cell-style="headClass"
|
||||
>
|
||||
<el-table-column :label="$t('schedule.event')" min-width="15%" prop="events">
|
||||
<template slot-scope="scope">
|
||||
|
@ -45,10 +45,10 @@
|
|||
@change="handleReceivers(scope.row)"
|
||||
prop="event" :disabled="!scope.row.isSet">
|
||||
<el-option
|
||||
v-for="item in eventOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
v-for="item in eventOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
@ -59,10 +59,10 @@
|
|||
:placeholder="$t('commons.please_select')"
|
||||
style="width: 100%;" :disabled="!row.isSet">
|
||||
<el-option
|
||||
v-for="item in row.receiverOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
v-for="item in row.receiverOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
@ -73,10 +73,10 @@
|
|||
size="mini"
|
||||
:disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)">
|
||||
<el-option
|
||||
v-for="item in receiveTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
v-for="item in receiveTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
@ -90,48 +90,48 @@
|
|||
<el-table-column :label="$t('commons.operating')" min-width="25%" prop="result">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tip-button
|
||||
circle
|
||||
type="success"
|
||||
size="mini"
|
||||
v-if="scope.row.isSet"
|
||||
v-xpack
|
||||
@click="handleTemplate(scope.$index,scope.row)"
|
||||
:tip="$t('organization.message.template')"
|
||||
icon="el-icon-tickets"/>
|
||||
circle
|
||||
type="success"
|
||||
size="mini"
|
||||
v-if="scope.row.isSet"
|
||||
v-xpack
|
||||
@click="handleTemplate(scope.$index,scope.row)"
|
||||
:tip="$t('organization.message.template')"
|
||||
icon="el-icon-tickets"/>
|
||||
<ms-tip-button
|
||||
circle
|
||||
type="primary"
|
||||
size="mini"
|
||||
v-show="scope.row.isSet"
|
||||
@click="handleAddTask(scope.$index,scope.row)"
|
||||
:tip="$t('commons.add')"
|
||||
icon="el-icon-check"/>
|
||||
circle
|
||||
type="primary"
|
||||
size="mini"
|
||||
v-show="scope.row.isSet"
|
||||
@click="handleAddTask(scope.$index,scope.row)"
|
||||
:tip="$t('commons.add')"
|
||||
icon="el-icon-check"/>
|
||||
<ms-tip-button
|
||||
circle
|
||||
size="mini"
|
||||
v-show="scope.row.isSet"
|
||||
@click="removeRowTask(scope.$index,defectTask)"
|
||||
:tip="$t('commons.cancel')"
|
||||
icon="el-icon-refresh-left"/>
|
||||
circle
|
||||
size="mini"
|
||||
v-show="scope.row.isSet"
|
||||
@click="removeRowTask(scope.$index,defectTask)"
|
||||
:tip="$t('commons.cancel')"
|
||||
icon="el-icon-refresh-left"/>
|
||||
<ms-tip-button
|
||||
el-button
|
||||
circle
|
||||
type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-edit"
|
||||
v-show="!scope.row.isSet"
|
||||
:tip="$t('commons.edit')"
|
||||
@click="handleEditTask(scope.$index,scope.row)"
|
||||
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
|
||||
el-button
|
||||
circle
|
||||
type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-edit"
|
||||
v-show="!scope.row.isSet"
|
||||
:tip="$t('commons.edit')"
|
||||
@click="handleEditTask(scope.$index,scope.row)"
|
||||
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
|
||||
<ms-tip-button
|
||||
circle
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
v-show="!scope.row.isSet"
|
||||
@click="deleteRowTask(scope.$index,scope.row)"
|
||||
:tip="$t('commons.delete')"
|
||||
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
|
||||
circle
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
v-show="!scope.row.isSet"
|
||||
@click="deleteRowTask(scope.$index,scope.row)"
|
||||
:tip="$t('commons.delete')"
|
||||
v-permission="['ORGANIZATION_MESSAGE:READ+EDIT']"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -160,23 +160,26 @@ export default {
|
|||
props: {
|
||||
receiverOptions: {
|
||||
type: Array
|
||||
},
|
||||
receiveTypeOptions: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: "<!DOCTYPE html>\n" +
|
||||
"<html lang=\"en\">\n" +
|
||||
"<head>\n" +
|
||||
" <meta charset=\"UTF-8\">\n" +
|
||||
" <title>MeterSphere</title>\n" +
|
||||
"</head>\n" +
|
||||
"<body>\n" +
|
||||
"<div>\n" +
|
||||
" <p>${operator}关闭了定时任务</p>\n" +
|
||||
"</div>\n" +
|
||||
"</body>\n" +
|
||||
"</html>",
|
||||
"<html lang=\"en\">\n" +
|
||||
"<head>\n" +
|
||||
" <meta charset=\"UTF-8\">\n" +
|
||||
" <title>MeterSphere</title>\n" +
|
||||
"</head>\n" +
|
||||
"<body>\n" +
|
||||
"<div>\n" +
|
||||
" <p>${operator}关闭了定时任务</p>\n" +
|
||||
"</div>\n" +
|
||||
"</body>\n" +
|
||||
"</html>",
|
||||
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() {
|
||||
|
|
|
@ -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')}
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -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 地址+令牌(账户设置-个人访问令牌-创建令牌)',
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue