Files
manage/src/utils/tableColumns.jsx

22 lines
579 B
JavaScript

import { Tag } from 'antd';
export const getStatusColumn = (options = {}) => ({
title: '状态',
dataIndex: 'status',
key: 'status',
render: (status) => {
const color = status === '进行中' ? 'green' :
status === '已完成' ? 'blue' :
status === '已取消' ? 'red' : 'default';
return <Tag color={color}>{status}</Tag>;
},
...options,
});
export const getDateColumn = (title, dataIndex, options = {}) => ({
title,
dataIndex,
key: dataIndex,
render: (date) => new Date(date).toLocaleString(),
...options,
});