|
|
@ -1,7 +1,11 @@ |
|
|
|
import { Col, Row } from 'antd' |
|
|
|
import React, { useState, useEffect } from 'react' |
|
|
|
import Module from '../../../public/module' |
|
|
|
|
|
|
|
import { connect } from 'react-redux' |
|
|
|
import Lun from "../../leadership/right/lunbo" |
|
|
|
import { getRoadmaintain } from "../../../../actions/example" |
|
|
|
import Hua from "../../leadership/right/hudong" |
|
|
|
import moment from 'moment' |
|
|
|
|
|
|
|
const iconSrc = [ |
|
|
|
'assets/images/quanju/biaoxian.png', |
|
|
@ -12,35 +16,99 @@ const iconSrc = [ |
|
|
|
const unit = ['km', '处', '个', 'km'] |
|
|
|
|
|
|
|
const RightTop = (props) => { |
|
|
|
const { highwaysData } = props |
|
|
|
const { highwaysData, dispatch } = props |
|
|
|
const [roadmaintainList, setRoadmaintainList] = useState([]) |
|
|
|
const [beijing, setBeijing] = useState() |
|
|
|
const [num, setNum] = useState() |
|
|
|
|
|
|
|
const style = { height: "31%", marginTop: "3%" } |
|
|
|
const textStyle = { fontSize: 14, color: '#E9F7FF' } |
|
|
|
const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 } |
|
|
|
let list = highwaysData?.sort((a, b) => a.id - b.id) |
|
|
|
list = highwaysData?.slice(0, 4).map((h, index) => { |
|
|
|
return { |
|
|
|
id: h.id, |
|
|
|
name: h.name, |
|
|
|
count: h.count, |
|
|
|
unit: unit[index], |
|
|
|
icon: iconSrc[index] |
|
|
|
// const textStyle = { fontSize: 14, color: '#E9F7FF' }
|
|
|
|
// const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 }
|
|
|
|
// let list = highwaysData?.sort((a, b) => a.id - b.id)
|
|
|
|
// list = highwaysData?.slice(0, 4).map((h, index) => {
|
|
|
|
// return {
|
|
|
|
// id: h.id,
|
|
|
|
// name: h.name,
|
|
|
|
// count: h.count,
|
|
|
|
// unit: unit[index],
|
|
|
|
// icon: iconSrc[index]
|
|
|
|
|
|
|
|
} |
|
|
|
// }
|
|
|
|
// })
|
|
|
|
|
|
|
|
// const arrayChunk = (array, size) => {
|
|
|
|
// let data = []
|
|
|
|
// for (let i = 0; i < array.length; i += size) {
|
|
|
|
// data.push(array.slice(i, i + size))
|
|
|
|
// }
|
|
|
|
// return data
|
|
|
|
// }
|
|
|
|
// let lists = list ? arrayChunk(list, 2) : []
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
dispatch(getRoadmaintain()).then((res) => { |
|
|
|
setRoadmaintainList(res.payload.data.reportList.filter((item, index) => { |
|
|
|
return item.projectType == "road" |
|
|
|
})) |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
|
|
|
|
const arrayChunk = (array, size) => { |
|
|
|
let data = [] |
|
|
|
for (let i = 0; i < array.length; i += size) { |
|
|
|
data.push(array.slice(i, i + size)) |
|
|
|
const renderBody = () => { |
|
|
|
return ( |
|
|
|
<div style={{ width: "100%", height: "100%" }}> |
|
|
|
{ |
|
|
|
roadmaintainList.map((item, index) => { |
|
|
|
return ( |
|
|
|
<li className={index} style={{ |
|
|
|
height: "20px", position: "relative", width: "100%", color: "#FFFFFF", marginTop: index == 0 ? "4px" : "5px", listStyle: "none", fontSize: "14px" |
|
|
|
}} onMouseEnter={() => { |
|
|
|
setBeijing(index) |
|
|
|
setNum(index) |
|
|
|
}} onMouseLeave={() => { |
|
|
|
setBeijing() |
|
|
|
setNum() |
|
|
|
}}> |
|
|
|
{beijing == index ? <img src='/assets/images/leadership/shezhi.png' style={{ width: "2%", height: "80%", position: "absolute", top: "12%", left: "1%" }} /> : ""} |
|
|
|
{beijing == index ? <img src='/assets/images/leadership/lan.png' style={{ width: "100%", height: "120%", position: "absolute", right: "5%" }} /> : ""} |
|
|
|
<p style={{ textAlign: "center", width: "40%", position: "absolute", right: "28.5%", color: beijing == index ? "#ffffff" : "rgba(216,240,255,0.8)" }} >{item?.user?.name || '--'}</p> |
|
|
|
<p style={{ textAlign: "left", width: "30%", position: "absolute", left: "5%", color: beijing == index ? "#ffffff" : "rgba(216,240,255,0.8)" }} >{item.road ? item.road : "--"}</p> |
|
|
|
<p style={{ textAlign: "right", width: "30%", position: "absolute", right: "3%", color: beijing == index ? "#ffffff" : "rgba(216,240,255,0.8)" }}> |
|
|
|
{ |
|
|
|
item.time ? |
|
|
|
moment(item.time).format("YYYY-MM-DD") |
|
|
|
: "--" |
|
|
|
} |
|
|
|
</p> |
|
|
|
{ |
|
|
|
num == index ? |
|
|
|
<div style={{ position: "fixed", width: "400px", height: "200px", zIndex: 100, right: "24%", marginTop: "0", top: "25%" }}> |
|
|
|
<img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} /> |
|
|
|
<div style={{ width: "50%", height: "100%", position: "absolute", top: "0", }}> |
|
|
|
<Hua shuzu={[{ "imgs": item.conserveAfterPic ? item.conserveAfterPic[0] : "" }, { "imgs": item.conserveBeforePic ? item.conserveBeforePic[0] : "" }, { "imgs": item.conserveUnderwayPic ? item.conserveUnderwayPic[0] : "" }]} /> |
|
|
|
</div> |
|
|
|
<div style={{ position: "absolute", top: "0", width: "50%", left: "50%", paddingRight: "10px" }}> |
|
|
|
<p style={{ marginTop: "20px", color: "#FFFFFF", fontSize: "16px", fontFamily: "YouSheBiaoTiHei" }}> |
|
|
|
{item.roadSectionStart ? item.roadSectionStart : ""}{item.roadSectionStart && item.roadSectionEnd ? "——" : ""}{item.roadSectionEnd ? item.roadSectionEnd : ""}{item.roadSectionStart || item.roadSectionEnd ? "" : "--"} |
|
|
|
</p> |
|
|
|
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>养护类型<span style={{ color: "#EEF4FF", marginLeft: "30px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>日常养护</span></p> |
|
|
|
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>负责人<span style={{ color: "#EEF4FF", marginLeft: "45px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>{item.user?.name ? item.user.name : "--"}</span></p> |
|
|
|
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>日期<span style={{ color: "#EEF4FF", marginLeft: "60px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>{moment(item.time).format("YYYY-MM-DD") ? moment(item.time).format("YYYY-MM-DD") : "--"}</span></p> |
|
|
|
</div> |
|
|
|
</div> : "" |
|
|
|
} |
|
|
|
return data |
|
|
|
</li> |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
let lists = list ? arrayChunk(list, 2) : [] |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Module style={style} title={"道路设施数量统计"}> |
|
|
|
<div style={{ paddingLeft: '8%' }}> |
|
|
|
{ |
|
|
|
<Module style={style} title={"养护详情"}> |
|
|
|
<div style={{ paddingLeft: '8%', height: '100%' }}> |
|
|
|
{/* { |
|
|
|
lists?.map((item, index) => { |
|
|
|
return <div style={{ display: 'flex', marginTop: "5%", justifyContent: 'space-around' }} key={index}> |
|
|
|
{ |
|
|
@ -56,10 +124,22 @@ const RightTop = (props) => { |
|
|
|
} |
|
|
|
</div> |
|
|
|
}) |
|
|
|
} |
|
|
|
} */} |
|
|
|
<Lun |
|
|
|
// canScroll={true}
|
|
|
|
content={renderBody()} |
|
|
|
containerStyle={{ height: "100%", width: "90%" }} |
|
|
|
divHeight={"100%"} |
|
|
|
divId={"screen"} |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</Module> |
|
|
|
</> |
|
|
|
) |
|
|
|
} |
|
|
|
export default RightTop |
|
|
|
function mapStateToProps (state) { |
|
|
|
return { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
export default connect(mapStateToProps)(RightTop) |