|  |  |  | 
|---|
|  |  |  | import React, { useState, useRef, useEffect, useMemo } from "react"; | 
|---|
|  |  |  | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; | 
|---|
|  |  |  | import { Box } from '@mui/material'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | List, | 
|---|
|  |  |  | DatagridConfigurable, | 
|---|
|  |  |  | SearchInput, | 
|---|
|  |  |  | TopToolbar, | 
|---|
|  |  |  | SelectColumnsButton, | 
|---|
|  |  |  | EditButton, | 
|---|
|  |  |  | FilterButton, | 
|---|
|  |  |  | CreateButton, | 
|---|
|  |  |  | ExportButton, | 
|---|
|  |  |  | BulkDeleteButton, | 
|---|
|  |  |  | WrapperField, | 
|---|
|  |  |  | useRecordContext, | 
|---|
|  |  |  | useTranslate, | 
|---|
|  |  |  | useNotify, | 
|---|
|  |  |  | useListContext, | 
|---|
|  |  |  | FunctionField, | 
|---|
|  |  |  | TextField, | 
|---|
|  |  |  | NumberField, | 
|---|
|  |  |  | DateField, | 
|---|
|  |  |  | BooleanField, | 
|---|
|  |  |  | ReferenceField, | 
|---|
|  |  |  | TextInput, | 
|---|
|  |  |  | DateTimeInput, | 
|---|
|  |  |  | DateInput, | 
|---|
|  |  |  | SelectInput, | 
|---|
|  |  |  | NumberInput, | 
|---|
|  |  |  | ReferenceInput, | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import PageDrawer from "../components/PageDrawer"; | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <DateInput label='common.time.after' source="timeStart"  />, | 
|---|
|  |  |  | <DateInput label='common.time.before' source="timeEnd" />, | 
|---|
|  |  |  | <NumberInput source="taskId" label="table.field.taskItem.taskId" />, | 
|---|
|  |  |  | <NumberInput source="orderId" label="table.field.taskItem.orderId" />, | 
|---|
|  |  |  | <NumberInput source="orderType" label="table.field.taskItem.orderType" />, | 
|---|
|  |  |  | <NumberInput source="orderItemId" label="table.field.taskItem.orderItemId" />, | 
|---|
|  |  |  | <NumberInput source="matnrId" label="table.field.taskItem.matnrId" />, | 
|---|
|  |  |  | <TextInput source="maktx" label="table.field.taskItem.maktx" />, | 
|---|
|  |  |  | <TextInput source="matnrCode" label="table.field.taskItem.matnrCode" />, | 
|---|
|  |  |  | <TextInput source="unit" label="table.field.taskItem.unit" />, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.taskItem.anfme" />, | 
|---|
|  |  |  | <TextInput source="batch" label="table.field.taskItem.batch" />, | 
|---|
|  |  |  | <TextInput source="spec" label="table.field.taskItem.spec" />, | 
|---|
|  |  |  | <TextInput source="model" label="table.field.taskItem.model" />, | 
|---|
|  |  |  | <TextInput label="common.field.memo" source="memo" />, | 
|---|
|  |  |  | <SelectInput | 
|---|
|  |  |  | label="common.field.status" | 
|---|
|  |  |  | source="status" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: '1', name: 'common.enums.statusTrue' }, | 
|---|
|  |  |  | { id: '0', name: 'common.enums.statusFalse' }, | 
|---|
|  |  |  | ]} | 
|---|
|  |  |  | resettable | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const TaskPanel = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | <List resource="taskItem" | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | title={"menu.taskItem"} | 
|---|
|  |  |  | filter={{ taskId: record.id }} | 
|---|
|  |  |  | // title={"menu.taskItem"} | 
|---|
|  |  |  | pagination={false} | 
|---|
|  |  |  | empty={false} | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | actions={false} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='taskItem' | 
|---|
|  |  |  | bulkActionButtons={false} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']} | 
|---|
|  |  |  | rowClick={false} | 
|---|
|  |  |  | expandSingle | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy$', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <NumberField source="taskId" label="table.field.taskItem.taskId" /> | 
|---|
|  |  |  | <NumberField source="orderId" label="table.field.taskItem.orderId" /> | 
|---|
|  |  |  | <NumberField source="orderType$" label="table.field.taskItem.orderType" /> | 
|---|
|  |  |  | <TextField source="sourceCode" label="table.field.taskItem.sourceCode" /> | 
|---|
|  |  |  | <NumberField source="orderItemId" label="table.field.taskItem.orderItemId" /> | 
|---|
|  |  |  | <NumberField source="matnrId" label="table.field.taskItem.matnrId" /> | 
|---|
|  |  |  | <TextField source="maktx" label="table.field.taskItem.maktx" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <TextField source="batch" label="table.field.taskItem.batch" /> | 
|---|
|  |  |  | <TextField source="spec" label="table.field.taskItem.spec" /> | 
|---|
|  |  |  | <TextField source="model" label="table.field.taskItem.model" /> | 
|---|
|  |  |  | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <TextField source="updateBy$" label="common.field.updateBy"/> | 
|---|
|  |  |  | <TextField source="createBy$" label="common.field.createBy"/> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </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} /> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <PageDrawer | 
|---|
|  |  |  | title='TaskItem Detail' | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </PageDrawer> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ); | 
|---|