#
luxiaotao1123
2024-10-07 d831cebd06d86aada71e9cc7250b4092d94e3445
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
import {
    useTranslate,
    EditButton,
    ReferenceArrayField,
    ReferenceField,
    ReferenceManyField,
    ShowBase,
    useDataProvider,
    useNotify,
    useRecordContext,
    useRedirect,
    useRefresh,
    useUpdate,
} from 'react-admin';
import {
    Box,
    Button,
    Chip,
    Dialog,
    DialogContent,
    Divider,
    Stack,
    Typography,
    Avatar,
    useTheme,
} from '@mui/material';
import { Link } from 'react-router-dom';
import DialogCloseButton from "../components/DialogCloseButton";
import { blueGrey, blue } from '@mui/material/colors';
import MoveToInboxIcon from '@mui/icons-material/MoveToInbox';
import { format } from 'date-fns';
import { TaskList } from "./TaskList";
import { ActionsIterator } from "../action/ActionsIterator";
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
 
const MissionResend = ({ open, id }) => {
    const redirect = useRedirect();
    const handleClose = () => {
        redirect('list', 'mission');
    };
 
    return (
        <Dialog
            open={open}
            onClose={handleClose}
            fullWidth
            maxWidth="md"
            sx={{
                '& .MuiDialog-container': {
                    alignItems: 'flex-start',
                },
            }}
        >
            <DialogContent sx={{ padding: 0 }}>
                {!!id ? (
                    <ShowBase id={id}>
                        <MissionResendContent handleClose={handleClose} />
                    </ShowBase>
                ) : null}
            </DialogContent>
        </Dialog>
    )
}
 
const MissionResendContent = ({ handleClose }) => {
    const theme = useTheme();
    const record = useRecordContext();
    const translate = useTranslate();
    if (!record) return null;
 
    return (
        <>
            <DialogCloseButton
                onClose={handleClose}
                top={12}
            />
            <Stack gap={1}>
                <Box display="flex" p={2}>
                    <Box flex="1">
                        <Stack
                            direction="row"
                            justifyContent="space-between"
                            mb={4}
                        >
                            <Stack direction="row" alignItems="center" gap={2}>
                                <Avatar
                                    sx={{
                                        width: 30,
                                        height: 30,
                                        bgcolor: theme.palette.primary.main,
                                    }}
                                >
                                    {record.agv}
                                </Avatar>
                                <Typography variant="h5">
                                    {record.groupNo}
                                </Typography>
                            </Stack>
                            <Stack
                                gap={1}
                                direction="row"
                                pr={6}
                            >
                                <Button
                                    component={Link}
                                    to={`/mission/${record.id}/show`}
                                    size="small"
                                    startIcon={<ArrowBackIosNewIcon />}
                                >
                                    {translate('page.mission.backToMission')}
                                </Button>
                            </Stack>
                        </Stack>
 
                        {!!record.codeList?.length && (
                            <Box m={2} sx={{ whiteSpace: 'pre-line' }}>
                                <Typography
                                    color="textSecondary"
                                    variant="caption"
                                >
                                    {translate('table.field.mission.runPath')}
                                </Typography>
                                <Typography variant="body2" sx={{ whiteSpace: 'normal', overflow: 'hidden', display: 'flex', flexWrap: 'wrap' }}>
                                    [&nbsp;{record.codeList.map((code, index) => (
                                        <span key={index} style={{
                                            color: record.currCode === code ? theme.palette.primary.main : 'inherit',
                                        }}>
                                            {code}{index < record.codeList.length - 1 && ','}&nbsp;
                                        </span>
                                    ))}&nbsp;]
                                </Typography>
                            </Box>
                        )}
 
                    </Box>
                </Box>
            </Stack>
        </>
    )
};
 
export default MissionResend;