Browse Source

fix 养护道路统计

dev
巴林闲侠 1 year ago
parent
commit
611efd332d
  1. 134
      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. 45
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js

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

@ -18,67 +18,79 @@ import PieChart from '../chart/pie-chart';
const type = ['culvert', '', 'road', 'bridge']
const RightBottom = (props) => {
const { roadMaintenances } = props
let totalData = null
let typesNum = null
const list = roadMaintenances?.reportCount?.map((r, index) => {
totalData += Number(r.count)
if (r.projectType === 'culvert' || 'road' || 'bridge') {
typesNum += Number(r.count)
}
switch (r.projectType) {
case 'road':
return {
name: '道路',
value: r.count,
colorList: 'rgba(7,185,254,1)',
underColorList: 'rgba(7,185,254,0.5)'
const { roadMaintenances } = props
let totalData = null
let typesNum = null
let list = roadMaintenances?.reportCount?.map((r, index) => {
totalData += Number(r.count)
if (r.projectType === 'culvert' || 'road' || 'bridge') {
typesNum += Number(r.count)
}
switch (r.projectType) {
case 'road':
case 'countyRoad':
case 'villageRoad':
case 'rusticRoad':
return {
name: '道路',
value: r.count,
colorList: 'rgba(7,185,254,1)',
underColorList: 'rgba(7,185,254,0.5)'
};
case 'culvert':
return {
name: '涵洞',
value: r.count,
colorList: 'rgba(4,251,240,1)',
underColorList: 'rgba(4,251,240,0.5)'
};
case 'bridge':
return {
name: '桥梁',
value: r.count,
colorList: 'rgba(28,96,254,1)',
underColorList: 'rgba(28,96,254,0.5)'
};
case 'other':
return {
name: '其他',
value: r.count,
colorList: 'rgba(255,194,20,1)',
underColorList: 'rgba(255,194,20,0.5)'
};
}
}).filter(f => f !== undefined)
console.log('list:',list);
let colorList = list?.map(c => c.colorList)
let underColorList =list?.map(c => c.underColorList)
const style = { height: "31%", marginTop: "3%" }
return (
<>
<Module style={style} title={"养护完成情况"}>
{/* <div ref = {chartRef} style={{ width: '100%', height: '100%' }}></div> */}
<PieChart
data={list}
width='100%'
height='100%'
text='养护总数'
textLeft={'21%'}
numLeft={'22%'}
total={totalData || 0}
colorList={colorList}
underColorList={underColorList}
/>
</Module>
</>
)
};
case 'culvert':
return {
name: '涵洞',
value: r.count,
colorList: 'rgba(4,251,240,1)',
underColorList: 'rgba(4,251,240,0.5)'
};
case 'bridge':
return {
name: '桥梁',
value: r.count,
colorList: 'rgba(28,96,254,1)',
underColorList: 'rgba(28,96,254,0.5)'
};
case 'other':
return {
name: '其他',
value: r.count,
colorList: 'rgba(255,194,20,1)',
underColorList: 'rgba(255,194,20,0.5)'
};
}
}).filter(f => f !== undefined)
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 underColorList = list?.map(c => c.underColorList)
const style = { height: "31%", marginTop: "3%" }
return (
<>
<Module style={style} title={"养护完成情况"}>
{/* <div ref = {chartRef} style={{ width: '100%', height: '100%' }}></div> */}
<PieChart
data={list}
width='100%'
height='100%'
text='养护总数'
textLeft={'21%'}
numLeft={'22%'}
total={totalData || 0}
colorList={colorList}
underColorList={underColorList}
/>
</Module>
</>
)
}
export default RightBottom

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 Lun from "../../leadership/right/lunbo"
import { getRoadmaintain } from "../../../../actions/example"
import Hua from "../../leadership/right/hudong"
import Hua from "../../leadership/centerleft/hudong"
import moment from 'moment'
const iconSrc = [
@ -48,7 +48,7 @@ const RightTop = (props) => {
useEffect(() => {
dispatch(getRoadmaintain()).then((res) => {
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"
}))
})
}, [])

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

@ -16,16 +16,15 @@ const Right = (props) => {
const [shuzu, setShuzu] = useState([])
useEffect(() => {
const daolus = dispatch(getRoadmaintain()).then((res) => {
// console.log(res);
setList(res.payload.data.reportList.filter((item, index) => {
return item.projectType == "road"
}))
setNums(res.payload.data.reportCount.filter((item, index) => {
return item.projectType == "road"
return item.projectType == "road" || item.projectType == "countyRoad" || item.projectType == "villageRoad" || item.projectType == "rusticRoad"
}))
// 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(() => {
@ -35,7 +34,7 @@ const Right = (props) => {
// const
})
}, [])
// console.log("1211", nums);
console.log("1211", nums);
const renderBody = () => {
return (
@ -64,18 +63,19 @@ 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: "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%" }}>
<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> : ""
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%" }} />
<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> : ""
}
</li>
)
@ -88,7 +88,6 @@ const Right = (props) => {
}
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: "43%", position: "relative", left: "1%" }}>
@ -118,7 +117,7 @@ const Right = (props) => {
{/* <p>{title || []}</p> */}
<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>
<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%" }} /> */}
</div>
{/* <Spin spinning={true} style={{ height: "80%" }}> */}

Loading…
Cancel
Save