From 5281d4e4afa6f1a31248b95f2dbba8c0ebf63330 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 20 Jan 2026 09:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=85=AC=E5=8F=B8bi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CenterPanel/index.js | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/pages/Container/White/BranchOffice/components/CenterPanel/index.js b/src/pages/Container/White/BranchOffice/components/CenterPanel/index.js index d97aa8e..c6ee354 100644 --- a/src/pages/Container/White/BranchOffice/components/CenterPanel/index.js +++ b/src/pages/Container/White/BranchOffice/components/CenterPanel/index.js @@ -64,27 +64,7 @@ function CenterPanel() { getWeatherData(); }, []); - useEventListener("resize", () => { - setTimeout(() => { - if (chart1Instance.current) { - chart1Instance.current.resize(); - } - if (chart2Instance.current) { - chart2Instance.current.resize(); - } - if (chart3Instance.current) { - chart3Instance.current.resize(); - } - if (chart4Instance.current) { - chart4Instance.current.resize(); - } - if (chart5Instance.current) { - chart5Instance.current.resize(); - } - }, 0); - }); - - useMount(() => { + const initEcharts = () => { setTimeout(() => { initEcharts1(main1Ref, chart1Instance, { majorRiskCount: 1, @@ -133,6 +113,31 @@ function CenterPanel() { { department: "设备管理部", yearOnYear: 1, monthOnMonth: 1 }, ]); }, 0); + }; + + useEventListener("resize", () => { + setTimeout(() => { + if (chart1Instance.current) { + chart1Instance.current.dispose(); + } + if (chart2Instance.current) { + chart2Instance.current.dispose(); + } + if (chart3Instance.current) { + chart3Instance.current.dispose(); + } + if (chart4Instance.current) { + chart4Instance.current.dispose(); + } + if (chart5Instance.current) { + chart5Instance.current.dispose(); + } + initEcharts(); + }, 0); + }); + + useMount(() => { + initEcharts(); return () => { if (chart1Instance.current) {