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

116 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { PageContainer, ProList } from '@ant-design/pro-components';
import { Card } from 'antd';
import moment from 'moment';
import request from 'umi-request';
import transInfo, { LogsItem } from './logItem';
const Logs: React.FC = () => {
return (
<PageContainer>
<Card>
<ProList<LogsItem>
search={{
filterType: 'light',
}}
rowKey="op"
headerTitle="日志列表"
request={async (params = {} as Record<string, any>) =>
request<{
data: LogsItem[];
}>('/admin/loglist', {
params,
})
}
pagination={{
pageSize: 10,
}}
metas={{
title: {
dataIndex: 'op',
title: '用户',
},
avatar: {
dataIndex: 'avatar',
search: false,
},
description: {
dataIndex: ['operation', 'target', 'prev', 'curr'],
search: false,
render: (_, row) => {
return (
<div>
{transInfo(row.operation, 'operation') +
'了' +
transInfo(row.target, 'target') +
'' +
row.prev.info +
' -> ' +
row.curr.info}
</div>
);
},
},
extra: {
dataIndex: 'time',
render: (_: React.ReactNode, row: LogsItem) => {
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,
},
operation: {
// 自己扩展的字段,主要用于筛选,不在列表中显示
title: '操作',
valueType: 'select',
valueEnum: {
all: { text: '全部', status: 'Default' },
add: {
text: '增加',
status: '0',
},
delete: {
text: '删除',
status: '1',
},
change: {
text: '更改',
status: '2',
},
},
},
target: {
// 自己扩展的字段,主要用于筛选,不在列表中显示
title: '操作对象',
valueType: 'select',
valueEnum: {
all: { text: '全部', status: 'Default' },
dutyTable: {
text: '值班表',
},
dutyInfo: {
text: '值班信息',
},
conclusion: {
text: '值班总结',
},
},
},
}}
/>
</Card>
</PageContainer>
);
};
export default Logs;