Browse Source

fix 养护道路统计

dev
巴林闲侠 2 years ago
parent
commit
611efd332d
  1. 16
      web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js
  2. 4
      web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js
  3. 23
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js

16
web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js

@ -21,13 +21,16 @@ const RightBottom = (props) => {
const { roadMaintenances } = props const { roadMaintenances } = props
let totalData = null let totalData = null
let typesNum = null let typesNum = null
const list = roadMaintenances?.reportCount?.map((r, index) => { let list = roadMaintenances?.reportCount?.map((r, index) => {
totalData += Number(r.count) totalData += Number(r.count)
if (r.projectType === 'culvert' || 'road' || 'bridge') { if (r.projectType === 'culvert' || 'road' || 'bridge') {
typesNum += Number(r.count) typesNum += Number(r.count)
} }
switch (r.projectType) { switch (r.projectType) {
case 'road': case 'road':
case 'countyRoad':
case 'villageRoad':
case 'rusticRoad':
return { return {
name: '道路', name: '道路',
value: r.count, value: r.count,
@ -58,7 +61,16 @@ const RightBottom = (props) => {
}; };
} }
}).filter(f => f !== undefined) }).filter(f => f !== undefined)
console.log('list:',list);
list = list?.reduce((pre, cur) => {
let existIndex = pre.findIndex(p => p.name == cur.name)
if (existIndex > -1) {
pre[existIndex].value = parseInt(pre[existIndex].value) + parseInt(cur.value)
} else {
pre.push(cur)
}
return pre
}, [])
let colorList = list?.map(c => c.colorList) let colorList = list?.map(c => c.colorList)
let underColorList = list?.map(c => c.underColorList) let underColorList = list?.map(c => c.underColorList)
const style = { height: "31%", marginTop: "3%" } const style = { height: "31%", marginTop: "3%" }

4
web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js

@ -4,7 +4,7 @@ import Module from '../../../public/module'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import Lun from "../../leadership/right/lunbo" import Lun from "../../leadership/right/lunbo"
import { getRoadmaintain } from "../../../../actions/example" import { getRoadmaintain } from "../../../../actions/example"
import Hua from "../../leadership/right/hudong" import Hua from "../../leadership/centerleft/hudong"
import moment from 'moment' import moment from 'moment'
const iconSrc = [ const iconSrc = [
@ -48,7 +48,7 @@ const RightTop = (props) => {
useEffect(() => { useEffect(() => {
dispatch(getRoadmaintain()).then((res) => { dispatch(getRoadmaintain()).then((res) => {
setRoadmaintainList(res.payload.data.reportList.filter((item, index) => { setRoadmaintainList(res.payload.data.reportList.filter((item, index) => {
return item.projectType == "road" return item.projectType == "road" || item.projectType == "countyRoad" || item.projectType == "villageRoad" || item.projectType == "rusticRoad"
})) }))
}) })
}, []) }, [])

23
web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js

@ -16,16 +16,15 @@ const Right = (props) => {
const [shuzu, setShuzu] = useState([]) const [shuzu, setShuzu] = useState([])
useEffect(() => { useEffect(() => {
const daolus = dispatch(getRoadmaintain()).then((res) => { const daolus = dispatch(getRoadmaintain()).then((res) => {
// console.log(res);
setList(res.payload.data.reportList.filter((item, index) => { setList(res.payload.data.reportList.filter((item, index) => {
return item.projectType == "road" || item.projectType == "countyRoad" || item.projectType == "villageRoad" || item.projectType == "rusticRoad"
return item.projectType == "road"
}))
setNums(res.payload.data.reportCount.filter((item, index) => {
return item.projectType == "road"
})) }))
// console.log(res.payload.data); setNums(res.payload.data.reportCount.reduce((count, item) => {
if (item.projectType == "road" || item.projectType == "countyRoad" || item.projectType == "villageRoad" || item.projectType == "rusticRoad") {
count += parseInt(item.count)
}
return count
}, 0))
}) })
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -35,7 +34,7 @@ const Right = (props) => {
// const // const
}) })
}, []) }, [])
// console.log("1211", nums); console.log("1211", nums);
const renderBody = () => { const renderBody = () => {
return ( return (
@ -64,7 +63,8 @@ const Right = (props) => {
<p style={{ textAlign: "left", width: "25%", position: "absolute", left: "5%", color: beijing == index ? "#ffffff" : "rgba(216,240,255,0.8)" }} >{item.road ? item.road : "--"}</p> <p style={{ textAlign: "left", width: "25%", 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)" }}>{moment(item.time).format("YYYY-MM-DD HH:mm:ss") ? moment(item.time).format("YYYY-MM-DD HH:mm:ss") : "--"}</p> <p style={{ textAlign: "right", width: "30%", position: "absolute", right: "3%", color: beijing == index ? "#ffffff" : "rgba(216,240,255,0.8)" }}>{moment(item.time).format("YYYY-MM-DD HH:mm:ss") ? moment(item.time).format("YYYY-MM-DD HH:mm:ss") : "--"}</p>
{ {
num == index ? <div style={{ position: "fixed", width: "400px", height: "200px", zIndex: 100, left: "50%", marginTop: "0", top: "35%" }}> num == index ?
<div style={{ position: "fixed", width: "400px", height: "200px", zIndex: 100, left: "50%", marginTop: "0", top: "35%" }}>
<img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} /> <img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} />
<div style={{ width: "50%", height: "100%", position: "absolute", top: "0", }}> <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] : "" }]} /> <Hua shuzu={[{ "imgs": item.conserveAfterPic ? item.conserveAfterPic[0] : "" }, { "imgs": item.conserveBeforePic ? item.conserveBeforePic[0] : "" }, { "imgs": item.conserveUnderwayPic ? item.conserveUnderwayPic[0] : "" }]} />
@ -88,7 +88,6 @@ const Right = (props) => {
} }
return ( return (
<> <>
{/* <Spin spinning={!nums && list && roads} tip="Loading" size="large" > */}
<div style={{ width: "100%", height: "100%", float: "right", marginRight: "1%", position: "relative" }}> <div style={{ width: "100%", height: "100%", float: "right", marginRight: "1%", position: "relative" }}>
<div style={{ width: "100%", height: "43%", position: "relative", left: "1%" }}> <div style={{ width: "100%", height: "43%", position: "relative", left: "1%" }}>
@ -118,7 +117,7 @@ const Right = (props) => {
{/* <p>{title || []}</p> */} {/* <p>{title || []}</p> */}
<img src='/assets/images/quanju/icon.png' style={{ width: "24px", position: "absolute", left: "-1%", top: "18%" }} /> <img src='/assets/images/quanju/icon.png' style={{ width: "24px", position: "absolute", left: "-1%", top: "18%" }} />
<span style={{ position: "absolute", color: "#FFFFFF", fontSize: "24px", fontFamily: "YouSheBiaoTiHei", left: "19px" }}>养护事件</span> <span style={{ position: "absolute", color: "#FFFFFF", fontSize: "24px", fontFamily: "YouSheBiaoTiHei", left: "19px" }}>养护事件</span>
<p style={{ position: "absolute", color: "#D8F0FF", fontSize: "14px", right: "6%" }}><span style={{ marginLeft: "-20%" }}>道路</span><span style={{ fontSize: "18px", fontFamily: "YouSheBiaoTiHei", color: "#ffffff", marginLeft: "10%" }}>{nums ? nums[0]?.count : 0}</span><span style={{ marginLeft: "10%" }}></span></p> <p style={{ position: "absolute", color: "#D8F0FF", fontSize: "14px", right: "6%" }}><span style={{ marginLeft: "-20%" }}>道路</span><span style={{ fontSize: "18px", fontFamily: "YouSheBiaoTiHei", color: "#ffffff", marginLeft: "10%" }}>{nums}</span><span style={{ marginLeft: "10%" }}></span></p>
{/* <img src='/assets/images/leadership/zibiaoti.png' style={{ width: "95%", height: "34px", position: "absolute", top: "12px", left: "6%" }} /> */} {/* <img src='/assets/images/leadership/zibiaoti.png' style={{ width: "95%", height: "34px", position: "absolute", top: "12px", left: "6%" }} /> */}
</div> </div>
{/* <Spin spinning={true} style={{ height: "80%" }}> */} {/* <Spin spinning={true} style={{ height: "80%" }}> */}

Loading…
Cancel
Save