1
zhang
2025-09-11 3fa7cdec6ce44f07a0dc7e1910511ead606990f3
zy-acs-flow/src/page/agv/show/AgvShowTask.jsx
@@ -23,7 +23,8 @@
import { formatDistance } from 'date-fns';
import request from '@/utils/request';
import { useTheme } from '@mui/material/styles';
import { getTaskStsColor } from '@/utils/common';
import { getTaskStsColor } from '@/utils/color-util';
import ListEmptyTip from "../../components/ListEmptyTip";
const TaskItem = ({ record, now }) => {
    const translate = useTranslate();
@@ -36,11 +37,12 @@
                    <ListItemAvatar>
                        <Avatar
                            alt={record.seqNum}
                            variant="rounded"
                            sx={{
                                '& img': { objectFit: 'contain' },
                                fontSize: '0.9rem',
                                width: 40,
                                height: 40,
                                height: 25,
                                bgcolor: getTaskStsColor(record.taskSts$),
                            }}
                        >
@@ -48,13 +50,52 @@
                        </Avatar>
                    </ListItemAvatar>
                    <ListItemText
                        primary={`${record.first_name} ${record.last_name}`}
                        primary={<>
                            <Stack direction={'row'}>
                                <Typography
                                    variant="body1"
                                    color="textSecondary"
                                    component="span"
                                    sx={{ fontWeight: '600' }}
                                >
                                    {record.taskType$}
                                </Typography>
                                <Typography
                                    variant="caption"
                                    color="textSecondary"
                                    component="span"
                                >
                                    &nbsp;-&nbsp; {record.taskTypeEl}
                                </Typography>
                            </Stack>
                        </>}
                        secondary={
                            <>
                                {record.title}
                                &nbsp; &nbsp;
                                <Typography
                                    variant="body2"
                                    color="textSecondary"
                                    component="span"
                                    sx={{ fontWeight: 'bold' }}
                                >
                                    {record.taskSts$}
                                </Typography>
                            </>
                        }
                    />
                    <ListItemText
                        variant="body2"
                        color="textSecondary"
                        primary={<>
                            <Typography
                                variant="body2"
                                color="textPrimary"
                                component="span"
                            >
                                {record.oriLoc$ || ''}{record.oriSta$ || ''} - {record.destLoc$ || ''}{record.destSta$ || ''}
                            </Typography>
                        </>}
                        secondary={`code: ${record.destCode$ || ''}`}
                    />
                    <ListItemSecondaryAction>
                        <Typography
@@ -62,7 +103,7 @@
                            color="textSecondary"
                            component="span"
                        >
                            last activity{' '}
                            last update {' '}
                            {formatDistance(record.createTime, now)} ago{' '}
                        </Typography>
                    </ListItemSecondaryAction>
@@ -72,10 +113,11 @@
    )
}
export const AgvShowTask = ({ agvId, pageSize = 20 }) => {
export const AgvShowTask = ({ agvId, pageSize = 10 }) => {
    const [currCount, setCurrCount] = useState(pageSize);
    const [records, setRecords] = useState(null);
    const [total, setTotal] = useState(0);
    const translate = useTranslate();
    useEffect(() => {
        const http = async () => {
@@ -125,22 +167,20 @@
    return (
        <>
            {records.length > 0 ? (
                <Box m={1}>
                <Box >
                    <List>
                        {records.map(record => {
                            return (
                                <>
                                <React.Fragment key={record.id}>
                                    <TaskItem
                                        key={record.id}
                                        record={record}
                                        now={now}
                                    />
                                    <Divider />
                                </>
                                </React.Fragment>
                            )
                        })}
                        {currCount < total && (
                            <Button
                                onClick={() =>
@@ -152,15 +192,13 @@
                                fullWidth
                                sx={{ mt: 1 }}
                            >
                                Load more activity
                                {translate('common.action.loadMore')}
                            </Button>
                        )}
                    </List>
                </Box>
            ) : (
                <Typography>
                    no data found
                </Typography>
                <ListEmptyTip />
            )}
        </>