#
luxiaotao1123
2024-09-21 365d1eae2e5f0b8b5acb1a2bd5417e0cb02cda58
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
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    ShowBase,
    TabbedShowLayout,
    useShowContext,
} from 'react-admin';
import {
    Box,
    Button,
    Card,
    CardContent,
    Stack,
    Typography,
    Avatar,
} from '@mui/material';
import { formatDistance } from 'date-fns';
import request from '@/utils/request';
 
export const AgvShowTask = ({ agvId }) => {
 
    const [records, setRecords] = useState(null);
 
    useEffect(() => {
        const http = async (agvId) => {
            const res = await request.post('task/page', { agvId: agvId });
            const { code, msg, data } = res.data;
            if (code === 200) {
                setRecords(data);
            } else {
                setRecords(null);
            }
        }
        if (agvId) {
            http(agvId);
        }
    }, [agvId]);
 
    return (
        <>
            <h1>{JSON.stringify(records)}</h1>
        </>
    )
}