From 25d4c60362bed60b04a97f671e51e41a57d851b4 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 4 Aug 2023 20:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=A4=A7=E5=B1=8F-=E5=85=AC?= =?UTF-8?q?=E4=BA=A4=E8=BF=90=E8=90=A5=E4=BF=A1=E6=81=AF=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=AD=97=E6=90=9C=E7=B4=A2=E4=BC=9A=E5=B1=95=E7=A4=BA=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/footer/operation/right.js | 151 ++++++++++-------- 1 file changed, 86 insertions(+), 65 deletions(-) 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 + } +