| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useRefresh, |
| | | Button |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import InitButton from './InitButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import MyField from "../../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import DashboardIcon from '@mui/icons-material/Dashboard'; |
| | | import request from '@/utils/request'; |
| | | |
| | | 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 />, |
| | | |
| | | <NumberField source="warehouseId$" label="table.field.loc.warehouseId" />, |
| | | <NumberField source="areaId$" label="table.field.loc.areaId" />, |
| | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | |
| | | 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.loc"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <InitButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='loc' /> |
| | | <MyExportButton /> |
| | |
| | | <TextField source="fucAtrrs" label="table.field.loc.fucAtrrs" /> |
| | | <TextField source="barcode" label="table.field.loc.barcode" /> |
| | | <TextField source="unit" label="table.field.loc.unit" /> |
| | | <TextField source="size" label="table.field.loc.size" /> |
| | | <TextField source="size" label="table.field.loc.length" /> |
| | | <TextField source="size" label="table.field.loc.width" /> |
| | | <TextField source="size" label="table.field.loc.height" /> |
| | | <NumberField source="lrow" label="table.field.loc.row" /> |
| | | <NumberField source="col" label="table.field.loc.col" /> |
| | | <NumberField source="lev" label="table.field.loc.lev" /> |
| | |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */} |
| | | <EnableButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | |
| | | } |
| | | |
| | | export default LocList; |
| | | |
| | | const EnableButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const enable = async () => { |
| | | const res = await request.post('/loc/update', { |
| | | ...record, |
| | | status: +!record.status |
| | | }); |
| | | if (res?.data?.code === 200) { |
| | | refresh() |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | return ( |
| | | record.status === 1 ? |
| | | (<Button onClick={enable} label={"toolbar.unenable"}> |
| | | <DashboardIcon /> |
| | | </Button>) : (<Button onClick={enable} label={"toolbar.enable"}> |
| | | <DashboardIcon /> |
| | | </Button>) |
| | | |
| | | ) |
| | | } |