mcfxkh-Web/src/views/Home/panels/WhSta/index.js

87 lines
3.1 KiB
JavaScript
Raw Normal View History

2025-05-28 17:05:53 +08:00
import React , { useState }from 'react';
2025-05-21 15:23:13 +08:00
import { OverallPromise } from '../../../../models/_/real';
import useRequest from '../../../../utils/useRequest';
import PanelBox from '../../components/PanelBox';
import OverallContent from './OverallContent';
2025-05-28 17:05:53 +08:00
import { Switch, FormControlLabel,InputLabel, Select, MenuItem,FormControl } from '@material-ui/core/index'
import { styled } from '@material-ui/styles';
2025-05-21 15:23:13 +08:00
export default function Overall({ style }) {
const { data } = useRequest(OverallPromise.get);
2025-05-28 17:05:53 +08:00
const CustomSwitch = styled(Switch)({
'& .MuiSwitch-switchBase': {
color: '#fff',
'&.Mui-checked': {
color: '#1890ff',
'& + .MuiSwitch-track': {
backgroundColor: '#1890ff',
opacity: 0.5,
},
},
},
'& .MuiSwitch-track': {
backgroundColor: 'rgba(255, 255, 255, 0.3)',
},
});
const StyledFormControlLabel = styled(FormControlLabel)({
'& .MuiFormControlLabel-label': {
color: '#fff'
}
});
const [dimension, setDimension] = useState('fqh');
const [checked, setChecked] = React.useState(false);
2025-05-21 15:23:13 +08:00
return (
<PanelBox
style={style}
2025-05-26 21:26:20 +08:00
title="巡查维护统计"
2025-05-21 15:23:13 +08:00
color="green"
>
<OverallContent data={data} />
2025-05-28 17:05:53 +08:00
<div style={{ position: 'absolute', color: '#fff', top: 70, left: -280, display: 'flex', alignItems: 'center' }}>
<StyledFormControlLabel
control={
<CustomSwitch
checked={checked}
onChange={(e) => setChecked(e.target.checked)}
/>
}
label="多灌区模式"
/>
{checked && <div style={{ marginTop: "-15px" }}>
<FormControl sx={{ minWidth: 200, marginBottom: 2 }}>
<InputLabel id="analysis-select-label"></InputLabel>
<Select
labelId="analysis-select-label"
value={dimension}
label=""
onChange={(event) => {
const value = event.target.value;
setDimension(value);
}}
sx={{
color: '#fff',
'.MuiOutlinedInput-notchedOutline': {
borderColor: 'rgba(255, 255, 255, 0.3)',
},
'&:hover .MuiOutlinedInput-notchedOutline': {
borderColor: 'rgba(255, 255, 255, 0.6)',
},
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
borderColor: '#fff',
}
}}
>
<MenuItem value="fqh">浮桥河灌区</MenuItem>
<MenuItem value="shk">三河口水库灌区</MenuItem>
<MenuItem value="qjs">群建水库灌区</MenuItem>
<MenuItem value="dsb">大石板灌区</MenuItem>
</Select>
</FormControl>
</div>}
</div>
2025-05-21 15:23:13 +08:00
</PanelBox>
)
}