117 lines
2.7 KiB
TypeScript
117 lines
2.7 KiB
TypeScript
import { Tag, Typography } from 'antd';
|
|
import React from 'react';
|
|
import XinTable from '@/components/XinTable';
|
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
|
import type ITaskBid from '@/domain/iTaskBid';
|
|
import { useTranslation } from 'react-i18next';
|
|
import dayjs from 'dayjs';
|
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
|
|
const { Title, Text } = Typography;
|
|
dayjs.extend(relativeTime);
|
|
|
|
const Table: React.FC = () => {
|
|
const { t } = useTranslation();
|
|
|
|
const columns: XinTableColumn<ITaskBid>[] = [
|
|
{
|
|
title: t('task.bid.id'),
|
|
dataIndex: 'id',
|
|
hideInForm: true,
|
|
sorter: true,
|
|
align: 'center',
|
|
width: 80,
|
|
},
|
|
{
|
|
title: t('task.bid.task_id'),
|
|
dataIndex: 'task_id',
|
|
valueType: 'text',
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('task.bid.user_id'),
|
|
dataIndex: 'user_id',
|
|
valueType: 'text',
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('task.bid.price'),
|
|
dataIndex: 'price',
|
|
hideInForm: true,
|
|
align: 'center',
|
|
render: (value: string) => `¥${value || '0.00'}`,
|
|
},
|
|
{
|
|
title: t('task.bid.message'),
|
|
dataIndex: 'message',
|
|
valueType: 'text',
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('task.bid.status'),
|
|
dataIndex: 'status',
|
|
valueType: 'text',
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('task.bid.accepted_at'),
|
|
dataIndex: 'accepted_at',
|
|
hideInForm: true,
|
|
hideInSearch: true,
|
|
align: 'center',
|
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
|
},
|
|
{
|
|
title: t('task.bid.created_at'),
|
|
hideInForm: true,
|
|
hideInSearch: true,
|
|
dataIndex: 'created_at',
|
|
align: 'center',
|
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
|
},
|
|
{
|
|
title: t('task.bid.updated_at'),
|
|
hideInForm: true,
|
|
hideInSearch: true,
|
|
dataIndex: 'updated_at',
|
|
align: 'center',
|
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
|
},
|
|
];
|
|
|
|
const tableProps: XinTableProps<ITaskBid> = {
|
|
api: '/task/bid',
|
|
columns,
|
|
rowKey: 'id',
|
|
accessName: 'task.bid',
|
|
formProps: {
|
|
grid: true,
|
|
colProps: { span: 12 },
|
|
rowProps: { gutter: [30, 0] },
|
|
layout: 'vertical',
|
|
},
|
|
modalProps: {
|
|
width: 800,
|
|
},
|
|
cardProps: {
|
|
variant: 'borderless',
|
|
},
|
|
pagination: {
|
|
size: 'small',
|
|
style: { marginBottom: 0 },
|
|
},
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<div className="mb-5">
|
|
<Title level={3}>{t('task.bid.page.title')}</Title>
|
|
<Text type="secondary">{t('task.bid.page.description')}</Text>
|
|
</div>
|
|
<XinTable<ITaskBid> {...tableProps} />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Table;
|