move conclusion to admin; add protable in conclusion

mgy
Dawn1Ocean 2024-04-16 11:51:17 +08:00
parent 2731f5560f
commit d6a42f6087
6 changed files with 261 additions and 0 deletions

View File

@ -14,6 +14,7 @@ export default [
{ path: '/admin', redirect: '/admin/dutyinfo' },
{ path: '/admin/dutyinfo', name: '值班信息', component: './Admin/DutyInfo' },
{ path: '/admin/dutytable', name: '值班表管理', component: './Admin/DutyTable' },
{ path: '/admin/conclusion', name: '值班总结管理', component: './Admin/Conclusion' },
{ path: '/admin/report', name: '反馈信息', component: './Admin/Report' },
{ path: '/admin/logs', name: '日志', component: './Admin/Logs' },
],

View File

@ -315,3 +315,41 @@ data:
```
前端显示的信息:"{op} 于 {time} {operation} 了 {target}{prev.info} -> {curr.info}"
## 值班总结管理页面
### 获取值班总结列表 `GET /admin/conclusionlist`
request:
```json
{
"current": 1,
"pageSize": 10,
"op?": "晓洋", // 如果不筛选则不出现在 request-body 内
"week": "all" | "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun", // all 之外的选项用于筛选
"shift": "all" | "first" | "second" | "third" // all 之外的选项用于筛选
}
```
data:
```json
{
"page": 1,
"total": 24,
"success": true,
"data": [
{
"op": "宇航员",
"avatar": "https://...",
"time": "2024-03-07T19:52:48.523303",
"week": "2",
"shift": "3",
}
// ...
]
}
```
前端显示的信息:"{op} 于 {time} 上传了{week}{shift}值班总结"

View File

@ -0,0 +1,73 @@
[
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:48.523303",
"week": "2",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:49.523303",
"week": "2",
"shift": "1"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:50.523303",
"week": "2",
"shift": "2"
},
{
"op": "晓洋",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:51.523303",
"week": "7",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:52.523303",
"week": "7",
"shift": "1"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:53.523303",
"week": "2",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:54.523303",
"week": "2",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:55.523303",
"week": "2",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:56.523303",
"week": "2",
"shift": "3"
},
{
"op": "宇航员",
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"time": "2024-03-07T19:52:57.523303",
"week": "2",
"shift": "3"
}
]

View File

@ -2,6 +2,7 @@ import loglist from './loglist.json';
import sheet from './sheet.json';
import sheetlist from './sheetlist.json';
import reportlist from './reportlist.json';
import conclusionlist from './conclusionlist.json';
module.exports = {
'GET /admin/stats': {
@ -55,6 +56,12 @@ module.exports = {
total: 24,
data: reportlist,
},
'GET /admin/conclusionlist': {
success: true,
page: 1,
total: 24,
data: conclusionlist,
},
'GET /api/currentUser': {
data: {
name: 'Serati Ma',

View File

@ -0,0 +1,31 @@
export type ConclusionItem = {
op: string;
time: string;
week: string;
shift: string;
};
const weekMap: { [key: string]: string } = {
'1': '周一',
'2': '周二',
'3': '周三',
'4': '周四',
'5': '周五',
'6': '周六',
'7': '周日',
};
const shiftMap: { [key: string]: string } = {
'1': '第一班',
'2': '第二班',
'3': '第三班',
};
const transConclusion = (week: string, shift: string) => {
if (week === '7' && shift === '3') {
return '其他值班时间';
} else {
return weekMap[week] + shiftMap[shift];
}
};
export default transConclusion;

View File

@ -0,0 +1,111 @@
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;