From 776db4072c95c013b808078fbf42f0379e96bbb2 Mon Sep 17 00:00:00 2001 From: guoxin Date: Fri, 12 Jan 2024 18:24:37 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=86=85BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableModule/index.jsx | 4 +++- src/pages/InRoadMgm/PersonMgm/Attendance/Fence/loadable.jsx | 6 ++++-- src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/TableModule/index.jsx b/src/components/TableModule/index.jsx index 63041fa..7bf076f 100644 --- a/src/components/TableModule/index.jsx +++ b/src/components/TableModule/index.jsx @@ -314,14 +314,16 @@ const TableModule = forwardRef((props, ref) => { let last = options[options.length - 1]; if (last.children) { addChild(last, res); + } else { + res = [last.id] } - res.push(last.id); } console.log(res); setAreaSelectedList(res); } const addChild = (child, res) => { if (child.children) { + res.push(child.id) child.children.forEach((item) => { addChild(item, res); }); diff --git a/src/pages/InRoadMgm/PersonMgm/Attendance/Fence/loadable.jsx b/src/pages/InRoadMgm/PersonMgm/Attendance/Fence/loadable.jsx index 3e08877..cef46f5 100644 --- a/src/pages/InRoadMgm/PersonMgm/Attendance/Fence/loadable.jsx +++ b/src/pages/InRoadMgm/PersonMgm/Attendance/Fence/loadable.jsx @@ -69,8 +69,9 @@ function Fence(props) { let last = options[options.length - 1]; if (last.children) { addChild(last, res); - } - res.push(last.id); + }else { + res = [last.id] + } } console.log(res); setAreaSelectedList(res); @@ -78,6 +79,7 @@ function Fence(props) { } const addChild = (child, res) => { if (child.children) { + res.push(child.id) child.children.forEach((item) => { addChild(item, res); }); diff --git a/src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx b/src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx index a9784d0..f36cbdc 100644 --- a/src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx +++ b/src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx @@ -79,8 +79,9 @@ function StuffMgm(props) { let last = options[options.length - 1]; if (last.children) { addChild(last, res); - } - res.push(last.id); + } else { + res = [last.id] + } } setGetOption(res) setFormData({ ...formData, region_id: value }) @@ -363,6 +364,7 @@ function StuffMgm(props) { ] const addChild = (child, res) => { if (child.children) { + res.push(child.id) child.children.forEach((item) => { addChild(item, res); });