|  |  |  | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | FunctionField, | 
|---|
|  |  |  | Pagination, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.action.uuid" />, | 
|---|
|  |  |  | <TextInput source="groupId" label="table.field.action.groupId" />, | 
|---|
|  |  |  | <ReferenceInput source="busId" label="table.field.action.busId" reference="bus"> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.busId" optionText="seqNum" filterToQuery={(val) => ({ seqNum: val })} /> | 
|---|
|  |  |  | // <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="groupId" label="table.field.action.groupId" alwaysOn resettable />, | 
|---|
|  |  |  | <ReferenceInput source="agvId" label="table.field.action.agvId" reference="agv" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <ReferenceInput source="taskId" label="table.field.action.taskId" reference="task"> | 
|---|
|  |  |  | <ReferenceInput source="busId" label="table.field.action.busId" reference="bus"> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.busId" optionText="busNo" filterToQuery={(val) => ({ seqNum: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <ReferenceInput source="taskId" label="table.field.action.taskId" reference="task" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.taskId" optionText="seqNum" filterToQuery={(val) => ({ seqNum: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <TextInput source="seqNum" label="table.field.action.seqNum" />, | 
|---|
|  |  |  | <NumberInput source="priority" label="table.field.action.priority" />, | 
|---|
|  |  |  | <TextInput source="name" label="table.field.action.name" />, | 
|---|
|  |  |  | <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="uuid" label="table.field.action.uuid" />, | 
|---|
|  |  |  | // <TextInput source="seqNum" label="table.field.action.seqNum" />, | 
|---|
|  |  |  | // <NumberInput source="priority" label="table.field.action.priority" />, | 
|---|
|  |  |  | // <TextInput source="name" label="table.field.action.name" />, | 
|---|
|  |  |  | <NumberInput source="val" label="table.field.action.val" />, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.action.code" />, | 
|---|
|  |  |  | <TextInput source="params" label="table.field.action.params" />, | 
|---|
|  |  |  | 
|---|
|  |  |  | <ReferenceInput source="actionSts" label="table.field.action.actionSts" reference="actionSts"> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.actionSts" optionText="name" filterToQuery={(val) => ({ name: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <ReferenceInput source="agvId" label="table.field.action.agvId" reference="agv"> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.action.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <DateInput source="ioTime" label="table.field.action.ioTime" />, | 
|---|
|  |  |  | <DateInput source="startTime" label="table.field.action.startTime" />, | 
|---|
|  |  |  | <DateInput source="endTime" label="table.field.action.endTime" />, | 
|---|
|  |  |  | <DateInput source="errTime" label="table.field.action.errTime" />, | 
|---|
|  |  |  | // <DateInput source="ioTime" label="table.field.action.ioTime" />, | 
|---|
|  |  |  | // <DateInput source="startTime" label="table.field.action.startTime" />, | 
|---|
|  |  |  | // <DateInput source="endTime" label="table.field.action.endTime" />, | 
|---|
|  |  |  | // <DateInput source="errTime" label="table.field.action.errTime" />, | 
|---|
|  |  |  | <TextInput source="errDesc" label="table.field.action.errDesc" />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput label="common.field.memo" source="memo" />, | 
|---|
|  |  |  | 
|---|
|  |  |  | title={"menu.action"} | 
|---|
|  |  |  | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | sort={{ field: "io_time", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|---|
|  |  |  | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='action' /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={25} | 
|---|
|  |  |  | pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />} | 
|---|
|  |  |  | perPage={50} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='action' | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|---|
|  |  |  | bulkActionButtons={false} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={() => <ActionPanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'uuid', 'errTime', 'updateBy', 'updateTime', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | omit={['id', 'uuid', 'busId', 'startTime', 'endTime', 'errTime', 'errDesc', 'updateBy', 'updateTime', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="uuid" label="table.field.action.uuid" /> | 
|---|
|  |  |  | <TextField source="groupId" label="table.field.action.groupId" /> | 
|---|
|  |  |  | <ReferenceField source="agvId" label="table.field.action.agvId" reference="agv" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="uuid" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <ReferenceField source="busId" label="table.field.action.busId" reference="bus" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="seqNum" /> | 
|---|
|  |  |  | <TextField source="busNo" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <ReferenceField source="taskId" label="table.field.action.taskId" reference="task" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="seqNum" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | {/* <TextField source="seqNum" label="table.field.action.seqNum" /> */} | 
|---|
|  |  |  | <NumberField source="priority" label="table.field.action.priority" /> | 
|---|
|  |  |  | <NumberField source="priority" label="table.field.action.priority" sortable={false} sx={{ fontWeight: 'bold' }} /> | 
|---|
|  |  |  | {/* <TextField source="name" label="table.field.action.name" /> */} | 
|---|
|  |  |  | <NumberField source="val" label="table.field.action.val" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.action.code" /> | 
|---|
|  |  |  | <TextField source="params" label="table.field.action.params" /> | 
|---|
|  |  |  | <ReferenceField source="actionType" label="table.field.action.actionType" reference="actionType" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="name" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <TextField source="code" label="table.field.action.code" sortable={false} /> | 
|---|
|  |  |  | <NumberField source="val" label="table.field.action.val" sortable={false} /> | 
|---|
|  |  |  | <TextField source="params" label="table.field.action.params" sortable={false} /> | 
|---|
|  |  |  | <ReferenceField source="actionSts" label="table.field.action.actionSts" reference="actionSts" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="name" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <ReferenceField source="agvId" label="table.field.action.agvId" reference="agv" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="uuid" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <DateField source="ioTime" label="table.field.action.ioTime" showTime /> | 
|---|
|  |  |  | {/* <DateField source="startTime" label="table.field.action.startTime" showTime /> */} | 
|---|
|  |  |  | <DateField source="startTime" label="table.field.action.startTime" showTime /> | 
|---|
|  |  |  | <DateField source="endTime" label="table.field.action.endTime" showTime /> | 
|---|
|  |  |  | <DateField source="errTime" label="table.field.action.errTime" showTime /> | 
|---|
|  |  |  | <TextField source="errDesc" label="table.field.action.errDesc" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | {/* <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | )} /> */} | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <ActionCreate | 
|---|