From ffcab76efc33a9f601caa8d3659d3c32765d139f Mon Sep 17 00:00:00 2001 From: wodeyangzipingpingwuqi Date: Mon, 6 May 2024 17:28:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E5=91=8A=E8=AD=A6=E9=80=9A?= =?UTF-8?q?=E7=9F=A5-=E9=80=9A=E7=9F=A5=E4=BA=BAWebhook=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/business.ts | 9 +- src/locales/langs/en-us.ts | 11 +- src/locales/langs/zh-cn.ts | 11 +- src/typings/api.d.ts | 18 ++- src/typings/app.d.ts | 7 ++ .../notify-recipient-operate-drawer.vue | 4 + .../notify/recipient/modules/webhook-form.vue | 112 ++++++++++++++++++ 7 files changed, 165 insertions(+), 7 deletions(-) create mode 100644 src/views/notify/recipient/modules/webhook-form.vue diff --git a/src/constants/business.ts b/src/constants/business.ts index 6f0fe99..512fb6d 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -49,10 +49,17 @@ export const alarmTypeRecord: Record = { + 1: 'page.notifyRecipient.form.applicationJson', + 2: 'page.notifyRecipient.form.applicationXWwwFormUrlencoded' +}; +export const alarmWebhookTypeRecordOptions = transformRecordToOption(alarmWebhookTypeRecord); + export const systemTaskType: Record = { 1: 'common.systemTaskType.retry', // 2: 'common.systemTaskType.callback', diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index b57f33c..429b9b6 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -736,17 +736,24 @@ const local: App.I18n.Schema = { dingDingAts: "Please enter the {'@'} phone number or DingTalk ID", weComAts: "Please enter the {'@'} Enterprise WeChat user ID", larkAts: "Please enter the {'@'} open_id", - webhookUrl: 'Please enter URL' + webhookUrl: 'Please enter URL', + secret: 'Please enter secret', + contentType: 'Please enter Request type', + applicationJson: 'application/json', + applicationXWwwFormUrlencoded: 'application/x-www-form-urlencoded' }, addNotifyRecipient: 'Add Notify Recipient', editNotifyRecipient: 'Edit Notify Recipient', ats: "{'@'} Notification Recipient", webhookUrl: 'Notification Address', + secret: 'secret', tos: 'Recipient Email Address', dingDing: 'DingTalk', email: 'Email', weCom: 'WeCom', - lark: 'Lark' + lark: 'Lark', + webhook: 'webhook', + contentType: 'Request type' }, retryDeadLetter: { title: 'RetryDeadLetter List', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 29aa06b..4a2daa3 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -732,17 +732,24 @@ const local: App.I18n.Schema = { dingDingAts: "请输入被{'@'}人手机号或钉钉号", weComAts: "请输入被{'@'}人企业微信用户id", larkAts: "请输入被{'@'}人open_id", - webhookUrl: '请输入URL' + webhookUrl: '请输入URL', + secret: '请输入密钥', + contentType: '请选择请求类型', + applicationJson: 'application/json', + applicationXWwwFormUrlencoded: 'application/x-www-form-urlencoded' }, addNotifyRecipient: '新增通知接收人', editNotifyRecipient: '编辑通知接收人', ats: "{'@'}通知人", webhookUrl: '通知地址', + secret: '密钥', tos: '通知人邮箱地址', dingDing: '钉钉', email: '邮箱', weCom: '企业微信', - lark: '飞书' + lark: '飞书', + webhook: 'webhook', + contentType: '请求类型' }, retryDeadLetter: { title: '死信任务列表', diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 9c8ce35..0dd07e2 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -637,6 +637,17 @@ declare namespace Api { }> & NotifyRecipient; + /** webhook Notify */ + type WebhookNotify = Common.CommonRecord<{ + /** 接收人名称 */ + webhookUrl: string; + /* 通知类型 */ + contentType: string; + /** 密钥 */ + secret?: string; + }> & + NotifyRecipient; + /** notifyRecipient search params */ type NotifyRecipientParams = CommonType.RecordNullable< Pick & @@ -646,8 +657,11 @@ declare namespace Api { /** notifyRecipient list */ type NotifyRecipientList = Common.PaginatingQueryRecord; - /** 1: 钉钉通知 2: 邮件通知 3: 企业通知 4: 飞书 */ - type AlarmType = 1 | 2 | 3 | 4; + /** 1: 钉钉通知 2: 邮件通知 3: 企业通知 4: 飞书 5: Webhook */ + type AlarmType = 1 | 2 | 3 | 4 | 5; + + /* 1: application/json 2:application/x-www-form-urlencoded */ + type AlarmTypeWebhook = 1 | 2; } namespace RetryDeadLetter { diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index a4b48cd..437171e 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -880,6 +880,10 @@ declare namespace App { weComAts: string; larkAts: string; webhookUrl: string; + secret: string; + contentType: string; + applicationJson: string; + applicationXWwwFormUrlencoded: string; }; addNotifyRecipient: string; editNotifyRecipient: string; @@ -890,6 +894,9 @@ declare namespace App { email: string; weCom: string; lark: string; + secret: string; + webhook: string; + contentType: string; }; retryDeadLetter: { title: string; diff --git a/src/views/notify/recipient/modules/notify-recipient-operate-drawer.vue b/src/views/notify/recipient/modules/notify-recipient-operate-drawer.vue index a86e26a..b953dcb 100644 --- a/src/views/notify/recipient/modules/notify-recipient-operate-drawer.vue +++ b/src/views/notify/recipient/modules/notify-recipient-operate-drawer.vue @@ -8,6 +8,7 @@ import DingDingForm from './dingding-form.vue'; import LarkForm from './lark-form.vue'; import EmailForm from './email-form.vue'; import WeComForm from './wecom-form.vue'; +import WebhookForm from './webhook-form.vue'; defineOptions({ name: 'NotifyRecipientOperateDrawer' @@ -121,6 +122,9 @@ watch(visible, () => { + + +