From 9c365f0072d6f94a20cf96b9994db4d104a14075 Mon Sep 17 00:00:00 2001 From: lijingqi <1437862981@qq.com> Date: Wed, 22 Jan 2025 17:50:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/StatisticsChart/index.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pages/GlobalModalServices/modals/ConstructionWaste/components/StatisticsChart/index.tsx b/src/pages/GlobalModalServices/modals/ConstructionWaste/components/StatisticsChart/index.tsx index faf568f9..d814b8a6 100644 --- a/src/pages/GlobalModalServices/modals/ConstructionWaste/components/StatisticsChart/index.tsx +++ b/src/pages/GlobalModalServices/modals/ConstructionWaste/components/StatisticsChart/index.tsx @@ -40,7 +40,7 @@ const StatisticsChart: React.FC = ({ searchTime }) => { }, }).then((res) => { if (res.code === 200) { - console.log(res); + return res?.data?.data?.records?.[0]?.total; } @@ -53,11 +53,14 @@ const StatisticsChart: React.FC = ({ searchTime }) => { let isUsingValue = true; const data = useMemo(() => { - const gczt = charData?.find((item) => item.name === 'gczt')?.num; - const gcnj = charData?.find((item) => item.name === 'gcnj')?.num; - const zxlj = charData?.find((item) => item.name === 'zxlj')?.num; - const gclj = charData?.find((item) => item.name === 'gclj')?.num; - const cclj = charData?.find((item) => item.name === 'cclj')?.num; + const gczt = charData?.find((item) => item.name === 'gczt')?.num??0; + const gcnj = charData?.find((item) => item.name === 'gcnj')?.num??0; + const zxlj = charData?.find((item) => item.name === 'zxlj')?.num??0; + const gclj = charData?.find((item) => item.name === 'gclj')?.num??0 + const cclj = charData?.find((item) => item.name === 'cclj')?.num??0; +console.log(gczt); + + return [ { name: '工程渣土', @@ -86,7 +89,7 @@ const StatisticsChart: React.FC = ({ searchTime }) => { { name: '拆除垃圾', value: cclj, - percentage: (((cclj / total)) * 100).toFixed(2), + percentage: ((cclj / total) * 100).toFixed(2), color: '#00FFB3', }, ]; -- GitLab