From e5a2d3c14472d64255d80cef130d83f6e24e591d Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期五, 15 八月 2025 10:49:56 +0800 Subject: [PATCH] 首页功能优化 --- rsf-admin/src/page/dashboard/index.jsx | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) diff --git a/rsf-admin/src/page/dashboard/index.jsx b/rsf-admin/src/page/dashboard/index.jsx index d47caa1..db9883b 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'; @@ -75,18 +76,22 @@ 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; if (code === 200) { setStatistic(data); } else { @@ -110,11 +115,23 @@ }) } + 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; - console.log(data); - console.log(code); if (code === 200) { setLocUsages(data?.data) } else { @@ -177,16 +194,17 @@ <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