| | |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | NumberInput, |
| | | useRefresh, |
| | | useGetRecordId, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import LocItemCreate from "./LocItemCreate"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import request from '@/utils/request'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | |
| | |
| | | )} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='locItem' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'locId', 'orderId', 'orderItemId', 'matnrId', 'statusBool','trackCode', 'createTime', 'fieldsIndex','splrBatch', 'createBy', 'spec', 'model', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="locId" label="table.field.locItem.locId" /> |
| | | <NumberField source="orderId" label="table.field.locItem.orderId" /> |
| | | <TextField source="type$" label="table.field.locItem.type" /> |
| | | <NumberField source="orderItemId" label="table.field.locItem.orderItemId" /> |
| | | <NumberField source="wkType$" label="table.field.locItem.wkType" /> |
| | | <NumberField source="matnrId" label="table.field.locItem.matnrId" /> |
| | | <TextField source="matnrCode" label="table.field.locItem.matnrCode" /> |
| | | <TextField source="maktx" label="table.field.locItem.maktx" /> |
| | | <TextField source="batch" label="table.field.locItem.batch" /> |
| | | <TextField source="trackCode" label="table.field.locItem.trackCode" /> |
| | | <NumberField source="anfme" label="table.field.locItem.anfme" /> |
| | | <TextField source="unit" label="table.field.locItem.unit" /> |
| | | <TextField source="splrBatch" label="table.field.locItem.splrBatch" /> |
| | | <TextField source="spec" label="table.field.locItem.spec" /> |
| | | <TextField source="model" label="table.field.locItem.model" /> |
| | | <TextField source="fieldsIndex" label="table.field.locItem.fieldsIndex" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <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} redirect={false}/> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | <DynamicFields /> |
| | | </List> |
| | | <LocItemCreate |
| | | open={createDialog} |
| | |
| | | ) |
| | | } |
| | | |
| | | |
| | | export default LocItemList; |
| | | |
| | | |
| | | const DynamicFields = (props) => { |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const [columns, setColumns] = useState([]); |
| | | const { isLoading } = useListContext(); |
| | | const refresh = useRefresh(); |
| | | useEffect(() => { |
| | | getDynamicFields(); |
| | | }, []); |
| | | |
| | | const getDynamicFields = async () => { |
| | | const { data: { code, data, msg }, } = await request.get("/fields/enable/list"); |
| | | if (code == 200) { |
| | | const arr = [ |
| | | <NumberField source="id" />, |
| | | <NumberField source="locId" label="table.field.locItem.locId" />, |
| | | <NumberField source="orderId" label="table.field.locItem.orderId" />, |
| | | <TextField source="type$" label="table.field.locItem.type" />, |
| | | <NumberField source="orderItemId" label="table.field.locItem.orderItemId" />, |
| | | <NumberField source="wkType$" label="table.field.locItem.wkType" />, |
| | | <NumberField source="matnrId" label="table.field.locItem.matnrId" />, |
| | | <TextField source="matnrCode" label="table.field.locItem.matnrCode" />, |
| | | <TextField source="maktx" label="table.field.locItem.maktx" />, |
| | | <TextField source="batch" label="table.field.locItem.batch" />, |
| | | <TextField source="trackCode" label="table.field.locItem.trackCode" />, |
| | | <NumberField source="anfme" label="table.field.locItem.anfme" />, |
| | | <TextField source="unit" label="table.field.locItem.unit" />, |
| | | <TextField source="splrBatch" label="table.field.locItem.splrBatch" />, |
| | | <TextField source="spec" label="table.field.locItem.spec" />, |
| | | <TextField source="model" label="table.field.locItem.model" />, |
| | | <TextField source="fieldsIndex" label="table.field.locItem.fieldsIndex" />, |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} />, |
| | | ] |
| | | const fields = data.map(el => <TextField key={el.fields} source={`extendFields.[${el.fields}]`} label={el.fieldsAlise} />) |
| | | const lastArr = [ |
| | | <TextField source="updateBy$" label="common.field.updateBy" />, |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime />, |
| | | <TextField source="createBy$" label="common.field.createBy" />, |
| | | <DateField source="createTime" label="common.field.createTime" showTime />, |
| | | <TextField source="memo" label="common.field.memo" sortable={false} />, |
| | | ] |
| | | setColumns([...arr, ...fields, ...lastArr]); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Box sx={{ position: 'relative', minHeight: "60vh", }}> |
| | | {isLoading && ( |
| | | <LinearProgress |
| | | sx={{ |
| | | height: "2px", |
| | | position: 'absolute', |
| | | top: 0, |
| | | left: 0, |
| | | right: 0, |
| | | }} |
| | | /> |
| | | )} |
| | | {columns.length > 0 && |
| | | <StyledDatagrid |
| | | preferenceKey='locItem' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'locId', 'orderId', 'orderItemId', 'matnrId', 'statusBool', 'trackCode', 'createTime', 'fieldsIndex', 'splrBatch', 'createBy', 'spec', 'model', 'memo']} |
| | | > |
| | | {columns.map((column) => column)} |
| | | </StyledDatagrid>} |
| | | </Box> |
| | | ) |
| | | } |