diff --git a/doc/api.md b/doc/api.md index 7a19ef3..c9a07e4 100644 --- a/doc/api.md +++ b/doc/api.md @@ -34,7 +34,7 @@ ## 主页面 -### 统计数据 `GET /admin/stats` +### 统计数据 `GET /stats` data: @@ -43,13 +43,32 @@ data: "success": true, "data": { "notInOreo": 114, - "total": 514 + "totalPT": 514, // 所有预填写工单 + "allSuccess": 1919, // 所有成功工单(包括 Oreo 内) + "all": 2024 // 所有工单(包括 Oreo 内) } } ``` ### 当前值班信息 `GET /admin/duty/current` +#### 正常值班 + +data: + +```json +{ + "isNormalDuty": true, + "inDutyCnt": 3, + "otherDutyTime": "", + "offDutyReason": "", + "place": "204", + "dutyRecoverTime": "" +} +``` + +#### 其他值班 + data: ```json @@ -93,7 +112,6 @@ request: } ``` - #### 更新值班表 `POST /admin/sheet/update` request: @@ -202,7 +220,7 @@ data: 无关项返回空字符串,后端手动校验 -request: +request: ```json { @@ -227,7 +245,7 @@ request: "current": 1, "pageSize": 10, "name?": "西西弗", // 如果不筛选则不出现在 request-body 内 - "phone?": "18888888888", // 如果不筛选则不出现在 request-body 内 + "phone?": "18888888888" // 如果不筛选则不出现在 request-body 内 } ``` @@ -244,7 +262,7 @@ data: "phone": "13333333333", "time": "2024-03-07T17:52:48.523303", "text": "你们为什么修不好天选3的PD充电?" - }, + } // ... ] } @@ -288,7 +306,7 @@ data: "id": 514, "info": "何君琳" } - }, + } // ... ] } diff --git a/package.json b/package.json index 6a0d84d..654d3e0 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "not ie <= 10" ], "dependencies": { + "@ant-design/charts": "^2.0.3", "@ant-design/icons": "^4.8.1", "@ant-design/pro-components": "^2.7.0", "@umijs/route-utils": "^2.2.2", diff --git a/src/pages/Admin/Report/index.tsx b/src/pages/Admin/Report/index.tsx index c992dd4..91ff741 100644 --- a/src/pages/Admin/Report/index.tsx +++ b/src/pages/Admin/Report/index.tsx @@ -52,7 +52,7 @@ const Logs: React.FC = () => { }, extra: { dataIndex: 'time', - render: (_, row) => { + render: (_: React.ReactNode, row: ReportItem) => { return (
{moment(row.time).format('YYYY-M-D HH:mm:ss')} diff --git a/src/pages/Welcome/index.tsx b/src/pages/Welcome/index.tsx index ffb74ba..27708cf 100644 --- a/src/pages/Welcome/index.tsx +++ b/src/pages/Welcome/index.tsx @@ -1,10 +1,35 @@ -import { PageContainer, ProCard } from '@ant-design/pro-components'; +import { Tiny } from '@ant-design/charts'; +import { PageContainer, ProCard, StatisticCard } from '@ant-design/pro-components'; import { Card, Statistic } from 'antd'; import RcResizeObserver from 'rc-resize-observer'; import { useState } from 'react'; const { Divider } = ProCard; +const percentRing = (percent: number, frontColor: string): React.JSX.Element => { + const config = { + percent, + width: 120, + height: 120, + color: ['#E8EFF5', frontColor], + annotations: [ + { + type: 'text', + style: { + text: `${percent * 100}%`, + x: '50%', + y: '50%', + textAlign: 'center', + fontSize: 16, + fontStyle: 'bold', + }, + }, + ], + }; + + return ; +}; + const Logs: React.FC = () => { const [responsive, setResponsive] = useState(false); return ( @@ -18,24 +43,52 @@ const Logs: React.FC = () => { > - + - - - - - - - - - - - + + + + ), + }} + chartPlacement="left" + /> + { + setResponsive(offset.width < 596); + }} + > + + + + + + + + + ), + }} + chartPlacement="left" + /> + + ); }; -export default Logs; \ No newline at end of file +export default Logs;