From 16845ea7cd44511661766c28b1b17a8e5bdce2a9 Mon Sep 17 00:00:00 2001
From: verou <857149855@qq.com>
Date: 星期一, 17 三月 2025 18:41:49 +0800
Subject: [PATCH] feat:库位初始化

---
 rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
index 937a8e4..901038b 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
@@ -31,6 +31,8 @@
     ReferenceArrayInput,
     AutocompleteInput,
     DeleteButton,
+    useRefresh,
+    Button
 
 } from 'react-admin';
 import { Box, Typography, Card, Stack, LinearProgress, Tooltip } from '@mui/material';
@@ -47,6 +49,8 @@
 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': {
@@ -165,7 +169,7 @@
                 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']}
+                    , 'createTime', 'createBy', 'memo', 'rglarId', 'groupId', 'stockLevel', 'isLabelMange']}
             >
                 <NumberField source="id" />
 
@@ -214,6 +218,7 @@
                 <WrapperField cellClassName="opt" label="common.field.opt">
                     <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                     {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */}
+                    <EnableButton />
                 </WrapperField>
             </StyledDatagrid>
         </Box>
@@ -275,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