From 10a43f2d14a1a161bc624b9fe2f70febc9776ac8 Mon Sep 17 00:00:00 2001 From: skyouc <958836976@qq.com> Date: 星期五, 05 九月 2025 09:42:19 +0800 Subject: [PATCH] 1 --- rsf-admin/src/page/dashboard/index.jsx | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 9 deletions(-) diff --git a/rsf-admin/src/page/dashboard/index.jsx b/rsf-admin/src/page/dashboard/index.jsx index c2f7fd8..a41514c 100644 --- a/rsf-admin/src/page/dashboard/index.jsx +++ b/rsf-admin/src/page/dashboard/index.jsx @@ -3,6 +3,7 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; import SensorOccupiedIcon from '@mui/icons-material/SensorOccupied'; import CardWithIcon from '../components/CardWithIcon'; +import CommentIcon from '@mui/icons-material/Comment'; import WifiIcon from '@mui/icons-material/Wifi'; import { useTheme } from '@mui/material/styles'; import { useNavigate } from 'react-router-dom'; @@ -13,7 +14,6 @@ import NbChart from "./NbChart"; import NbList from "./NbList"; import NbCard from "./NbCard"; -import { orderBy } from 'lodash'; import NbPie from './NbPie'; const styles = { @@ -75,17 +75,25 @@ const [statistic, setStatistic] = useState({}); const [stock, setStock] = useState([]); const [deadStock, setDeadStock] = useState([]); + const [locUsage, setLocUsages] = useState([]); + const [tasks, setTasks] = useState([]); + const [total, setTotal] = useState(0); + useEffect(() => { getDashBoardHeader() getRecentTrands() getRecentStocks() + getRecentUsage() + getExcingTasks() }, []) const getDashBoardHeader = async () => { await request.post('/asnOrder/dashbord/header').then(res => { - const { code, msg, data } = res.data?.data; + const { code, msg, data } = res?.data; + console.log(code); + if (code === 200) { setStatistic(data); } else { @@ -101,6 +109,33 @@ const { code, msg, data } = res?.data; if (code === 200) { setDeadStock(data?.records); + } else { + notify(msg, { type: 'error', messageArgs: { _: msg } }); + } + }).catch((error) => { + notify(error.message, { type: 'error', messageArgs: { _: error.message } }); + }) + } + + const getExcingTasks = async () => { + await request.post('/task/page', { current: 1, pageSize: 100, orderBy: 'sort desc' }).then(res => { + const { code, msg, data } = res?.data; + if (code === 200) { + setTasks(data?.records) + setTotal(data?.total) + } else { + notify(msg, { type: 'error', messageArgs: { _: msg } }); + } + }).catch((error) => { + notify(error.message, { type: 'error', messageArgs: { _: error.message } }); + }) + } + + const getRecentUsage = () => { + request.post("/loc/pie/list").then(res => { + const { code, msg, data } = res?.data; + if (code === 200) { + setLocUsages(data?.data) } else { notify(msg, { type: 'error', messageArgs: { _: msg } }); } @@ -141,7 +176,7 @@ <CardWithIcon icon={SensorOccupiedIcon} subtitle={translate('page.dashboard.header.outStockQty')} - title={`${statistic?.membersTotalQua}`} + title={`${statistic?.outAnf}`} type={"out"} statistic={statistic} /> @@ -151,27 +186,27 @@ <NbChart orders={stock} /> </Box> <Spacer /> - <Box sx={{ display: 'flex' }}> + <Box sx={{ display: 'flex', justifyContent: 'space-between' }}> <NbList deadStock={deadStock} /> - <NbPie /> + <NbPie locUsage={locUsage} /> </Box> <Spacer /> - </Grid> <Grid item md={4}> <Box sx={{ display: 'flex' }}> <Spacer /> <NbCard - icon={SensorOccupiedIcon} + icon={CommentIcon} subtitle={translate('page.dashboard.header.taskWorkQty')} - title={`${statistic?.membersTotalQua}`} + title={`${statistic?.taskQty}`} + total={total} to={{ pathname: '/task', search: JSON.stringify({ filter: JSON.stringify({ status: 1 }), }), }} - list={deadStock} + tasks={tasks} /> </Box> </Grid> -- Gitblit v1.9.1