From a8f691a048f3389701d801a63651c854a1512bfc Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Sat, 30 Jul 2022 21:13:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quanju/containers/footer/build/index.js | 373 ++++++++++-------- 1 file changed, 219 insertions(+), 154 deletions(-) diff --git a/web/client/src/sections/quanju/containers/footer/build/index.js b/web/client/src/sections/quanju/containers/footer/build/index.js index 71afc009..c15ab296 100644 --- a/web/client/src/sections/quanju/containers/footer/build/index.js +++ b/web/client/src/sections/quanju/containers/footer/build/index.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React, { useEffect, useState, useRef } from 'react' import { connect } from 'react-redux'; // import LeftTop from './Lefttop' // import LeftCenter from './Leftcenter' @@ -11,99 +11,108 @@ import Module from '../../public/module' import RightBottom from './Rightbottom' import AutoRollComponent from './AutoRollComponent' import './style.less' -import {getdaolutongji,getxuanchuan} from '../../../actions/example' +import { getdaolutongji, getxuanchuan } from '../../../actions/example' import { Carousel } from 'antd'; // import { number } from 'echarts'; const Build = (props) => { const { dispatch } = 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) + { 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 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]))})) + let alltype = Object.keys(res.payload.data?.roadType || {}).map((item) => ({ name: item, value: Number(keepThreeNum(res.payload.data.roadType[item])) })) // console.log(alltype,'打他啊') - setdata(alltype.filter(item=>item.name==='县'||item.name==="乡"||item.name==='村')) + setdata(alltype.filter(item => item.name === '县' || item.name === "乡" || item.name === '村')) setbuildingnumber(res.payload.data) // console.log(res.payload.data,'哈哈哈') - + } //获取宣传栏数据 - const requestxuanchuanlan = async ()=>{ + const requestxuanchuanlan = async () => { const res = await dispatch(getxuanchuan()); - + // setdata(alltype.filter(item=>item.name!=='null')) setxuandata(res.payload.data || []) - console.log(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 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)=> { + const keepThreeNum = (value) => { let resValue = 0 //小数点的位置 - let index = value&&value.toString().indexOf('.') + 1 + 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) + let num = value && Math.abs(Number(value)).toString().length - index + if (index && num > 3) { + resValue = value && Number(value).toFixed(3) } else { - resValue = value + 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)=>{ + } + 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 - }) + }) // console.log(list,'红红火') - //道路等级数据 - let alldengji = Object.keys(buildingnumber?.roadLevel || {}).map((item)=>({name:item,value:Number(keepThreeNum(buildingnumber.roadLevel[item]))})) + //道路等级数据 + 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)=>{ + 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 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) + }) + let sunonlineproject = onlineproject?.reduce((x, y) => x + y.total, 0) + 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(()=>{ + useEffect(() => { requestbuildingnumber(); requestxuanchuanlan() - },[]) - const rendercontent = ()=>{ + }, []) + useEffect(()=>{ + lunbo.current.goTo(lunboindex) + },[lunboindex]) + const rendercontent = () => { return (
- {list.map(({name,number,gongli},index)=>
- {name} - {number} - {gongli} -
)} -
) + {list.map(({ name, number, gongli }, index) =>
+ {name} + {number} + {gongli} +
)} + ) } // const xuandata1 = [ // { @@ -113,119 +122,175 @@ const Build = (props) => { // "enable": true // } // ] - console.log(localStorage.getItem("qndmn"),'七牛') - console.log(xuandata,"宣传") + // console.log(localStorage.getItem("qndmn"), '七牛') + // console.log(xuandata, "宣传") + + let videos = [] + if (xuandata && xuandata.length) { + for (let x of xuandata) { + if (x.enable) { + if (x.video && x.video.length) { + for (let v of x.video) { + videos.push(v) + } + } + } + } + } + console.log(lunboindex) return ( - <> -
- -
- - {buildingnumber&&buildingnumber.buildedRoad!==0&&totalgongli!==0?
-
-
- {/* */} - - 在建公路数量 -
-
{buildingnumber?.buildingRoad || 0}
-
- -
-
- {/* */} - - 已建公路数量 -
-
{buildingnumber?.buildedRoad || 0}
+ <> +
+ +
+ + {buildingnumber && buildingnumber.buildedRoad !== 0 && totalgongli !== 0 ?
+
+
+ {/* */} + + 在建公路数量 +
+
{buildingnumber?.buildingRoad || 0}
+
+ +
+
+ {/* */} + + 已建公路数量 +
+
{buildingnumber?.buildedRoad || 0}
+
+
: }
-
:} -
- - - { totalcount && totalcount!==0?
-
-
- + + + {totalcount && totalcount !== 0 ?
+
- 公路公里数/公里 - {keepThreeNum(totalgongli)} + +
+ 公路公里数/公里 + {keepThreeNum(totalgongli)} +
-
-
-
- 公路总数/条 - {totalcount||0} + +
+ 公路总数/条 + {totalcount || 0} +
-
-
- 乡镇名称 - 公路数量/条 - 公里 -
- -
:} - - - { data&&sundata!==0?:} - - -
-
- -
- {/* */} - - {xuandata&&xuandata!==null&&xuandata.length!==0?xuandata.map((item,index)=>{ +
+ 乡镇名称 + 公路数量/条 + 公里 +
+ +
: } +
+ + {data && sundata !== 0 ? : } + + +
+
+ +
+ {lunboindex}//{lunboMsg.current.index} + {/* */} + { + + setlunboindex(current)}}> + {/* { + videos.map((v, i) => { + console.log('first') + return i == lunboMsg.current.index ? + + :

123

+ }) + } */} + + { + xuandata&&xuandata!==null&&xuandata.length!==0?xuandata.map((item,index1)=>{ if(item.enable){ if(item.video&&item.video!==null&&item.video.length!==0){ return item.video.map((i,index)=>{ // console.log(i,'视频') - return + console.log(index1,'index1') + if(index1-1===lunboindex){ + // lunbo.current.goTo(lunboindex) + console.log("自动播放",index1) + return + }else{ + // console.log("不自动播放",index1) + return + } }) } // return } - }):} - {/* */} -
-

全面建设好农村公路,切实发挥先行官作用

-
-
- - {sunonlineproject!==0?:} - - - {safetyData&&sunsafetyData!==0?:} - -
+ }) + : + } + {/* */} + +

全面建设好农村公路,切实发挥先行官作用

+
+
+ + {sunonlineproject !== 0 ? : } + + + {safetyData && sunsafetyData !== 0 ? : } + +
) } From b9ffae57eba053043b79df16bd8a49adeca12653 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Sat, 30 Jul 2022 21:14:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?culvert=20=E6=B6=B5=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/components/patrolTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index e8a79935..9cc6cd06 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -119,7 +119,7 @@ const DetailList = (props) => { switch (text) { case 'road': return '道路'; case 'bridge': return '桥梁'; - case 'culvert ': return '涵洞'; + case 'culvert': return '涵洞'; case 'other': return '其他'; default: return text; }