|
|
@ -2,12 +2,6 @@ import React from 'react' |
|
|
|
import Module from '../../../public/module' |
|
|
|
import PieChart from '../chart/pie-chart'; |
|
|
|
|
|
|
|
let data = [ |
|
|
|
{ value: 435, name: "道路" }, |
|
|
|
{ value: 679, name: "桥梁" }, |
|
|
|
{ value: 848, name: "涵洞" }, |
|
|
|
{ value: 666, name: "其他" }, |
|
|
|
] |
|
|
|
let colorList = [ |
|
|
|
"rgba(7,185,254,1)", |
|
|
|
"rgba(28,96,254,1)", |
|
|
@ -20,18 +14,49 @@ let underColorList = [ |
|
|
|
"rgba(4,251,240,0.5)", |
|
|
|
"rgba(255,194,20,0.5)" |
|
|
|
] |
|
|
|
const RightBottom = () => { |
|
|
|
|
|
|
|
const type = ['road', 'culvert', '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 === type[index]) { |
|
|
|
typesNum += Number(r.count) |
|
|
|
} |
|
|
|
switch (r.projectType) { |
|
|
|
case 'road': |
|
|
|
return { |
|
|
|
name: '道路', |
|
|
|
value: r.count |
|
|
|
}; |
|
|
|
case 'culvert': |
|
|
|
return { |
|
|
|
name: '涵洞', |
|
|
|
value: r.count |
|
|
|
}; |
|
|
|
case 'bridge': |
|
|
|
return { |
|
|
|
name: '桥梁', |
|
|
|
value: r.count |
|
|
|
} |
|
|
|
} |
|
|
|
}).filter(f => f !== undefined) |
|
|
|
const otherNum = totalData - typesNum |
|
|
|
otherNum !== null && list?.push({ name: '其他', value: otherNum }) |
|
|
|
const style = { height: "31%", marginTop: "3%" } |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Module style={style} title={"养护完成情况"}> |
|
|
|
{/* <div ref = {chartRef} style={{ width: '100%', height: '100%' }}></div> */} |
|
|
|
<PieChart |
|
|
|
data={data} |
|
|
|
data={list} |
|
|
|
width='100%' |
|
|
|
height='100%' |
|
|
|
text='养护总数' |
|
|
|
total={2344.13} |
|
|
|
total={totalData || 0} |
|
|
|
colorList={colorList} |
|
|
|
underColorList={underColorList} |
|
|
|
/> |
|
|
|