Commit 2797b88b2c0faa36d0dceafb322c17d608fb2ea2

Authored by loveumiko
1 parent bacf4743

feat: 告警联系人新增钉钉字段

1 1 export enum MessageEnum {
2 2 IS_SMS = 'PHONE_MESSAGE',
3 3 IS_EMAIL = 'EMAIL_MESSAGE',
  4 + IS_DINGTALK = 'DINGTALK_MESSAGE',
4 5 }
... ...
... ... @@ -74,6 +74,12 @@
74 74 username: values.username,
75 75 password: values.password,
76 76 };
  77 + } else if (values.messageType === 'DINGTALK_MESSAGE') {
  78 + config = {
  79 + AgentId: values?.AgentId,
  80 + ClientID: values?.ClientID,
  81 + Clientsecret: values?.Clientsecret,
  82 + };
77 83 }
78 84 Reflect.set(values, 'config', config);
79 85 let saveMessage = '添加成功';
... ...
... ... @@ -79,6 +79,9 @@ export const isMessage = (type: string) => {
79 79 export const isEmail = (type: string) => {
80 80 return type === MessageEnum.IS_EMAIL;
81 81 };
  82 +export const isDingtalk = (type: string) => {
  83 + return type === MessageEnum.IS_DINGTALK;
  84 +};
82 85 export const messageTypeIsTencentCloud = (type: string) => {
83 86 return type === 'TENCENT_CLOUD';
84 87 };
... ... @@ -251,6 +254,39 @@ export const formSchema: FormSchema[] = [
251 254 },
252 255 },
253 256 {
  257 + field: 'AgentId',
  258 + label: 'AgentId',
  259 + component: 'Input',
  260 + required: true,
  261 + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')),
  262 + componentProps: {
  263 + maxLength: 36,
  264 + placeholder: '请输入AgentId',
  265 + },
  266 + },
  267 + {
  268 + field: 'ClientID',
  269 + label: 'ClientID',
  270 + component: 'Input',
  271 + required: true,
  272 + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')),
  273 + componentProps: {
  274 + maxLength: 36,
  275 + placeholder: '请输入ClientID',
  276 + },
  277 + },
  278 + {
  279 + field: 'Clientsecret',
  280 + label: 'Clientsecret',
  281 + component: 'Input',
  282 + ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')),
  283 + required: true,
  284 + componentProps: {
  285 + maxLength: 36,
  286 + placeholder: '请输入Clientsecret',
  287 + },
  288 + },
  289 + {
254 290 field: 'status',
255 291 label: '状态',
256 292 component: 'RadioButtonGroup',
... ...