From 2a45029c7748872cdf6eae4c4e2b044b08d4a7f1 Mon Sep 17 00:00:00 2001 From: al Date: Mon, 1 Jul 2024 20:26:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/bill/[type]/income_querry/page.jsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/bill/[type]/income_querry/page.jsx b/app/bill/[type]/income_querry/page.jsx index 53d368a..869f2c6 100644 --- a/app/bill/[type]/income_querry/page.jsx +++ b/app/bill/[type]/income_querry/page.jsx @@ -17,6 +17,16 @@ export default function IncomeQuerry({ children }) { useEffect(() => { getData(); }, []); + useEffect(() => { + if(databoard.current&&data.week_dashboard){ + createDataBoard(data.week_dashboard); + } + }, [databoard.current]); + useEffect(() => { + if(incomeOrgin.current && data.income_from_dashboard){ + createIncomeOrgin(data.income_from_dashboard); + } + }, [incomeOrgin.current]); const getData = async () => { const base = webviewBaseRequest(); const signature = generateSignature({ @@ -40,12 +50,11 @@ export default function IncomeQuerry({ children }) { return total + item.income; }, 0); data && setData({ ...data, weekIncom }); - createDataBoard(data.week_dashboard); - createIncomeOrgin(data.income_from_dashboard); + } catch (error) {} }; + const createDataBoard = (data) => { - if (databoard.current) { var myChart = echarts.init(databoard.current, "dark"); var option; option = { @@ -114,10 +123,8 @@ export default function IncomeQuerry({ children }) { ], }; option && myChart.setOption(option); - } }; const createIncomeOrgin = (data) => { - if (incomeOrgin.current) { var myChart = echarts.init(incomeOrgin.current, "dark"); var option; option = { @@ -179,7 +186,6 @@ export default function IncomeQuerry({ children }) { ], }; option && myChart.setOption(option); - } }; const getDateStr = (data) => { -- 2.41.0