|  |  | 
 |  |  |     AutocompleteInput, | 
 |  |  |     DeleteButton, | 
 |  |  |     FunctionField, | 
 |  |  |     Pagination, | 
 |  |  |     useNotify, | 
 |  |  |     useRefresh, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Box, Typography, Card, Chip } from '@mui/material'; | 
 |  |  | import { Box, Typography, Button, Chip } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import BusCreate from "./BusCreate"; | 
 |  |  | import BusPanel from "./BusPanel"; | 
 |  |  | 
 |  |  | import MyExportButton from '../components/MyExportButton'; | 
 |  |  | import PageDrawer from "../components/PageDrawer"; | 
 |  |  | import MyField from "../components/MyField"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import BusListAside from "./BusListAside"; | 
 |  |  | import { getBusStsColor } from '@/utils/color-util'; | 
 |  |  | import CancelIcon from '@mui/icons-material/Cancel'; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  | import ConfirmButton from "../components/ConfirmButton"; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  | 
 |  |  |     '& .column-tasksNum': { | 
 |  |  |         maxWidth: '8em', | 
 |  |  |     }, | 
 |  |  |     '& .column-tasksNumTotal': { | 
 |  |  |         maxWidth: '8em', | 
 |  |  |     }, | 
 |  |  |     '& .column-memo': { | 
 |  |  |         maxWidth: '12em', | 
 |  |  |         overflow: 'hidden', | 
 |  |  | 
 |  |  |         whiteSpace: 'nowrap', | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 200 | 
 |  |  |         width: 120 | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  | const BusList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |  | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |  | 
 |  |  |     const onCancel = (busId) => { | 
 |  |  |         request.get("/bus/cancel/" + busId).then(res => { | 
 |  |  |             const { code, msg, data } = res.data; | 
 |  |  |             if (code === 200) { | 
 |  |  |                 notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); | 
 |  |  |                 refresh(); | 
 |  |  |             } else { | 
 |  |  |                 notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); | 
 |  |  |             } | 
 |  |  |         }) | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box display="flex"> | 
 |  |  | 
 |  |  |                         <MyExportButton /> | 
 |  |  |                     </TopToolbar> | 
 |  |  |                 )} | 
 |  |  |                 perPage={25} | 
 |  |  |                 pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />} | 
 |  |  |                 perPage={20} | 
 |  |  |             // aside={<BusListAside />} | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  | 
 |  |  |                     <NumberField source="id" /> | 
 |  |  |                     <TextField source="uuid" label="table.field.bus.uuid" /> | 
 |  |  |                     <TextField source="busNo" label="table.field.bus.busNo" /> | 
 |  |  |                     <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={false}> | 
 |  |  |                     <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={true}> | 
 |  |  |                         <FunctionField render={record => ( | 
 |  |  |                             <Chip | 
 |  |  |                                 label={record.name} | 
 |  |  | 
 |  |  |                         )} /> | 
 |  |  |                         {/* <TextField source="name" /> */} | 
 |  |  |                     </ReferenceField> | 
 |  |  |                     <NumberField source="tasksNum" label="table.field.bus.tasksNum" sortable={false} /> | 
 |  |  |                     <NumberField source="tasksNum" label="table.field.bus.tasksNum" sortable={false} sx={{ fontWeight: 'bold' }} /> | 
 |  |  |                     <NumberField source="tasksNumTotal" label="table.field.bus.tasksNumTotal" sortable={false} sx={{ fontWeight: 'bold' }} /> | 
 |  |  |                     <DateField source="startTime" label="table.field.bus.startTime" showTime /> | 
 |  |  |                     <DateField source="endTime" label="table.field.bus.endTime" showTime emptyText="-" /> | 
 |  |  |                     <TextField source="phase" label="table.field.bus.phase" sortable={false} /> | 
 |  |  | 
 |  |  |                     <DateField source="createTime" label="common.field.createTime" showTime /> | 
 |  |  |                     {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} | 
 |  |  |                     <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" /> | 
 |  |  |                     <WrapperField cellClassName="opt" label="common.field.opt"> | 
 |  |  |                         <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
 |  |  |                         <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
 |  |  |                     </WrapperField> | 
 |  |  |                     <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( | 
 |  |  |                         (record.busSts === 15) && ( | 
 |  |  |                             <ConfirmButton | 
 |  |  |                                 label="ra.action.cancel" | 
 |  |  |                                 size="small" | 
 |  |  |                                 color="error" | 
 |  |  |                                 startIcon={<CancelIcon />} | 
 |  |  |                                 sx={{ padding: '1px', fontSize: '.75rem' }} | 
 |  |  |                                 data={record.busNo} | 
 |  |  |                                 onConfirm={() => { | 
 |  |  |                                     onCancel(record.id); | 
 |  |  |                                 }} | 
 |  |  |                             /> | 
 |  |  |                         ) | 
 |  |  |                     )} /> | 
 |  |  |                 </StyledDatagrid> | 
 |  |  |             </List> | 
 |  |  |             <BusCreate |