From 55833211343bc9d0f80e947ab773b75821b04466 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 07 十月 2024 08:27:17 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/mission/MissionList.jsx   |    4 +
 zy-acs-flow/src/page/mission/MissionResend.jsx |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 zy-acs-flow/src/page/mission/MissionShow.jsx   |    4 +
 3 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/zy-acs-flow/src/page/mission/MissionList.jsx b/zy-acs-flow/src/page/mission/MissionList.jsx
index f1bb75c..b0b3eca 100644
--- a/zy-acs-flow/src/page/mission/MissionList.jsx
+++ b/zy-acs-flow/src/page/mission/MissionList.jsx
@@ -14,11 +14,11 @@
 import { matchPath, useLocation } from 'react-router';
 import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material';
 import { styled } from '@mui/material/styles';
-import PageDrawer from "../components/PageDrawer";
 import * as Common from '@/utils/common';
 import MissionShow from "./MissionShow";
 import { MissionListContent } from "./MissionListContent";
 import EmptyDataLoader from "../components/EmptyDataLoader";
+import MissionResend from "./MissionResend";
 
 const MissionList = () => {
 
@@ -45,6 +45,7 @@
 const MissionLayout = () => {
     const location = useLocation();
     const matchShow = matchPath('/mission/:id/show', location.pathname);
+    const matchResend = matchPath('/mission/:id/resend', location.pathname);
 
     const { data, isPending, filterValues } = useListContext();
     const hasFilters = filterValues && Object.keys(filterValues).length > 0;
@@ -72,6 +73,7 @@
                 <MissionListContent />
             </Card>
             <MissionShow open={!!matchShow} id={matchShow?.params.id} />
+            <MissionResend open={!!matchResend} id={matchResend?.params.id} />
         </Stack>
     );
 }
diff --git a/zy-acs-flow/src/page/mission/MissionResend.jsx b/zy-acs-flow/src/page/mission/MissionResend.jsx
new file mode 100644
index 0000000..5ec3fbb
--- /dev/null
+++ b/zy-acs-flow/src/page/mission/MissionResend.jsx
@@ -0,0 +1,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 />}
+                                >
+                                    Back to deal
+                                </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;
\ No newline at end of file
diff --git a/zy-acs-flow/src/page/mission/MissionShow.jsx b/zy-acs-flow/src/page/mission/MissionShow.jsx
index 8a6c6af..b58ba7f 100644
--- a/zy-acs-flow/src/page/mission/MissionShow.jsx
+++ b/zy-acs-flow/src/page/mission/MissionShow.jsx
@@ -229,7 +229,9 @@
     const translate = useTranslate();
 
     const handleClick = () => {
-        alert(1);
+        redirect(`/mission/${record.id}/resend`, undefined, undefined, undefined, {
+            _scrollToTop: false,
+        });
     };
 
     return (

--
Gitblit v1.9.1