巴林闲侠 3 years ago
parent
commit
83afec6a51
  1. 4
      api/app/lib/controllers/report/index.js
  2. 25
      web/client/src/sections/fillion/components/maintenanceTable.js
  3. 26
      web/client/src/sections/fillion/components/patrolTable.js
  4. 91
      web/client/src/sections/quanju/containers/footer/build/index.js

4
api/app/lib/controllers/report/index.js

@ -4,7 +4,7 @@ const { QueryTypes } = require('sequelize');
async function reportList (ctx) { async function reportList (ctx) {
try { try {
const models = ctx.fs.dc.models; 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 = { let findOption = {
where: { where: {
@ -14,7 +14,7 @@ async function reportList (ctx) {
model: models.User, model: models.User,
attributes: ['name'] attributes: ['name']
}], }],
order: [['time', 'DESC']], order: [['time', asc ? 'ASC': 'DESC']],
} }
if (limit) { if (limit) {
findOption.limit = limit findOption.limit = limit

25
web/client/src/sections/fillion/components/maintenanceTable.js

@ -14,7 +14,7 @@ const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props; const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn')); const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [ const keyList = [
{ key: '编号', name: 'id' }, // { key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' }, { key: '工程类型', name: 'projectType' },
{ key: '所在路段', name: 'road' }, { key: '所在路段', name: 'road' },
{ key: '具体位置', name: 'address' }, { key: '具体位置', name: 'address' },
@ -91,7 +91,8 @@ const DetailList = (props) => {
} }
} }
let daySet = {}; let basicDate = null;
let counter = 0;
const columns = [ const columns = [
{ {
@ -101,14 +102,16 @@ const DetailList = (props) => {
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD") let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) { if(!basicDate){
daySet[day].add(Symbol()) basicDate = day;
} else { counter +=1;
daySet[day] = new Set() } else if(basicDate == day){
daySet[day].add(Symbol()) counter += 1;
} else if(basicDate != day){
basicDate = day;
counter = 1;
} }
return day * 10000 + daySet[day].size return moment(record.time).format("YYYYMMDD") * 10000 + counter;
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
} }
}, { }, {
title: '工程类型', title: '工程类型',
@ -300,7 +303,7 @@ const MaintenanceTable = (props) => {
useEffect(() => { useEffect(() => {
if (record) { 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] != '')) { if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) {
query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') 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') query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
@ -317,7 +320,7 @@ const MaintenanceTable = (props) => {
} }
const handelRefresh = () => { const handelRefresh = () => {
let query = { userId: record.id, reportType: 'patrol' } let query = { userId: record.id, reportType: 'patrol', asc: true }
dispatch(getReportList(query)); dispatch(getReportList(query));
} }

26
web/client/src/sections/fillion/components/patrolTable.js

@ -15,7 +15,7 @@ const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props; const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn')); const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [ const keyList = [
{ key: '编号', name: 'id' }, // { key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' }, { key: '工程类型', name: 'projectType' },
{ key: '所在路段', name: 'road' }, { key: '所在路段', name: 'road' },
{ key: '具体位置', name: 'address' }, { key: '具体位置', name: 'address' },
@ -91,7 +91,9 @@ const DetailList = (props) => {
}) })
} }
} }
let daySet = {}; let basicDate = null;
let counter = 0;
const columns = [ const columns = [
{ {
title: '编号', title: '编号',
@ -100,14 +102,16 @@ const DetailList = (props) => {
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD") let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) { if(!basicDate){
daySet[day].add(Symbol()) basicDate = day;
} else { counter +=1;
daySet[day] = new Set() } else if(basicDate == day){
daySet[day].add(Symbol()) counter += 1;
} else if(basicDate != day){
basicDate = day;
counter = 1;
} }
return day * 10000 + daySet[day].size return moment(record.time).format("YYYYMMDD") * 10000 + counter;
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
} }
}, },
{ {
@ -316,7 +320,7 @@ const PatrolTable = (props) => {
}, [record, dateRange]) }, [record, dateRange])
const queryData = () => { 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] != '')) { if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) {
query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') 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') query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
@ -333,7 +337,7 @@ const PatrolTable = (props) => {
}, [activeTabKey1]) }, [activeTabKey1])
const handelRefresh = () => { const handelRefresh = () => {
let query = { userId: record.id, reportType: 'patrol' } let query = { userId: record.id, reportType: 'patrol', asc: true }
dispatch(getReportList(query)); dispatch(getReportList(query));
} }

