feat: dutytable page

This commit is contained in:
Dawn1Ocean
2024-09-18 13:58:08 +08:00
parent 5158fd19d9
commit f023e4b64a
5 changed files with 410 additions and 350 deletions
-14
View File
@@ -1,14 +0,0 @@
import { Todo } from '@/components';
import { PageContainer } from '@ant-design/pro-components';
import { Card } from 'antd';
const Logs: React.FC = () => {
return (
<PageContainer>
<Card>
<Todo />
</Card>
</PageContainer>
);
};
export default Logs;
@@ -0,0 +1,6 @@
export type DutyTableItem = {
name: string;
isSelect: boolean;
time: string;
id: number;
};
+71
View File
@@ -0,0 +1,71 @@
import { PageContainer, ProList } from '@ant-design/pro-components';
import { Card, Space, Tag } from 'antd';
import moment from 'moment';
import request from 'umi-request';
import { DutyTableItem } from './dutyTableItem';
const DutyTable: React.FC = () => {
return (
<PageContainer>
<Card>
<ProList<DutyTableItem>
search={{
filterType: 'light',
}}
rowKey="op"
headerTitle="值班表列表"
request={async (params = {} as Record<string, any>) =>
request<{
data: DutyTableItem[];
}>('/admin/sheet/list', {
params,
})
}
pagination={{
pageSize: 10,
}}
metas={{
title: {
dataIndex: 'name',
title: '值班表',
},
subTitle: {
dataIndex: ['isSelect'],
render: (_, row) => {
return row.isSelect ? (
<Space size={0}>
<Tag color="blue">当前</Tag>
</Space>
) : (
<div></div>
);
},
title: '值班时间',
search: false,
},
extra: {
dataIndex: 'time',
render: (_: React.ReactNode, row: DutyTableItem) => {
return (
<div style={{ marginLeft: '3vh' }}>
{moment(row.time).format('YYYY-M-D HH:mm:ss')}
</div>
);
},
search: false,
},
actions: {
render: () => [
<a href="" target="_blank" rel="noopener noreferrer" key="view">
查看
</a>,
],
search: false,
},
}}
/>
</Card>
</PageContainer>
);
};
export default DutyTable;