import React, { useState,useEffect } from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Button, Box, IconButton, ButtonGroup, Grid } from '@material-ui/core'; import SearchIcon from '@material-ui/icons/Search'; import RefreshIcon from '@material-ui/icons/Refresh'; import { DatePicker } from 'antd'; import moment from 'moment'; import { useDispatch, useSelector } from 'react-redux'; import ModalView from './view' const { RangePicker } = DatePicker; const useStyles = makeStyles((theme) => ({ root: { width: '100%', backgroundColor: 'transparent', color: '#fff' }, toolbar: { padding: theme.spacing(2), display: 'flex', gap: theme.spacing(2), alignItems: 'center', borderBottom: '1px solid rgba(255, 255, 255, 0.1)' }, searchRow: { display: 'flex', gap: theme.spacing(2), alignItems: 'center', flexWrap: 'wrap' }, searchField: { '& .MuiInputBase-root': { color: '#fff', backgroundColor: 'rgba(255, 255, 255, 0.05)', borderRadius: 4, width: 200 }, '& .MuiInputLabel-root': { color: '#fff' }, '& .MuiOutlinedInput-notchedOutline': { borderColor: 'rgba(255, 255, 255, 0.1)' } }, datePicker: { '& .MuiInputBase-root': { color: '#fff', backgroundColor: 'rgba(255, 255, 255, 0.05)', width: 200 }, '& .MuiIconButton-root': { color: '#fff' }, '& .MuiOutlinedInput-notchedOutline': { borderColor: 'rgba(255, 255, 255, 0.1)' } }, buttonGroup: { '& .MuiButton-root': { color: '#fff', borderColor: 'rgba(255, 255, 255, 0.3)', '&.active': { backgroundColor: '#2196f3', borderColor: '#2196f3' } } }, table: { '& .MuiTableCell-head': { backgroundColor: 'rgba(255, 255, 255, 0.05)', color: '#fff', fontWeight: 'bold', borderBottom: '1px solid rgba(255, 255, 255, 0.1)' }, '& .MuiTableCell-body': { color: '#fff', borderBottom: '1px solid rgba(255, 255, 255, 0.1)' } }, status: { padding: '4px 8px', borderRadius: 4, backgroundColor: 'rgba(33, 150, 243, 0.1)', color: '#2196f3' }, actionButton: { color: '#2196f3', '&:hover': { backgroundColor: 'rgba(33, 150, 243, 0.1)' } } })); const TaskList = () => { const classes = useStyles(); const [startDate, setStartDate] = useState(null); const dispatch = useDispatch(); const [endDate, setEndDate] = useState(null); const [activeType, setActiveType] = useState('daily'); const [visible, setVisible] = useState(false) const handleTypeChange = (type) => { setActiveType(type); }; const columns = [ { id: 'sequence', label: '序号', width: 70 }, { id: 'city', label: '市' }, { id: 'district', label: '区县' }, { id: 'location', label: '街道乡镇' }, { id: 'taskType', label: '任务标题' }, { id: 'taskContent', label: '任务内容' }, { id: 'status', label: '任务状态' }, { id: 'person', label: '巡查人' }, { id: 'startTime', label: '开始时间' }, { id: 'endTime', label: '结束时间' }, { id: 'problems', label: '问题数量', width: 100 }, { id: 'processed', label: '待处理', width: 100 }, { id: 'actions', label: '操作', width: 150 } ]; const mockData = [ { sequence: 1, city: '黄冈市', district: '麻城市', location: '', taskType: '06-02明山水库日常巡查', taskContent: '20250602每日巡检', status: '未完成', person: '姜兴军', startTime: '2025-06-02 00:00:00', endTime: '2025-06-08 23:59:59', problems: 0, processed: 0, createTime: '2025-06-02 02:00:00', creator: '' }, { sequence: 2, city: '黄冈市', district: '麻城市', location: '', taskType: '06-02浮桥河水库汛前巡查', taskContent: '20250602每日巡检', status: '未完成', person: '熊杰', startTime: '2025-06-02 00:00:00', endTime: '2025-06-08 23:59:59', problems: 0, processed: 0, createTime: '2025-06-02 02:00:00', creator: '' }, { sequence: 3, city: '黄冈市', district: '麻城市', location: '', taskType: '06-02永丰水库特别检查', taskContent: '20250602每日巡检', status: '未完成', person: '白斌', startTime: '2025-06-02 00:00:00', endTime: '2025-06-08 23:59:59', problems: 0, processed: 0, createTime: '2025-06-02 02:00:00', creator: '' }, { sequence: 4, city: '黄冈市', district: '麻城市', location: '', taskType: '06-02永红水库日常巡查', taskContent: '20250602每日巡检', status: '未完成', person: '于静', startTime: '2025-06-02 00:00:00', endTime: '2025-06-08 23:59:59', problems: 0, processed: 0, createTime: '2025-06-02 02:00:00', creator: '' },{ sequence: 5, city: '黄冈市', district: '麻城市', location: '', taskType: '06-02四新水库日常巡查', taskContent: '20250602每日巡检', status: '未完成', person: '何义红', startTime: '2025-06-02 00:00:00', endTime: '2025-06-08 23:59:59', problems: 0, processed: 0, createTime: '2025-06-02 02:00:00', creator: '' }, ]; const flyTo = () => { // dispatch?.runtime.setInfoDlg({ layerId: 'ChaoshiDetailLayer', properties: {} }) setVisible(true) } const [params, setParams] = useState({ tm: [] }) const searchTm = (e) => { setParams({ ...params, stm: e[0].format("YYYY-MM-DD HH:mm"), etm: e[1].format("YYYY-MM-DD HH:mm"), tm: e, }) }; useEffect(() => { let options = ""; options = { etm: moment().add(1, 'hour').set({ minute: 0, second: 0 }).format("YYYY-MM-DD HH:mm"), stm: moment().subtract(7, 'days').add(1, 'hour').set({ minute: 0, second: 0 }).format("YYYY-MM-DD HH:mm"), tm: [ moment().subtract(7, 'days').add(1, 'hour').set({ minute: 0, second: 0 }), moment().add(1, 'hour').set({ minute: 0, second: 0 }), ], } setParams(options) }, []) return (
时段选择:
trigger.parentElement} />
{columns.map((column) => ( {column.label} ))} {mockData.map((row, index) => ( {row.sequence} {row.city} {row.district} {row.location} {row.taskType} {row.taskContent} {row.status} {row.person} {row.startTime} {row.endTime} {row.problems} {row.processed} 查看 ))}
setVisible(false)} >
); }; export default TaskList;