From 1267cb4f15f7f03abb4b8d3551b34416f15915ec Mon Sep 17 00:00:00 2001 From: wanyiwei Date: Thu, 28 Jul 2022 15:41:33 +0800 Subject: [PATCH] =?UTF-8?q?*=E5=A4=A7=E5=B1=8F=E8=BF=90=E8=90=A5=E5=85=AC?= =?UTF-8?q?=E4=BA=A4=E8=BD=A6=E8=BE=86=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E6=96=B0=E5=A2=9E=E5=8F=8A=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/footer/operation/left.js | 82 ++++++++++--------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/web/client/src/sections/quanju/containers/footer/operation/left.js b/web/client/src/sections/quanju/containers/footer/operation/left.js index 7e7e9f81..ec820602 100644 --- a/web/client/src/sections/quanju/containers/footer/operation/left.js +++ b/web/client/src/sections/quanju/containers/footer/operation/left.js @@ -39,9 +39,10 @@ const Left = (props) => { }; const loop = (treeData) => treeData.map((item) => { - const index = item.title.indexOf(searchValue); - const beforeStr = item.title.substr(0, index); - const afterStr = item.title.substr(index + searchValue.length); + // console.log(item,'===> item -----'); + const index = item.title != null && item.title.indexOf(searchValue); + const beforeStr = item.title != null && item.title.substr(0, index); + const afterStr = item.title != null && item.title.substr(index + searchValue.length); const title = index > -1 ? ( @@ -75,47 +76,52 @@ const Left = (props) => { let busTierList = [] let busTierOpen = [] let dataList = [] - - busTier && busTier.data && busTier.data.forEach((e, index) => { - if (index == 0) { - busTierOpen.push(e.name) - } - busTierList.push({ - key: e.name, - title: e.name, - children: e.child.map(s => { - return { - key: s.name, - title: s.name, - children: s.child.map(i => { - return { - key: i.vehicleLicensePlateNumber, - title: i.vehicleLicensePlateNumber, - } - }) - } + let busTierNewList = [] + if (busTier && busTier.data && busTier.data.length > 0) { + busTierNewList.push(busTier && busTier.data && busTier.data[0]) + } + if (busTierNewList.length > 0) { + busTierNewList.forEach((e, index) => { + if (index == 0) { + busTierOpen.push(e.name) + } + busTierList.push({ + key: e.name, + title: e.name, + children: e.child.map(s => { + return { + key: s.name, + title: s.name, + children: s.child.map(i => { + return { + key: i.name, + title: i.name, + children: i.child.map(x => { + return { + key: x.name, + title: x.name, + } + }) + } + }) + } + }) }) }) - }) - busTier && busTier.data && busTier.data.forEach(e => { - dataList.push({ - key: e.name, - title: e.name, - }) - e.child.forEach(i => { - dataList.push({ - key: i.name, - title: i.name, - }) - i.child.forEach(s => { - dataList.push({ - key: s.vehicleLicensePlateNumber, - title: s.vehicleLicensePlateNumber, + busTierNewList.forEach(e => { + e.child.forEach(i => { + i.child.forEach(s => { + s.child.forEach(x => { + dataList.push({ + key: x.name, + title: x.name + }) + }) }) }) }) - }) + } setTreeData(busTierList) setExpandedKeys(busTierOpen) setTreeDataList(dataList)