feat: 通知管理接口

This commit is contained in:
JiangQiming 2023-01-28 17:51:10 +08:00
parent 6b5bd5ee25
commit 841fa8433a
4 changed files with 59 additions and 21 deletions

View File

@ -1,15 +1,37 @@
import { patch, post, get } from '@/utils/request'
import { BindConfig } from '@/views/notice/Template/types'
import { patch, post, get, remove } from '@/utils/request'
export default {
// 列表
list: (data: any) => post(`/notifier/config/_query`, data),
// 不分页列表
listNoPage: (data: any) => post<BindConfig>(`/notifier/config/_query/no-paging?paging=false`, data),
// 详情
detail: (id: string): any => get(`/notifier/config/${id}`),
// 新增
save: (data: any) => post(`/notifier/config`, data),
// 修改
update: (data: any) => patch(`/notifier/config`, data)
update: (data: any) => patch(`/notifier/config`, data),
del: (id: string) => remove(`/notifier/config/${id}`),
getTemplate: (data: any, id: string) => post(`/notifier/template/${id}/_query`, data),
getTemplateDetail: (id: string) => get(`/notifier/template/${id}/detail`),
debug: (data: any, configId: string, templateId: string) => post(`/notifier/${configId}/${templateId}/_send`, data),
getHistory: (data: any, id: string) => post(`/notify/history/config/${id}/_query`, data),
// 获取所有平台用户
getPlatformUsers: () => post(`/user/_query/no-paging`, { paging: false }),
// 钉钉部门
dingTalkDept: (id: string) => get(`/notifier/dingtalk/corp/${id}/departments/tree`),
// 钉钉部门人员
getDingTalkUsers: (configId: string, deptId: string) => get(`/notifier/dingtalk/corp/${configId}/${deptId}/users`),
// 钉钉已经绑定的人员
getDingTalkBindUsers: (id: string) => get(`/user/third-party/dingTalk_dingTalkMessage/${id}`),
// 钉钉绑定用户
dingTalkBindUser: (data: any, id: string) => patch(`/user/third-party/dingTalk_dingTalkMessage/${id}`, data),
// 微信部门
weChatDept: (id: string) => get(`/notifier/wechat/corp/${id}/departments`),
// 微信部门人员
getWeChatUsers: (configId: string, deptId: string) => get(`/notifier/wechat/corp/${configId}/${deptId}/users`),
// 微信已经绑定的人员
getWeChatBindUsers: (id: string) => get(`/user/third-party/weixin_corpMessage/${id}`),
// 微信绑定用户
weChatBindUser: (data: any, id: string) => patch(`/user/third-party/weixin_corpMessage/${id}`, data),
// 解绑
unBindUser: (data: any, id: string) => post(`/user/third-party/${id}/_unbind`, data)
}

View File

@ -1,4 +1,5 @@
import { patch, post, get } from '@/utils/request'
import { patch, post, get, remove } from '@/utils/request'
import { BindConfig } from '@/views/notice/Template/types'
export default {
// 列表
@ -8,5 +9,19 @@ export default {
// 新增
save: (data: any) => post(`/notifier/template`, data),
// 修改
update: (data: any) => patch(`/notifier/template`, data)
update: (data: any) => patch(`/notifier/template`, data),
del: (id: any) => remove(`/notifier/template/${id}`),
getConfig: (data: any) => post<BindConfig>(`/notifier/config/_query/no-paging?paging=false`, data),
getTemplateDetail: (id: string) => get(`/notifier/template/${id}/detail`),
debug: (data: any, configId: string, templateId: string) => post(`/notifier/${configId}/${templateId}/_send`, data),
getHistory: (data: any, id: string) => post(`/notify/history/template/${id}/_query`, data),
// 钉钉/微信, 根据配置获取部门和用户
getDept: (type: string, id: string) => get(`/notifier/${type}/corp/${id}/departments`),
getUser: (type: string, id: string) => get(`/notifier/${type}/corp/${id}/users`),
// 微信获取标签推送
getTags: (id: string) => get(`/notifier/wechat/corp/${id}/tags`),
// 语音/短信获取阿里云模板
getAliTemplate: (id: string) => get(`/notifier/sms/aliyun/${id}/templates`),
// 短信获取签名
getSigns: (id: string) => get(`/notifier/sms/aliyun/${id}/signs`)
}

View File

@ -121,8 +121,7 @@
>
<!-- <a-input
v-model:value="
formData.template.markdown
?.title
formData.template.markdown?.title
"
placeholder="请输入标题"
/> -->
@ -483,7 +482,6 @@ import {
VOICE_TYPE,
} from '@/views/notice/const';
import templateApi from '@/api/notice/template';
import configApi from '@/api/notice/config';
import Doc from './doc/index';
import MonacoEditor from '@/components/MonacoEditor/index.vue';
import Attachments from './components/Attachments.vue';
@ -627,7 +625,7 @@ const getConfigList = async () => {
{ column: 'type$IN', value: formData.value.type },
{ column: 'provider', value: formData.value.provider },
];
const { result } = await configApi.listNoPage({ terms });
const { result } = await templateApi.getConfig({ terms });
configList.value = result;
};
getConfigList();

View File

@ -16,6 +16,17 @@ interface IVariableDefinitions {
format: string;
}
interface IMarkDown {
text: string;
title: string;
}
interface ILink {
title: string;
picUrl: string;
messageUrl: string;
text: string;
}
export type TemplateFormData = {
template: {
// 钉钉消息
@ -23,16 +34,8 @@ export type TemplateFormData = {
message?: string;
// 钉钉机器人
messageType?: string;
markdown?: {
text: string;
title: string;
};
link?: {
title: string;
picUrl: string;
messageUrl: string;
text: string;
};
markdown?: IMarkDown;
link?: ILink;
// 微信
// agentId?: string;
// message?: string;