Files
tashow-manager/src/pages/system/messages/notify/template/config.tsx

194 lines
3.5 KiB
TypeScript

import type {
ProColumns,
ProDescriptionsItemProps,
ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { NotifyTemplateVO } from '@/services/system/message/notify/template';
export const baseTenantColumns: ProColumns<NotifyTemplateVO>[] = [
{
title: '模板编码',
dataIndex: 'code',
width: 100,
},
{
title: '模板名称',
dataIndex: 'name',
},
{
title: '类型',
dataIndex: 'type',
hideInSearch: true, // 在搜索表单中隐藏
},
{
title: '发送人名称',
dataIndex: 'nickname',
hideInSearch: true,
},
{
title: '模板内容',
dataIndex: 'content',
hideInSearch: true,
},
{
title: '开启状态',
dataIndex: 'status',
},
{
title: '备注',
dataIndex: 'remark',
hideInSearch: true,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateRange',
hideInSearch: true,
render: (_, record: NotifyTemplateVO) =>
dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
export const formColumns = (type: string): ProFormColumnsType[] => [
{
title: '模版编码',
dataIndex: 'code',
tip: '模版编码', // 提示信息
formItemProps: {
rules: [
{
required: true,
message: '请输入模版编码',
},
],
},
},
{
title: '模板名称',
dataIndex: 'name',
formItemProps: {
rules: [
{
required: true,
message: '请输入模版名称',
},
],
},
},
{
title: '发件人名称',
dataIndex: 'nickname',
formItemProps: {
rules: [
{
required: true,
message: '请输入发件人名称',
},
],
},
},
{
title: '模板内容',
dataIndex: 'content',
formItemProps: {
rules: [
{
required: true,
message: '请输入模板内容',
},
],
},
},
{
title: '类型',
dataIndex: 'type',
formItemProps: {
rules: [
{
required: true,
message: '请选择类型',
},
],
},
},
{
title: '开启状态',
dataIndex: 'status',
valueType: 'select',
fieldProps: {
placeholder: '请选择开启状态',
options: [
{
label: '正常',
value: 1,
},
{
label: '禁用',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请选择状态',
},
],
},
},
{
title: '备注',
dataIndex: 'remark',
fieldProps: {
placeholder: '请输入备注',
},
},
];
export const formTestColumns = (type: string): ProFormColumnsType[] => [
{
title: '模板内容',
dataIndex: 'content',
},
{
title: '用户类型',
dataIndex: 'userType',
valueType: 'radio',
fieldProps: {
options: [
{
label: '用户',
value: 1,
},
{
label: '管理员',
value: 2,
},
],
},
formItemProps: {
rules: [
{
required: true,
message: '请输入模版名称',
},
],
},
},
{
title: '接收人ID',
dataIndex: 'userId',
formItemProps: {
rules: [
{
required: true,
message: '请输入接收人ID',
},
],
},
},
];