diff --git a/web/client/src/sections/quanju/containers/footer/operation/right.js b/web/client/src/sections/quanju/containers/footer/operation/right.js index f1ce70d2..4bbd5c84 100644 --- a/web/client/src/sections/quanju/containers/footer/operation/right.js +++ b/web/client/src/sections/quanju/containers/footer/operation/right.js @@ -30,16 +30,55 @@ const Right = ({ busRunTime }) => { const [queryStr, setQueryStr] = useState('') useEffect(() => { - setBusRunTimeList( - queryStr ? - busRunTime.filter(b => { - return b?.busNoChar?.indexOf(queryStr) > -1 - }) - : busRunTime - ) + let repeatCarNo = [] + let nextBusRunList = queryStr ? + busRunTime.filter(b => { + let queryMatch = b?.busNoChar?.indexOf(queryStr) > -1 + if (repeatCarNo.some(c => c == b.busNoChar.trim())) { + return false + } else { + repeatCarNo.push(b.busNoChar.trim()) + return queryMatch && true + } + }) + : busRunTime.filter(b => { + if (repeatCarNo.some(c => c == b.busNoChar.trim())) { + return false + } else { + repeatCarNo.push(b.busNoChar.trim()) + return true + } + }) + console.log(nextBusRunList); + setBusRunTimeList(nextBusRunList) }, [queryStr, busRunTime]) const style = { height: "97%", marginTop: "3%" } + const carouselContent = busRunTimeList.map((d, index) => { + return ( +