Browse Source

接入大屏建设部分的数据

release_0.0.1
dengyinhuan 3 years ago
parent
commit
5e478ea587
  1. 16
      web/client/src/sections/quanju/actions/example.js
  2. 26
      web/client/src/sections/quanju/containers/footer/build/Leftbottom.js
  3. 6
      web/client/src/sections/quanju/containers/footer/build/Rightbottom.js
  4. 41
      web/client/src/sections/quanju/containers/footer/build/Rightcenter.js
  5. 108
      web/client/src/sections/quanju/containers/footer/build/index.js
  6. 4
      web/client/src/sections/quanju/containers/footer/build/style.less
  7. 2
      web/client/src/sections/quanju/containers/footer/guanli/index.js
  8. 5
      web/client/src/utils/webapi.js

16
web/client/src/sections/quanju/actions/example.js

@ -34,7 +34,7 @@ export function getjiandmanage() {
dispatch: dispatch,
actionType: 'GET_JIANDMANAGE',
url: ApiTable.getzhichaomanager,
msg: { error: '获取治超监测点处理数据信息' },
msg: { error: '获取治超监测点处理数据信息失败' },
// reducer: { name: 'members' }
});
}
@ -47,7 +47,19 @@ export function getjiandetail() {
dispatch: dispatch,
actionType: 'GET_JIANDETAIL',
url: ApiTable.getzhichaodetail,
msg: { error: '获取治超监测点处理数据信息' },
msg: { error: '获取治超监测点处理数据信息失败' },
// reducer: { name: 'members' }
});
}
//获取宣传数据
export function getxuanchuan() {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_XUANCHUAN',
url: ApiTable.getpropagata,
msg: { error: '获取宣传信息失败' },
// reducer: { name: 'members' }
});
}

26
web/client/src/sections/quanju/containers/footer/build/Leftbottom.js

