| New file | 
 |  |  | 
 |  |  | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
 |  |  | import { useNavigate } 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, | 
 |  |  |     useRefresh, | 
 |  |  |     Button, | 
 |  |  |     useList, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import MyCreateButton from "../components/MyCreateButton"; | 
 |  |  | import MyExportButton from '../components/MyExportButton'; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import LocListAside from "./LocListAside"; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  |         height: '.9em' | 
 |  |  |     }, | 
 |  |  |     '& .RaDatagrid-row': { | 
 |  |  |         cursor: 'auto' | 
 |  |  |     }, | 
 |  |  |     '& .column-name': { | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 180 | 
 |  |  |     }, | 
 |  |  |     '& .type .MuiTypography-root': { | 
 |  |  |         whiteSpace: 'nowrap', | 
 |  |  |         overflow: 'hidden', | 
 |  |  |         textOverflow: 'ellipsis', | 
 |  |  |         display: 'block', | 
 |  |  |         width: 'auto', | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | const LocItemList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |     const [initDialog, setInitDialog] = useState(false); | 
 |  |  |     const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_use_stas')) || []; | 
 |  |  |     const locType = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || []; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const filters = [ | 
 |  |  |         <SearchInput source="condition" alwaysOn />, | 
 |  |  |         <ReferenceInput | 
 |  |  |             source="warehouseId" | 
 |  |  |             label="table.field.loc.warehouseId" | 
 |  |  |             reference="warehouse" | 
 |  |  |         > | 
 |  |  |             <AutocompleteInput | 
 |  |  |                 label="table.field.loc.warehouseId" | 
 |  |  |                 optionText="name" | 
 |  |  |                 filterToQuery={(val) => ({ name: val })} | 
 |  |  |             /> | 
 |  |  |         </ReferenceInput>, | 
 |  |  |         <ReferenceInput | 
 |  |  |             source="areaId" | 
 |  |  |             label="table.field.loc.areaId" | 
 |  |  |             reference="warehouseAreas" | 
 |  |  |         > | 
 |  |  |             <AutocompleteInput | 
 |  |  |                 label="table.field.loc.areaId" | 
 |  |  |                 optionText="name" | 
 |  |  |                 filterToQuery={(val) => ({ name: val })} | 
 |  |  |             /> | 
 |  |  |         </ReferenceInput>, | 
 |  |  |         <AutocompleteInput | 
 |  |  |             choices={dicts} | 
 |  |  |             optionText="label" | 
 |  |  |             label="table.field.loc.useStatus" | 
 |  |  |             source="useStatus" | 
 |  |  |             optionValue="value" | 
 |  |  |             parse={v => v} | 
 |  |  |             alwaysOn | 
 |  |  |         />, | 
 |  |  |         <TextInput source="code" label="table.field.loc.code" />, | 
 |  |  |         <AutocompleteInput | 
 |  |  |             choices={locType} | 
 |  |  |             optionText="label" | 
 |  |  |             label="table.field.loc.type" | 
 |  |  |             source="type" | 
 |  |  |             optionValue="value" | 
 |  |  |             parse={v => v} | 
 |  |  |         />, <TextInput source="name" label="table.field.loc.name" />, | 
 |  |  |         <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />, | 
 |  |  |         <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />, | 
 |  |  |         <TextInput source="barcode" label="table.field.loc.barcode" />, | 
 |  |  |         <TextInput source="unit" label="table.field.loc.unit" />, | 
 |  |  |         <TextInput source="size" label="table.field.loc.size" />, | 
 |  |  |         <NumberInput source="row" label="table.field.loc.row" />, | 
 |  |  |         <NumberInput source="col" label="table.field.loc.col" />, | 
 |  |  |         <NumberInput source="lev" label="table.field.loc.lev" />, | 
 |  |  |         <NumberInput source="channel" label="table.field.loc.channel" />, | 
 |  |  |         <NumberInput source="maxParts" label="table.field.loc.maxParts" />, | 
 |  |  |         <NumberInput source="maxPack" label="table.field.loc.maxPack" />, | 
 |  |  |         <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />, | 
 |  |  |         <TextInput source="locAttrs" label="table.field.loc.locAttrs" />, | 
 |  |  |         <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 | 
 |  |  |         />, | 
 |  |  |     ] | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box display="flex"> | 
 |  |  |             <List | 
 |  |  |                 sx={{ | 
 |  |  |                     flexGrow: 1, | 
 |  |  |                     transition: (theme) => | 
 |  |  |                         theme.transitions.create(['all'], { | 
 |  |  |                             duration: theme.transitions.duration.enteringScreen, | 
 |  |  |                         }), | 
 |  |  |                     marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                 }} | 
 |  |  |                 storeKey="locItem" | 
 |  |  |                 resource="loc" | 
 |  |  |                 title={"menu.locItem"} | 
 |  |  |                 empty={false} | 
 |  |  |                 filters={filters} | 
 |  |  |                 sort={{ field: "create_time", order: "desc" }} | 
 |  |  |                 actions={( | 
 |  |  |                     <TopToolbar> | 
 |  |  |                         <FilterButton /> | 
 |  |  |                         {/* <SelectColumnsButton preferenceKey='loc' /> */} | 
 |  |  |                     </TopToolbar> | 
 |  |  |                 )} | 
 |  |  |                 perPage={DEFAULT_PAGE_SIZE} | 
 |  |  |                 aside={<LocListAside />} | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='locItem' | 
 |  |  |                     align="left" | 
 |  |  |                     bulkActionButtons={false} | 
 |  |  |                     rowClick={() => false} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo', 'updateTime', 'updateBy']} | 
 |  |  |                 > | 
 |  |  |                     <NumberField source="id" /> | 
 |  |  |                     <NumberField source="warehouseId$" label="table.field.loc.warehouseId" /> | 
 |  |  |                     <NumberField source="areaId$" label="table.field.loc.areaId" /> | 
 |  |  |                     <TextField source="code" label="table.field.loc.code" /> | 
 |  |  |                     <TextField source="typeIds$" label="table.field.loc.type" cellClassName="type" /> | 
 |  |  |                     <TextField source="barcode" label="table.field.loc.barcode" /> | 
 |  |  |                     <TextField source="length" label="table.field.loc.length" /> | 
 |  |  |                     <TextField source="width" label="table.field.loc.width" /> | 
 |  |  |                     <TextField source="height" label="table.field.loc.height" /> | 
 |  |  |                     <NumberField source="row" label="table.field.loc.row" /> | 
 |  |  |                     <NumberField source="col" label="table.field.loc.col" /> | 
 |  |  |                     <NumberField source="lev" label="table.field.loc.lev" /> | 
 |  |  |                     <NumberField source="channel" label="table.field.loc.channel" /> | 
 |  |  |                     <TextField source="useStatus$" label="table.field.loc.useStatus" /> | 
 |  |  |                     <TextField source="updateBy$" label="common.field.updateBy" /> | 
 |  |  |                     <DateField source="updateTime" label="common.field.updateTime" showTime align="left" /> | 
 |  |  |                     <TextField source="createBy$" label="common.field.createBy" /> | 
 |  |  |                     <DateField source="createTime" label="common.field.createTime" showTime align="left" /> | 
 |  |  |                     <BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" /> | 
 |  |  |                     <TextField source="memo" label="common.field.memo" sortable={false} /> | 
 |  |  |                     <WrapperField cellClassName="opt" label="common.field.opt"> | 
 |  |  |                         <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} resource="locItem" label="toolbar.detail" /> | 
 |  |  |                     </WrapperField> | 
 |  |  |                 </StyledDatagrid> | 
 |  |  |             </List> | 
 |  |  |         </Box> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export default LocItemList; |