fix: welcome page layout
parent
29fa1341d8
commit
29704a6197
|
|
@ -42,8 +42,10 @@ data:
|
||||||
{
|
{
|
||||||
"success": true,
|
"success": true,
|
||||||
"data": {
|
"data": {
|
||||||
"notInOreo": 114,
|
"todayPT": 114, // 今日预填写工单总数
|
||||||
"totalPT": 514, // 所有预填写工单
|
"totalPT": 514, // 所有预填写工单
|
||||||
|
"oreo": 93, // 加入 Oreo 工单数
|
||||||
|
"report": 8, // 今日反馈数
|
||||||
"allSuccess": 1919, // 所有成功工单(包括 Oreo 内)
|
"allSuccess": 1919, // 所有成功工单(包括 Oreo 内)
|
||||||
"all": 2024 // 所有工单(包括 Oreo 内)
|
"all": 2024 // 所有工单(包括 Oreo 内)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@ import { Card, Statistic } from 'antd';
|
||||||
import RcResizeObserver from 'rc-resize-observer';
|
import RcResizeObserver from 'rc-resize-observer';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
const { Divider } = ProCard;
|
|
||||||
|
|
||||||
const percentRing = (percent: number, frontColor: string): React.JSX.Element => {
|
const percentRing = (percent: number, frontColor: string): React.JSX.Element => {
|
||||||
const config = {
|
const config = {
|
||||||
percent,
|
percent: percent / 100,
|
||||||
width: 120,
|
width: 120,
|
||||||
height: 120,
|
height: 120,
|
||||||
color: ['#E8EFF5', frontColor],
|
color: ['#E8EFF5', frontColor],
|
||||||
|
|
@ -16,7 +14,7 @@ const percentRing = (percent: number, frontColor: string): React.JSX.Element =>
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
style: {
|
style: {
|
||||||
text: `${percent * 100}%`,
|
text: `${percent}%`,
|
||||||
x: '50%',
|
x: '50%',
|
||||||
y: '50%',
|
y: '50%',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
|
@ -30,6 +28,24 @@ const percentRing = (percent: number, frontColor: string): React.JSX.Element =>
|
||||||
return <Tiny.Ring {...config} />;
|
return <Tiny.Ring {...config} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface IndexData {
|
||||||
|
todayPT: number;
|
||||||
|
report: number;
|
||||||
|
oreo: number;
|
||||||
|
totalPT: number;
|
||||||
|
allSuccess: number;
|
||||||
|
all: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const indexData: IndexData = {
|
||||||
|
todayPT: 14,
|
||||||
|
report: 8,
|
||||||
|
oreo: 93,
|
||||||
|
totalPT: 1145,
|
||||||
|
allSuccess: 1818,
|
||||||
|
all: 1919,
|
||||||
|
};
|
||||||
|
|
||||||
const Logs: React.FC = () => {
|
const Logs: React.FC = () => {
|
||||||
const [responsive, setResponsive] = useState(false);
|
const [responsive, setResponsive] = useState(false);
|
||||||
return (
|
return (
|
||||||
|
|
@ -41,51 +57,56 @@ const Logs: React.FC = () => {
|
||||||
setResponsive(offset.width < 596);
|
setResponsive(offset.width < 596);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ProCard.Group direction={responsive ? 'column' : 'row'}>
|
<ProCard split={responsive ? 'horizontal' : 'vertical'}>
|
||||||
<ProCard>
|
<ProCard title="左侧详情" colSpan="48%">
|
||||||
<Statistic title="今日预填写工单数" value={13} />
|
左侧内容
|
||||||
</ProCard>
|
</ProCard>
|
||||||
<Divider type={responsive ? 'horizontal' : 'vertical'} />
|
<ProCard colSpan="20%">
|
||||||
<StatisticCard
|
<StatisticCard
|
||||||
chart={percentRing(0.372, '#00CC66')}
|
style={{ marginTop: '2vh' }}
|
||||||
|
statistic={{
|
||||||
|
title: '今日预填写工单数',
|
||||||
|
value: indexData.todayPT,
|
||||||
|
description: (
|
||||||
|
<Statistic
|
||||||
|
style={{ marginTop: '15vh' }}
|
||||||
|
title="今日反馈数"
|
||||||
|
value={indexData.report}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</ProCard>
|
||||||
|
<ProCard>
|
||||||
|
<StatisticCard.Group direction={responsive ? 'row' : 'column'}>
|
||||||
|
<StatisticCard
|
||||||
|
chart={percentRing(
|
||||||
|
Math.round(((indexData.oreo / indexData.totalPT) * 1000) / 10),
|
||||||
|
'#00CC66',
|
||||||
|
)}
|
||||||
statistic={{
|
statistic={{
|
||||||
title: '加入 Oreo 工单数',
|
title: '加入 Oreo 工单数',
|
||||||
value: 93,
|
value: indexData.oreo,
|
||||||
description: (
|
description: <Statistic title="预填写工单总数" value={indexData.totalPT} />,
|
||||||
<>
|
|
||||||
<Statistic title="预填写工单总数" value={1145} />
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
chartPlacement="left"
|
chartPlacement="left"
|
||||||
/>
|
/>
|
||||||
</ProCard.Group>
|
|
||||||
</RcResizeObserver>
|
|
||||||
<RcResizeObserver
|
|
||||||
key="resize-observer"
|
|
||||||
onResize={(offset) => {
|
|
||||||
setResponsive(offset.width < 596);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StatisticCard.Group direction={responsive ? 'column' : 'row'}>
|
|
||||||
<ProCard>
|
|
||||||
<Statistic title="今日反馈数" value={8} />
|
|
||||||
</ProCard>
|
|
||||||
<Divider type={responsive ? 'horizontal' : 'vertical'} />
|
|
||||||
<StatisticCard
|
<StatisticCard
|
||||||
chart={percentRing(0.642, '#66AFF4')}
|
style={{ marginTop: '3vh' }}
|
||||||
|
chart={percentRing(
|
||||||
|
Math.round((indexData.allSuccess / indexData.all) * 1000) / 10,
|
||||||
|
'#66AFF4',
|
||||||
|
)}
|
||||||
statistic={{
|
statistic={{
|
||||||
title: '维修成功次数',
|
title: '维修成功次数',
|
||||||
value: 1818,
|
value: indexData.allSuccess,
|
||||||
description: (
|
description: <Statistic title="Oreo、ETA 总工单数" value={indexData.all} />,
|
||||||
<>
|
|
||||||
<Statistic title="Oreo、ETA 总工单数" value={1919} />
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
chartPlacement="left"
|
chartPlacement="left"
|
||||||
/>
|
/>
|
||||||
</StatisticCard.Group>
|
</StatisticCard.Group>
|
||||||
|
</ProCard>
|
||||||
|
</ProCard>
|
||||||
</RcResizeObserver>
|
</RcResizeObserver>
|
||||||
</Card>
|
</Card>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue