From 03009cd64d9a5d80099fc7384844edff6f4b0f06 Mon Sep 17 00:00:00 2001 From: wuxichen <17301714657@163.com> Date: Fri, 19 Sep 2025 15:17:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=9F=AD=E4=BF=A1=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/messages/sms/log/config.tsx | 171 +++++++++++++++++++ src/pages/system/messages/sms/log/index.tsx | 70 ++++++++ src/services/system/message/sms/log.tsx | 4 +- 3 files changed, 243 insertions(+), 2 deletions(-) create mode 100644 src/pages/system/messages/sms/log/config.tsx create mode 100644 src/pages/system/messages/sms/log/index.tsx diff --git a/src/pages/system/messages/sms/log/config.tsx b/src/pages/system/messages/sms/log/config.tsx new file mode 100644 index 0000000..59f2d12 --- /dev/null +++ b/src/pages/system/messages/sms/log/config.tsx @@ -0,0 +1,171 @@ +import type { + ProColumns, + ProDescriptionsItemProps, +} from '@ant-design/pro-components'; +import dayjs from 'dayjs'; +import type { SmsLogVO } from '@/services/system/message/sms/log'; +export const baseTenantColumns: ProColumns[] = [ + { + title: '编号', + dataIndex: 'id', + width: 100, + hideInSearch: true, // 在搜索表单中隐藏 + }, + { + title: '手机号', + dataIndex: 'mobile', + }, + { + title: '短信内容', + dataIndex: 'templateContent', + hideInSearch: true, // 在搜索表单中隐藏 + }, + { + title: '发送状态', + dataIndex: 'sendStatus', + }, + { + title: '发送人名称', + dataIndex: 'templateNickname', + hideInSearch: true, // 在搜索表单中隐藏 + }, + + { + title: '接收状态', + dataIndex: 'receiveStatus', + }, + { + title: '短信渠道', + dataIndex: 'channelId', + }, + { + title: '模板编号', + dataIndex: 'templateId', + }, + { + title: '短信类型', + dataIndex: 'templateType', + hideInSearch: true, + }, + { + title: '创建时间', + dataIndex: 'createTime', + valueType: 'dateRange', + hideInSearch: true, + search: { + transform: (value) => { + return { + [`createTime[0]`]: dayjs(value[0]) + .startOf('day') + .format('YYYY-MM-DD HH:mm:ss'), + [`createTime[1]`]: dayjs(value[1]) + .endOf('day') + .format('YYYY-MM-DD HH:mm:ss'), + }; + }, + }, + render: (_, record: SmsLogVO) => + dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'), + }, + { + title: '接收时间', + dataIndex: 'receiveTime', + valueType: 'dateRange', + hideInTable: true, + search: { + transform: (value) => { + return { + [`createTime[0]`]: dayjs(value[0]) + .startOf('day') + .format('YYYY-MM-DD HH:mm:ss'), + [`createTime[1]`]: dayjs(value[1]) + .endOf('day') + .format('YYYY-MM-DD HH:mm:ss'), + }; + }, + }, + render: (_, record: SmsLogVO) => + dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'), + }, +]; + +export const descriptionsColumns = (): ProDescriptionsItemProps< + Record, + 'text' +>[] => [ + { + title: '日志主键', + key: 'id', + dataIndex: 'id', + }, + { + title: '短信渠道', + key: 'channelId', + dataIndex: 'channelId', + }, + { + title: '短信模板', + key: 'templateCode', + dataIndex: 'templateCode', + }, + { + title: 'API 的模板编号', + key: 'apiTemplateId', + dataIndex: 'apiTemplateId', + }, + { + title: '用户信息', + key: 'mobile', + dataIndex: 'mobile', + }, + { + title: '短信内容', + key: 'templateContent', + dataIndex: 'templateContent', + }, + { + title: '短信参数', + key: 'templateParams', + dataIndex: 'templateParams', + }, + { + title: '创建时间', + key: 'createTime', + dataIndex: 'createTime', + }, + { + title: '发送状态', + key: 'sendStatus', + dataIndex: 'sendStatus', + }, + { + title: '发送时间', + key: 'sendTime', + dataIndex: 'sendTime', + }, + { + title: 'API 发送结果', + key: 'apiSendMsg', + dataIndex: 'apiSendMsg', + }, + { + title: 'API 短信编号', + key: 'apiSerialNo', + dataIndex: 'apiSerialNo', + }, + { + title: 'API 请求编号', + key: 'apiRequestId', + dataIndex: 'apiRequestId', + }, + { + title: 'API 接收状态', + key: 'receiveStatus', + dataIndex: 'receiveStatus', + }, + { + title: 'API 接收结果', + key: 'apiReceiveMsg', + dataIndex: 'apiReceiveMsg', + }, +]; diff --git a/src/pages/system/messages/sms/log/index.tsx b/src/pages/system/messages/sms/log/index.tsx new file mode 100644 index 0000000..39a5a06 --- /dev/null +++ b/src/pages/system/messages/sms/log/index.tsx @@ -0,0 +1,70 @@ +import type { ActionType, ProColumns } from '@ant-design/pro-components'; +import React, { useRef } from 'react'; +import EnhancedProTable from '@/components/EnhancedProTable'; +import ModalDescriptions, { + type DescriptionsFormRef, +} from '@/components/ModalDescriptions'; +import { + getSmsLogPage, + type SmsLogVO, +} from '@/services/system/message/sms/log'; +import { baseTenantColumns, descriptionsColumns } from './config'; + +const SyStemMessageNotifyMessage = () => { + const tableRef = useRef(null); + const descriptionsRef = useRef(null); + const onFetch = async ( + params: SmsLogVO & { + pageSize?: number; + current?: number; + }, + ) => { + const data = await getSmsLogPage({ + ...params, + pageNo: params.current, + pageSize: params.pageSize, + }); + return { + data: data.list, + success: true, + total: data.total, + }; + }; + + const handleDetail = (record: SmsLogVO) => { + descriptionsRef.current?.open(record); + }; + + const actionColumns: ProColumns = { + title: '操作', + dataIndex: 'option', + valueType: 'option', + fixed: 'right', + width: 80, + render: (text: React.ReactNode, record: SmsLogVO) => [ + handleDetail(record)}> + 详情 + , + ], + }; + const columns = [...baseTenantColumns, actionColumns]; + return ( + <> + + ref={tableRef} + columns={columns} + request={onFetch} + headerTitle="登录日志" + showIndex={false} + showSelection={false} + /> + + + ); +}; + +export default SyStemMessageNotifyMessage; diff --git a/src/services/system/message/sms/log.tsx b/src/services/system/message/sms/log.tsx index c70e650..04a4962 100644 --- a/src/services/system/message/sms/log.tsx +++ b/src/services/system/message/sms/log.tsx @@ -1,7 +1,7 @@ import { request } from "@umijs/max"; export interface SmsLogVO { - id: number | null; + id: number; channelId: number | null; channelCode: string; templateId: number | null; @@ -29,7 +29,7 @@ export interface SmsLogVO { // 查询短信日志列表 export async function getSmsLogPage(params: PageParam) { - return request("/system/sms-channel/page", { + return request("/system/sms-log/page", { method: "GET", params, });