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 ( +
+
+ + +

车辆牌照

+
{d.busNoChar}
+

调度状态

+

{busWillRun.find(w => w.value == d.willRun)?.text || '--'}

+
+ +

发车时间

+
{d.lastDepTime}
+
+ +

司机

+
{d.employeeName}
+

工号

+

{d.opNo}

+
+
+
+ ) + }) return (
{ />
- - { - busRunTimeList.map((d, index) => { - return ( + { + carouselContent.length > 3 ? + + { + carouselContent + } + {/* { + dataLists.map((data, index) => (
-

车辆牌照

-
{d.busNoChar}
-

调度状态

-

{busWillRun.find(w => w.value == d.willRun)?.text || '--'}

-
- -

发车时间

-
{d.lastDepTime}
-
- -

司机

-
{d.employeeName}
-

工号

-

{d.opNo}

+

所属线路

+

{data.route}

+

车辆牌照号

+
{data.plate}
+
+
+
+
+
- ) - }) - } - {/* { - dataLists.map((data, index) => ( -
-
- - -

所属线路

-

{data.route}

-

车辆牌照号

-
{data.plate}
-
-
-
-
-
-
-
-
- )) - } */} -
+ )) + } */} +
+ : + carouselContent + } +