diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 1bf8125e..45edb9a6 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,7 +15,7 @@ "args": [ "-p 13400", "-f http://localhost:13400", - "-g postgres://postgres:123@10.8.30.32:5432/highways4good", + "-g postgres://FashionAdmin:123456@10.8.16.184:5432/sihaogonglu", // "-g postgres://FashionAdmin:123456@10.8.30.156:5432/highway4goodn0728", "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", "--qnsk yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa", diff --git a/api/app/lib/controllers/luzheng/index.js b/api/app/lib/controllers/luzheng/index.js new file mode 100644 index 00000000..6299fffe --- /dev/null +++ b/api/app/lib/controllers/luzheng/index.js @@ -0,0 +1,106 @@ +'use strict' +//查询路政 +async function getRoadadministration(ctx, next) { + try { + + const { limit = 10, page,keyword,startTime,endTime} = ctx.query; + // const distinct = 'false' == includeCount ? false : true//gis大屏需要总设备,后台管理不需要include的统计 + const models = ctx.fs.dc.models; + let where = {}; + + if(startTime && endTime){ + where.enforcementdate = { + where: { enforcementdate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, + } + + } + let findObj = { + order: [["id", "desc"]], + where: where, + + }; + if (page && limit) { + findObj.limit = Number(limit) + findObj.offset = Number(page - 1) * Number(limit) + } + let rslt = await models.Roadadministration.findAndCountAll(findObj); + ctx.body = rslt; + ctx.status = 200; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "获取路政数据失败" + } + } + +} + + +// 新增路政 +function addRoadadministration(opts) { + return async function (ctx, next) { + const models = ctx.fs.dc.models; + try { + let rslt = ctx.request.body; + await models.Roadadministration.create(rslt) + + ctx.status = 204; + ctx.body = { message: '添加路政数据成功' } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { message: '添加路政失败' } + } + } +} + +// 删除路政 +function delRoadadministration(opts) { + return async function (ctx, next) { + try { + const models = ctx.fs.dc.models; + const { id } = ctx.params; + await models.Roadadministration.destroy({ + where: { + id: id + } + }) + ctx.status = 204; + ctx.body = { message: '删除路政信息' } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { message: '删除健康体检' } + } + } +} + +// 修改路政 +function editRoadadministration(opts) { + return async function (ctx, next) { + + try { + const models = ctx.fs.dc.models; + const { id } = ctx.params; + const body = ctx.request.body; + await models.Roadadministration.update( + body, + { where: { id: id, } } + ) + ctx.status = 204; + ctx.body = { message: '修改健康体检数据成功' } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { message: '修改健康体检数据失败' } + } + } +} + +module.exports = { + getRoadadministration, + addRoadadministration, + delRoadadministration, + editRoadadministration +} \ No newline at end of file diff --git a/api/app/lib/models/roadadministration.js b/api/app/lib/models/roadadministration.js new file mode 100644 index 00000000..580c57aa --- /dev/null +++ b/api/app/lib/models/roadadministration.js @@ -0,0 +1,65 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const Roadadministration = sequelize.define("roadadministration", { + id: { + index: 1, + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true + }, + enforcementdate: { + index: 2, + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: '执法日期', + primaryKey: false, + field: "enforcementdate", + autoIncrement: false + }, + roadname: { + index: 3, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '道路名称', + primaryKey: false, + field: "roadname", + autoIncrement: false + }, + enforcementreslt: { + index: 4, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '执法结果', + primaryKey: false, + field: "enforcementreslt", + autoIncrement: false + }, + picfile: { + index: 4, + type: DataTypes.JSON, + allowNull: true, + defaultValue: null, + comment: '执法图片', + primaryKey: false, + field: "picfile", + autoIncrement: false + } + }, { + tableName: "roadadministration", + comment: "路政管理", + indexes: [] + }); + dc.models.Roadadministration = Roadadministration; + return Roadadministration; +}; \ No newline at end of file diff --git a/api/app/lib/routes/luzheng/index.js b/api/app/lib/routes/luzheng/index.js new file mode 100644 index 00000000..8800776e --- /dev/null +++ b/api/app/lib/routes/luzheng/index.js @@ -0,0 +1,21 @@ + + +'use strict'; + +const Roadadministration = require('../../controllers/luzheng') + +module.exports = function (app, router, opts) { + app.fs.api.logAttr['GET/getRoadadministration'] = { content: '获取路政数据', visible: false }; + router.get('/getRoadadministration', Roadadministration.getRoadadministration); + + + app.fs.api.logAttr['POST/addRoadadministration'] = { content: '增加路政数据', visible: true }; + router.post('/addRoadadministration', Roadadministration.addRoadadministration(opts)); + + app.fs.api.logAttr['DEL/delRoadadministration/:id'] = { content: '删除路政数据', visible: true }; + router.del('/delRoadadministration/:id', Roadadministration.delRoadadministration(opts)) + + // // 修改健康体检 + app.fs.api.logAttr['PUT/editRoadadministration/:id'] = { content: '修改路政数据', visible: true }; + router.put('/editRoadadministration/:id', Roadadministration.editRoadadministration(opts)) +}; \ No newline at end of file diff --git a/scripts/1.3.0/schema/6.roadadministration.sql b/scripts/1.3.0/schema/6.roadadministration.sql new file mode 100644 index 00000000..a4319c78 --- /dev/null +++ b/scripts/1.3.0/schema/6.roadadministration.sql @@ -0,0 +1,8 @@ +create table if not exists roadadministration +( + id serial not null primary key, + enforcementdate timestamp, + roadname varchar(255), + enforcementreslt varchar(255), + picfile jsonb +); \ No newline at end of file diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index fa71b055..44276273 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -1329,26 +1329,25 @@ const Index = () => { /> } + + + 养护中 + { - isView && isBeforeReport ? <> - - - 养护中 - + isView ? {conserveUnderwayPic.map(item => ( handleImgClick(undefined, item)} /> ))} - - : null - // = 3 ? false : true} - // files={conserveUnderwayPic} - // onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')} - // onImageClick={handleImgClick} - // /> + : + = 3 ? false : true} + files={conserveUnderwayPic} + onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')} + onImageClick={handleImgClick} + /> } diff --git a/web/client/src/sections/fillion/actions/luzheng.js b/web/client/src/sections/fillion/actions/luzheng.js new file mode 100644 index 00000000..5c4a0a17 --- /dev/null +++ b/web/client/src/sections/fillion/actions/luzheng.js @@ -0,0 +1,51 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' +export function getRoadadministration (query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query: query, + actionType: 'GET_LU_ZHENG', + url: ApiTable.getRoadadministration, + msg: { option: '获取路政信息' }, + // reducer: { name: 'chcekList' } + }); +} + + +export function addRoadadministration (params) { + return dispatch => basicAction({ + type: 'post', + data: params, + dispatch: dispatch, + actionType: 'ADD_LU_ZHENG', + url: ApiTable.addRoadadministration, + msg: { option: '新增路政信息' }, + }); +} + + +export function delRoadadministration (id) { + return dispatch => basicAction({ + type: 'delete', + dispatch: dispatch, + actionType: 'DEL_LU_ZHENG', + url: ApiTable.delRoadadministration.replace(':id', id), + msg: { option: '删除路政信息' }, + }) +} +export function modifyRoadadministration (id, params) { + return dispatch => basicAction({ + type: 'put', + data: params, + dispatch: dispatch, + actionType: 'EDIT_LU_ZHENG', + url: ApiTable.modifyRoadadministration.replace(':id', id), + msg: { option: '修改路政信息' }, + }); +} + + + diff --git a/web/client/src/sections/fillion/nav-item.js b/web/client/src/sections/fillion/nav-item.js index bc6306dc..8ac54677 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -33,6 +33,10 @@ export function getNavItem(user, dispatch) { {/* 任务管理 */} + {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ? + + 路政管理 + : ''} {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ? 道路管理 diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js index 2dc943df..9172cd69 100644 --- a/web/client/src/sections/fillion/routes.js +++ b/web/client/src/sections/fillion/routes.js @@ -15,6 +15,7 @@ import { Jiekouguanli } from './containers' import { Task, Assess, VideoCenter, } from './containers' import { Building } from './containers' import { MaintenanceSpotCheck } from './containers' +import Luzheng from './containers/luzheng'; export default [{ type: 'inner', route: { @@ -30,7 +31,16 @@ export default [{ component: Infor, breadcrumb: '治超管理', authCode: 'OVERLOADMANAGE' - }, { + }, + { + path: '/luzheng', + key: 'luzheng', + menuSelectKeys: ['luzheng'], + component: Luzheng, + breadcrumb: '路政管理', + authCode: 'OVERLOADMANAGE' + }, + { path: '/task', key: 'filliontask', menuSelectKeys: ['filliontask'], diff --git a/web/client/src/sections/quanju/containers/public/olMap.js b/web/client/src/sections/quanju/containers/public/olMap.js index 6f5cc9af..a3da1c71 100644 --- a/web/client/src/sections/quanju/containers/public/olMap.js +++ b/web/client/src/sections/quanju/containers/public/olMap.js @@ -7,6 +7,7 @@ import { OlMapRequest } from '$utils' const OlMap = (props) => { const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList, tab, busRunTime, busLine } = props + console.log(patrolList) const [olMapOpenData, setOlMapOpenData] = useState([]) const [olMap, setOlMap] = useState() const [pointItem, setPointItem] = useState({}) @@ -66,10 +67,11 @@ const OlMap = (props) => { olMapTool.closeOverlay('pointClickOpen') olMapTool.removeGeometryLayer('geometry0') + // 请求路线坐标 request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/bufferSearch`) .type('form') .send({ - params: `{"layerName":"view_by_line","pageSize":10,"pageNum":1,"filter":"","isReturnGeometry":"true","spatialRel":"INTERSECTS","orderByFields":" sort1, sort2, lxbm, sxxfx, qdzh asc", "spatialFilter":"point(${p.coordinate[0]} ${p.coordinate[1]})","distance":20}` + params: `{"layerName":"view_by_line","pageSize":1,"pageNum":1,"filter":"","isReturnGeometry":"true","spatialRel":"INTERSECTS","orderByFields":" sort1, sort2, lxbm, sxxfx, qdzh asc", "spatialFilter":"point(${p.coordinate[0]} ${p.coordinate[1]})","distance":20}` }) .then(res => { if (res.status == 200 && res.body && res.body.code == 1) { @@ -98,6 +100,7 @@ const OlMap = (props) => { positioning: 'top-right' } // 注意 现在只取第一条数据 所以能在这里请求 + // 这里请求的是路线的信息 request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/search`) .type('form') .send({ @@ -184,6 +187,49 @@ const OlMap = (props) => { autoPanMargin: 100, positioning: 'top-right' }) + // 请求路线坐标 + console.log(d.code_road); + if (d.code_road) { + let codeMap = { + x: 'gpsxd', + y: 'gpsyd', + c: 'gpscd', + } + let roadCodeStart = d.code_road[0] + let layerName = codeMap[roadCodeStart.toLowerCase()] + if (layerName) { + request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/search`) + .type('form') + .send({ + params: `{"layerName":"${layerName}","filter":"(roadcode = '${d.code_road}')","spatialFilter":"","isReturnGeometry":"true","orderByFields":"roadcode, roadstart asc","spatialRel":"INTERSECTS","pageNum":1,"pageSize":99}` + }) + .then(res => { + if (res.status == 200 && res.body && res.body.code == 1) { + console.log(res); + const data = res.body.data + const { datalist } = data + if (datalist?.list?.length) { + let index = 0 + for (let d of datalist.list) { + olMap.addGeometryJMLayer({ + features: [ + { + geometry: d.shape, + geometryType: 'LineString', + // geometryType: 'Point', + }, + ], + style: { stroke: { width: 5, color: '#9933FF' } }, + selectStyle: { stroke: { width: 8, color: '#9933FF' } }, + layerName: 'geometry' + index++ + }); + } + } + } + }) + } + } + } }, geometry: [d.longitude, d.latitude], @@ -217,6 +263,10 @@ const OlMap = (props) => { layerName: 'geometry_patrol_' + index }); }); + } else if (tab != 'conserve' && olMap) { + patrolList.forEach((d, index) => { + olMap.removeGeometryLayer('geometry_patrol_' + index) + }) } }, [patrolList, olMap, tab]) @@ -250,6 +300,8 @@ const OlMap = (props) => { autoPanMargin: 100, positioning: 'top-right' }) + // 查路线 + } }, geometry: [d.longitude, d.latitude], diff --git a/web/package.json b/web/package.json index add7d5a1..398df73a 100644 --- a/web/package.json +++ b/web/package.json @@ -95,4 +95,4 @@ "webpack-dev-server": "^3.11.2", "xlsx": "^0.16.9" } -} \ No newline at end of file +}