From 4996d05d1e29bb8b85b95a973649d204c03ecc18 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 27 Jan 2023 16:59:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E7=AE=B1=E6=A8=A1=E5=9D=97=EF=BC=9Avu?= =?UTF-8?q?e3=20=E9=82=AE=E4=BB=B6=E6=A8=A1=E7=89=88=E7=9A=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/mail/account/index.ts | 5 + .../src/api/system/mail/template/index.ts | 58 ++++ ...count.template.data.ts => account.data.ts} | 0 .../src/views/system/mail/account/index.vue | 2 +- .../src/views/system/mail/template/index.vue | 258 ++++++++++++++++++ .../system/mail/template/template.data.ts | 93 +++++++ .../views/system/sms/smsTemplate/index.vue | 4 +- 7 files changed, 417 insertions(+), 3 deletions(-) create mode 100644 yudao-ui-admin-vue3/src/api/system/mail/template/index.ts rename yudao-ui-admin-vue3/src/views/system/mail/account/{account.template.data.ts => account.data.ts} (100%) create mode 100644 yudao-ui-admin-vue3/src/views/system/mail/template/index.vue create mode 100644 yudao-ui-admin-vue3/src/views/system/mail/template/template.data.ts diff --git a/yudao-ui-admin-vue3/src/api/system/mail/account/index.ts b/yudao-ui-admin-vue3/src/api/system/mail/account/index.ts index 37bdc8147..8b662a701 100644 --- a/yudao-ui-admin-vue3/src/api/system/mail/account/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/mail/account/index.ts @@ -39,3 +39,8 @@ export const updateMailAccountApi = async (data: MailAccountVO) => { export const deleteMailAccountApi = async (id: number) => { return await request.delete({ url: '/system/mail-account/delete?id=' + id }) } + +// 获得邮箱账号精简列表 +export const getSimpleMailAccounts = async () => { + return request.get({ url: '/system/mail-account/list-all-simple' }) +} diff --git a/yudao-ui-admin-vue3/src/api/system/mail/template/index.ts b/yudao-ui-admin-vue3/src/api/system/mail/template/index.ts new file mode 100644 index 000000000..a0a0faf2f --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/mail/template/index.ts @@ -0,0 +1,58 @@ +import request from '@/config/axios' + +export interface MailTemplateVO { + id: number + name: string + code: string + accountId: number + nickname: string + title: string + content: string + params: string + status: number + remark: string +} + +export interface MailTemplatePageReqVO extends PageParam { + name?: string + code?: string + accountId?: number + status?: number + createTime?: Date[] +} + +export interface MailSmsReqVO { + mail: string + templateCode: string + templateParams: Map +} + +// 查询邮件模版列表 +export const getMailTemplatePageApi = async (params: MailTemplatePageReqVO) => { + return await request.get({ url: '/system/mail-template/page', params }) +} + +// 查询邮件模版详情 +export const getMailTemplateApi = async (id: number) => { + return await request.get({ url: '/system/mail-template/get?id=' + id }) +} + +// 新增邮件模版 +export const createMailTemplateApi = async (data: MailTemplateVO) => { + return await request.post({ url: '/system/mail-template/create', data }) +} + +// 修改邮件模版 +export const updateMailTemplateApi = async (data: MailTemplateVO) => { + return await request.put({ url: '/system/mail-template/update', data }) +} + +// 删除邮件模版 +export const deleteMailTemplateApi = async (id: number) => { + return await request.delete({ url: '/system/mail-template/delete?id=' + id }) +} + +// 发送邮件 +export const sendMailApi = (data: MailSmsReqVO) => { + return request.post({ url: '/system/mail-template/send-mail', data }) +} diff --git a/yudao-ui-admin-vue3/src/views/system/mail/account/account.template.data.ts b/yudao-ui-admin-vue3/src/views/system/mail/account/account.data.ts similarity index 100% rename from yudao-ui-admin-vue3/src/views/system/mail/account/account.template.data.ts rename to yudao-ui-admin-vue3/src/views/system/mail/account/account.data.ts diff --git a/yudao-ui-admin-vue3/src/views/system/mail/account/index.vue b/yudao-ui-admin-vue3/src/views/system/mail/account/index.vue index b8fdf0931..7c4ad0f9d 100644 --- a/yudao-ui-admin-vue3/src/views/system/mail/account/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/mail/account/index.vue @@ -69,7 +69,7 @@ diff --git a/yudao-ui-admin-vue3/src/views/system/mail/template/template.data.ts b/yudao-ui-admin-vue3/src/views/system/mail/template/template.data.ts new file mode 100644 index 000000000..b7707b433 --- /dev/null +++ b/yudao-ui-admin-vue3/src/views/system/mail/template/template.data.ts @@ -0,0 +1,93 @@ +import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' + +// 表单校验 +export const rules = reactive({ + name: [required], + code: [required], + accountId: [required], + title: [required], + content: [required], + params: [required], + status: [required] +}) + +// CrudSchema +const crudSchemas = reactive({ + primaryKey: 'id', // 默认的主键ID + primaryTitle: '编号', // 默认显示的值 + primaryType: null, + action: true, + actionWidth: '260', + columns: [ + { + title: '模板编码', + field: 'code', + isSearch: true + }, + { + title: '模板名称', + field: 'name', + isSearch: true + }, + { + title: '模板标题', + field: 'title' + }, + { + title: '模板内容', + field: 'content', + form: { + component: 'Editor', + colProps: { + span: 24 + }, + componentProps: { + valueHtml: '' + } + } + }, + { + title: '邮箱账号', + field: 'accountId', + isSearch: true, + table: { + width: 200, + slots: { + default: 'accountId_default' + } + } + }, + { + title: '发送人名称', + field: 'nickname' + }, + { + title: '开启状态', + field: 'status', + isSearch: true, + dictType: DICT_TYPE.COMMON_STATUS, + dictClass: 'number' + }, + { + title: '备注', + field: 'remark', + isTable: false + }, + { + title: '创建时间', + field: 'createTime', + isForm: false, + formatter: 'formatDate', + table: { + width: 180 + }, + search: { + show: true, + itemRender: { + name: 'XDataTimePicker' + } + } + } + ] +}) +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue index 0bc40c8d8..bbc7c8636 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue @@ -197,7 +197,7 @@ const sendSmsForm = ref({ }) const sendSmsRules = ref({ mobile: [{ required: true, message: '手机不能为空', trigger: 'blur' }], - templateCode: [{ required: true, message: '手机不能为空', trigger: 'blur' }], + templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }], templateParams: {} }) const sendVisible = ref(false) @@ -225,7 +225,7 @@ const sendSmsTest = async () => { } const res = await SmsTemplateApi.sendSmsApi(data) if (res) { - message.success('发送成功') + message.success('提交发送成功!发送结果,见发送日志编号:' + res) } sendVisible.value = false }