From 9db673e6a50075aae4a35c19ce7cf6d6c3494e83 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 19 Jul 2023 15:30:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=BB=E6=8A=A4=E5=B8=83=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 41 +++- .../src/sections/quanju/containers/example.js | 26 +- .../containers/footer/conserve/index.js | 5 +- .../quanju/containers/public/olMap.js | 232 +++++++++++++++++- web/client/src/utils/webapi.js | 1 - 5 files changed, 290 insertions(+), 15 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index e4fc1476..8ab4c205 100644 --- a/api/app/lib/controllers/report/index.js +++ b/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; diff --git a/web/client/src/sections/quanju/containers/example.js b/web/client/src/sections/quanju/containers/example.js index 030c4cc0..7d511841 100644 --- a/web/client/src/sections/quanju/containers/example.js +++ b/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) => {
{/* */} - +
diff --git a/web/client/src/sections/quanju/containers/footer/conserve/index.js b/web/client/src/sections/quanju/containers/footer/conserve/index.js index eeb36b55..87ac88e1 100644 --- a/web/client/src/sections/quanju/containers/footer/conserve/index.js +++ b/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) => { ) } -function mapStateToProps(state) { +function mapStateToProps (state) { // const { auth } = state; diff --git a/web/client/src/sections/quanju/containers/public/olMap.js b/web/client/src/sections/quanju/containers/public/olMap.js index cc7cebe8..816ac777 100644 --- a/web/client/src/sections/quanju/containers/public/olMap.js +++ b/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 (
@@ -171,6 +289,118 @@ const OlMap = (props) => { }
+
+
+ {/* */} +
+
+ { + pointItem.id ? + + : '' + } +
+
+

+ { + 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 ? "" : "--" + } + + } + +

+

+ { + isRoadProject ? '上报内容' : '养护内容' + } + + { + pointItem.content ? pointItem.content : "--" + } + +

+ { + isRoadProject ? '' : +

+ 负责人 + + { + pointItem.user_name ? pointItem.user_name : "--" + } + +

+ } +

+ 日期 + + { + pointItem.time ? moment(pointItem.time).format("YYYY-MM-DD") : "--" + } + +

+
+
+ + { + isRoadProject && pointItem.project ? +
+ {[{ + n: '项目名称', + k: 'entryName', + }, { + n: '项目规模(公里)', + k: 'projectMileage', + }, { + n: '项目投资(万元)', + k: 'investment', + }, { + n: '开工时间', + k: 'startTime', + },].map(s => { + return ( +

+ {s.n} + + { + s.k == 'startTime' ? + pointItem.project[s.k] ? moment(pointItem.project[s.k]).format("YYYY-MM-DD") : "--" + : + pointItem.project[s.k] || "--" + } + +

+ ) + })} +
+ : '' + } +
+
) } diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index e16c5015..c45ebbad 100644 --- a/web/client/src/utils/webapi.js +++ b/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', From e38149ba094a03ef09af2885ccc5d8b37c397af9 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 19 Jul 2023 16:56:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=8F=96=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index c718fb41..0000ce3b 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -176,13 +176,18 @@ const Index = () => { console.log('地址:::', 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) From 8c803f9e6bdde21de09e725a2549a8cc4f3eebc6 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 19 Jul 2023 17:19:49 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=AB=98=E6=B8=85?= =?UTF-8?q?=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 4 ++-- .../quanju/containers/footer/leadership/left/left-center.js | 4 +++- .../quanju/containers/footer/leadership/right/hudongVideo.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 0000ce3b..f1266d0c 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -515,7 +515,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) => { @@ -618,7 +618,7 @@ const Index = () => { } }) } - console.log(handleType,'handleType'); + return ( {/* { diff --git a/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js b/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js index 1e7c21f6..36aeabe6 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js +++ b/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={{ diff --git a/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js b/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js index f3d24dfc..ce22bfba 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js +++ b/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={{ From bb356a45c1d4b8163d5fe5c25f701d99cf68d230 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 19 Jul 2023 17:30:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=85=BB=E6=8A=A4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=80=92=E5=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/overview/conserve.js | 1 + 1 file changed, 1 insertion(+) diff --git a/api/app/lib/controllers/overview/conserve.js b/api/app/lib/controllers/overview/conserve.js index e8d10250..75e10310 100644 --- a/api/app/lib/controllers/overview/conserve.js +++ b/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) {