|  |  | 
 |  |  |     ReferenceArrayInput, | 
 |  |  |     AutocompleteInput, | 
 |  |  |     DeleteButton, | 
 |  |  |     useRefresh, | 
 |  |  |     Button | 
 |  |  | } 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 PageDrawer from "../components/PageDrawer"; | 
 |  |  | import MyField from "../components/MyField"; | 
 |  |  | import BatchModal from "./BatchModal"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  | 
 |  |  |  | 
 |  |  | const filters = [ | 
 |  |  |     <SearchInput source="condition" alwaysOn />, | 
 |  |  |     <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
 |  |  |     <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
 |  |  |  | 
 |  |  |     <ReferenceInput | 
 |  |  |         source="warehouseId" | 
 |  |  |         label="table.field.loc.warehouseId" | 
 |  |  |         reference="warehouse" | 
 |  |  |     > | 
 |  |  |         <AutocompleteInput | 
 |  |  |             label="table.field.loc.warehouseId" | 
 |  |  |             optionText="name" | 
 |  |  |             filterToQuery={(val) => ({ name: val })} | 
 |  |  |         /> | 
 |  |  |     </ReferenceInput>, | 
 |  |  |     <TextInput source="uuid" label="table.field.warehouseAreas.uuid" />, | 
 |  |  |     <TextInput source="name" label="table.field.warehouseAreas.name" />, | 
 |  |  |     <TextInput source="code" label="table.field.warehouseAreas.code" />, | 
 |  |  | 
 |  |  |     <SelectInput source="flagMinus" label="table.field.warehouseAreas.flagMinus" | 
 |  |  |         choices={[ | 
 |  |  |             { id: 0, name: '否' }, | 
 |  |  |             { id:  1, name: '是' }, | 
 |  |  |             { id: 1, name: '是' }, | 
 |  |  |         ]} | 
 |  |  |     />, | 
 |  |  |     <SelectInput source="flagLabelMange" label="table.field.warehouseAreas.flagLabelMange" | 
 |  |  |         choices={[ | 
 |  |  |             { id: 0, name: ' 否' }, | 
 |  |  |             { id:  1, name: ' 是' }, | 
 |  |  |             { id: 1, name: ' 是' }, | 
 |  |  |         ]} | 
 |  |  |     />, | 
 |  |  |     <SelectInput source="flagMix" label="table.field.warehouseAreas.flagMix" | 
 |  |  |         choices={[ | 
 |  |  |             { id: 0, name: '否' }, | 
 |  |  |             { id:  1, name: '是' }, | 
 |  |  |             { id: 1, name: '是' }, | 
 |  |  |         ]} | 
 |  |  |     />, | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  | const WarehouseAreasList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |  | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |  | 
 |  |  | 
 |  |  |                         theme.transitions.create(['all'], { | 
 |  |  |                             duration: theme.transitions.duration.enteringScreen, | 
 |  |  |                         }), | 
 |  |  |                     marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                     marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                 }} | 
 |  |  |                 title={"menu.warehouseAreas"} | 
 |  |  |                 empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
 |  |  |                 filters={filters} | 
 |  |  |                 sort={{ field: "create_time", order: "desc" }} | 
 |  |  |                 sort={{ field: "warehouseId", order: "desc" }} | 
 |  |  |                 actions={( | 
 |  |  |                     <TopToolbar> | 
 |  |  |                         <FilterButton /> | 
 |  |  | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='warehouseAreas' | 
 |  |  |                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
 |  |  |                     bulkActionButtons={ | 
 |  |  |                         <> | 
 |  |  |                             <WareButton /> | 
 |  |  |                             <MixButton /> | 
 |  |  |                             <StatusButton /> | 
 |  |  |                             <BulkDeleteButton mutationMode={OPERATE_MODE} /> | 
 |  |  |                         </> | 
 |  |  |                     } | 
 |  |  |                     rowClick={(id, resource, record) => false} | 
 |  |  |                     expand={() => <WarehouseAreasPanel />} | 
 |  |  |                     expandSingle={true} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo']} | 
 |  |  |                 > | 
 |  |  |                     <NumberField source="id" /> | 
 |  |  |                     <TextField source="uuid" label="table.field.warehouseAreas.uuid" /> | 
 |  |  |                     {/* <TextField source="uuid" label="table.field.warehouseAreas.uuid" /> */} | 
 |  |  |                     <TextField source="name" label="table.field.warehouseAreas.name" /> | 
 |  |  |                     <TextField source="code" label="table.field.warehouseAreas.code" /> | 
 |  |  |                     <ReferenceField source="shipperId" label="table.field.warehouseAreas.shipperId" reference="shipper" link={false} sortable={false}> | 
 |  |  |                     <TextField source="type$" label="table.field.warehouseAreas.type"/> | 
 |  |  |                     {/* <ReferenceField source="shipperId" label="table.field.warehouseAreas.shipperId" reference="shipper" link={false} sortable={false}> | 
 |  |  |                         <TextField source="name" /> | 
 |  |  |                     </ReferenceField> | 
 |  |  |                     </ReferenceField> */} | 
 |  |  |                     <TextField source="warehouseId$" label="table.field.warehouseAreas.wareId" /> | 
 |  |  |                     <TextField source="shipperId$" label="table.field.warehouseAreas.shipperId" /> | 
 |  |  |                     <NumberField source="supplierId" label="table.field.warehouseAreas.supplierId" /> | 
 |  |  |                     <TextField source="flagMinus$" label="table.field.warehouseAreas.flagMinus" sortable={false} /> | 
 |  |  |                     <TextField source="flagLabelMange$" label="table.field.warehouseAreas.flagLabelMange" sortable={false} /> | 
 |  |  |                     <TextField source="flagMix$" label="table.field.warehouseAreas.flagMix" sortable={false} /> | 
 |  |  |  | 
 |  |  |                     <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
 |  |  |                         <TextField source="nickname" /> | 
 |  |  |                     </ReferenceField> | 
 |  |  | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export default WarehouseAreasList; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | const MixButton = () => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <> | 
 |  |  |             <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchMix"}> | 
 |  |  |                 <EditIcon /> | 
 |  |  |             </Button> | 
 |  |  |  | 
 |  |  |             <BatchModal | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  |                 fieldType={'flagMix'} | 
 |  |  |             /> | 
 |  |  |         </> | 
 |  |  |  | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const WareButton = () => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <> | 
 |  |  |             <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchWarehouse"}> | 
 |  |  |                 <EditIcon /> | 
 |  |  |             </Button> | 
 |  |  |  | 
 |  |  |             <BatchModal | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  |                 fieldType={'wareId'} | 
 |  |  |             /> | 
 |  |  |         </> | 
 |  |  |  | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const StatusButton = () => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <> | 
 |  |  |             <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}> | 
 |  |  |                 <EditIcon /> | 
 |  |  |             </Button> | 
 |  |  |  | 
 |  |  |             <BatchModal | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  |                 fieldType={'status'} | 
 |  |  |             /> | 
 |  |  |         </> | 
 |  |  |  | 
 |  |  |     ) | 
 |  |  | } |