#
luxiaotao1123
2024-10-07 55833211343bc9d0f80e947ab773b75821b04466
#
2个文件已修改
1个文件已添加
151 ■■■■■ 已修改文件
zy-acs-flow/src/page/mission/MissionList.jsx 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/mission/MissionResend.jsx 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/mission/MissionShow.jsx 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
    );
}
zy-acs-flow/src/page/mission/MissionResend.jsx
New file
@@ -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;
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 (