diff --git a/apps/web-antd/src/api/system/sms/log/index.ts b/apps/web-antd/src/api/system/sms/log/index.ts new file mode 100644 index 000000000..4a2aac414 --- /dev/null +++ b/apps/web-antd/src/api/system/sms/log/index.ts @@ -0,0 +1,45 @@ +import type { PageParam } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsLogApi { + /** 短信日志信息 */ + export interface SmsLogVO { + id: null | number; + channelId: null | number; + channelCode: string; + templateId: null | number; + templateCode: string; + templateType: null | number; + templateContent: string; + templateParams: null | Record; + apiTemplateId: string; + mobile: string; + userId: null | number; + userType: null | number; + sendStatus: null | number; + sendTime: Date | null; + apiSendCode: string; + apiSendMsg: string; + apiRequestId: string; + apiSerialNo: string; + receiveStatus: null | number; + receiveTime: Date | null; + apiReceiveCode: string; + apiReceiveMsg: string; + createTime: Date | null; + } +} + +/** 查询短信日志列表 */ +export function getSmsLogPage(params: PageParam) { + return requestClient.get<{ + list: SystemSmsLogApi.SmsLogVO[]; + total: number; + }>('/system/sms-log/page', { params }); +} + +/** 导出短信日志 */ +export function exportSmsLog(params: SystemSmsLogApi.SmsLogVO) { + return requestClient.download('/system/sms-log/export-excel', { params }); +} diff --git a/apps/web-antd/src/views/system/sms/log/data.ts b/apps/web-antd/src/views/system/sms/log/data.ts new file mode 100644 index 000000000..893bcdf43 --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/data.ts @@ -0,0 +1,172 @@ +import type { SystemSmsLogApi } from 'src/api/system/sms/log'; + +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { getSimpleSmsChannelList } from 'src/api/system/sms/channel'; + +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'mobile', + label: '手机号', + component: 'Input', + }, + { + fieldName: 'channelId', + label: '短信渠道', + component: 'ApiSelect', + componentProps: { + api: async () => await getSimpleSmsChannelList(), + labelField: 'signature', + valueField: 'id', + allowClear: true, + }, + }, + { + fieldName: 'templateId', + label: '模板编号', + component: 'Input', + }, + { + fieldName: 'sendStatus', + label: '发送状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_SEND_STATUS, 'number'), + }, + }, + { + fieldName: 'sendTime', + label: '发送时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + { + fieldName: 'receiveStatus', + label: '接收状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, 'number'), + }, + }, + { + fieldName: 'receiveTime', + label: '接收时间', + component: 'RangePicker', + componentProps: { + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + minWidth: 100, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'mobile', + title: '手机号', + minWidth: 120, + }, + { + field: 'templateContent', + title: '短信内容', + minWidth: 300, + }, + { + field: 'sendStatus', + title: '发送状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_SEND_STATUS }, + }, + }, + { + field: 'sendTime', + title: '发送时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'receiveStatus', + title: '接收状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS }, + }, + }, + { + field: 'receiveTime', + title: '接收时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'channelCode', + title: '短信渠道', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE }, + }, + }, + { + field: 'templateId', + title: '模板编号', + minWidth: 100, + }, + { + field: 'templateType', + title: '短信类型', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE }, + }, + }, + { + field: 'operation', + title: '操作', + minWidth: 120, + align: 'center', + fixed: 'right', + cellRender: { + attrs: { + nameField: 'mobile', + nameTitle: '短信日志', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'view', + text: '查看', + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/sms/log/index.vue b/apps/web-antd/src/views/system/sms/log/index.vue new file mode 100644 index 000000000..7ba9b7b3b --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/index.vue @@ -0,0 +1,98 @@ + + + diff --git a/apps/web-antd/src/views/system/sms/log/modules/form.vue b/apps/web-antd/src/views/system/sms/log/modules/form.vue new file mode 100644 index 000000000..731d900ca --- /dev/null +++ b/apps/web-antd/src/views/system/sms/log/modules/form.vue @@ -0,0 +1,122 @@ + + + + +