| | |
| | | import PrintIcon from '@mui/icons-material/Print'; |
| | | import request from '@/utils/request'; |
| | | import BatchModal from './BatchModal'; |
| | | import BatchGropuModal from './BatchGropuModal'; |
| | | import PrintModal from './PrintModal'; |
| | | import LinkIcon from '@mui/icons-material/Link'; |
| | | import BindModal from './BindModal'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | display: 'block', |
| | | width: '100px', |
| | | width: '200px', |
| | | }, |
| | | '& .RaDatagrid-table': { |
| | | width: '100%' |
| | | width: '100%', |
| | | position: 'relative', |
| | | } |
| | | })); |
| | | |
| | |
| | | <NumberField key="stagn" source="stagn" label="table.field.matnr.stagn" />, |
| | | <NumberField key="valid" source="valid" label="table.field.matnr.valid" />, |
| | | <NumberField key="validWarn" source="validWarn" label="table.field.matnr.validWarn" />, |
| | | <NumberField key="flagCheck" source="flagCheck" label="table.field.matnr.flagCheck" />, |
| | | <BooleanField key="flagCheck" source="flagCheck" label="table.field.matnr.flagCheck" sortable={false} />, |
| | | <ReferenceField key="updateBy" source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField>, |
| | |
| | | <TextField key="memo" source="memo" label="common.field.memo" sortable={false} />, |
| | | ] |
| | | const fields = data.map(el => <TextField key={el.fields} source={`extendFields.[${el.fields}]`} label={el.fieldsAlise} />) |
| | | const opt = <WrapperField key="opt" cellClassName="opt" label="common.field.opt"> |
| | | const opt = <WrapperField key="opt" cellClassName="fixed" className="fixed" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <EnableButton /> |
| | | <PrintButton /> |
| | | </WrapperField> |
| | | setColumns([...arr, ...fields, opt]); |
| | | |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<> |
| | | <BatchButton /> |
| | | <PrintButton /> |
| | | <BatchGroupButton /> |
| | | <BatchWarnButton /> |
| | | <BatchFlagButton /> |
| | | <BatchStatusButton /> |
| | | <BatchLevelButton /> |
| | | <BindButton /> |
| | | <BatchPrintButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | </>} |
| | | rowClick={(id, resource, record) => false} |
| | |
| | | ) |
| | | } |
| | | |
| | | const BatchButton = () => { |
| | | const BatchStatusButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'status'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | const BatchLevelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStockLevel"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'stockLevel'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchWarnButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchValidWarn"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'validWarn'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchFlagButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchFlagCheck"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'flagCheck'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchGroupButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchMatnrGropu"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchGropuModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | |
| | | ) |
| | | } |
| | | |
| | | const PrintButton = () => { |
| | | const BatchPrintButton = () => { |
| | | const record = useRecordContext(); |
| | | const { resource, selectedIds } = useListContext(); |
| | | const notify = useNotify(); |
| | |
| | | rows={selectedIds} |
| | | /> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const PrintButton = () => { |
| | | const record = useRecordContext(); |
| | | |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button color="secondary" onClick={() => setCreateDialog(true)} label={"toolbar.print"}> |
| | | <PrintIcon /> |
| | | </Button> |
| | | |
| | | <PrintModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | rows={[record.id]} |
| | | /> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const BindButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.bindloc"}> |
| | | <LinkIcon /> |
| | | </Button> |
| | | |
| | | <BindModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |