巴林闲侠 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) {
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

25
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));
}

26
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));
}

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 LeftTop from './Lefttop'
// import LeftCenter from './Leftcenter'
@ -32,6 +32,12 @@ const Build = (props) => {
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 () => {
@ -96,6 +102,9 @@ const Build = (props) => {
requestbuildingnumber();
requestxuanchuanlan()
}, [])
useEffect(()=>{
lunbo.current.goTo(lunboindex)
},[lunboindex])
const rendercontent = () => {
return (<div className='build-left-center-content'>
{list.map(({ name, number, gongli }, index) => <div className='build-left-center-item' key={index}>
@ -113,12 +122,27 @@ 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 (
<>
<div className='bgbuild-left'>
<Module title={"各状态公路数量统计"} style={{ width: "100%",
<Module title={"各状态公路数量统计"} style={{
width: "100%",
height: " 33%"
}} customize={true}>
<div style={{ height: "100%", position: "relative" }} >
@ -144,7 +168,8 @@ const Build = (props) => {
</div> : <NoData />}
</div>
</Module>
<Module title={"各乡镇已建道路统计"} style={{ width: "100%",
<Module title={"各乡镇已建道路统计"} style={{
width: "100%",
height: " 33%", marginTop: '3%'
}} customize={true}>
{totalcount && totalcount !== 0 ? <div className='build-left-center'>
@ -173,7 +198,8 @@ const Build = (props) => {
divHeight={"100%"} divId={"chart"} />
</div> : <NoData />}
</Module>
<Module title={"道路统计"} style={{ width: "100%",
<Module title={"道路统计"} style={{
width: "100%",
height: " 30%", marginTop: '3%'
}} customize={true}>
{data && sundata !== 0 ? <LeftBottom
@ -189,34 +215,73 @@ const Build = (props) => {
</div>
<div className='bgbuild-right'>
<Module title={"宣传栏"} style={{ width: "100%",
<Module title={"宣传栏"} style={{
width: "100%",
height: " 33%"
}} customize={true}>
<div className='build-right-top'>
{lunboindex}//{lunboMsg.current.index}
{/* <img src='/assets/images/quanju/xuanchuanlan.jpg'></img> */}
<Carousel autoplay={true} dots={false} autoplaySpeed={180000}>
{xuandata&&xuandata!==null&&xuandata.length!==0?xuandata.map((item,index)=>{
<Carousel dots={true} ref={lunbo} key={lunboindex} afterChange={(current)=>{
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.video&&item.video!==null&&item.video.length!==0){
return item.video.map((i,index)=>{
// 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>
}
}):<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> */}
</Carousel>
<h2>全面建设好农村公路切实发挥先行官作用</h2>
</div>
</Module>
<Module title={"各乡镇在建工程统计"} style={{ width: "100%",
<Module title={"各乡镇在建工程统计"} style={{
width: "100%",
height: " 33%", marginTop: '3%'
}} customize={true}>
{sunonlineproject !== 0 ? <Rightcenter data={onlineproject} sundata={sunonlineproject} /> : <NoData />}
</Module>
<Module title={"各路段技术等级统计"} style={{ width: "100%",
<Module title={"各路段技术等级统计"} style={{
width: "100%",
height: " 30%", marginTop: '3%'
}} customize={true}>
{safetyData && sunsafetyData !== 0 ? <RightBottom width='100%'

Loading…
Cancel
Save