ww664853070 1 year ago
parent
commit
5bb7c42dbb
  1. 16
      api/app/lib/controllers/report/index.js
  2. 28
      web/client/src/sections/fillion/components/patrolTable.js
  3. 20
      web/client/src/sections/organization/components/userModal.js
  4. 7
      web/client/src/sections/organization/containers/user.js
  5. 62
      web/client/src/sections/quanju/containers/public/olMap.js

16
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
@ -48,7 +48,9 @@ async function reportList (ctx) {
model: models.User,
attributes: ['name']
}],
order: [['time', asc ? 'ASC' : 'DESC']],
//order: [['time', asc ? 'ASC' : 'DESC']],
order: [['time', 'DESC']],
}
if (limit) {
findOption.limit = limit
@ -114,7 +116,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
@ -164,7 +166,7 @@ async function reportPosition (ctx) {
}
}
async function reportDetail (ctx) {
async function reportDetail(ctx) {
try {
const models = ctx.fs.dc.models;
const { reportId } = ctx.params
@ -186,7 +188,7 @@ async function reportDetail (ctx) {
}
}
async function reportHandle (ctx) {
async function reportHandle(ctx) {
try {
const { models } = ctx.fs.dc;
@ -216,7 +218,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;
@ -238,7 +240,7 @@ async function createReport (ctx) {
}
}
async function deleteReport (ctx) {
async function deleteReport(ctx) {
try {
const models = ctx.fs.dc.models;
const { reportId } = ctx.params;

28
web/client/src/sections/fillion/components/patrolTable.js

@ -368,23 +368,19 @@ const PatrolNameList = (props) => {
});
return children;
};
if (user?.username === 'SuperAdmin') {
departments = [...new Set(depAllUser)]
} else {
let depAllUserCopy = []
depAllUser.map((item) => {
if (item.depId === user?.departmentId) {
depAllUserCopy.push(item)
}
})
departments = [...new Set(depAllUserCopy)]
if (depAllUser && depAllUser.length) {
if (user?.username === 'SuperAdmin') {
departments = [...new Set(depAllUser)]
} else {
const targetDepartment = depAllUser.find(department => department.users.some(item => item.id === user?.id));
departments = [targetDepartment]
}
const processedData = [];
const expandedKeys = generateData(departments, null, processedData);
setDefaultData(processedData);
setDataList(processedData.map(item => ({ key: item.key, title: item.title.toString(), children: item.children })));
setExpandedKeys(expandedKeys);
}
const processedData = [];
const expandedKeys = generateData(departments, null, processedData);
setDefaultData(processedData);
setDataList(processedData.map(item => ({ key: item.key, title: item.title.toString(), children: item.children })));
setExpandedKeys(expandedKeys);
}, [depAllUser])
useEffect(() => {

20
web/client/src/sections/organization/components/userModal.js

@ -3,14 +3,30 @@ import { connect } from 'react-redux';
import { Spin } from 'antd';
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form';
const UserModal = (props) => {
const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props
const { visible, modalType, depData, onVisibleChange, onConfirm, editData, depMessagedata } = props
const pakData = (dep) => {
// console.log(dep);
return dep.map((d) => {
return {
title: d.name,
value: d.id,
// key: d.id,
children: pakData(d.subordinate)
}
})
}
let depDatas = pakData(depMessagedata || [])
const onFinish = (values) => {
if (onConfirm) {
onConfirm(values);
}
}
const checkName = (rule, value, callback) => {
if (value && value.replace(/[^\u4E00-\u9FA5]/g).includes('undefined')) {
callback(new Error('请输入中文!'));
@ -98,7 +114,7 @@ const UserModal = (props) => {
}}
rules={[{ required: true, message: '请选择所属部门' }]}
request={async () => {
return depData
return depDatas
}}
expandedKeys={["title"]}
/>

7
web/client/src/sections/organization/containers/user.js

@ -315,14 +315,14 @@ const UserManage = (props) => {
<Col flex="260px" style={{ height: '100%' }}>
<Card bordered={false} bodyStyle={{ padding: 8, paddingTop: 24, }}>
<Button
{user?.username === 'SuperAdmin' ? <Button
type="primary"
key="primary"
style={{ marginLeft: 10 }}
onClick={() => openDepModal('create')}
disabled={user?.username !== 'SuperAdmin'}
>
新建部门</Button>
新建部门</Button> : null}
{
depMessage.length ?
@ -412,6 +412,7 @@ const UserManage = (props) => {
{
depMessage.length && modalVisible ?
<UserModal
depMessagedata={depMessagedata}
dispatch={dispatch}
visible={modalVisible}
onVisibleChange={setModalVisible}

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

@ -11,7 +11,6 @@ const OlMap = (props) => {
}, [])
useEffect(() => {
console.log(olMapGeoDataHost);
if (olMapGeoDataHost) {
let config = {
layerName: 'nanchang',
@ -83,7 +82,54 @@ const OlMap = (props) => {
autoPanMargin: 100,
positioning: 'top-right'
}
setOlMapOpenData([{ k: Math.random() }])
// 注意 现在只取第一条数据 所以能在这里请求
request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/search`)
.type('form')
.send({
params: `{"layerName":"${d.tablename.toLowerCase()}","filter":"(roadcode = '${d.roadcode}')","spatialFilter":"","isReturnGeometry":"false","orderByFields":"roadcode, roadstart asc","spatialRel":"INTERSECTS","pageNum":1,"pageSize":1}`
})
.then(detailRes => {
if (detailRes.status == 200 && detailRes.body && detailRes.body.code == 1) {
const detailData = detailRes.body.data
const { datalist: detailDatalist } = detailData
for (let de of detailDatalist.list) {
setOlMapOpenData([{
n: '路段编码',
v: de['roadcode'],
}, {
n: '路段名称',
v: de['roadname'],
}, {
n: '起点名称',
v: de['f006'],
}, {
n: '起点桩号',
v: de['roadstart'],
}, {
n: '止点名称',
v: de['f010'],
}, {
n: '止点桩号',
v: de['roadends'],
}, {
n: '路段里程',
v:
!isNaN(de['roadends']) && !isNaN(de['roadstart']) ?
de['roadends'] - de['roadstart']
: '-',
}, {
n: '技术等级',
v: de['f014'],
map: [{ text: '高速公路', value: '1' }, { text: '一级公路', value: '2' }, { text: '二级公路', value: '3' }, { text: '三级公路', value: '4' }, { text: '四级公路', value: '5' }, { text: '等外公路', value: '6' }],
}, {
n: '路面类型',
v: de['f016'],
map: [{ text: '沥青混凝土', value: '11' }, { text: '水泥混凝土', value: '12' }, { text: '沥青贯入式', value: '21' }, { text: '沥青碎石', value: '22' }, { text: '沥青表面处治', value: '23' }, { text: '砂石路面', value: '31' }, { text: '石质路面', value: '32' }, { text: '渣石路面', value: '33' }, { text: '砖铺路面', value: '34' }, { text: '砼预制块', value: '35' }, { text: '无路面', value: '36' }]
},])
break
}
}
})
olMapTool.addOverlay('clickOpen', config)
break
}
@ -110,8 +156,16 @@ const OlMap = (props) => {
{
olMapOpenData.map(s => {
return <div style={{ display: 'flex' }}>
{/* <div style={{ width: 120 }}>1</div>
<div style={{ flex: 1 }}>: {s.k}</div> */}
<div style={{ width: 100, textAlign: 'right' }}>{s.n} </div>
<div style={{ flex: 1 }}>
{
s.map ?
s.map.find(sm => sm.value == s.v)?.text
: s.v || s.v == 0 ?
s.v
: '-'
}
</div>
</div>
})
}

Loading…
Cancel
Save