@ -24,6 +24,8 @@ function Leftbottom(props) {
const chartTitle = '道路总公里';
const title = '基础设施安全监测版块';
let name = [], emptyName = []
console.log(data,'传入的值')
console.log(emptyName,'第二个')
// const name = data?.map(d)
data?.forEach(d => {
name.push(d.name)
@ -132,6 +134,26 @@ function Leftbottom(props) {
tooltip: {
trigger: "item",
},
// title: {
// text:total,//主标题文本
// left:'center',
// // top:'35%',
// subtext:chartTitle,//副标题文本
// textStyle:{
// fontFamily : "YouSheBiaoTiHei",
// fontSize: 20,
// color:'#FFFFFF',
// marginLeft:'20%',
// align:'center'
// },
// subtextStyle:{
// fontFamily : "PingFangSC-Medium PingFang SC",
// fontSize: 12,
// fontWeight:500,
// color:'#E9F7FF',
// }
// },
legend: {
orient: "vertical",
itemWidth: 10,
@ -219,12 +241,12 @@ function Leftbottom(props) {
return ()=>{
// clearInterval(changePieInterval)
}
}, []);
}, [data]);
return (
<div className='build-left-bottom'>
<div className='build-left-bottom-title'>
<h2>3234.23</h2>
<h2>{total}</h2>
<span>道路总公里</span>
</div>
<img src='/assets/images/quanju/chart-circle.png'></img>

6
web/client/src/sections/quanju/containers/footer/build/Rightbottom.js

@ -133,14 +133,14 @@ function Rightbottom(props) {
// }
myChart.setOption(option);
return ()=>{
clearInterval(changePieInterval)
// clearInterval(changePieInterval)
}
}, []);
}, [data]);
return (
<div className='build-right-bottom'>
<div className='build-right-bottom-title'>
<h2>3234.23</h2>
<h2>{total||0}</h2>
<span>道路总公里</span>
</div>
<img src='/assets/images/quanju/chart-circle.png'></img>

41
web/client/src/sections/quanju/containers/footer/build/Rightcenter.js

@ -1,25 +1,25 @@
import React from 'react'
import './style.less'
import AutoRollComponent from './AutoRollComponent'
export default function Rightcenter() {
const data =[ {name: '莲塘镇', total: 12739},
{name: '向塘镇', total: 2445},
{name: '蒋巷镇', total: 2035},
{name: '幽兰镇', total: 1999},
{name: '塘南镇', total: 1915},
{name: '武阳镇', total: 1842},
{name: '冈上镇', total: 1446},
{name: '广福镇', total: 1063},
{name: '三江镇', total: 851},
{name: '泾口乡', total: 657},
{name: '南新镇', total: 640},
{name: '八一乡', total: 569},
{name: '黄马乡', total: 541},
{name: '塔城乡', total: 534},
{name: '富山乡', total: 515},
{name: '东新乡', total: 513},
{name: '银三角', total: 513},
{name: '八月湖街道', total: 513},]
export default function Rightcenter({data,sundata}) {
// const data =[ {name: '莲塘镇', total: 12739},
// {name: '向塘镇', total: 2445},
// {name: '蒋巷镇', total: 2035},
// {name: '幽兰镇', total: 1999},
// {name: '塘南镇', total: 1915},
// {name: '武阳镇', total: 1842},
// {name: '冈上镇', total: 1446},
// {name: '广福镇', total: 1063},
// {name: '三江镇', total: 851},
// {name: '泾口乡', total: 657},
// {name: '南新镇', total: 640},
// {name: '八一乡', total: 569},
// {name: '黄马乡', total: 541},
// {name: '塔城乡', total: 534},
// {name: '富山乡', total: 515},
// {name: '东新乡', total: 513},
// {name: '银三角', total: 513},
// {name: '八月湖街道', total: 513},]
const province = undefined
const FIRST = "linear-gradient(360deg, rgba(43, 180, 211, 0.1) 0%, rgba(43, 180, 211, 0.4) 100%)"
const SECOND = "linear-gradient(360deg, rgba(255, 209, 86, 0.1) 0%, rgba(255, 209, 86, 0.4) 100%)"
@ -27,6 +27,7 @@ const THIRD = "linear-gradient(360deg, rgba(148, 148, 255, 0.1) 0%, rgba(148, 14
const OTHER = "linear-gradient(360deg, rgba(28, 96, 253, 0) 0%, rgba(28, 96, 253, 0.2) 100%)"
let TOTALS = data?.map(({ name, total }, index) => {
let max = province ? data.length * 30 + 100 : data.length * 500 + 100
console.log(max,'好朋友吗')
return {
name,
value: total,
@ -81,7 +82,7 @@ const RNAKS = [FIRST, SECOND, THIRD]
<div className='build-right-center-top'>
<img src="/assets/images/quanju/gonglugongcheng.png"></img>
<div>在线公路工程数量</div>
<h2>1234,123</h2>
<h2>{sundata}</h2>
</div>
<AutoRollComponent content={renderContent()}
containerStyle={{ position: "relative", height: "65%", }}

108
web/client/src/sections/quanju/containers/footer/build/index.js

@ -11,38 +11,90 @@ import Module from '../../public/module'
import RightBottom from './Rightbottom'
import AutoRollComponent from './AutoRollComponent'
import './style.less'
import {getdaolutongji} from '../../../actions/example'
import {getdaolutongji,getxuanchuan} from '../../../actions/example'
const Build = (props) => {
const { dispatch } = props
let data = [
{ value: 435, name: "县道" },
{ value: 679, name: "乡道" },
{ value: 848, name: "村道" },
let data1 = [
{name: "县", value: 207},
{name: "乡", value: 729},
{name: "村", value: 1938}
]
const safetyData = [
{name: '一级公路', value: 42},
{name: '二级公路', value: 17},
{name: '三级公路', value: 17},
{name: '四级公路', value: 30},
// const safetyData = [
// {name: '一级公路', value: 42},
// {name: '二级公路', value: 17},
// {name: '三级公路', value: 17},
// {name: '四级公路', value: 30},
]
// ]
const [buildingnumber,setbuildingnumber] = useState(0)
const [data,setdata] = useState([])
const [xuandata,setxuandata] = useState(null)
//获取道路管理数据
const requestbuildingnumber = async ()=>{
const res = await dispatch(getdaolutongji());
let alltype = Object.keys(res.payload.data?.roadType || {}).map((item)=>({name:item,value:Number(keepThreeNum(res.payload.data.roadType[item]))}))
setdata(alltype.filter(item=>item.name!=='null'))
setbuildingnumber(res.payload.data)
// console.log(res.payload.data,'哈哈哈')
console.log(res.payload.data,'哈哈哈')
}
//获取宣传栏数据
const requestxuanchuanlan = async ()=>{
const res = await dispatch(getxuanchuan());
// setdata(alltype.filter(item=>item.name!=='null'))
setxuandata(res.payload.data)
console.log(res.payload.data,'宣传栏数据')
}
let t1 = Object.values(buildingnumber?.townRoad || {})
let totalgongli = t1.length!==0 ? t1.reduce((x,y)=>x+y.mileage,0):0 //乡镇道路占比总公里数
let totalcount = t1.length !==0 ? t1.reduce((x,y)=>x+y.roadCount,0):0 //乡镇道路占比公路总条数
// let sungongli = alltype.reduce((x,y)=>x+y.value,0)
const keepThreeNum=(value)=> {
let resValue = 0
//小数点的位置
let index = value&&value.toString().indexOf('.') + 1
//小数的位数
let num = value&&Math.abs(Number(value)).toString().length - index
if(index && num > 3){
resValue = value&&Number(value).toFixed(3)
} else {
resValue = value
}
return resValue
}
let datas = Object.keys(buildingnumber?.townRoad || {}).map((item)=>({name:item,number:buildingnumber.townRoad[item].roadCount,gongli:Number(keepThreeNum(buildingnumber.townRoad[item].mileage))}))
//道路等级数据
let alldengji = Object.keys(buildingnumber?.roadLevel || {}).map((item)=>({name:item,value:Number(keepThreeNum(buildingnumber.roadLevel[item]))}))
let onlineproject = Object.keys(buildingnumber?.townProject||{}).map((item)=>({name:item,total:buildingnumber.townProject[item]}))
let sunonlineproject = onlineproject.reduce((x,y)=>x+y.total,0)
let safetyData = alldengji.filter(item=>item.name!=='null')
let sundata = data.reduce((x,y)=>x+y.value,0)
let sunsafetyData = safetyData.reduce((x,y)=>x+y.value,0)
console.log(safetyData,'好凶猛')
console.log(data1,'对比')
// console.log(totalgongli,"好好的")
// console.log(keepThreeNum(totalgongli),'jjjjj')
useEffect(()=>{
requestbuildingnumber()
requestbuildingnumber();
requestxuanchuanlan()
},[])
const datas = new Array(15)
datas.fill({
name:"东乡镇",
number:"11111",
gongli:'9999'
},0,15)
// const datas = new Array(15)
// datas.fill({
// name:"东乡镇",
// number:"11111",
// gongli:'9999'
// },0,15)
const rendercontent = ()=>{
return (<div className='build-left-center-content'>
{datas.map(({name,number,gongli},index)=><div className='build-left-center-item' key={index}>
@ -65,7 +117,7 @@ const Build = (props) => {
<span/>
<span>在建公路数量</span>
</div>
<div>{buildingnumber.buildingRoad || 0}</div>
<div>{buildingnumber?.buildingRoad || 0}</div>
</div>
<img src='/assets/images/quanju/zhuangtaigonglui.png' className='build-left-top-center'/>
<div className='build-left-top-item'>
@ -74,7 +126,7 @@ const Build = (props) => {
<span/>
<span>已建公路数量</span>
</div>
<div>{buildingnumber.buildedRoad || 0}</div>
<div>{buildingnumber?.buildedRoad || 0}</div>
</div>
</div>
</Module>
@ -87,14 +139,14 @@ const Build = (props) => {
<img src='/assets/images/quanju/gonglugongli.png'></img>
<div>
<span>公路公里数/公里</span>
<span>1234,123</span>
<span>{keepThreeNum(totalgongli)}</span>
</div>
</div>
<div>
<img src='/assets/images/quanju/gongluzong.png'></img>
<div>
<span>公路公里数/公里</span>
<span>1234,123</span>
<span>公路总数/</span>
<span>{totalcount||0}</span>
</div>
</div>
</div>
@ -115,7 +167,7 @@ const Build = (props) => {
width='100%'
height='100%'
text='道路总公里'
total={2344.13}
total={keepThreeNum(sundata)}
// colorList={colorList}
// underColorList={underColorList}
/>
@ -134,7 +186,7 @@ const Build = (props) => {
<Module title={"各乡镇在建公路工程"} style={{ width: "100%",
height:" 33%",marginTop:'3%'
}} customize = {true}>
<Rightcenter/>
<Rightcenter data={onlineproject} sundata={sunonlineproject}/>
</Module>
<Module title={"公路等级统计"} style={{ width: "100%",
height:" 30%",marginTop:'3%'
@ -142,8 +194,8 @@ const Build = (props) => {
<RightBottom width='100%'
height='100%'
text='道路总公里'
total={2344.13}
data={safetyData}/>
total={sunsafetyData}
data={keepThreeNum(safetyData)}/>
</Module>
</div>
</div>

4
web/client/src/sections/quanju/containers/footer/build/style.less

@ -141,6 +141,10 @@
display: flex ;
width: 100%;
height: 28px;
align-items: center;
&:hover{
background: linear-gradient(270deg, rgba(0,124,230,0) 0%, rgba(0,70,200,0.8700) 100%);
}
span{
flex:1;
text-align: center;

2
web/client/src/sections/quanju/containers/footer/guanli/index.js

@ -59,7 +59,7 @@ const Guanli = (props) => {
<div className = "guanli-right-top">
<img src="/assets/images/quanju/zhicaolog.png"></img>
<span>已处理</span>
<span>{rightDatas.processed||0}</span>
<span>{rightDatas?.processed||0}</span>
<span></span>
</div>
<div className='guanli-right-title'>

5
web/client/src/utils/webapi.js

@ -57,7 +57,10 @@ export const ApiTable = {
getzhichaomanager: 'manage/overspeed/processed',
//获取治超详情数据
getzhichaodetail: '/manage/overspeed'
getzhichaodetail: 'manage/overspeed',
//获取宣传栏数据
getpropagata:'publicity'
};

Loading…
Cancel
Save