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); });