From 031e36213941ad3430da2b0429701e742f09f5d8 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 18 三月 2025 11:14:20 +0800 Subject: [PATCH] Merge branch 'front' into devlop --- rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx | 115 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 83 insertions(+), 32 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx index e2e4c63..901038b 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx @@ -31,8 +31,11 @@ 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"; @@ -40,33 +43,52 @@ 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>, @@ -90,14 +112,14 @@ <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" />, @@ -125,31 +147,33 @@ 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" /> @@ -193,12 +217,13 @@ <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 = () => { @@ -217,7 +242,7 @@ 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) }} />} @@ -235,7 +260,7 @@ </TopToolbar> )} perPage={DEFAULT_PAGE_SIZE} - aside={ <MatListAside /> } + aside={<MatListAside />} > <MatnrListContent /> </List> @@ -255,4 +280,30 @@ MatnrList.Context = React.createContext() -export default MatnrList; \ No newline at end of file +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>) + + ) +} \ No newline at end of file -- Gitblit v1.9.1