EVA-Tea/src/pages/Admin/Conclusion/index.tsx

112 lines
3.1 KiB
TypeScript

import { PageContainer, ProList } from '@ant-design/pro-components';
import { Card } from 'antd';
import moment from 'moment';
import request from 'umi-request';
import transConclusion, { ConclusionItem } from './conclusionItem';
const Logs: React.FC = () => {
return (
<PageContainer>
<Card>
<ProList<ConclusionItem>
search={{
filterType: 'light',
}}
rowKey="op"
headerTitle="值班总结列表"
request={async (params = {} as Record<string, any>) =>
request<{
data: ConclusionItem[];
}>('/admin/conclusionlist', {
params,
})
}
pagination={{
pageSize: 10,
}}
metas={{
title: {
dataIndex: 'op',
title: '用户',
},
avatar: {
dataIndex: 'avatar',
search: false,
},
description: {
dataIndex: ['time', 'week', 'shift'],
search: false,
render: (_, row) => {
return (
<div>
{'于 ' +
moment(row.time).format('YYYY-M-D HH:mm:ss') +
' 上传了' +
transConclusion(row.week, row.shift) +
'值班总结'}
</div>
);
},
},
actions: {
render: () => [
<a href="" target="_blank" rel="noopener noreferrer" key="view">
</a>,
],
search: false,
},
week: {
// 自己扩展的字段,主要用于筛选,不在列表中显示
title: '星期',
valueType: 'select',
valueEnum: {
all: { text: '全部', status: 'Default' },
mon: {
text: '周一',
},
tue: {
text: '周二',
},
wed: {
text: '周三',
},
thu: {
text: '周四',
},
fri: {
text: '周五',
},
sat: {
text: '周六',
},
sun: {
text: '周日',
},
},
},
shift: {
// 自己扩展的字段,主要用于筛选,不在列表中显示
title: '值班',
valueType: 'select',
valueEnum: {
all: { text: '全部', status: 'Default' },
first: {
text: '第一班',
},
second: {
text: '第二班',
},
third: {
text: '第三班',
},
},
},
}}
/>
</Card>
</PageContainer>
);
};
export default Logs;