From 76873143a00935b5e381a7a44d8585477863a540 Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 22 Mar 2023 00:18:58 +0800 Subject: [PATCH] feat: sms --- src/api/system/sms/smsTemplate/index.ts | 2 +- src/views/system/sms/SmsTemplateModel.vue | 58 ++++++++ src/views/system/sms/smsLog.data.ts | 133 +++++++++++++++++ src/views/system/sms/smsLog.vue | 42 +++++- src/views/system/sms/smsTemplate.data.ts | 172 ++++++++++++++++++++++ src/views/system/sms/smsTemplate.vue | 104 ++++++++++++- 6 files changed, 508 insertions(+), 3 deletions(-) create mode 100644 src/views/system/sms/SmsTemplateModel.vue create mode 100644 src/views/system/sms/smsLog.data.ts create mode 100644 src/views/system/sms/smsTemplate.data.ts diff --git a/src/api/system/sms/smsTemplate/index.ts b/src/api/system/sms/smsTemplate/index.ts index eb5d13f9..ba902210 100644 --- a/src/api/system/sms/smsTemplate/index.ts +++ b/src/api/system/sms/smsTemplate/index.ts @@ -72,6 +72,6 @@ export const sendSmsApi = (data: SendSmsReqVO) => { } // 导出短信模板 -export const exportPostApi = (params: SmsTemplateExportReqVO) => { +export const exportSmsTemplateApi = (params: SmsTemplateExportReqVO) => { return defHttp.download({ url: '/system/sms-template/export-excel', params }, '短信模板.xls') } diff --git a/src/views/system/sms/SmsTemplateModel.vue b/src/views/system/sms/SmsTemplateModel.vue new file mode 100644 index 00000000..d4717d0a --- /dev/null +++ b/src/views/system/sms/SmsTemplateModel.vue @@ -0,0 +1,58 @@ + + diff --git a/src/views/system/sms/smsLog.data.ts b/src/views/system/sms/smsLog.data.ts new file mode 100644 index 00000000..374025a8 --- /dev/null +++ b/src/views/system/sms/smsLog.data.ts @@ -0,0 +1,133 @@ +import { getSimpleSmsChannels } from '@/api/system/sms/smsChannel' +import { getIntDictOptions } from '../../../utils/dict' +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '日志编号', + dataIndex: 'id', + width: 100 + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + }, + { + title: '手机号', + dataIndex: 'mobile', + width: 180, + customRender: ({ text, record }) => { + if (record.userType && record.userId) { + return useRender.renderDict(record.userType, DICT_TYPE.USER_TYPE) + 'record.userId' + } else { + return text + } + } + }, + { + title: '短信内容', + dataIndex: 'templateContent', + width: 300 + }, + { + title: '发送状态', + dataIndex: 'sendStatus', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_SEND_STATUS) + } + }, + { + title: '接收状态', + dataIndex: 'receiveStatus', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS) + } + }, + { + title: '短信渠道', + dataIndex: 'channelCode', + width: 180, + customRender: ({ text, record }) => { + return useRender.renderText(record.channelId, '') || '' + useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) || '' + } + }, + { + title: '模板编号', + dataIndex: 'templateId', + width: 120 + }, + { + title: '短信类型', + dataIndex: 'templateType', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '手机号', + field: 'mobile', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '短信渠道', + field: 'channelId', + component: 'ApiSelect', + componentProps: { + options: getSimpleSmsChannels(), + fieldNames: { + label: 'signature', + key: 'id', + value: 'id' + } + }, + colProps: { span: 8 } + }, + { + label: '模板编号', + field: 'templateId', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '发送状态', + field: 'sendStatus', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_SMS_SEND_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '发送时间', + field: 'sendTime', + component: 'RangePicker', + colProps: { span: 8 } + }, + { + label: '接收状态', + field: 'receiveStatus', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '接收时间', + field: 'receiveTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] diff --git a/src/views/system/sms/smsLog.vue b/src/views/system/sms/smsLog.vue index 3b64cfc4..e947079f 100644 --- a/src/views/system/sms/smsLog.vue +++ b/src/views/system/sms/smsLog.vue @@ -1,3 +1,43 @@ + diff --git a/src/views/system/sms/smsTemplate.data.ts b/src/views/system/sms/smsTemplate.data.ts new file mode 100644 index 00000000..726497c5 --- /dev/null +++ b/src/views/system/sms/smsTemplate.data.ts @@ -0,0 +1,172 @@ +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '模板编码', + dataIndex: 'code', + width: 180 + }, + { + title: '模板名称', + dataIndex: 'name', + width: 100 + }, + { + title: '模板内容', + dataIndex: 'content', + width: 300 + }, + { + title: '短信类型', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE) + } + }, + { + title: '开启状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) + } + }, + { + title: '备注', + dataIndex: 'remark', + width: 180 + }, + { + title: '短信 API 的模板编号', + dataIndex: 'apiTemplateId', + width: 180 + }, + { + title: '短信渠道', + dataIndex: 'channelCode', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) + } + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '短信类型', + field: 'type', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE) + }, + colProps: { span: 8 } + }, + { + label: '开启状态', + field: 'status', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '模板编码', + field: 'code', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '短信 API 的模板编号', + field: 'apiTemplateId', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '短信渠道', + field: 'channelId', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE) + }, + colProps: { span: 8 } + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input' + }, + { + label: '短信渠道编号', + field: 'channelId', + required: true, + component: 'Input' + }, + { + label: '短信类型', + field: 'type', + component: 'Select', + defaultValue: 0, + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE) + } + }, + { + label: '模板编号', + field: 'code', + required: true, + component: 'Input' + }, + { + label: '模板名称', + field: 'name', + required: true, + component: 'Input' + }, + { + label: '模板内容', + field: 'content', + required: true, + component: 'Input' + }, + { + label: '开启状态', + field: 'status', + component: 'Select', + defaultValue: 0, + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + } + }, + { + label: '短信 API 模板编号', + field: 'apiTemplateId', + required: true, + component: 'Input' + }, + { + label: '备注', + field: 'remark', + component: 'InputTextArea' + } +] diff --git a/src/views/system/sms/smsTemplate.vue b/src/views/system/sms/smsTemplate.vue index 3b64cfc4..fdf1a729 100644 --- a/src/views/system/sms/smsTemplate.vue +++ b/src/views/system/sms/smsTemplate.vue @@ -1,3 +1,105 @@ +