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)