Files
iot-device-management-frontend/apps/web-antd/src/views/system/sms/log/data.ts

166 lines
3.8 KiB
TypeScript
Raw Normal View History

2025-04-03 17:43:52 +08:00
import type { VbenFormSchema } from '#/adapter/form';
2025-05-19 17:58:06 +08:00
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
2025-04-22 11:25:11 +08:00
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
2025-05-06 23:23:42 +08:00
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
2025-04-03 17:43:52 +08:00
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'mobile',
label: '手机号',
component: 'Input',
2025-04-03 22:56:03 +08:00
componentProps: {
allowClear: true,
placeholder: '请输入手机号',
2025-04-04 12:37:12 +08:00
},
2025-04-03 17:43:52 +08:00
},
{
fieldName: 'channelId',
label: '短信渠道',
component: 'ApiSelect',
componentProps: {
api: async () => await getSimpleSmsChannelList(),
labelField: 'signature',
valueField: 'id',
allowClear: true,
2025-04-03 22:56:03 +08:00
placeholder: '请选择短信渠道',
2025-04-03 17:43:52 +08:00
},
},
{
fieldName: 'templateId',
label: '模板编号',
component: 'Input',
2025-04-03 22:56:03 +08:00
componentProps: {
allowClear: true,
placeholder: '请输入模板编号',
2025-04-04 12:37:12 +08:00
},
2025-04-03 17:43:52 +08:00
},
{
fieldName: 'sendStatus',
label: '发送状态',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.SYSTEM_SMS_SEND_STATUS, 'number'),
2025-04-03 22:56:03 +08:00
allowClear: true,
placeholder: '请选择发送状态',
2025-04-03 17:43:52 +08:00
},
},
{
fieldName: 'sendTime',
label: '发送时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
2025-04-03 17:43:52 +08:00
allowClear: true,
},
},
{
fieldName: 'receiveStatus',
label: '接收状态',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, 'number'),
2025-04-03 22:56:03 +08:00
allowClear: true,
placeholder: '请选择接收状态',
2025-04-03 17:43:52 +08:00
},
},
{
fieldName: 'receiveTime',
label: '接收时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
2025-04-03 17:43:52 +08:00
allowClear: true,
},
},
];
}
/** 列表的字段 */
2025-05-19 17:58:06 +08:00
export function useGridColumns(): VxeTableGridOptions['columns'] {
2025-04-03 17:43:52 +08:00
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 },
},
},
{
title: '操作',
2025-05-19 17:58:06 +08:00
width: 80,
2025-04-03 17:43:52 +08:00
fixed: 'right',
2025-05-19 17:58:06 +08:00
slots: { default: 'actions' },
2025-04-03 17:43:52 +08:00
},
];
}