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;
|