ww664853070 1 year ago
parent
commit
0d25baf4b3
  1. 2
      api/.vscode/launch.json
  2. 106
      api/app/lib/controllers/luzheng/index.js
  3. 65
      api/app/lib/models/roadadministration.js
  4. 21
      api/app/lib/routes/luzheng/index.js
  5. 8
      scripts/1.3.0/schema/6.roadadministration.sql
  6. 29
      weapp/src/packages/patrol/index.jsx
  7. 51
      web/client/src/sections/fillion/actions/luzheng.js
  8. 4
      web/client/src/sections/fillion/nav-item.js
  9. 12
      web/client/src/sections/fillion/routes.js
  10. 54
      web/client/src/sections/quanju/containers/public/olMap.js

2
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",

106
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
}

65
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;
};

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

8
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
);

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

@ -1329,26 +1329,25 @@ const Index = () => {
/>
}
<View className='horizontal-line hl-two'>
<View className='circle c-two'></View>
<View className='text t-two'>养护中</View>
</View>
{
isView && isBeforeReport ? <>
<View className='horizontal-line hl-two'>
<View className='circle c-two'></View>
<View className='text t-two'>养护中</View>
</View>
isView ?
<View className='img-box'>
{conserveUnderwayPic.map(item => (
<Image className='img' src={item.url} onClick={() => handleImgClick(undefined, item)} />
))}
</View>
</> : null
// <AtImagePicker
// className='img-picker'
// count={3 - conserveUnderwayPic.length}
// showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
// files={conserveUnderwayPic}
// onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
// onImageClick={handleImgClick}
// />
</View> :
<AtImagePicker
className='img-picker'
count={3 - conserveUnderwayPic.length}
showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
files={conserveUnderwayPic}
onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
onImageClick={handleImgClick}
/>
}
<View className='horizontal-line hl-three'>

51
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: '修改路政信息' },
});
}

4
web/client/src/sections/fillion/nav-item.js

@ -33,6 +33,10 @@ export function getNavItem(user, dispatch) {
{/* <Menu.Item key="filliontask">
<Link to="/fillion/task">任务管理</Link>
</Menu.Item> */}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ?
<Menu.Item key="luzheng">
<Link to="/fillion/luzheng">路政管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ?
<Menu.Item key="filliontransportation">
<Link to="/fillion/transportation">道路管理</Link>

12
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'],

54
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],

Loading…
Cancel
Save