| import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
| import { useNavigate, useLocation } from 'react-router-dom'; | 
| 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, | 
|   Button, | 
|   useEditContext, | 
|   useGetRecordId, | 
|   useGetOne | 
| } from 'react-admin'; | 
| import { Box, Typography, Card, Stack, Dialog, DialogActions, DialogTitle } from '@mui/material'; | 
| import { styled } from '@mui/material/styles'; | 
| import OutOrderItemCreate from "./OutOrderItemCreate"; | 
| import EmptyData from "../../components/EmptyData"; | 
| import MyCreateButton from "../../components/MyCreateButton"; | 
| import MyExportButton from '../../components/MyExportButton'; | 
| import PageDrawer from "../../components/PageDrawer"; | 
| import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; | 
| import OutOrderItemEdit from "./OutOrderItemEdit"; | 
| import ImportButton from "../../components/ImportButton"; | 
|   | 
| const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|   '& .css-1vooibu-MuiSvgIcon-root': { | 
|     height: '.9em', | 
|   }, | 
|   '& .RaDatagrid-row': { | 
|     cursor: 'auto' | 
|   }, | 
|   '& .column-name': { | 
|   }, | 
|   '& .opt': { | 
|     width: 200 | 
|   }, | 
| })); | 
|   | 
| const filters = [ | 
|   <SearchInput source="condition" alwaysOn />, | 
|   <NumberInput source="asnId" label="table.field.outStockItem.asnId" />, | 
|   <TextInput source="asnCode" label="table.field.outStockItem.asnCode" alwaysOn/>, | 
|   <TextInput source="poDetlId" label="table.field.outStockItem.poDetlId" />, | 
|   <TextInput source="matnrId" label="table.field.outStockItem.matnrId" />, | 
|   <TextInput source="maktx" label="table.field.outStockItem.maktx" alwaysOn/>, | 
|   <TextInput source="matnrCode" label="table.field.outStockItem.matnrCode" alwaysOn/>, | 
|   <NumberInput source="anfme" label="table.field.outStockItem.anfme" />, | 
|   <TextInput source="stockUnit" label="table.field.outStockItem.stockUnit" />, | 
|   <NumberInput source="purQty" label="table.field.outStockItem.purQty" />, | 
|   <TextInput source="purUnit" label="table.field.outStockItem.purUnit" />, | 
|   <NumberInput source="qty" label="table.field.outStockItem.qty" />, | 
|   <TextInput source="splrCode" label="table.field.outStockItem.splrCode" />, | 
|   <TextInput source="splrName" label="table.field.outStockItem.splrName" />, | 
|   <TextInput source="qrcode" label="table.field.outStockItem.qrcode" />, | 
|   <TextInput source="trackCode" label="table.field.outStockItem.barcode" />, | 
|   <TextInput source="packName" label="table.field.outStockItem.packName" />, | 
|   <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 OutOrderItemList = () => { | 
|   const translate = useTranslate(); | 
|   const [createDialog, setCreateDialog] = useState(false); | 
|   const [editDialog, setEditDialog] = useState(false); | 
|   const [drawerVal, setDrawerVal] = useState(false); | 
|   const [select, setSelect] = useState({}); | 
|   const asnId = useGetRecordId(); | 
|   const { data: dicts, isPending, error } = useGetOne('outStock', { id: asnId }); | 
|   | 
|   return ( | 
|     <> | 
|       <Box display="flex"> | 
|         <List | 
|           resource="outStockItem" | 
|           storeKey='outStockItem' | 
|           sx={{ | 
|             flexGrow: 1, | 
|             transition: (theme) => | 
|               theme.transitions.create(['all'], { | 
|                 duration: theme.transitions.duration.enteringScreen, | 
|               }), | 
|             marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|           }} | 
|           title={"menu.outStockItem"} | 
|           empty={false} | 
|           filter={{ asnId: asnId, deleted: 0 }} | 
|           filters={filters} | 
|           sort={{ field: "create_time", order: "desc" }} | 
|           actions={( | 
|             <TopToolbar> | 
|               <FilterButton /> | 
|               <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|               <SelectColumnsButton preferenceKey='outStockItem' /> | 
|               {/* <MyExportButton /> */} | 
|             </TopToolbar> | 
|           )} | 
|           perPage={DEFAULT_ITEM_PAGE_SIZE} | 
|         > | 
|           <StyledDatagrid | 
|             preferenceKey='outStockItem' | 
|             bulkActionButtons={false} | 
|             rowClick={(id, resource, record) => { | 
|               setSelect(record) | 
|               setEditDialog(true) | 
|             }} | 
|              omit={['id', 'createTime', 'createBy', 'memo', 'poDetlId', 'matnrId', 'asnId']} | 
|           > | 
|             <NumberField source="id" /> | 
|             <NumberField source="asnId" label="table.field.outStockItem.asnId" /> | 
|             <TextField source="asnCode" label="table.field.outStockItem.asnCode" /> | 
|             <TextField source="poDetlId" label="table.field.outStockItem.poDetlId" /> | 
|             <TextField source="matnrId" label="table.field.outStockItem.matnrId" /> | 
|             <TextField source="matnrCode" label="table.field.outStockItem.matnrCode" /> | 
|             <TextField source="maktx" label="table.field.outStockItem.maktx" /> | 
|             <NumberField source="anfme" label="table.field.outStockItem.anfme" /> | 
|             <TextField source="stockUnit" label="table.field.outStockItem.stockUnit" /> | 
|             <NumberField source="purQty" label="table.field.outStockItem.purQty" /> | 
|             <TextField source="purUnit" label="table.field.outStockItem.purUnit" /> | 
|             <NumberField source="qty" label="table.field.outStockItem.qty" /> | 
|             <TextField source="splrCode" label="table.field.outStockItem.splrCode" /> | 
|             <TextField source="splrName" label="table.field.outStockItem.splrName" /> | 
|             <TextField source="qrcode" label="table.field.outStockItem.qrcode" /> | 
|             <TextField source="trackCode" label="table.field.outStockItem.barcode" /> | 
|             <TextField source="packName" label="table.field.outStockItem.packName" /> | 
|             <TextField source="updateBy$" label="common.field.updateBy" /> | 
|             <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|             <TextField source="createBy$" label="common.field.createBy" /> | 
|             <DateField source="createTime" label="common.field.createTime" showTime /> | 
|             <BooleanField source="status$" label="common.field.status" sortable={false} /> | 
|             <TextField source="memo" label="common.field.memo" sortable={false} /> | 
|           </StyledDatagrid> | 
|         </List> | 
|         <OutOrderItemCreate | 
|           open={createDialog} | 
|           setOpen={setCreateDialog} | 
|           record={dicts} | 
|         /> | 
|         <OutOrderItemEdit | 
|           open={editDialog} | 
|           setOpen={setEditDialog} | 
|           record={select} | 
|         /> | 
|         <PageDrawer | 
|           title='OutStockItem Detail' | 
|           drawerVal={drawerVal} | 
|           setDrawerVal={setDrawerVal} | 
|         > | 
|         </PageDrawer> | 
|       </Box> | 
|     </> | 
|   ) | 
| } | 
| OutOrderItemList.Context = React.createContext() | 
|   | 
| export default OutOrderItemList; |