| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useRefresh, |
| | | Button |
| | | |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack,LinearProgress } from '@mui/material'; |
| | | import { Box, Typography, Card, Stack, LinearProgress, Tooltip } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import MatnrCreate from "./MatnrCreate"; |
| | | import MatnrPanel from "./MatnrPanel"; |
| | |
| | | import MyCreateButton from "@/page/components/MyCreateButton"; |
| | | import MyExportButton from '@/page/components/MyExportButton'; |
| | | import PageDrawer from "@/page/components/PageDrawer"; |
| | | import MyField from "@/page/components/MyField"; |
| | | import TooltipField from "@/page/components/TooltipField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | import MatListAside from './MatnrListAside'; |
| | | import { display, height } from "@mui/system"; |
| | | import DashboardIcon from '@mui/icons-material/Dashboard'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .RaList-content': { |
| | | width: '200px' |
| | | }, |
| | | '& .RaList-main': { |
| | | minHeight: '80vh' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | '& .name': { |
| | | width: '100px', |
| | | |
| | | }, |
| | | '& .name .MuiTypography-root': { |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | display: 'block', |
| | | width: '100px', |
| | | } |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="name" label="table.field.matnr.name" />, |
| | | <TextInput source="code" label="table.field.matnr.code" />, |
| | | <TextInput source="name" label="table.field.matnr.name" alwaysOn />, |
| | | <TextInput source="code" label="table.field.matnr.code" alwaysOn />, |
| | | <ReferenceInput source="shipperId$" label="table.field.matnr.shipperId" reference="shipper"> |
| | | <AutocompleteInput label="table.field.matnr.shipperId" optionText="name" filterToQuery={(val) => ({ name: val })} /> |
| | | </ReferenceInput>, |
| | |
| | | <SelectInput source="stockLeval" label="table.field.matnr.stockLevel" |
| | | choices={[ |
| | | { id: 0, name: ' A' }, |
| | | { id: 1, name: ' B' }, |
| | | { id: 2, name: 'C' }, |
| | | { id: 1, name: ' B' }, |
| | | { id: 2, name: 'C' }, |
| | | ]} |
| | | />, |
| | | <SelectInput source="isLabelMange" label="table.field.matnr.isLabelMange" |
| | | choices={[ |
| | | { id: 0, name: ' 否' }, |
| | | { id: 1, name: ' 是' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | />, |
| | | <NumberInput source="safeQty" label="table.field.matnr.safeQty" />, |
| | |
| | | const { isLoading } = useListContext(); |
| | | |
| | | return ( |
| | | <Box sx={{ position: 'relative' }}> |
| | | {isLoading && ( |
| | | <LinearProgress |
| | | sx={{ |
| | | height: "2px", |
| | | position: 'absolute', |
| | | top: 0, |
| | | left: 0, |
| | | right: 0, |
| | | }} |
| | | /> |
| | | )} |
| | | <StyledDatagrid |
| | | <Box sx={{ position: 'relative', minHeight: "40vh", }}> |
| | | {isLoading && ( |
| | | <LinearProgress |
| | | sx={{ |
| | | height: "2px", |
| | | position: 'absolute', |
| | | top: 0, |
| | | left: 0, |
| | | right: 0, |
| | | }} |
| | | /> |
| | | )} |
| | | |
| | | <StyledDatagrid |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <MatnrPanel />} |
| | | expandSingle={true} |
| | | omit={['id','shipperId','platCode','spec','model','weight','color','size','describle' |
| | | ,'nromNum','unit','purchaseUnit','stockUnit','stockLeval','isLabelMange','safeQty' |
| | | ,'minQty','maxQty','stagn','valid','validWarn','flagCheck','updateTime', 'updateBy' |
| | | , 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'shipperId', 'platCode', 'spec', 'model', 'weight', 'color', 'size', 'describle' |
| | | , 'nromNum', 'unit', 'purchaseUnit', 'stockUnit', 'stockLeval', 'isLabelMange', 'safeQty' |
| | | , 'minQty', 'maxQty', 'stagn', 'valid', 'validWarn', 'flagCheck', 'updateTime', 'updateBy' |
| | | , 'createTime', 'createBy', 'memo', 'rglarId', 'groupId', 'stockLevel', 'isLabelMange']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="name" label="table.field.matnr.name" /> |
| | | |
| | | <TooltipField source="name" label="table.field.matnr.name" cellClassName="name" /> |
| | | <TextField source="code" label="table.field.matnr.code" /> |
| | | <ReferenceField source="shipperId" label="table.field.matnr.shipperId" reference="shipper" link={false} sortable={false}> |
| | | <TextField source="name" /> |
| | |
| | | <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> |
| | | </Box> |
| | | ); |
| | | |
| | | |
| | | } |
| | | |
| | | const MatnrList = () => { |
| | |
| | | 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.matnr"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | aside={ <MatListAside /> } |
| | | aside={<MatListAside />} |
| | | > |
| | | <MatnrListContent /> |
| | | </List> |
| | |
| | | |
| | | MatnrList.Context = React.createContext() |
| | | |
| | | export default MatnrList; |
| | | export default MatnrList; |
| | | |
| | | 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>) |
| | | |
| | | ) |
| | | } |