feat: 短信日志
This commit is contained in:
171
src/pages/system/messages/sms/log/config.tsx
Normal file
171
src/pages/system/messages/sms/log/config.tsx
Normal file
@@ -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<SmsLogVO>[] = [
|
||||
{
|
||||
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<string, any>,
|
||||
'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',
|
||||
},
|
||||
];
|
||||
70
src/pages/system/messages/sms/log/index.tsx
Normal file
70
src/pages/system/messages/sms/log/index.tsx
Normal file
@@ -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<ActionType>(null);
|
||||
const descriptionsRef = useRef<DescriptionsFormRef>(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<SmsLogVO> = {
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
fixed: 'right',
|
||||
width: 80,
|
||||
render: (text: React.ReactNode, record: SmsLogVO) => [
|
||||
<a key="editable" onClick={() => handleDetail(record)}>
|
||||
详情
|
||||
</a>,
|
||||
],
|
||||
};
|
||||
const columns = [...baseTenantColumns, actionColumns];
|
||||
return (
|
||||
<>
|
||||
<EnhancedProTable<SmsLogVO>
|
||||
ref={tableRef}
|
||||
columns={columns}
|
||||
request={onFetch}
|
||||
headerTitle="登录日志"
|
||||
showIndex={false}
|
||||
showSelection={false}
|
||||
/>
|
||||
<ModalDescriptions
|
||||
ref={descriptionsRef}
|
||||
title="登录日志详情"
|
||||
columns={descriptionsColumns()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default SyStemMessageNotifyMessage;
|
||||
Reference in New Issue
Block a user