|  |  |  | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | FunctionField, | 
|---|
|  |  |  | Pagination, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { Box, Typography, Card, 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'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | '& .RaDatagrid-row': { | 
|---|
|  |  |  | cursor: 'auto' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .column-name': { | 
|---|
|  |  |  | '& .column-busNo': { | 
|---|
|  |  |  | minWidth: '16em', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .column-tasksNum': { | 
|---|
|  |  |  | maxWidth: '8em', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .column-memo': { | 
|---|
|  |  |  | maxWidth: '12em', | 
|---|
|  |  |  | overflow: 'hidden', | 
|---|
|  |  |  | textOverflow: 'ellipsis', | 
|---|
|  |  |  | whiteSpace: 'nowrap', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .opt': { | 
|---|
|  |  |  | width: 200 | 
|---|
|  |  |  | width: 80 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput source="uuid" label="table.field.bus.uuid" />, | 
|---|
|  |  |  | <TextInput source="busNo" label="table.field.bus.busNo" />, | 
|---|
|  |  |  | <DateInput source="startTime" label="table.field.bus.startTime" />, | 
|---|
|  |  |  | <DateInput source="endTime" label="table.field.bus.endTime" />, | 
|---|
|  |  |  | <ReferenceInput source="busSts" label="table.field.bus.busSts" reference="busSts"> | 
|---|
|  |  |  | // <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="busNo" label="table.field.bus.busNo" alwaysOn resettable />, | 
|---|
|  |  |  | // <DateInput source="startTime" label="table.field.bus.startTime" />, | 
|---|
|  |  |  | // <DateInput source="endTime" label="table.field.bus.endTime" />, | 
|---|
|  |  |  | <ReferenceInput source="busSts" label="table.field.bus.busSts" reference="busSts" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.bus.busSts" optionText="name" filterToQuery={(val) => ({ name: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <TextInput source="phase" label="table.field.bus.phase" />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
|---|
|  |  |  | <TextInput label="common.field.memo" source="memo" />, | 
|---|
|  |  |  | <SelectInput | 
|---|
|  |  |  | label="common.field.status" | 
|---|
|  |  |  | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={25} | 
|---|
|  |  |  | pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />} | 
|---|
|  |  |  | perPage={20} | 
|---|
|  |  |  | // aside={<BusListAside />} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='bus' | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | bulkActionButtons={false} | 
|---|
|  |  |  | rowClick={'expand'} | 
|---|
|  |  |  | expand={() => <BusPanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'phase', 'updateBy', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | omit={['id', 'uuid', 'phase', 'updateBy', 'updateTime', 'createTime', 'createBy']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="uuid" label="table.field.bus.uuid" /> | 
|---|
|  |  |  | <TextField source="busNo" label="table.field.bus.busNo" /> | 
|---|
|  |  |  | <DateField source="startTime" label="table.field.bus.startTime" showTime /> | 
|---|
|  |  |  | <DateField source="endTime" label="table.field.bus.endTime" showTime /> | 
|---|
|  |  |  | <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="name" /> | 
|---|
|  |  |  | <ReferenceField source="busSts" label="table.field.bus.busSts" reference="busSts" link={false} sortable={true}> | 
|---|
|  |  |  | <FunctionField render={record => ( | 
|---|
|  |  |  | <Chip | 
|---|
|  |  |  | label={record.name} | 
|---|
|  |  |  | variant="outlined" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | color={getBusStsColor(record.name)} | 
|---|
|  |  |  | sx={{ fontSize: '0.75rem' }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | )} /> | 
|---|
|  |  |  | {/* <TextField source="name" /> */} | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <NumberField source="tasksNum" label="table.field.bus.tasksNum" sortable={false} /> | 
|---|
|  |  |  | <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} /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <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} /> | 
|---|
|  |  |  | <WrapperField cellClassName="opt" label="common.field.opt"> | 
|---|
|  |  |  | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
|---|
|  |  |  | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" /> | 
|---|
|  |  |  | <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( | 
|---|
|  |  |  | (record.busSts === 15) && ( | 
|---|
|  |  |  | <DeleteButton label="" sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | )} /> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <BusCreate | 
|---|