feat: add feishu and aliyunsms

This commit is contained in:
engigu
2025-12-17 21:51:21 +08:00
parent f520dbf746
commit 64f746a7ec
16 changed files with 537 additions and 165 deletions
@@ -194,12 +194,12 @@ onMounted(async () => {
</Button>
</DrawerTrigger>
<DrawerContent class="w-[800px] max-w-[90vw] mx-auto h-[90vh] max-h-[90vh]">
<DrawerHeader>
<DrawerContent class="w-[800px] max-w-[90vw] mx-auto flex flex-col max-h-[96vh]">
<DrawerHeader class="flex-shrink-0">
<DrawerTitle>新增发信渠道</DrawerTitle>
</DrawerHeader>
<div class="px-4 pb-4 overflow-y-auto">
<div class="flex-1 overflow-y-auto px-4 pb-4">
<AddWays v-model:open="isAddChannelDrawerOpen" @save="handleSaveChannel" />
</div>
</DrawerContent>
@@ -257,12 +257,12 @@ onMounted(async () => {
<!-- 编辑渠道Drawer -->
<Drawer v-model:open="isEditChannelDrawerOpen">
<DrawerContent class="w-[800px] max-w-[90vw] mx-auto h-[90vh] max-h-[90vh]">
<DrawerHeader>
<DrawerContent class="w-[800px] max-w-[90vw] mx-auto flex flex-col max-h-[96vh]">
<DrawerHeader class="flex-shrink-0">
<DrawerTitle>编辑发信渠道</DrawerTitle>
</DrawerHeader>
<div class="px-4 pb-4 overflow-y-auto">
<div class="flex-1 overflow-y-auto px-4 pb-4">
<EditWays v-model:open="isEditChannelDrawerOpen" :edit-data="editChannelData" @save="handleEditChannel" />
</div>
</DrawerContent>
@@ -251,10 +251,10 @@ const saveButtonText = computed(() => {
<div class="mb-6">
<label class="text-lg font-medium mb-3 block">渠道类型</label>
<!-- 编辑模式只展示当前渠道的简洁文本描述并保留群发标识 -->
<div v-if="props.mode === 'edit'" class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300">
<div>当前渠道{{ currentChannelConfig?.label || channelMode }}</div>
<span v-if="currentChannelConfig?.dynamicRecipient?.support" class="inline-block text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300">群发</span>
<!-- 编辑模式只展示当前渠道的简洁文本描述并保留"群发"标识 -->
<div v-if="props.mode === 'edit'" class="flex items-center gap-1.5 text-sm text-gray-700 dark:text-gray-300">
<span class="font-medium">{{ currentChannelConfig?.label || channelMode }}</span>
<span v-if="currentChannelConfig?.dynamicRecipient?.support" class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300">群发</span>
</div>
<!-- 新增模式保留原有的单选切换显示 -->
+14 -10
View File
@@ -212,17 +212,21 @@ const formatInsConfigDisplay = (row: any) => {
if (!row.config) {
return ""
}
if (["Email", "WeChatOFAccount"].includes(row.way_type)) {
let config = JSON.parse(row.config)
// 检查是否为动态接收者模式
if (config.allowMultiRecip === true) {
return "动态接收"
}
// 固定模式,显示接收者
return config.to_account || ""
} else {
return ""
let config = JSON.parse(row.config)
// 检查是否为动态接收者模式
if (config.allowMultiRecip === true) {
return "动态接收"
}
// 固定模式,根据 constant.js 配置动态获取接收者字段
const channelConfig = CONSTANT.WAYS_DATA.find((item: any) => item.type === row.way_type)
if (channelConfig?.dynamicRecipient?.support) {
const recipientField = channelConfig.dynamicRecipient.field
return config[recipientField] || ""
}
return ""
}
// 查询实例列表数据
@@ -20,8 +20,8 @@ const forwarded = useForwardPropsEmits(props, emits) as any
v-bind="forwarded"
:class="cn(
`group/drawer-content bg-background fixed z-50 flex h-auto flex-col`,
`data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg`,
`data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg`,
`data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[96vh] data-[vaul-drawer-direction=top]:rounded-b-lg`,
`data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[96vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg`,
`data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:sm:max-w-sm`,
`data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:sm:max-w-sm`,
props.class,
+45 -20
View File
@@ -76,6 +76,24 @@ const CONSTANT = {
taskInsInputs: [
],
},
{
type: 'Feishu',
label: '飞书机器人',
inputs: [
{ subLabel: 'access_token', value: '', col: 'access_token', desc: "飞书webhook中的access_token" },
{ subLabel: '加签', value: '', col: 'secret', desc: "加签的签名" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "输入框说明", desc: "飞书支持加签和关键字过滤,如果是配置了关键字过滤,只需要消息里面包含了关键字,就会发送"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
{ subLabel: 'markdown', content: 'markdown' },
],
taskInsInputs: [
],
},
{
type: 'Custom',
label: '自定义推送',
@@ -135,26 +153,33 @@ const CONSTANT = {
],
},
// 暂时屏蔽阿里云短信入口
// {
// type: 'AliyunSMS',
// label: '阿里云短信',
// inputs: [
// { subLabel: 'AccessKeyId', value: '', col: 'access_key_id', desc: "阿里云AccessKeyId" },
// { subLabel: 'AccessKeySecret', value: '', col: 'access_key_secret', desc: "阿里云AccessKeySecret" },
// { subLabel: '短信签名', value: '', col: 'sign_name', desc: "短信签名名称" },
// { subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
// ],
// tips: {
// text: "阿里云短信说明", desc: "使用阿里云短信服务发送短信,需要在阿里云控制台申请短信签名和模板。<br />AccessKey请在阿里云控制台获取。"
// },
// taskInsRadios: [
// { subLabel: 'text', content: 'text' },
// ],
// taskInsInputs: [
// { value: '', col: 'phone_number', desc: "手机号码(接收短信的手机号)" },
// { value: '', col: 'template_code', desc: "短信模板CODE在阿里云短信控制台获取" },
// ],
// },
{
type: 'AliyunSMS',
label: '阿里云短信',
// 动态接收者配置
dynamicRecipient: {
support: true, // 是否支持动态接收者
field: 'phone_number', // 接收者字段名
label: '手机号码', // 接收者字段标签
desc: '手机号码', // 接收者字段描述
},
inputs: [
{ subLabel: 'AccessKeyId', value: '', col: 'access_key_id', desc: "阿里云AccessKeyId" },
{ subLabel: 'AccessKeySecret', value: '', col: 'access_key_secret', desc: "阿里云AccessKeySecret" },
{ subLabel: '短信签名', value: '', col: 'sign_name', desc: "短信签名名称" },
{ subLabel: '渠道名', value: '', col: 'name', desc: "想要设置的渠道名字" },
],
tips: {
text: "阿里云短信说明", desc: "使用阿里云短信服务发送短信,需要在阿里云控制台申请短信签名和模板。<br />AccessKey请在阿里云控制台获取。"
},
taskInsRadios: [
{ subLabel: 'text', content: 'text' },
],
taskInsInputs: [
{ value: '', col: 'phone_number', desc: "手机号码(接收短信的手机号)", label: '手机号码' },
{ value: '', col: 'template_code', desc: "短信模板CODE(在阿里云短信控制台获取)", label: '短信模板CODE' },
],
},
],
API_VIEW_DATA: [
{ label: "curl", class: "language-shell line-numbers", code: "", func: ApiStrGenerate.getCurlString },