From c912c5e0f5eef9be21d94727f5ee9fcc0c85eac1 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 15 八月 2025 10:42:16 +0800
Subject: [PATCH] 首页修改

---
 rsf-admin/src/page/dashboard/index.jsx |   73 +++++++++++++-----------------------
 1 files changed, 27 insertions(+), 46 deletions(-)

diff --git a/rsf-admin/src/page/dashboard/index.jsx b/rsf-admin/src/page/dashboard/index.jsx
index b832f8d..d47caa1 100644
--- a/rsf-admin/src/page/dashboard/index.jsx
+++ b/rsf-admin/src/page/dashboard/index.jsx
@@ -13,6 +13,7 @@
 import NbChart from "./NbChart";
 import NbList from "./NbList";
 import NbCard from "./NbCard";
+import NbPie from './NbPie';
 
 const styles = {
     flex: { display: 'flex' },
@@ -72,11 +73,14 @@
     const notify = useNotify();
     const [statistic, setStatistic] = useState({});
     const [stock, setStock] = useState([]);
+    const [deadStock, setDeadStock] = useState([]);
+    const [locUsage, setLocUsages] = useState([]);
 
     useEffect(() => {
         getDashBoardHeader()
         getRecentTrands()
         getRecentStocks()
+        getRecentUsage()
 
     }, [])
 
@@ -94,10 +98,10 @@
     }
 
     const getRecentStocks = async () => {
-        await request.post('/asnOrder/dashbord/header').then(res => {
-            const { code, msg, data } = res.data?.data;
+        await request.post('/locItem/page', { current: 1, pageSize: 10, orderBy: 'create_time asc' }).then(res => {
+            const { code, msg, data } = res?.data;
             if (code === 200) {
-                setStatistic(data);
+                setDeadStock(data?.records);
             } else {
                 notify(msg, { type: 'error', messageArgs: { _: msg } });
             }
@@ -106,6 +110,20 @@
         })
     }
 
+    const getRecentUsage = () => {
+        request.post("/loc/pie/list").then(res => {
+            const { code, msg, data } = res?.data;
+            console.log(data);
+            console.log(code);
+            if (code === 200) {
+                setLocUsages(data?.data)
+            } else {
+                notify(msg, { type: 'error', messageArgs: { _: msg } });
+            }
+        }).catch((error) => {
+            notify(error.message, { type: 'error', messageArgs: { _: error.message } });
+        })
+    }
 
     /**
      * 鑾峰彇搴撹繎涓�涓湀鍑哄叆搴撲俊鎭�
@@ -123,47 +141,9 @@
         })
     }
 
-    const recentOrders = [
-        {
-            id: 1,
-            name: 'a',
-            date: "2025-08-10T12:23:56.959Z",
-            total: 138.94,
-            inTotal: 254,
-        },
-        {
-            id: 2,
-            name: 'b',
-            date: "2025-08-03T07:45:00.304Z",
-            total: 214.66,
-            inTotal: 258,
-        },
-        {
-            id: 3,
-            name: 'c',
-            date: "2025-07-28T00:20:10.968Z",
-            total: 68.19,
-            inTotal: 154,
-        },
-        {
-            id: 4,
-            name: 'd',
-            date: "2025-07-22T20:39:00.293Z",
-            total: 36.56,
-            inTotal: 124,
-        },
-        {
-            id: 5,
-            name: 'e',
-            date: "2025-07-16T17:40:24.791Z",
-            total: 100.82,
-            inTotal: 354,
-        },
-    ]
-
     return (
         <>
-            <Grid container md={12}>
+            <Grid container md={12} item>
                 <Grid item md={8}>
                     <Box sx={{ display: "flex" }}>
                         <CardWithIcon
@@ -180,7 +160,6 @@
                             title={`${statistic?.membersTotalQua}`}
                             type={"out"}
                             statistic={statistic}
-
                         />
                     </Box>
                     <Spacer />
@@ -188,9 +167,11 @@
                         <NbChart orders={stock} />
                     </Box>
                     <Spacer />
-                    <Box>
-                        <NbList orders={recentOrders} />
+                    <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>
+                        <NbList deadStock={deadStock} />
+                        <NbPie locUsage={locUsage} />
                     </Box>
+                    <Spacer />
                 </Grid>
                 <Grid item md={4}>
                     <Box sx={{ display: 'flex' }}>
@@ -205,7 +186,7 @@
                                     filter: JSON.stringify({ status: 1 }),
                                 }),
                             }}
-                            list={recentOrders}
+                            list={deadStock}
                         />
                     </Box>
                 </Grid>

--
Gitblit v1.9.1