zhang
2025-05-20 1313906bb1eb983d3beece810035e7fc28d6a92f
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
import React, { useState, useRef, useEffect } from 'react';
import { useTranslate } from "react-admin";
import { Box, Typography, Toolbar, Stack, useTheme, Card, Divider, Button } from '@mui/material';
import JsonShow from '../JsonShow';
import CheckOutlinedIcon from '@mui/icons-material/CheckOutlined';
import ClearOutlinedIcon from '@mui/icons-material/ClearOutlined';
import * as Tool from '../tool';
 
const BatchSettings = (props) => {
    const theme = useTheme();
    const themeMode = theme.palette.mode;
    const translate = useTranslate();
    const { batchSprites, drawerClose } = props;
 
    return (
        <Box>
            <JsonShow
                data={
                    batchSprites?.map(item => {
                        return item.data?.type + '-' + item.data?.no;
                    })
                }
                height={550}
            />
            <Box mt={2}>
                <Divider sx={{
                    marginBottom: '16px'
                }} />
                <Toolbar sx={{
                    display: 'flex',
                    justifyContent: 'space-between',
                    minHeight: { sm: 0 },
                }}>
                    <Button
                        variant="outlined"
                        color="primary"
                        onClick={drawerClose}
                        sx={{ borderColor: theme => theme.palette.success.main }}
                        startIcon={
                            <CheckOutlinedIcon sx={{ color: theme => theme.palette.success.main }} />
                        }
                    >
                        {translate('ra.action.confirm')}
                    </Button>
 
                    <Button
                        variant="outlined"
                        color="primary"
                        onClick={() => {
                            batchSprites?.forEach((sprite) => {
                                Tool.getMapContainer().removeChild(sprite);
                                drawerClose();
                            })
                        }}
                        sx={{ borderColor: theme => theme.palette.error.main }}
                        startIcon={
                            <ClearOutlinedIcon sx={{ color: theme => theme.palette.error.main }} />
                        }
                    >
                        {translate('ra.action.delete')}
                    </Button>
                </Toolbar>
            </Box>
        </Box>
    )
}
 
export default BatchSettings;