From 83bebf33f2a141a13a7adef66d09b43145fc29e9 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 26 五月 2025 08:47:28 +0800 Subject: [PATCH] 库位信息查询 --- rsf-admin/src/page/locItem/LocItemList.jsx | 265 +++++++++++++++++++++++++---------------------------- 1 files changed, 125 insertions(+), 140 deletions(-) diff --git a/rsf-admin/src/page/locItem/LocItemList.jsx b/rsf-admin/src/page/locItem/LocItemList.jsx index 2a39802..a07bb72 100644 --- a/rsf-admin/src/page/locItem/LocItemList.jsx +++ b/rsf-admin/src/page/locItem/LocItemList.jsx @@ -29,22 +29,18 @@ NumberInput, ReferenceInput, ReferenceArrayInput, - useRefresh, AutocompleteInput, DeleteButton, + useRefresh, + Button, + useList, } from 'react-admin'; -import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material'; +import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; -import LocItemCreate from "./LocItemCreate"; -import LocItemPanel from "./LocItemPanel"; -import EmptyData from "../components/EmptyData"; import MyCreateButton from "../components/MyCreateButton"; import MyExportButton from '../components/MyExportButton'; -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 request from '@/utils/request'; +import LocListAside from "./LocListAside"; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -56,49 +52,97 @@ '& .column-name': { }, '& .opt': { - width: 100 + width: 180 + }, + '& .type .MuiTypography-root': { + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + display: 'block', + width: 'auto', }, })); -const filters = [ - <SearchInput source="condition" alwaysOn />, - <DateInput label='common.time.after' source="timeStart" />, - <DateInput label='common.time.before' source="timeEnd" />, - <NumberInput source="locId" label="table.field.locItem.locId" />, - <TextInput source="locCode" label="table.field.locItem.locCode" />, - <NumberInput source="orderId" label="table.field.locItem.orderId" />, - <TextInput source="type" label="table.field.locItem.type" />, - <NumberInput source="orderItemId" label="table.field.locItem.orderItemId" />, - <NumberInput source="wkType" label="table.field.locItem.wkType" />, - <NumberInput source="matnrId" label="table.field.locItem.matnrId" />, - <TextInput source="maktx" label="table.field.locItem.maktx" />, - <TextInput source="matnrCode" label="table.field.locItem.matnrCode" />, - <TextInput source="trackCode" label="table.field.locItem.trackCode" />, - <TextInput source="unit" label="table.field.locItem.unit" />, - <NumberInput source="anfme" label="table.field.locItem.anfme" />, - <NumberInput source="qty" label="table.field.locItem.qty" />, - <NumberInput source="workQty" label="table.field.locItem.workQty" />, - <TextInput source="batch" label="table.field.locItem.batch" />, - <TextInput source="splrBatch" label="table.field.locItem.splrBatch" />, - <TextInput source="spec" label="table.field.locItem.spec" />, - <TextInput source="model" label="table.field.locItem.model" />, - <TextInput source="fieldsIndex" label="table.field.locItem.fieldsIndex" />, - <TextInput label="common.field.memo" source="memo" />, - <SelectInput - label="common.field.status" - source="status" - choices={[ - { id: '1', name: 'common.enums.statusTrue' }, - { id: '0', name: 'common.enums.statusFalse' }, - ]} - resettable - />, -] + const LocItemList = () => { const translate = useTranslate(); + const notify = useNotify(); + const refresh = useRefresh(); const [createDialog, setCreateDialog] = useState(false); const [drawerVal, setDrawerVal] = useState(false); + const [initDialog, setInitDialog] = useState(false); + const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_use_stas')) || []; + const locType = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || []; + + + const filters = [ + <SearchInput source="condition" alwaysOn />, + <ReferenceInput + source="warehouseId" + label="table.field.loc.warehouseId" + reference="warehouse" + > + <AutocompleteInput + label="table.field.loc.warehouseId" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput>, + <ReferenceInput + source="areaId" + label="table.field.loc.areaId" + reference="warehouseAreas" + > + <AutocompleteInput + label="table.field.loc.areaId" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput>, + <AutocompleteInput + choices={dicts} + optionText="label" + label="table.field.loc.useStatus" + source="useStatus" + optionValue="value" + parse={v => v} + />, + <TextInput source="code" label="table.field.loc.code" />, + <AutocompleteInput + choices={locType} + optionText="label" + label="table.field.loc.type" + source="type" + optionValue="value" + parse={v => v} + />, <TextInput source="name" label="table.field.loc.name" />, + <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />, + <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />, + <TextInput source="barcode" label="table.field.loc.barcode" />, + <TextInput source="unit" label="table.field.loc.unit" />, + <TextInput source="size" label="table.field.loc.size" />, + <NumberInput source="row" label="table.field.loc.row" />, + <NumberInput source="col" label="table.field.loc.col" />, + <NumberInput source="lev" label="table.field.loc.lev" />, + <NumberInput source="channel" label="table.field.loc.channel" />, + <NumberInput source="maxParts" label="table.field.loc.maxParts" />, + <NumberInput source="maxPack" label="table.field.loc.maxPack" />, + <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />, + <TextInput source="locAttrs" label="table.field.loc.locAttrs" />, + <TextInput label="common.field.memo" source="memo" />, + <SelectInput + label="common.field.status" + source="status" + choices={[ + { id: '1', name: 'common.enums.statusTrue' }, + { id: '0', name: 'common.enums.statusFalse' }, + ]} + resettable + />, + ] + + return ( <Box display="flex"> @@ -109,8 +153,10 @@ theme.transitions.create(['all'], { duration: theme.transitions.duration.enteringScreen, }), - marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, + marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} + storeKey="locItem" + resource="loc" title={"menu.locItem"} empty={false} filters={filters} @@ -118,107 +164,46 @@ actions={( <TopToolbar> <FilterButton /> - {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} - <SelectColumnsButton preferenceKey='locItem' /> - {/* <MyExportButton /> */} + <SelectColumnsButton preferenceKey='loc' /> </TopToolbar> )} perPage={DEFAULT_PAGE_SIZE} + aside={<LocListAside />} > - <DynamicFields /> + <StyledDatagrid + preferenceKey='locItem' + align="left" + bulkActionButtons={false} + rowClick={() => false} + omit={['id', 'createTime', 'createBy', 'memo', 'updateTime', 'updateBy']} + > + <NumberField source="id" /> + <NumberField source="warehouseId$" label="table.field.loc.warehouseId" /> + <NumberField source="areaId$" label="table.field.loc.areaId" /> + <TextField source="code" label="table.field.loc.code" /> + <TextField source="typeIds$" label="table.field.loc.type" cellClassName="type" /> + <TextField source="barcode" label="table.field.loc.barcode" /> + <TextField source="length" label="table.field.loc.length" /> + <TextField source="width" label="table.field.loc.width" /> + <TextField source="height" label="table.field.loc.height" /> + <NumberField source="row" label="table.field.loc.row" /> + <NumberField source="col" label="table.field.loc.col" /> + <NumberField source="lev" label="table.field.loc.lev" /> + <NumberField source="channel" label="table.field.loc.channel" /> + <TextField source="useStatus$" label="table.field.loc.useStatus" /> + <TextField source="updateBy$" label="common.field.updateBy" /> + <DateField source="updateTime" label="common.field.updateTime" showTime align="left" /> + <TextField source="createBy$" label="common.field.createBy" /> + <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"> + <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} resource="locItem" label="toolbar.detail" /> + </WrapperField> + </StyledDatagrid> </List> - <LocItemCreate - open={createDialog} - setOpen={setCreateDialog} - /> - <PageDrawer - title='LocItem Detail' - drawerVal={drawerVal} - setDrawerVal={setDrawerVal} - > - </PageDrawer> </Box> ) } -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" />, - <TextField source="wareArea" label="table.field.locItem.wareArea" />, - <TextField source="locCode" label="table.field.locItem.locCode" />, - <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="spec" label="table.field.locItem.spec" />, - <TextField source="model" label="table.field.locItem.model" />, - <TextField source="batch" label="table.field.locItem.batch" />, - <TextField source="trackCode" label="table.field.locItem.trackCode" />, - <TextField source="unit" label="table.field.locItem.unit" />, - <NumberField source="anfme" label="table.field.locItem.anfme" />, - <NumberField source="workQty" label="table.field.locItem.workQty" />, - <NumberField source="qty" label="table.field.locItem.qty" />, - <TextField source="splrBatch" label="table.field.locItem.splrBatch" />, - <TextField source="fieldsIndex" label="table.field.locItem.fieldsIndex" />, - ] - 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 />, - <BooleanField source="statusBool" label="common.field.status" sortable={false} />, - <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={false} - rowClick={false} - expand={false} - expandSingle={true} - omit={['id', 'createTime','spec', 'model', 'locId', 'orderId', 'trackCode', 'orderItemId', 'matnrId', 'splrBatch','createBy', 'memo', 'fieldsIndex']} - > - {columns.map((column) => column)} - </StyledDatagrid>} - </Box> - ) -} \ No newline at end of file +export default LocItemList; \ No newline at end of file -- Gitblit v1.9.1