|  |  |  | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | useRefresh, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | useList | 
|---|
|  |  |  | useList, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import LocCreate from "./LocCreate"; | 
|---|
|  |  |  | import LocPanel from "./LocPanel"; | 
|---|
|  |  |  | import BindModal from "./BindModal"; | 
|---|
|  |  |  | import EmptyData from "../../components/EmptyData"; | 
|---|
|  |  |  | import DynamicField from "../../components/DynamicField"; | 
|---|
|  |  |  | import MyCreateButton from "../../components/MyCreateButton"; | 
|---|
|  |  |  | 
|---|
|  |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | import DiscountIcon from '@mui/icons-material/Discount'; | 
|---|
|  |  |  | import LinkIcon from '@mui/icons-material/Link'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | '& .opt': { | 
|---|
|  |  |  | width: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .RaDatagrid-headerCell': { | 
|---|
|  |  |  | textAlign: 'left' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .RaDatagrid-rowCell': { | 
|---|
|  |  |  | textAlign: 'left' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <NumberField source="warehouseId$" label="table.field.loc.warehouseId" />, | 
|---|
|  |  |  | <NumberField source="areaId$" label="table.field.loc.areaId" />, | 
|---|
|  |  |  | <ReferenceInput | 
|---|
|  |  |  | source="warehouseId" | 
|---|
|  |  |  | label="table.field.loc.warehouseId" | 
|---|
|  |  |  | reference="warehouse" | 
|---|
|  |  |  | alwaysOn | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <AutocompleteInput | 
|---|
|  |  |  | label="table.field.loc.warehouseId" | 
|---|
|  |  |  | optionText="name" | 
|---|
|  |  |  | filterToQuery={(val) => ({ name: val })} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <ReferenceInput | 
|---|
|  |  |  | source="areaId" | 
|---|
|  |  |  | label="table.field.loc.areaId" | 
|---|
|  |  |  | reference="warehouseAreas" | 
|---|
|  |  |  | alwaysOn | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <AutocompleteInput | 
|---|
|  |  |  | label="table.field.loc.areaId" | 
|---|
|  |  |  | optionText="name" | 
|---|
|  |  |  | filterToQuery={(val) => ({ name: val })} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.loc.code" />, | 
|---|
|  |  |  | <TextInput source="type" label="table.field.loc.type" />, | 
|---|
|  |  |  | <TextInput source="name" label="table.field.loc.name" />, | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='loc' | 
|---|
|  |  |  | align="left" | 
|---|
|  |  |  | bulkActionButtons={ | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <BatchButton /> | 
|---|
|  |  |  | <BindButton /> | 
|---|
|  |  |  | <SubzoneButton /> | 
|---|
|  |  |  | <BulkDeleteButton /> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | 
|---|
|  |  |  | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime align="left" /> | 
|---|
|  |  |  | <ReferenceField source="createBy" label="common.field.createBy" align="left" 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} /> | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BindButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Button onClick={() => setCreateDialog(true)} label={"toolbar.bindmatnr"}> | 
|---|
|  |  |  | <LinkIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <BindModal | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|