diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index c7aa1d18..c098336e 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -4,7 +4,7 @@ const { QueryTypes } = require('sequelize'); async function reportList (ctx) { try { const models = ctx.fs.dc.models; - const { limit, page, startTime, endTime, keyword, userId, reportType, isTop } = ctx.query + const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc } = ctx.query let findOption = { where: { @@ -14,7 +14,7 @@ async function reportList (ctx) { model: models.User, attributes: ['name'] }], - order: [['time', 'DESC']], + order: [['time', asc ? 'ASC': 'DESC']], } if (limit) { findOption.limit = limit diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index 937169ac..07207b78 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -14,7 +14,7 @@ const DetailForm = (props) => { const { visible, data, handleClose, loading } = props; const [qndmn] = useState(localStorage.getItem('qndmn')); const keyList = [ - { key: '编号', name: 'id' }, + // { key: '编号', name: 'id' }, { key: '工程类型', name: 'projectType' }, { key: '所在路段', name: 'road' }, { key: '具体位置', name: 'address' }, @@ -91,7 +91,8 @@ const DetailList = (props) => { } } - let daySet = {}; + let basicDate = null; + let counter = 0; const columns = [ { @@ -101,14 +102,16 @@ const DetailList = (props) => { align: 'center', render: (text, record) => { let day = moment(record.time).format("YYYYMMDD") - if (daySet[day]) { - daySet[day].add(Symbol()) - } else { - daySet[day] = new Set() - daySet[day].add(Symbol()) + if(!basicDate){ + basicDate = day; + counter +=1; + } else if(basicDate == day){ + counter += 1; + } else if(basicDate != day){ + basicDate = day; + counter = 1; } - return day * 10000 + daySet[day].size - return moment(record.time).format("YYYYMMDD") * 10000 + record.id; + return moment(record.time).format("YYYYMMDD") * 10000 + counter; } }, { title: '工程类型', @@ -300,7 +303,7 @@ const MaintenanceTable = (props) => { useEffect(() => { if (record) { - let query = { userId: record.id, reportType: 'conserve' } + let query = { userId: record.id, reportType: 'conserve' , asc: true} if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') @@ -317,7 +320,7 @@ const MaintenanceTable = (props) => { } const handelRefresh = () => { - let query = { userId: record.id, reportType: 'patrol' } + let query = { userId: record.id, reportType: 'patrol', asc: true } dispatch(getReportList(query)); } diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 9cc6cd06..f07f3674 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -15,7 +15,7 @@ const DetailForm = (props) => { const { visible, data, handleClose, loading } = props; const [qndmn] = useState(localStorage.getItem('qndmn')); const keyList = [ - { key: '编号', name: 'id' }, + // { key: '编号', name: 'id' }, { key: '工程类型', name: 'projectType' }, { key: '所在路段', name: 'road' }, { key: '具体位置', name: 'address' }, @@ -91,7 +91,9 @@ const DetailList = (props) => { }) } } - let daySet = {}; + let basicDate = null; + let counter = 0; + const columns = [ { title: '编号', @@ -100,14 +102,16 @@ const DetailList = (props) => { align: 'center', render: (text, record) => { let day = moment(record.time).format("YYYYMMDD") - if (daySet[day]) { - daySet[day].add(Symbol()) - } else { - daySet[day] = new Set() - daySet[day].add(Symbol()) + if(!basicDate){ + basicDate = day; + counter +=1; + } else if(basicDate == day){ + counter += 1; + } else if(basicDate != day){ + basicDate = day; + counter = 1; } - return day * 10000 + daySet[day].size - return moment(record.time).format("YYYYMMDD") * 10000 + record.id; + return moment(record.time).format("YYYYMMDD") * 10000 + counter; } }, { @@ -316,7 +320,7 @@ const PatrolTable = (props) => { }, [record, dateRange]) const queryData = () => { - let query = { userId: record.id, reportType: 'patrol' } + let query = { userId: record.id, reportType: 'patrol', asc: true } if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') @@ -333,7 +337,7 @@ const PatrolTable = (props) => { }, [activeTabKey1]) const handelRefresh = () => { - let query = { userId: record.id, reportType: 'patrol' } + let query = { userId: record.id, reportType: 'patrol', asc: true } dispatch(getReportList(query)); } 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 (
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 } - }):} - {/* */} -