import React from 'react';
import { Tag, Badge } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { Action, PreviewColumn } from 'components';
/**
* 生成表格配置数据
*/
export const createColumns = ({ edit, del }: any) => {
const columns: ColumnsType = [
{
title: '头像',
dataIndex: 'avatar',
width: 60,
render: (v, { title }: any) => ,
},
{ title: '用户名', dataIndex: 'username', width: 120 },
{ title: '昵称', dataIndex: 'nickname', width: 160 },
{ title: '注册IP', dataIndex: 'reg_ip', width: 160 },
{ title: '登陆IP', dataIndex: 'login_ip', width: 160 },
{ title: '注册时间', dataIndex: 'create_date', width: 180 },
{ title: '登陆时间', dataIndex: 'login_date', width: 180 },
{
title: '帐号类型',
dataIndex: 'type',
width: 90,
fixed: 'right',
render: (v?: TTypeKeys) => renders.type[v!],
},
{ title: '状态', dataIndex: 'status', width: 90, fixed: 'right', render: v => renders.status[v] },
{
title: '操作',
key: 'action',
width: 120,
fixed: 'right',
render: data => (
edit(data)}>
编辑
del([data.id])}>
删除
),
},
];
return columns;
};
export const options = {
type: { admin: '管理员', user: '用户' },
status: ['未审核', '已审核', '冻结'],
};
export const renders = {
type: {
admin: 管理员,
user: 用户,
},
status: [
,
,
,
],
};
export type TTypeKeys = keyof typeof renders.type;