skyouc
1 天以前 beb003f8e8cd5ae31a0ac55d0624ed2b2ad862bb
rsf-admin/src/page/components/CardWithIcon.jsx
@@ -1,13 +1,17 @@
import * as React from 'react';
import { FC, createElement } from 'react';
import { Card, Box, Typography, Divider } from '@mui/material';
import { Card, Box, Typography, Divider, Stack } from '@mui/material';
import { useTranslate } from 'react-admin';
import { Link } from 'react-router-dom';
const CardWithIcon = ({ icon, title, subtitle, to, children }) => (
const CardWithIcon = ({ icon, title, subtitle, to, children, statistic, type }) => {
    const translate = useTranslate();
    return (
    <Card
        sx={{
                width: '100%',
            minHeight: 52,
            display: 'flex',
            flexDirection: 'column',
            flex: '1',
            '& a': {
@@ -46,15 +50,36 @@
                {createElement(icon, { fontSize: 'large' })}
            </Box>
            <Box textAlign="right">
                <Typography color="textSecondary">{title}</Typography>
                <Typography variant="h5" component="h2">
                    {subtitle || ' '}
                </Typography>
                    {type ? <Box sx={{ display: "flex" }}>
                        <Box sx={{ display: 'flex', padding: '1em' }}>
                            <Typography color="textSecondary">{translate("page.dashboard.header.planQty")}:</Typography>
                            <Typography color="textSecondary">{statistic?.inAnf}</Typography>
                        </Box>
                        {!children && <Box sx={{ display: "flex" }}>
                            <Box sx={{ display: 'flex', padding: '1em' }}>
                                <Typography color="textSecondary">{translate("page.dashboard.header.realQty")}:</Typography>
                                <Typography color="textSecondary">{statistic?.taskIn}</Typography>
                            </Box>
                            <Box sx={{ display: 'flex', padding: '1em' }}>
                                <Typography color="textSecondary">{type == 'in' ? translate("page.dashboard.header.waitQty") : translate("page.dashboard.header.waitOutQty")}:</Typography>
                                <Typography color="textSecondary">{type == 'in' ? statistic?.taskIn : statistic?.taskOut}</Typography>
                            </Box>
                        </Box>}
                    </Box> : <Box>
                        <Typography  sx={{ display: 'flex', padding: '1em' }}>
                            {' 12234'}
                        </Typography>
                    </Box>}
            </Box>
        </Box>
        {children && <Divider />}
        {children}
    </Card>
);
    )
};
export default CardWithIcon;