import React, { useEffect, useState, useRef } from 'react' import { connect } from 'react-redux'; // import LeftTop from './Lefttop' // import LeftCenter from './Leftcenter' import LeftBottom from './Leftbottom' // import RightTop from './Righttop' import Rightcenter from './Rightcenter' // import Rightbottom from './Rightbottom' import NoData from '../../public/noData'; import Module from '../../public/module' import RightBottom from './Rightbottom' import AutoRollComponent from './AutoRollComponent' import './style.less' import { getdaolutongji, getxuanchuan } from '../../../actions/example' import { Carousel } from 'antd'; import { getProject } from '../../../../fillion/actions/infor' // import { number } from 'echarts'; const Build = (props) => { const { dispatch, projectList } = props 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 [buildingnumber, setbuildingnumber] = useState(0) const [data, setdata] = useState([]) const [xuandata, setxuandata] = useState(null) const lunbo = useRef(null) const lunbovideo = useRef(null) const [lunboindex, setlunboindex] = useState(0) // const lunboMsg = useRef({ index: 0 }) //获取道路管理数据 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 === '县' || item.name === "乡" || item.name === '村')) setbuildingnumber(res.payload.data) } //获取宣传栏数据 const requestxuanchuanlan = async () => { const res = await dispatch(getxuanchuan()); // setdata(alltype.filter(item=>item.name!=='null')) setxuandata(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 totalcount = buildingnumber?.buildedRoad || 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 list = datas.sort((a, b) => { return b.number - a.number }) list = list.filter(item => item.name !== "其他") //道路等级数据 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] })) onlineproject = onlineproject.sort((a, b) => { return b.total - a.total }) let sunonlineproject = onlineproject?.reduce((x, y) => x + y.total, 0) let buildingCount = buildingnumber?.buildingCount //let projectAll= let safetyData = alldengji?.filter(item => item.name === '一级公路' || item.name === '二级公路' || item.name === '三级公路' || item.name === '四级公路' || item.name === '等外公路') let sundata = data?.reduce((x, y) => x + y.value, 0) let sunsafetyData = safetyData?.reduce((x, y) => x + y.value, 0) useEffect(() => { requestbuildingnumber(); requestxuanchuanlan() dispatch(getProject()) }, []) useEffect(() => { lunbo.current.goTo(lunboindex) }, [lunboindex]) const rendercontent = () => { return (
123
}) } */} { xuandata && xuandata !== null && xuandata.length !== 0 ? xuandata.filter(i => i.enable).map((item, index1) => { if (item.video && item.video !== null && item.video.length !== 0) { return item.video.map((i, index) => { if (index1 === lunboindex) { return } else { return } }) } // return }) : } {/* */}