ww664853070 1 year ago
parent
commit
1392b05cae
  1. 1
      api/app/lib/controllers/overview/conserve.js
  2. 41
      api/app/lib/controllers/report/index.js
  3. 17
      weapp/src/packages/patrol/index.jsx
  4. 26
      web/client/src/sections/quanju/containers/example.js
  5. 5
      web/client/src/sections/quanju/containers/footer/conserve/index.js
  6. 4
      web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js
  7. 2
      web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js
  8. 232
      web/client/src/sections/quanju/containers/public/olMap.js
  9. 1
      web/client/src/utils/webapi.js

1
api/app/lib/controllers/overview/conserve.js

@ -15,6 +15,7 @@ async function statistic (ctx) {
model: models.User,
attributes: ['name']
}],
order: [['time', 'DESC']]
}
if (projectType) {

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

@ -1,7 +1,7 @@
'use strict';
const { QueryTypes } = require('sequelize');
async function reportList(ctx) {
async function reportList (ctx) {
try {
const models = ctx.fs.dc.models;
const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '' } = ctx.query
@ -44,7 +44,7 @@ async function reportList(ctx) {
},
attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType',
'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad', 'handleContent', 'handlePic','videoUrl'],
'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad', 'handleContent', 'handlePic', 'videoUrl'],
include: [{
model: models.User,
attributes: ['name']
@ -100,8 +100,33 @@ async function reportList(ctx) {
let reportRes = null;
if (isTop) {
const sqlStr = 'select * from (SELECT R.*, "row_number"() OVER(PARTITION BY R.user_id ORDER BY R."time" DESC) AS NEWINDEX FROM report AS R ) AS NR WHERE NEWINDEX = 1'
const sqlStr = `
select NR.*, "user".name as user_name
from (SELECT R.*, "row_number"() OVER (PARTITION BY R.user_id ORDER BY R."time" DESC) AS NEWINDEX
FROM report AS R
${reportType ? `
where report_type = '${reportType}'
`: ''
}
) AS NR
left join "user" on "user".id = NR.user_id
WHERE NEWINDEX = 1;
`
reportRes = await sequelize.query(sqlStr, { type: QueryTypes.SELECT });
if (reportType == 'road') {
const projectNameArr = reportRes.map(item => item.project_name).filter(item => item)
const projectRes = projectNameArr.length ? await models.Project.findAll({
where: {
entryName: { $in: projectNameArr }
}
}) : []
for (let r of reportRes) {
let corProject = projectRes.find(item => item.entryName == r.project_name)
if (corProject) {
r.project = corProject.dataValues
}
}
}
} else {
reportRes = await models.Report.findAll(findOption)
}
@ -117,7 +142,7 @@ async function reportList(ctx) {
}
}
async function reportPosition(ctx) {
async function reportPosition (ctx) {
try {
const models = ctx.fs.dc.models;
const { startTime, endTime, userId, reportType } = ctx.query
@ -167,7 +192,7 @@ async function reportPosition(ctx) {
}
}
async function reportDetail(ctx) {
async function reportDetail (ctx) {
try {
const models = ctx.fs.dc.models;
const { reportId } = ctx.params
@ -189,7 +214,7 @@ async function reportDetail(ctx) {
}
}
async function reportHandle(ctx) {
async function reportHandle (ctx) {
try {
const { models } = ctx.fs.dc;
@ -219,7 +244,7 @@ async function reportHandle(ctx) {
}
}
async function createReport(ctx) {
async function createReport (ctx) {
try {
const { userId } = ctx.fs.api
const models = ctx.fs.dc.models;
@ -241,7 +266,7 @@ async function createReport(ctx) {
}
}
async function deleteReport(ctx) {
async function deleteReport (ctx) {
try {
const models = ctx.fs.dc.models;
const { reportId } = ctx.params;

17
weapp/src/packages/patrol/index.jsx

@ -175,13 +175,18 @@ const Index = () => {
success: function (res) {
// res
let addresscity = ''
addresscity =
res.data.result.address_component.province
+ res.data.result.address_component.city
+ res.data.result.address_component.district
+ res.data.result.address_component.street_number
// addresscity =
// res.data.result.address_component.province
// + res.data.result.address_component.city
// + res.data.result.address_component.district
// + res.data.result.address_component.street_number
// + res.data.result.address_component.street
// addresscity = res.data.result.formatted_addresses.standard_address
addresscity = res.data.result.address
let street = res.data.result.address_component.street
setRoad(street)
setAddress(addresscity)
@ -509,7 +514,7 @@ const Index = () => {
}
useEffect(() => {
if (!isView) {
let newRoadList = roadList.filter(e => e.routeName.match(road))
let newRoadList = roadList.filter(e => e?.routeName?.match(road))
let codeRoadSel = []
if (newRoadList.length && road != '') {
newRoadList.forEach((e, index) => {

26
web/client/src/sections/quanju/containers/example.js

@ -8,17 +8,39 @@ import Footer from './footer';
import ProTable, { TableDropdown } from '@ant-design/pro-table';
import Gis from './footer/gis/gis';
import OlMap from './public/olMap'
import { getReportList } from '../../fillion/actions/patrol'
const MAPID = 'screenGis'
const Example = (props) => {
const { dispatch, actions, user, loading } = props
const [tabKey, setTabKey] = useState('leadership')
const [mapObj, setMapObj] = useState();
const [patrolList, setPatrolList] = useState([]);
const [roadProjectList, setRoadProjectList] = useState([]);
const tabChange = (tab) => {
setTabKey(tab)
// dispatch({ type: 'TAB-CHANGE', data: tab })
console.log(tab);
if (tab === 'conserve') {
dispatch(getReportList({
reportType: 'patrol',
isTop: true
})).then(res => {
console.log(res);
if (res.success) {
setPatrolList(res.payload.data || [])
}
})
dispatch(getReportList({
reportType: 'road',
isTop: true
})).then(res => {
if (res.success) {
setRoadProjectList(res.payload.data || [])
}
})
}
}
return (
@ -34,7 +56,7 @@ const Example = (props) => {
</div>
<div style={{ position: 'absolute', width: "100%", height: "90%" }}>
{/* <Gis tabKey={tabKey} /> */}
<OlMap />
<OlMap patrolList={patrolList} roadProjectList={roadProjectList} />
<Footer tabKey={tabKey} dispatch={dispatch} />
</div>
</div>

5
web/client/src/sections/quanju/containers/footer/conserve/index.js

@ -4,8 +4,7 @@ import Right from './right'
import { connect } from 'react-redux'
import moment from 'moment';
import { getdaolutongji } from '../../../actions/example'
import { getHighways, getRoadMaintenances, getxiuyang,getMaintenance } from './action'
import { getHighways, getRoadMaintenances, getxiuyang, getMaintenance } from './action'
const Conserve = (props) => {
const [roadData, setRoadData] = useState()
@ -45,7 +44,7 @@ const Conserve = (props) => {
</div>
)
}
function mapStateToProps(state) {
function mapStateToProps (state) {
// const { auth } = state;

4
web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js

@ -95,7 +95,9 @@ const Leftcenter = ({ videoCenterList }) => {
containerId={`yingshiPlay_${index}`}
height='100%'
width="100%"
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.live`}
// height={410}
// width={310}
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.hd.live`}
audio="0"
ysToken={item.token}
videoState={{

2
web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js

@ -40,7 +40,7 @@ class ReactCarousel extends Component {
containerId={`yingshiPlay_lu_${index}`}
height='100%'
width="100%"
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.live`}
url={`ezopen://open.ys7.com/${item.deviceSerial}/${item.channelNo || '1'}.hd.live`}
audio="0"
ysToken={item.token}
videoState={{

232
web/client/src/sections/quanju/containers/public/olMap.js

@ -1,11 +1,16 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import request from 'superagent'
import Hua from '../footer/leadership/centerleft/hudong'
import moment from 'moment';
import { OlMapRequest } from '$utils'
const OlMap = (props) => {
const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost } = props
const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList } = props
const [olMapOpenData, setOlMapOpenData] = useState([])
const [olMap, setOlMap] = useState()
const [pointItem, setPointItem] = useState({})
useEffect(() => {
}, [])
@ -48,7 +53,9 @@ const OlMap = (props) => {
})
olMapTool.map.on('singleclick', function (p) {
setOlMapOpenData([])
setPointItem({})
olMapTool.closeOverlay('clickOpen')
olMapTool.closeOverlay('pointClickOpen')
olMapTool.removeGeometryLayer('geometry0')
request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/bufferSearch`)
@ -136,9 +143,120 @@ const OlMap = (props) => {
}
})
})
setOlMap(olMapTool)
}
}, [olMapGeoDataHost])
useEffect(() => {
if (patrolList.length && olMap) {
patrolList.forEach((d, index) => {
console.log(d, index);
olMap.addGeometryLayer({
features: [
{
name: 'patrolPoint',
attributes: {
callbackParams: {
type: 'patrolPoint',
id: d.id,
},
callback: (p) => {
setPointItem(d)
olMap.addOverlay('pointClickOpen', {
id: 'pointClickOpen',
offset: [0, 25], // 偏移
position: [d.longitude, d.latitude], // 坐标
autoPan: true,
autoPanMargin: 100,
positioning: 'top-right'
})
}
},
geometry: [d.longitude, d.latitude],
geometryType: 'Point',
},
],
style: {
icon: {
src: '/assets/images/worker.png',
// anchor: [0.5, 1],
scale: 0.08, // 图标引用
},
// stroke: { width: 1, color: '#ffff00' },
// circle: {
// radius: 12, // 直径
// fill: '#ff0000', // 颜色
// stroke: { width: 1, color: '#ffff00' },
// },
},
selectStyle: {
icon: {
src: '/assets/images/worker.png',
// anchor: [0.5, 1],
scale: 0.08, // 图标引用
},
// circle: {
// radius: 16, // 直径
// fill: '#ff0000', // 颜色
// stroke: { width: 2, color: '#ffff00' },
// },
// stroke: { width: 2, color: '#ffff00' },
},
layerName: 'geometry_patrol_' + index
});
});
}
}, [patrolList, olMap])
useEffect(() => {
if (roadProjectList.length && olMap) {
roadProjectList.forEach((d, index) => {
olMap.addGeometryLayer({
features: [
{
name: 'roadPoint',
attributes: {
callbackParams: {
type: 'roadPoint',
id: d.id,
},
callback: (p) => {
setPointItem(d)
olMap.addOverlay('pointClickOpen', {
id: 'pointClickOpen',
offset: [0, 25], // 偏移
position: [d.longitude, d.latitude], // 坐标
// position: [115.944220000000, 28.545380000000],
autoPan: true,
autoPanMargin: 100,
positioning: 'top-right'
})
}
},
geometry: [d.longitude, d.latitude],
// geometry: [115.944220000000, 28.545380000000],
geometryType: 'Point',
},
],
style: {
icon: {
src: '/assets/images/worker.png',
scale: 0.08, // 图标引用
},
},
selectStyle: {
icon: {
src: '/assets/images/worker.png',
scale: 0.08, // 图标引用
},
},
layerName: 'geometry_road_' + index
});
});
}
}, [roadProjectList, olMap])
const isRoadProject = pointItem.report_type == 'road'
return (
<div id="olMap" style={{ position: 'absolute', height: '100%', width: "100%" }}>
<div slot="overlays" style={{ display: 'none', }}>
@ -171,6 +289,118 @@ const OlMap = (props) => {
}
</div>
</div>
<div slot="overlays" style={{ display: 'none', }}>
<div id="pointClickOpen" style={{
width: "400px", zIndex: 100, right: "24%", marginTop: "0", top: "25%", backgroundImage: `url(../../../../../assets/images/leadership/beijinglan.png)`, backgroundPosition: 'center',
backgroundSize: '100% 100%',
padding: '24px',
backgroundRepeat: 'no-repeat',
}}>
{/* <img src='/assets/images/leadership/beijinglan.png' style={{ width: "100%", height: "100%" }} /> */}
<div style={{ display: "flex", }}>
<div style={{ width: "50%", height: "100%", }}>
{
pointItem.id ?
<Hua shuzu={[{
"imgs": pointItem.conserve_after_pic ?
pointItem.conserve_after_pic[0] : ""
}, {
"imgs": pointItem.conserve_before_pic ?
pointItem.conserve_before_pic[0] : ""
}, {
"imgs": pointItem.conserve_underway_pic ?
pointItem.conserve_underway_pic[0] : ""
}]} />
: ''
}
</div>
<div style={{ width: "50%", left: "50%", }}>
<p style={{ marginTop: "20px", color: "#FFFFFF", fontSize: "16px", fontFamily: "YouSheBiaoTiHei" }}>
{
isRoadProject ?
pointItem.user_name || '--'
:
<>
{
pointItem.road_section_start ? pointItem.road_section_start : ""
}{
pointItem.road_section_start && pointItem.road_section_end ? "——" : ""
}{
pointItem.road_section_end ? pointItem.road_section_end : ""
}{
pointItem.road_section_start || pointItem.road_section_end ? "" : "--"
}
</>
}
</p>
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>
{
isRoadProject ? '上报内容' : '养护内容'
}
<span style={{ color: "#EEF4FF", marginLeft: "30px", fontFamily: " PingFangSC-Medium, PingFang SC", overflowWrap: 'break-word' }}>
{
pointItem.content ? pointItem.content : "--"
}
</span>
</p>
{
isRoadProject ? '' :
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>
负责人
<span style={{ color: "#EEF4FF", marginLeft: "45px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>
{
pointItem.user_name ? pointItem.user_name : "--"
}
</span>
</p>
}
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>
日期
<span style={{ color: "#EEF4FF", marginLeft: "60px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>
{
pointItem.time ? moment(pointItem.time).format("YYYY-MM-DD") : "--"
}
</span>
</p>
</div>
</div>
{
isRoadProject && pointItem.project ?
<div style={{ paddingTop: 24 }}>
{[{
n: '项目名称',
k: 'entryName',
}, {
n: '项目规模(公里)',
k: 'projectMileage',
}, {
n: '项目投资(万元)',
k: 'investment',
}, {
n: '开工时间',
k: 'startTime',
},].map(s => {
return (
<p style={{ color: "rgba(216,240,255,0.8)", fontSize: "14px", fontFamily: "PingFangSC-Regular, PingFang SC" }}>
{s.n}
<span style={{ color: "#EEF4FF", marginLeft: "45px", fontFamily: " PingFangSC-Medium, PingFang SC" }}>
{
s.k == 'startTime' ?
pointItem.project[s.k] ? moment(pointItem.project[s.k]).format("YYYY-MM-DD") : "--"
:
pointItem.project[s.k] || "--"
}
</span>
</p>
)
})}
</div>
: ''
}
</div>
</div>
</div>
)
}

1
web/client/src/utils/webapi.js

@ -2,7 +2,6 @@
import { ProxyRequest } from "@peace/utils";
export const GodTransRequest = new ProxyRequest("_godTrans");
export const OlMapRequest = new ProxyRequest("_olMap");
export const ApiTable = {
login: 'login',

Loading…
Cancel
Save