#
vincentlu
2025-04-21 bfc0fff77167d63165e49d3733bb02a78e74cb27
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
import React, { useState, useRef, useEffect, useMemo } from "react";
import { useTranslate } from "react-admin";
import {
    Select,
    MenuItem,
    Button,
    useTheme,
    ListItemIcon,
    ListItemText,
} from '@mui/material';
import { handleRePositionAll } from "../http";
import GpsFixedIcon from '@mui/icons-material/GpsFixed';
 
const MoreOperate = ({ }) => {
    const translate = useTranslate();
    const theme = useTheme();
 
    const verifyPassword = (fn) => {
        let pass = true;
        const pwd = prompt("please enter password:");
        if (pwd === 'xltys1995') {
            pass = true;
        } else {
            pass = false;
            if (pwd) {
                alert('Incorrect password');
            }
        }
        if (pass) {
            if (fn) {
                fn();
            }
        }
    }
 
    const handleLocateAll = () => {
        alert('定位成功');
    }
 
    return (
        <>
            <Select
                value={translate('page.map.action.moreOperation')}
                onChange={(event) => {
                    console.log(event.target.value);
                }}
                renderValue={(selected) =>
                    translate('page.map.action.moreOperation')
                }
                variant="outlined"
                size="small"
                sx={{
                    ml: 2,
                    backgroundColor: theme.palette.background.paper,
                    color: theme.palette.text.primary,
                    borderRadius: 1,
                }}
            >
                <MenuItem value={translate('page.map.action.moreOperation')} sx={{ display: 'none' }} />
                <MenuItem
                    onClick={() => {
                        verifyPassword(handleLocateAll);
                    }}
                >
                    <ListItemIcon>
                        <GpsFixedIcon fontSize="small" />
                    </ListItemIcon>
                    <ListItemText>{translate('page.map.action.oneClickLocate')}</ListItemText>
                </MenuItem>
            </Select>
            {/* <Button
                variant="contained"
                color="primary"
                onClick={handleToggle}
                sx={{ mr: 2 }}
            >
                重新定位
            </Button> */}
        </>
 
    );
}
 
export default MoreOperate;