Browse Source

运营大屏-公交运营信息关键字搜索会展示重复数据

dev
巴林闲侠 1 year ago
parent
commit
25d4c60362
  1. 151
      web/client/src/sections/quanju/containers/footer/operation/right.js

151
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 (
<div key={index} style={{ width: '100%', height: '40%' }}>
<div className='busInformation'>
<img src='/assets/images/quanju/theBus.png' style={{ width: '15%', display: 'block', float: 'left' }} />
<span>
<h3>车辆牌照</h3>
<h5>{d.busNoChar}</h5>
<h3>调度状态</h3>
<h4>{busWillRun.find(w => w.value == d.willRun)?.text || '--'}</h4>
</span>
<span>
<h3>发车时间</h3>
<h5>{d.lastDepTime}</h5>
</span>
<span style={{ position: 'relative', left: '21%' }}>
<h3>司机</h3>
<h5>{d.employeeName}</h5>
<h3>工号</h3>
<h4>{d.opNo}</h4>
</span>
</div>
</div>
)
})
return (
<div style={{ position: 'absolute', right: 0, width: "23%", height: "100%", marginRight: "1%", }}>
<Module style={style} customize={true}
@ -70,71 +109,53 @@ const Right = ({ busRunTime }) => {
/>
</div>
<Carousel
autoplay
infinite
// autoplaySpeed={300000}
autoplaySpeed={1000 * 3}
vertical={true}
slidesToShow={4}
>
{
busRunTimeList.map((d, index) => {
return (
{
carouselContent.length > 3 ?
<Carousel
autoplay
infinite
// autoplaySpeed={300000}
autoplaySpeed={1000 * 3}
vertical={true}
slidesToShow={4}
>
{
carouselContent
}
{/* {
dataLists.map((data, index) => (
<div key={index} style={{ width: '100%', height: '40%' }}>
<div className='busInformation'>
<img src='/assets/images/quanju/theBus.png' style={{ width: '15%', display: 'block', float: 'left' }} />
<span>
<h3>车辆牌照</h3>
<h5>{d.busNoChar}</h5>
<h3>调度状态</h3>
<h4>{busWillRun.find(w => w.value == d.willRun)?.text || '--'}</h4>
</span>
<span>
<h3>发车时间</h3>
<h5>{d.lastDepTime}</h5>
</span>
<span style={{ position: 'relative', left: '21%' }}>
<h3>司机</h3>
<h5>{d.employeeName}</h5>
<h3>工号</h3>
<h4>{d.opNo}</h4>
<h3>所属线路</h3>
<h4>{data.route}</h4>
<h3>车辆牌照号</h3>
<h5>{data.plate}</h5>
</span>
</div>
<div className='busVideo'>
<div style={{
width: '98%', margin: '1% 1%', height: 152, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj1.png' style={{ width: '100%', height: '100%' }} /></div>
<div style={{
width: '48%', margin: '1% 1%', height: 100, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj2.png' style={{ width: '100%', height: '100%' }} /></div>
<div style={{
width: '48%', margin: '1% 1%', height: 100, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj3.png' style={{ width: '100%', height: '100%' }} /></div>
</div>
</div>
)
})
}
{/* {
dataLists.map((data, index) => (
<div key={index} style={{ width: '100%', height: '40%' }}>
<div className='busInformation'>
<img src='/assets/images/quanju/theBus.png' style={{ width: '15%', display: 'block', float: 'left' }} />
<span>
<h3>所属线路</h3>
<h4>{data.route}</h4>
<h3>车辆牌照号</h3>
<h5>{data.plate}</h5>
</span>
</div>
<div className='busVideo'>
<div style={{
width: '98%', margin: '1% 1%', height: 152, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj1.png' style={{ width: '100%', height: '100%' }} /></div>
<div style={{
width: '48%', margin: '1% 1%', height: 100, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj2.png' style={{ width: '100%', height: '100%' }} /></div>
<div style={{
width: '48%', margin: '1% 1%', height: 100, display: 'block', float: 'left', boxShadow: '0px 1px 5px 0px #1C60FE',
border: '1px solid #1C60FE'
}}><img src='/assets/images/quanju/fake/gj3.png' style={{ width: '100%', height: '100%' }} /></div>
</div>
</div>
))
} */}
</Carousel>
))
} */}
</Carousel>
:
carouselContent
}
</div>
</Module>
</div>

Loading…
Cancel
Save