91
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 { connect } from 'react-redux';
// import LeftTop from './Lefttop' // import LeftTop from './Lefttop'
// import LeftCenter from './Leftcenter' // import LeftCenter from './Leftcenter'
@ -32,6 +32,12 @@ const Build = (props) => {
const [buildingnumber, setbuildingnumber] = useState(0) const [buildingnumber, setbuildingnumber] = useState(0)
const [data, setdata] = useState([]) const [data, setdata] = useState([])
const [xuandata, setxuandata] = useState(null) 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 () => {
@ -96,6 +102,9 @@ const Build = (props) => {
requestbuildingnumber(); requestbuildingnumber();
requestxuanchuanlan() requestxuanchuanlan()
}, []) }, [])
useEffect(()=>{
lunbo.current.goTo(lunboindex)
},[lunboindex])
const rendercontent = () => { const rendercontent = () => {
return (<div className='build-left-center-content'> return (<div className='build-left-center-content'>
{list.map(({ name, number, gongli }, index) => <div className='build-left-center-item' key={index}> {list.map(({ name, number, gongli }, index) => <div className='build-left-center-item' key={index}>
@ -113,12 +122,27 @@ const Build = (props) => {
// "enable": true // "enable": true
// } // }
// ] // ]
console.log(localStorage.getItem("qndmn"),'七牛') // console.log(localStorage.getItem("qndmn"), '七牛')
console.log(xuandata,"宣传") // 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 ( return (
<> <>
<div className='bgbuild-left'> <div className='bgbuild-left'>
<Module title={"各状态公路数量统计"} style={{ width: "100%", <Module title={"各状态公路数量统计"} style={{
width: "100%",
height: " 33%" height: " 33%"
}} customize={true}> }} customize={true}>
<div style={{ height: "100%", position: "relative" }} > <div style={{ height: "100%", position: "relative" }} >
@ -144,7 +168,8 @@ const Build = (props) => {
</div> : <NoData />} </div> : <NoData />}
</div> </div>
</Module> </Module>
<Module title={"各乡镇已建道路统计"} style={{ width: "100%", <Module title={"各乡镇已建道路统计"} style={{
width: "100%",
height: " 33%", marginTop: '3%' height: " 33%", marginTop: '3%'
}} customize={true}> }} customize={true}>
{totalcount && totalcount !== 0 ? <div className='build-left-center'> {totalcount && totalcount !== 0 ? <div className='build-left-center'>
@ -173,7 +198,8 @@ const Build = (props) => {
divHeight={"100%"} divId={"chart"} /> divHeight={"100%"} divId={"chart"} />
</div> : <NoData />} </div> : <NoData />}
</Module> </Module>
<Module title={"道路统计"} style={{ width: "100%", <Module title={"道路统计"} style={{
width: "100%",
height: " 30%", marginTop: '3%' height: " 30%", marginTop: '3%'
}} customize={true}> }} customize={true}>
{data && sundata !== 0 ? <LeftBottom {data && sundata !== 0 ? <LeftBottom
@ -189,34 +215,73 @@ const Build = (props) => {
</div> </div>
<div className='bgbuild-right'> <div className='bgbuild-right'>
<Module title={"宣传栏"} style={{ width: "100%", <Module title={"宣传栏"} style={{
width: "100%",
height: " 33%" height: " 33%"
}} customize={true}> }} customize={true}>
<div className='build-right-top'> <div className='build-right-top'>
{lunboindex}//{lunboMsg.current.index}
{/* <img src='/assets/images/quanju/xuanchuanlan.jpg'></img> */} {/* <img src='/assets/images/quanju/xuanchuanlan.jpg'></img> */}
<Carousel autoplay={true} dots={false} autoplaySpeed={180000}> <Carousel dots={true} ref={lunbo} key={lunboindex} afterChange={(current)=>{
{xuandata&&xuandata!==null&&xuandata.length!==0?xuandata.map((item,index)=>{
setlunboindex(current)}}>
{/* {
videos.map((v, i) => {
console.log('first')
return i == lunboMsg.current.index ?
<video src={`${localStorage.getItem("qndmn")}/${v}`} key={Math.random()} autoPlay={i == lunboMsg.current.index} onEnded={() => {
console.log('end', i + 1, videos.length)
if (i == videos.length - 1) {
setlunboindex(0)
lunboMsg.current.index = 0
lunbo.current.goTo(1)
} else {
console.log('first222', i + 1)
setlunboindex(i + 1)
lunboMsg.current.index = i + 1
lunbo.current.next()
}
}}></video>
: <p>123</p>
})
} */}
{
xuandata&&xuandata!==null&&xuandata.length!==0?xuandata.map((item,index1)=>{
if(item.enable){ if(item.enable){
if(item.video&&item.video!==null&&item.video.length!==0){ if(item.video&&item.video!==null&&item.video.length!==0){
return item.video.map((i,index)=>{ return item.video.map((i,index)=>{
// console.log(i,'视频') // console.log(i,'视频')
return <video src={`${localStorage.getItem("qndmn")}/${i}`} autoPlay="autoplay" loop></video> console.log(index1,'index1')
if(index1-1===lunboindex){
// lunbo.current.goTo(lunboindex)
console.log("自动播放",index1)
return <video src={`${localStorage.getItem("qndmn")}/${i}`} autoPlay={true} ref={lunbovideo} loop></video>
}else{
// console.log("不自动播放",index1)
return <video src={`${localStorage.getItem("qndmn")}/${i}`} autoPlay={false}></video>
}
}) })
} }
// return <video src={`${localStorage.getItem("qndmn")}/${item.video!==null&&item.video.length!==0?item.video[0]:""}`} autoPlay="autoplay" loop></video> // return <video src={`${localStorage.getItem("qndmn")}/${item.video!==null&&item.video.length!==0?item.video[0]:""}`} autoPlay="autoplay" loop></video>
} }
}):<video src='#'></video>} })
:<video src='#'></video>
}
{/* <video src={xuandata&&xuandata!==null&&xuandata.length!==0?`${localStorage.getItem("qndmn")}/${xuandata[0].video!==null&&xuandata[0].video?xuandata[0].video[0]:""}`:"#"} autoPlay="autoplay" loop></video> */} {/* <video src={xuandata&&xuandata!==null&&xuandata.length!==0?`${localStorage.getItem("qndmn")}/${xuandata[0].video!==null&&xuandata[0].video?xuandata[0].video[0]:""}`:"#"} autoPlay="autoplay" loop></video> */}
</Carousel> </Carousel>
<h2>全面建设好农村公路切实发挥先行官作用</h2> <h2>全面建设好农村公路切实发挥先行官作用</h2>
</div> </div>
</Module> </Module>
<Module title={"各乡镇在建工程统计"} style={{ width: "100%", <Module title={"各乡镇在建工程统计"} style={{
width: "100%",
height: " 33%", marginTop: '3%' height: " 33%", marginTop: '3%'
}} customize={true}> }} customize={true}>
{sunonlineproject !== 0 ? <Rightcenter data={onlineproject} sundata={sunonlineproject} /> : <NoData />} {sunonlineproject !== 0 ? <Rightcenter data={onlineproject} sundata={sunonlineproject} /> : <NoData />}
</Module> </Module>
<Module title={"各路段技术等级统计"} style={{ width: "100%", <Module title={"各路段技术等级统计"} style={{
width: "100%",
height: " 30%", marginTop: '3%' height: " 30%", marginTop: '3%'
}} customize={true}> }} customize={true}>
{safetyData && sunsafetyData !== 0 ? <RightBottom width='100%' {safetyData && sunsafetyData !== 0 ? <RightBottom width='100%'

Loading…
Cancel
Save