From 1504150a9e26ef221fc6ac4e0ad494446968d06d Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期六, 30 八月 2025 16:28:22 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop

---
 rsf-admin/src/page/dashboard/NbChart.jsx |   70 +++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/rsf-admin/src/page/dashboard/NbChart.jsx b/rsf-admin/src/page/dashboard/NbChart.jsx
index 2ed9df8..5b4fce4 100644
--- a/rsf-admin/src/page/dashboard/NbChart.jsx
+++ b/rsf-admin/src/page/dashboard/NbChart.jsx
@@ -19,28 +19,28 @@
 const dateFormatter = (date) =>
     new Date(date).toLocaleDateString();
 
-const aggregateOrdersByDay = (orders) =>
-    orders
-        .filter((order) => order.status !== 'cancelled')
-        .reduce(
-            (acc, curr) => {
-                const day = format(curr.date, 'yyyy-MM-dd');
-                if (!acc[day]) {
-                    acc[day] = 0;
-                }
-                acc[day] += curr.total;
-                return acc;
-            },
-            {}
-        );
+// const aggregateOrdersByDay = (orders) =>
+//     orders
+//         .filter((order) => order.status !== 'cancelled')
+//         .reduce(
+//             (acc, curr) => {
+//                 const day = format(curr.date, 'yyyy-MM-dd');
+//                 if (!acc[day]) {
+//                     acc[day] = 0;
+//                 }
+//                 acc[day] += curr.total;
+//                 return acc;
+//             },
+//             {}
+//         );
 
-const getRevenuePerDay = (orders) => {
-    const daysWithRevenue = aggregateOrdersByDay(orders);
-    return lastMonthDays.map(date => ({
-        date: date.getTime(),
-        total: daysWithRevenue[format(date, 'yyyy-MM-dd')] || 0,
-    }));
-};
+// const getRevenuePerDay = (orders) => {
+//     const daysWithRevenue = aggregateOrdersByDay(orders);
+//     return lastMonthDays.map(date => ({
+//         date: date.getTime(),
+//         total: daysWithRevenue[format(date, 'yyyy-MM-dd')] || 0,
+//     }));
+// };
 
 const NbChart = (props) => {
     const { orders } = props;
@@ -49,11 +49,12 @@
 
     return (
         <Card>
-            <CardHeader title={translate('pos.dashboard.month_history')} />
+            <CardHeader title={translate('page.dashboard.chart.histories')} />
             <CardContent>
                 <div style={{ width: '100%', height: 300 }}>
                     <ResponsiveContainer>
-                        <AreaChart data={getRevenuePerDay(orders)}>
+                        <AreaChart data={orders?.trandItem
+                        }>
                             <defs>
                                 <linearGradient
                                     id="colorUv"
@@ -64,28 +65,26 @@
                                 >
                                     <stop
                                         offset="5%"
-                                        stopColor="#8884d8"
+                                        stopColor="#5091abff"
                                         stopOpacity={0.8}
                                     />
                                     <stop
                                         offset="95%"
-                                        stopColor="#8884d8"
+                                        stopColor="#5091abff"
                                         stopOpacity={0}
                                     />
                                 </linearGradient>
                             </defs>
                             <XAxis
-                                dataKey="date"
-                                name="Date"
-                                type="number"
-                                scale="time"
+                                dataKey="orderTime"
+
                                 domain={[
                                     addDays(aMonthAgo, 1).getTime(),
                                     new Date().getTime(),
                                 ]}
                                 tickFormatter={dateFormatter}
                             />
-                            <YAxis dataKey="total" name="Revenue" unit="鈧�" />
+                            <YAxis dataKey="inQty" name="Revenue" unit="" />
                             <CartesianGrid strokeDasharray="3 3" />
                             <Tooltip
                                 cursor={{ strokeDasharray: '3 3' }}
@@ -101,8 +100,15 @@
                             />
                             <Area
                                 type="monotone"
-                                dataKey="total"
-                                stroke="#8884d8"
+                                dataKey="inQty"
+                                stroke="#50911aff"
+                                strokeWidth={2}
+                                fill="url(#colorUv)"
+                            />
+                            <Area
+                                type="monotone"
+                                dataKey="outQty"
+                                stroke="#5091abff"
                                 strokeWidth={2}
                                 fill="url(#colorUv)"
                             />

--
Gitblit v1.9.1