CODE 1 year ago
parent
commit
6199ec38d7
  1. 317
      api/app/lib/controllers/data/road.js
  2. 25
      api/app/lib/controllers/report/index.js
  3. 16
      web/client/src/sections/fillion/actions/index.js
  4. 100
      web/client/src/sections/fillion/actions/infor.js
  5. 111
      web/client/src/sections/fillion/actions/spotCheck.js
  6. 181
      web/client/src/sections/fillion/components/adjustment.js
  7. 190
      web/client/src/sections/fillion/containers/adjustLog.js
  8. 10
      web/client/src/sections/fillion/containers/index.js
  9. 290
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js
  10. 200
      web/client/src/sections/fillion/nav-item.js
  11. 339
      web/client/src/sections/fillion/routes.js
  12. 492
      web/client/src/sections/organization/containers/authority.js

317
api/app/lib/controllers/data/road.js

@ -2,176 +2,179 @@
const roadKeyMap = require('./road.json') const roadKeyMap = require('./road.json')
async function importIn (ctx) { async function importIn (ctx) {
// 数据导入 // 数据导入
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { level, } = ctx.query; const { level, } = ctx.query;
const data = ctx.request.body; const data = ctx.request.body;
const roadRes = await models.Road.findAll({ const roadRes = await models.Road.findAll({
where: { where: {
level level
} }
}) })
let preCreateArr = [] let preCreateArr = []
for (let d of data) { for (let d of data) {
if (roadRes.some(r => r.routeCode + r.sectionNo == d['路线代码'] + d['路段序号'])) { if (roadRes.some(r => r.routeCode + r.sectionNo == d['路线代码'] + d['路段序号'])) {
//repeat //repeat
} else { } else {
// await models.Road.create(d); // await models.Road.create(d);
} }
} }
ctx.status = 204 ctx.status = 204
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
message: typeof error == 'string' ? error : undefined message: typeof error == 'string' ? error : undefined
} }
} }
} }
async function get (ctx) { async function get (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { codePrefix, level, road, sectionStart, sectionEnd } = ctx.query; const { codePrefix, level, road, sectionStart, sectionEnd, alterId } = ctx.query;
let findOption = { let findOption = {
where: {}, where: {},
order: [['id', 'DESC']] order: [['id', 'DESC']]
} }
if (alterId) {
if (codePrefix) { findOption.where.id = { $notIn: alterId }
findOption.where.routeCode = { $like: `${codePrefix}%` } }
}
if (codePrefix) {
if (level) { findOption.where.routeCode = { $like: `${codePrefix}%` }
findOption.where.level = level }
}
if (road || sectionStart || sectionEnd) { if (level) {
findOption.where['$or'] = {} findOption.where.level = level
if (road) { }
findOption.where['$or']. if (road || sectionStart || sectionEnd) {
routeName = { $like: `%${road}%` } findOption.where['$or'] = {}
} if (road) {
if (sectionStart) { findOption.where['$or'].
findOption.where['$or']. routeName = { $like: `%${road}%` }
startingPlaceName = { $like: `%${sectionStart}%` } }
if (sectionStart) {
} findOption.where['$or'].
if (sectionEnd) { startingPlaceName = { $like: `%${sectionStart}%` }
findOption.where['$or'].
stopPlaceName = { $like: `%${sectionEnd}%` } }
if (sectionEnd) {
} findOption.where['$or'].
} stopPlaceName = { $like: `%${sectionEnd}%` }
const roadRes = await models.Road.findAll(findOption) }
}
ctx.status = 200;
ctx.body = roadRes const roadRes = await models.Road.findAll(findOption)
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 200;
ctx.status = 400; ctx.body = roadRes
ctx.body = { } catch (error) {
message: typeof error == 'string' ? error : undefined ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
} ctx.status = 400;
} ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
} }
async function getRoadSection (ctx) { async function getRoadSection (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { level, road, sectionStart, sectionEnd } = ctx.query; const { level, road, sectionStart, sectionEnd } = ctx.query;
let findOption = { let findOption = {
where: {}, where: {},
order: [['id', 'DESC']], order: [['id', 'DESC']],
attributes: ['id', 'routeName', 'startingPlaceName', 'stopPlaceName', 'routeCode'] attributes: ['id', 'routeName', 'startingPlaceName', 'stopPlaceName', 'routeCode']
} }
if (level) { if (level) {
findOption.where.level = level findOption.where.level = level
} }
if (road || sectionStart || sectionEnd) { if (road || sectionStart || sectionEnd) {
findOption.where['$or'] = {} findOption.where['$or'] = {}
if (road) { if (road) {
findOption.where['$or']. findOption.where['$or'].
routeName = { $like: `%${road}%` } routeName = { $like: `%${road}%` }
} }
if (sectionStart) { if (sectionStart) {
findOption.where['$or']. findOption.where['$or'].
startingPlaceName = { $like: `%${sectionStart}%` } startingPlaceName = { $like: `%${sectionStart}%` }
} }
if (sectionEnd) { if (sectionEnd) {
findOption.where['$or']. findOption.where['$or'].
stopPlaceName = { $like: `%${sectionEnd}%` } stopPlaceName = { $like: `%${sectionEnd}%` }
} }
} }
const roadRes = await models.Road.findAll(findOption) const roadRes = await models.Road.findAll(findOption)
ctx.status = 200; ctx.status = 200;
ctx.body = roadRes ctx.body = roadRes
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
message: typeof error == 'string' ? error : undefined message: typeof error == 'string' ? error : undefined
} }
} }
} }
async function edit (ctx) { async function edit (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const data = ctx.request.body; const data = ctx.request.body;
if (!data.roadId) { if (!data.roadId) {
await models.Road.create(data) await models.Road.create(data)
} else { } else {
await models.Road.update( await models.Road.update(
data, { data, {
where: { where: {
id: data.roadId id: data.roadId
} }
}) })
} }
ctx.status = 204 ctx.status = 204
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
message: typeof error == 'string' ? error : undefined message: typeof error == 'string' ? error : undefined
} }
} }
} }
async function del (ctx) { async function del (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { roadId } = ctx.params; const { roadId } = ctx.params;
await models.Road.destroy({ await models.Road.destroy({
where: { where: {
id: roadId id: roadId
} }
}) })
ctx.status = 204 ctx.status = 204
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
message: typeof error == 'string' ? error : undefined message: typeof error == 'string' ? error : undefined
} }
} }
} }
module.exports = { module.exports = {
importIn, importIn,
getRoadSection, getRoadSection,
get, edit, del, get, edit, del,
}; };

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

@ -805,30 +805,26 @@ async function roadSpotList (ctx) {
let findOpt = { let findOpt = {
order: [['id', 'DESC']], order: [['id', 'DESC']],
where: { where: {
checked: false checked: true
} }
} }
if (startTime && endTime) { if (startTime && endTime) {
findOpt.where = { findOpt.where.date = {
date: { $between: [moment(startTime).startOf('day').format(), moment(endTime).endOf('day').format()]
$between: [moment(startTime).startOf('day').format(), moment(endTime).endOf('day').format()]
}
} }
}
const listRes = await models.RoadSpotCheckPreview.findAll({ }
order: [['id', 'DESC']],
where: {
checked: true,
}
})
if (page && limit) { if (page && limit) {
findOpt.offset = (page - 1) * limit findOpt.offset = (page - 1) * limit
findOpt.limit = limit findOpt.limit = limit
} }
const listRes = await models.RoadSpotCheckPreview.findAll(findOpt)
ctx.status = 200; ctx.status = 200;
ctx.body = listRes.map(item => { ctx.body = listRes.map(item => {
return { return {
@ -838,6 +834,9 @@ async function roadSpotList (ctx) {
spotCountyRoadCount: item.countyRoadId ? item.countyRoadId.length : 0, spotCountyRoadCount: item.countyRoadId ? item.countyRoadId.length : 0,
spotTownRoadCount: item.townshipRoadId ? item.townshipRoadId.length : 0, spotTownRoadCount: item.townshipRoadId ? item.townshipRoadId.length : 0,
spotVillageRoadCount: item.villageId ? item.villageId.length : 0, spotVillageRoadCount: item.villageId ? item.villageId.length : 0,
countyRoadId: item.countyRoadId,
townshipRoadId: item.townshipRoadId,
villageId: item.villageId,
} }
}) })
} catch (error) { } catch (error) {
@ -991,7 +990,7 @@ async function roadSpotChangList (ctx) {
where: { where: {
checked: true, checked: true,
}, },
attributes: ['id'] attributes: ['id', 'date']
} }
if (startTime && endTime) { if (startTime && endTime) {

16
web/client/src/sections/fillion/actions/index.js

@ -7,12 +7,14 @@ import * as assess from './assess'
import * as allDepUsers from './allDepUsers' import * as allDepUsers from './allDepUsers'
import * as getReportSpotPrepare from './extract' import * as getReportSpotPrepare from './extract'
import * as luzheng from './luzheng' import * as luzheng from './luzheng'
import * as spotCheck from './spotCheck'
export default { export default {
...infor, ...infor,
...patrol, ...patrol,
...file, ...file,
...assess, ...assess,
...allDepUsers, ...allDepUsers,
...getReportSpotPrepare, ...getReportSpotPrepare,
...luzheng ...luzheng,
...spotCheck
} }

100
web/client/src/sections/fillion/actions/infor.js

@ -2,7 +2,7 @@ import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils' import { ApiTable } from '$utils'
import { Request } from '@peace/utils' import { Request } from '@peace/utils'
export function getDepMessage() { export function getDepMessage () {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -24,7 +24,7 @@ export function getDepMessage() {
// }); // });
// } // }
export function getOperaTional(query) { export function getOperaTional (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -35,7 +35,7 @@ export function getOperaTional(query) {
}); });
} }
export function putOperaTional(query) { export function putOperaTional (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -46,7 +46,7 @@ export function putOperaTional(query) {
}); });
} }
export function getSpecificVehicle(query) { export function getSpecificVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -57,7 +57,7 @@ export function getSpecificVehicle(query) {
}); });
} }
export function putSpecificVehicle(query) { export function putSpecificVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -68,7 +68,7 @@ export function putSpecificVehicle(query) {
}); });
} }
export function putHouseholds(query) { export function putHouseholds (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -79,7 +79,7 @@ export function putHouseholds(query) {
}); });
} }
export function getHouseholds(query) { export function getHouseholds (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -90,7 +90,7 @@ export function getHouseholds(query) {
}); });
} }
export function getRoadway(query) { export function getRoadway (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -98,20 +98,20 @@ export function getRoadway(query) {
actionType: 'GET_ROADWAY', actionType: 'GET_ROADWAY',
url: ApiTable.getRoadway, url: ApiTable.getRoadway,
msg: { error: '获取道路信息失败' }, msg: { error: '获取道路信息失败' },
reducer: { name: 'road' }
}); });
} }
export function putRoadway(query) { export function putRoadway (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
data: query, data: query,
actionType: 'PUT_ROADWAY', actionType: 'PUT_ROADWAY',
url: ApiTable.putRoadway, url: ApiTable.putRoadway,
msg: { option: query?.roadId?'编辑':'新增' + '道路信息' }, msg: { option: query?.roadId ? '编辑' : '新增' + '道路信息' },
}); });
} }
export function getBridge(query) { export function getBridge (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -122,7 +122,7 @@ export function getBridge(query) {
}); });
} }
export function putBridge(query) { export function putBridge (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -133,7 +133,7 @@ export function putBridge(query) {
}); });
} }
export function getProject(query) { export function getProject (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -141,10 +141,10 @@ export function getProject(query) {
actionType: 'GET_PROJECT', actionType: 'GET_PROJECT',
url: ApiTable.getProject, url: ApiTable.getProject,
msg: { error: '获取工程信息失败' }, msg: { error: '获取工程信息失败' },
reducer: { name: 'projectList' } reducer: { name: 'projectList' }
}); });
} }
export function putProject(query) { export function putProject (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -155,7 +155,7 @@ export function putProject(query) {
}); });
} }
export function getHighways(query) { export function getHighways (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -166,7 +166,7 @@ export function getHighways(query) {
}); });
} }
export function putHighways(query) { export function putHighways (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -177,7 +177,7 @@ export function putHighways(query) {
}); });
} }
export function getCircuit(query) { export function getCircuit (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -188,7 +188,7 @@ export function getCircuit(query) {
}); });
} }
export function putCircuit(query) { export function putCircuit (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -199,7 +199,7 @@ export function putCircuit(query) {
}); });
} }
export function getVehicle(query) { export function getVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -210,7 +210,7 @@ export function getVehicle(query) {
}); });
} }
export function putVehicle(query) { export function putVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -221,7 +221,7 @@ export function putVehicle(query) {
}); });
} }
export function delRoadway(query) { export function delRoadway (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -231,7 +231,7 @@ export function delRoadway(query) {
}); });
} }
export function delProject(query) { export function delProject (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -241,7 +241,7 @@ export function delProject(query) {
}); });
} }
export function delBridge(query) { export function delBridge (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -251,7 +251,7 @@ export function delBridge(query) {
}); });
} }
export function delSpecificVehicle(query) { export function delSpecificVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -261,7 +261,7 @@ export function delSpecificVehicle(query) {
}); });
} }
export function delHouseholds(query) { export function delHouseholds (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -271,7 +271,7 @@ export function delHouseholds(query) {
}); });
} }
export function delCircuit(query) { export function delCircuit (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -281,7 +281,7 @@ export function delCircuit(query) {
}); });
} }
export function delVehicle(query) { export function delVehicle (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -292,7 +292,7 @@ export function delVehicle(query) {
}); });
} }
export function getPurchase(query) { export function getPurchase (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -303,7 +303,7 @@ export function getPurchase(query) {
}); });
} }
export function putPurchase(query) { export function putPurchase (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -314,7 +314,7 @@ export function putPurchase(query) {
}); });
} }
export function delPurchase(query) { export function delPurchase (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -325,7 +325,7 @@ export function delPurchase(query) {
}); });
} }
export function getPropagata(query) { export function getPropagata (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -336,7 +336,7 @@ export function getPropagata(query) {
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }
export function putAddPropagata(query) { export function putAddPropagata (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -347,7 +347,7 @@ export function putAddPropagata(query) {
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }
export function putEditPropagata(query) { export function putEditPropagata (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -358,7 +358,7 @@ export function putEditPropagata(query) {
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }
export function delPropagata(query) { export function delPropagata (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'del', type: 'del',
dispatch: dispatch, dispatch: dispatch,
@ -369,7 +369,7 @@ export function delPropagata(query) {
}); });
} }
export function getShippingList(query) { export function getShippingList (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -380,7 +380,7 @@ export function getShippingList(query) {
}); });
} }
export function putShippingList(query) { export function putShippingList (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',
dispatch: dispatch, dispatch: dispatch,
@ -391,7 +391,7 @@ export function putShippingList(query) {
}); });
} }
//获取管养单位概况 //获取管养单位概况
export function getCustodyunit() { export function getCustodyunit () {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
dispatch: dispatch, dispatch: dispatch,
@ -401,10 +401,10 @@ export function getCustodyunit() {
reducer: { name: 'roadMaintenances_management' } reducer: { name: 'roadMaintenances_management' }
}); });
} }
export function getCustodyunitOne(query) { export function getCustodyunitOne (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
query:query, query: query,
dispatch: dispatch, dispatch: dispatch,
actionType: 'GET_CUSTODY_UNIT_ONE', actionType: 'GET_CUSTODY_UNIT_ONE',
url: ApiTable.getCustodyunit, url: ApiTable.getCustodyunit,
@ -412,7 +412,7 @@ export function getCustodyunitOne(query) {
// reducer: { name: 'roadMaintenances_management' } // reducer: { name: 'roadMaintenances_management' }
}); });
} }
export function postCustodyunit(query) { export function postCustodyunit (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'post', type: 'post',
data: query, data: query,
@ -423,14 +423,14 @@ export function postCustodyunit(query) {
// reducer: { name: 'roadMaintenances' } // reducer: { name: 'roadMaintenances' }
}); });
} }
export function getxiuyangas(query) { export function getxiuyangas (query) {
return dispatch => basicAction({ return dispatch => basicAction({
type: 'get', type: 'get',
query, query,
dispatch: dispatch, dispatch: dispatch,
actionType: 'GET_XIUYANG', actionType: 'GET_XIUYANG',
url: ApiTable.getXiuyang, url: ApiTable.getXiuyang,
msg: { error: '获取信息失败' }, msg: { error: '获取信息失败' },
reducer: { name: 'xiuyang' } reducer: { name: 'xiuyang' }
}); });
} }

111
web/client/src/sections/fillion/actions/spotCheck.js

@ -0,0 +1,111 @@
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function roadSpotList (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query,
actionType: 'GET_ROAD_STOP_LIST',
url: 'road/spot/list',
msg: { error: '获取抽查列表失败' },
reducer: { name: 'roadSpotList' }
});
}
export function roadSpotDetail (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query,
actionType: 'GET_ROAD_STOP_DETAIL',
url: 'road/spot/detail',
msg: { error: '获取抽查详情失败' },
reducer: { name: 'roadSpotDetail' }
});
}
export function roadSpotPrepare (data = {}) {
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
data: data,
actionType: 'POST_ROAD_STOP_PREPARE',
url: 'road/spot/prepare',
msg: { option: '抽取' },
reducer: { name: 'roadSpotPrepare' }
});
}
export function confirmRoadSpot (data = {}) {
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
data: data,
actionType: 'POST_ROAD_STOP_CONFIRM',
url: 'road/spot/confirm',
msg: { option: '确认抽取' },
reducer: { name: 'confirmRoadSpot' }
});
}
export function exportSpotRode (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query,
actionType: 'GET_ROAD_STOP_EXPORT',
url: 'road/spot/export',
msg: { option: '导出路线抽查' },
reducer: { name: '' }
});
}
export function roadSpotChangList (query = {}) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query,
actionType: 'GET_ROAD_STOP_CHANG_LIST',
url: 'road/spot/change',
msg: { error: '获取抽查路线更改列表' },
reducer: { name: 'roadSpotChangList' }
});
}
export function roadSpotChange (data = {}) {
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
data: data,
actionType: 'POST_ROAD_STOP_CHANGE',
url: 'road/spot/change',
msg: { option: '更改抽查路线' },
reducer: { name: '' }
});
}
// export function delAssess (query) {
// return dispatch => basicAction({
// type: 'del',
// dispatch: dispatch,
// actionType: 'DEL_ASSESS',
// url: ApiTable.delAssess.replace("{assessId}", query?.id),
// msg: { option: '删除考核评分信息' },
// });
// }
// export function editAssess (query) {
// return dispatch => basicAction({
// type: 'put',
// dispatch: dispatch,
// data: query,
// actionType: 'PUT_ASSESS',
// url: ApiTable.editAssess,
// msg: { option: '编辑/新增考核评分信息' },
// });
// }

181
web/client/src/sections/fillion/components/adjustment.js

@ -0,0 +1,181 @@
import { connect } from 'react-redux';
import React, { useEffect, useState } from 'react';
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Descriptions, Table } from 'antd'
import { roadSpotChange } from '../actions/spotCheck';
import { getRoadway } from "../actions/infor"
import moment from 'moment'
import '../components/maintenanceTable.less'
const Adjustment = (props) => {
const { dispatch, user, loading, reportDetail, editData, onCancel, road, onOk } = props
const [data, setData] = useState()//外层表格的数据
const [vis, setVis] = useState(false)//模态框的显示与隐藏变量
const [count, setCount] = useState(0)
const [page, setPage] = useState(1)
const [depName, setDepName] = useState('')
const [total, setTotal] = useState(0)
const [previewId, setPreviewId] = useState(0)
const [reportData, setReportData] = useState([])
const [detailList, setDetailList] = useState([])
const [detailVisible, setDetailVisible] = useState(false)
const [dateRange, setDateRange] = useState([]);
const { RangePicker } = DatePicker
const [nameList, setNameList] = useState([]);
const [codeList, setCodeList] = useState([]);
const [indexList, setIndexList] = useState([]);
const [roadFind, setRoadFind] = useState({});
useEffect(() => {
if (editData?.id) {
dispatch(getRoadway({ level: editData?.road?.level, alterId: editData?.alterId })).then(res => {
if (res.success) {
let name = []
let code = []
let index = []
res?.payload.data?.forEach(v => {
if (v.routeName && !name.includes(v.routeName)) {
name.push(v.routeName)
}
if (v.routeCode && !code.includes(v.routeCode)) {
code.push(v.routeCode)
}
if (v.sectionNo && !index.includes(v.sectionNo)) {
index.push(v.sectionNo)
}
});
setNameList(name)
setCodeList(code)
setIndexList(index)
}
})
}
}, [])
const [form] = Form.useForm()
return (
<Modal visible={true}
onCancel={() => {
onCancel()
}}
title='调整' onOk={() => {
form.validateFields().then((values) => {
let data = road?.find(d => values?.routeName == d?.routeName
&& values?.routeCode == d?.routeCode && values?.sectionNo == d?.sectionNo)
dispatch(roadSpotChange({
previewId: editData?.previewId,
originRoadId: editData?.id,
changeRoadId: data?.id
})).then(res => {
if (res.success) {
onCancel()
onOk()
}
});
})
}}>
<Form form={form} labelCol={{ span: 4 }} onValuesChange={(changedValues, allValues) => {
let name = []
let code = []
let index = []
let data = road?.filter(d => (allValues?.routeName ? allValues?.routeName == d?.routeName : true)
&& (allValues?.routeCode ? allValues?.routeCode == d?.routeCode : true) &&
(allValues?.sectionNo ? allValues?.sectionNo == d?.sectionNo : true))
data?.forEach(v => {
if (v.routeName && !name.includes(v.routeName)) {
name.push(v.routeName)
}
if (v.routeCode && !code.includes(v.routeCode)) {
code.push(v.routeCode)
}
if (v.sectionNo && !index.includes(v.sectionNo)) {
index.push(v.sectionNo)
}
});
setNameList(name)
setCodeList(code)
setIndexList(index)
if (allValues?.routeName && allValues?.routeCode && allValues?.sectionNo) {
form.setFieldsValue({
'startingPlaceName': data[0]?.startingPlaceName,
'stopPlaceName': data[0]?.stopPlaceName
})
} else {
form.setFieldsValue({
'startingPlaceName': null,
'stopPlaceName': null
})
}
}}>
<Form.Item label='道路类型' name='type' initialValue={editData?.road?.level ? (editData?.road?.level + "道") : ""} >
<Input disabled style={{ marginBottom: 10 }} />
</Form.Item>
<Form.Item
label="路线名称"
name="routeName"
rules={[{ required: true, message: '请选择路线名称' }]}
>
<Select style={{ marginBottom: 10 }} allowClear showSearch={true} placeholder="请选择路线名称" options={nameList?.map(v => ({ value: v, label: v })) || []} />
</Form.Item>
<Form.Item
label="路线代码"
name="routeCode"
rules={[{ required: true, message: '请选择路线代码' }]}
>
<Select style={{ marginBottom: 10 }} allowClear showSearch={true} placeholder="请选择路线代码" options={codeList?.map(v => ({ value: v, label: v })) || []} />
</Form.Item>
<Form.Item
label="路段序号"
name="sectionNo"
rules={[{ required: true, message: '请选择抽取比例' }]}
>
<Select style={{}} allowClear showSearch={true} placeholder="请选择抽取比例" options={indexList?.map(v => ({ value: v, label: v })) || []} />
</Form.Item>
<Form.Item label='起点地名' name='startingPlaceName'>
<Input disabled />
</Form.Item>
<Form.Item label='止点地名' name='stopPlaceName'>
<Input disabled />
</Form.Item>
</Form>
</Modal>
)
}
function mapStateToProps (state) {
const { auth, road } = state
//('state1', state)
return {
user: auth.user,
road: road?.data || [],
}
}
export default connect(mapStateToProps)(Adjustment);

190
web/client/src/sections/fillion/containers/adjustLog.js

@ -0,0 +1,190 @@
import { connect } from 'react-redux';
import React, { useEffect, useState } from 'react';
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Descriptions, Table } from 'antd'
const { TextArea } = Input;
import { roadSpotChangList } from '../actions/spotCheck';
import moment from 'moment'
import '../components/maintenanceTable.less'
const AdjustLog = (props) => {
const { dispatch, user, loading, reportDetail, reportDetailLoading, detailLoading } = props
const [data, setData] = useState()//外层表格的数据
const [vis, setVis] = useState(false)//模态框的显示与隐藏变量
const [count, setCount] = useState(0)
const [page, setPage] = useState(1)
const [depName, setDepName] = useState('')
const [total, setTotal] = useState(0)
const [previewId, setPreviewId] = useState(0)
const [reportData, setReportData] = useState([])
const [detailList, setDetailList] = useState([])
const [detailVisible, setDetailVisible] = useState(false)
const [dateRange, setDateRange] = useState([]);
const { RangePicker } = DatePicker
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
//console.log('reportData', reportData)
const [form] = Form.useForm()
//里层列名
const columns = [
{
title: '抽查日期',
key: 'date',
dataIndex: 'date',
render: (_, record) => record?.roadSpotCheckPreview?.date && moment(record?.roadSpotCheckPreview?.date).format('YYYY-MM-DD') || '--'
},
{
title: '调整内容',
key: 'content',
dataIndex: 'content',
},
{
title: '调整人员',
key: 'user',
dataIndex: 'user',
render: (_, record) => record?.user?.name || '--'
},
{
title: '调整时间',
key: 'time',
dataIndex: 'time',
render: (_, record) => record?.time && moment(record?.time).format('YYYY-MM-DD HH:mm:ss') || '--'
},
{
title: '操作',
key: 'operation',
dataIndex: 'operation',
render: (_, record) => <Button type="link" onClick={() => {
setVis(true)
form.setFieldsValue({
'date': record?.roadSpotCheckPreview?.date && moment(record?.roadSpotCheckPreview?.date).format('YYYY-MM-DD') || '--',
'content': record?.content,
'user': record?.user?.name || '--',
'time': record?.time && moment(record?.time).format('YYYY-MM-DD HH:mm:ss') || '--',
})
}}> 查看详情 </Button >
},
]
const queryData = (data = {}) => {
dispatch(roadSpotChangList(data)).then(res => {
if (res.success) {
setReportData(res?.payload.data)
}
})
}
useEffect(() => {
queryData()
}, [])
const cancelHandler = () => {
setVis(false)
form.resetFields()
}
return (
<div>
<div style={{ marginBottom: 16 }}>
抽查日期
<RangePicker value={dateRange[0] ? [moment(dateRange[0]), moment(dateRange[1])] : []} onChange={(date, dateString) => {
setDateRange(dateString)
}} style={{ marginRight: 20 }} />
<Button style={{ marginRight: 20 }} onClick={() => {
setPage(1)
setExpandedRowKeys([])
queryData({ startTime: dateRange[0], endTime: dateRange[1] })
}} > 查询 </Button>
<Button style={{ marginRight: 20 }} onClick={() => {
setDateRange([])
}} > 重置 </Button>
</div>
<Table
columns={columns}
dataSource={reportData}
loading={loading}
pagination={{
total: reportData?.length || 0,
pageSize: 10,
current: page || 1,
defaultPageSize: 10,
showSizeChanger: false,
onChange: (page, pageSize) => {
setPage(page)
}
}}
rowKey={(record) => { return record.id }}
/>
{vis && <Modal visible={vis} onCancel={cancelHandler} title='查看详情'
footer={<Button onClick={() => {
setVis(false)
form.resetFields()
}} > 重置 </Button>}
onOk={() => {
form.resetFields()
setVis(false)
}}>
<Form form={form}>
<Form.Item label='抽查日期' name='date'>
<Input disabled />
</Form.Item>
<Form.Item label='调整内容' name='content'>
<TextArea
disabled
placeholder=""
autoSize={{
minRows: 2,
maxRows: 6,
}}
/>
</Form.Item>
<Form.Item label='调整人员' name='user'>
<Input disabled />
</Form.Item>
<Form.Item label='调整时间' name='time'>
<Input disabled />
</Form.Item>
</Form>
</Modal>}
</div>
)
}
function mapStateToProps (state) {
const { auth, roadSpotList, reportDetail, roadSpotDetail } = state
//('state1', state)
return {
user: auth.user,
loading: roadSpotList?.isRequesting,
detailLoading: roadSpotDetail?.isRequesting,
reportDetailLoading: reportDetail.isRequesting,
reportDetail: reportDetail.data,
}
}
export default connect(mapStateToProps)(AdjustLog);

10
web/client/src/sections/fillion/containers/index.js

@ -18,9 +18,11 @@ import Assess from './assess'
import VideoCenter from './videoCenter'; import VideoCenter from './videoCenter';
import Building from './building' import Building from './building'
import MaintenanceSpotCheck from './maintenanceSpotCheck' import MaintenanceSpotCheck from './maintenanceSpotCheck'
import MaintenanceSpotCheckNew from './maintenanceSpotCheck-new'
import AdjustLog from './adjustLog'
export { export {
Infor, transportation, BridgeTable, HigHways, Infor, transportation, BridgeTable, HigHways,
OperaTional, Enforce, Public, Videois, PromoTional, OperaTional, Enforce, Public, Videois, PromoTional,
Maintenance, Patrol, File, Jiekouguanli, Maintenance, Patrol, File, Jiekouguanli,
Task, Building, Assess, VideoCenter, MaintenanceSpotCheck Task, Building, Assess, VideoCenter, MaintenanceSpotCheck, MaintenanceSpotCheckNew, AdjustLog
}; };

290
web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

@ -0,0 +1,290 @@
import { connect } from 'react-redux';
import React, { useEffect, useState } from 'react';
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Descriptions, Table } from 'antd'
import { roadSpotList, roadSpotDetail, roadSpotPrepare, confirmRoadSpot, exportSpotRode } from '../actions/spotCheck';
import moment from 'moment'
import Adjustment from '../components/adjustment'
import '../components/maintenanceTable.less'
const MaintenanceSpotCheck = (props) => {
const { dispatch, user, loading, reportDetail, reportDetailLoading, detailLoading } = props
const [data, setData] = useState()//外层表格的数据
const [vis, setVis] = useState(false)//模态框的显示与隐藏变量
const [count, setCount] = useState(0)
const [page, setPage] = useState(1)
const [depName, setDepName] = useState('')
const [total, setTotal] = useState(0)
const [previewId, setPreviewId] = useState(0)
const [reportData, setReportData] = useState([])
const [detailList, setDetailList] = useState([])
const [detailVisible, setDetailVisible] = useState(false)
const [dateRange, setDateRange] = useState([]);
const { RangePicker } = DatePicker
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
const [isAdjustment, setIsAdjustment] = useState(false);
const [editData, setEditData] = useState({});
//里层列名
const columns = [
{
title: '抽查日期',
key: 'date',
dataIndex: 'date',
render: (_, record) => record?.date && moment(record?.date).format('YYYY-MM-DD') || '--'
},
{
title: '抽查县道比率(%)',
key: 'countyPercentage',
dataIndex: 'countyPercentage',
},
{
title: '抽查县道',
key: 'spotCountyRoadCount',
dataIndex: 'spotCountyRoadCount',
},
{
title: '抽查乡道',
key: 'spotTownRoadCount',
dataIndex: 'spotTownRoadCount',
},
{
title: '抽查村道',
key: 'spotVillageRoadCount',
dataIndex: 'spotVillageRoadCount',
},
{
title: '操作',
key: 'operation',
dataIndex: 'operation',
render: (_, record) =>
<a href={`/_api/road/spot/export?token=${user?.token}&previewId=${record.id}`}>导出</a>
},
]
const queryData = (data = {}) => {
dispatch(roadSpotList(data)).then(res => {
if (res.success) {
setReportData(res?.payload.data)
}
})
}
const detailData = (data = {}) => {
dispatch(roadSpotDetail(data)).then(res => {
if (res.success) {
setDetailList(res?.payload.data)
}
})
}
useEffect(() => {
queryData()
}, [])
const [form] = Form.useForm()
const extractHandler = () => {
form.validateFields(['percentValue']).then(async (values) => {
if (Number(values.percentValue) > 0) {
const res = await dispatch(roadSpotPrepare({ countyPercentage: values.percentValue }))
setPreviewId(res?.payload.data?.previewId)
form.setFieldsValue({
'spotCountyRoadCount': res?.payload.data?.spotCountyRoadCount,
'spotTownRoadCount': res?.payload.data?.spotTownRoadCount,
'spotVillageRoadCount': res?.payload.data?.spotVillageRoadCount,
})
}
})
}
const cancelHandler = () => {
setVis(false)
form.resetFields()
}
return (
<div>
<div style={{ display: "flex", alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}>
<Button onClick={() => {
setVis(true)
}} type='primary' style={{ marginLeft: 10 }}> 新增 </Button>
<div>
<RangePicker value={dateRange[0] ? [moment(dateRange[0]), moment(dateRange[1])] : []} onChange={(date, dateString) => {
setDateRange(dateString)
}} style={{ marginRight: 20 }} />
<Button style={{ marginRight: 20 }} onClick={() => {
setPage(1)
setExpandedRowKeys([])
queryData({ startTime: dateRange[0], endTime: dateRange[1] })
}} > 查询 </Button>
<Button style={{ marginRight: 20 }} onClick={() => {
setDateRange([])
}} > 重置 </Button>
</div>
</div>
<Table
columns={columns}
dataSource={reportData}
loading={loading}
expandable={{
expandedRowKeys: expandedRowKeys, // 控制哪些行展开,这里需要通过 state 管理
// defaultExpandedRowKeys: ['0'],
onExpand: (expanded, record) => {
if (expanded) {
setExpandedRowKeys([record?.id])
detailData({ previewId: record?.id })
} else {
setExpandedRowKeys([])
}
},
expandedRowRender: (record) => (
< Table
pagination={{
pageSize: 10,
defaultPageSize: 10,
showSizeChanger: false,
}}
loading={detailLoading}
style={{ margin: 0 }}
dataSource={detailList}
columns={
[
{
title: '道路类型', key: 'level', dataIndex: 'level', render: (_, r) => r?.road?.level ? (r?.road?.level + '道') : '--'
},
{ title: '道路名称', key: 'routeName', dataIndex: 'routeName', render: (_, r) => r.road?.routeName || '--' },
{ title: '道路代码', key: 'routeCode', dataIndex: 'routeCode', render: (_, r) => r.road?.routeCode || '--' },
{ title: '路段序号', key: 'sectionNo', dataIndex: 'sectionNo', render: (_, r) => r.road?.sectionNo || '--' },
{ title: '起点地名', key: 'startingPlaceName', dataIndex: 'startingPlaceName', render: (_, r) => r.road?.startingPlaceName || '--' },
{ title: '止点地名', key: 'stopPlaceName', dataIndex: 'stopPlaceName', render: (_, r) => r.road?.stopPlaceName || '--' },
{ title: '里程', key: 'chainageMileage', dataIndex: 'chainageMileage', render: (_, r) => r.road?.chainageMileage || '--' },
{ title: '养护次数(次)', key: 'maintenanceCount', dataIndex: 'maintenanceCount' },
{
title: '操作',
key: 'action',
dataIndex: 'action',
render: (_, r) => <Button type="link" onClick={() => {
setEditData({
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId
: r?.road?.level == '乡' ? record?.townshipRoadId
: r?.road?.level == '村' ? record?.villageId : [],
previewId: record?.id
})
setIsAdjustment(true)
}}> 调整 </Button >
},
]}
/>
),
}}
pagination={{
total: reportData?.length || 0,
pageSize: 10,
current: page || 1,
defaultPageSize: 10,
showSizeChanger: false,
onChange: (page, pageSize) => {
setPage(page)
}
}}
rowKey={(record) => { return record.id }}
// toolBarRender={false}
// search={false}
/>
{
vis && <Modal visible={vis} onCancel={cancelHandler} title='养护抽查' onOk={() => {
dispatch(confirmRoadSpot({ previewId })).then(res => {
if (res.success) {
setPage(1)
setExpandedRowKeys([])
queryData({ startTime: dateRange[0], endTime: dateRange[1] })
form.resetFields()
setVis(false)
}
});
}}>
<Form form={form}>
<Form.Item
label="抽取比例(%)"
name="percentValue"
rules={[
{ required: true, message: '请选择抽取比例' },
// {
// pattern: /^(100|\d{1,2})(\.\d{1,2})?$/,
// message: '请输入有效的比例',
// },
]}
>
<Select style={{}} placeholder="请选择抽取比例" options={[{ value: 25, label: '25%', }, { value: 50, label: '50%', }]} />
</Form.Item>
<Form.Item className="ant-row" style={{
textAlign: 'center',
}}>
<Button style={{}} type='primary' onClick={extractHandler}>开始抽取</Button>
</Form.Item>
<Form.Item label='抽查县道(条)' name='spotCountyRoadCount'>
<Input disabled />
</Form.Item>
<Form.Item label='抽查乡道(条)' name='spotTownRoadCount'>
<Input disabled />
</Form.Item>
<Form.Item label='抽查村道(条)' name='spotVillageRoadCount'>
<Input disabled />
</Form.Item>
</Form>
</Modal>
}
{
isAdjustment &&
<Adjustment
editData={editData}
onCancel={() => {
setEditData({})
setIsAdjustment(false)
}}
onOk={() => {
queryData({ startTime: dateRange[0], endTime: dateRange[1] })
}}
/>
}
</div >
)
}
function mapStateToProps (state) {
const { auth, roadSpotList, reportDetail, roadSpotDetail } = state
//('state1', state)
return {
user: auth.user,
loading: roadSpotList?.isRequesting,
detailLoading: roadSpotDetail?.isRequesting,
reportDetailLoading: reportDetail.isRequesting,
reportDetail: reportDetail.data,
}
}
export default connect(mapStateToProps)(MaintenanceSpotCheck);

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

@ -4,115 +4,117 @@ import { Menu } from 'antd';
import { ReadOutlined } from '@ant-design/icons'; import { ReadOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
export function getNavItem (user, dispatch) { export function getNavItem (user, dispatch) {
const isshow = user?.userResources?. const isshow = user?.userResources?.
some(i => i.resourceId === 'OVERLOADMANAGE' || some(i => i.resourceId === 'OVERLOADMANAGE' ||
i.resourceId === 'ROADMANAGE' || i.resourceId === 'ROADMANAGE' ||
i.resourceId === 'BRIDGEMANAGE' || i.resourceId === 'BRIDGEMANAGE' ||
i.resourceId === 'MAINTENANCEMANAGE' || i.resourceId === 'MAINTENANCEMANAGE' ||
i.resourceId === 'TRANSPORTATIONMANAGE' || i.resourceId === 'TRANSPORTATIONMANAGE' ||
i.resourceId === 'CONSERVATIONMANAGE' || i.resourceId === 'CONSERVATIONMANAGE' ||
i.resourceId === 'PUBLICTRANSPORTMANAGE' || i.resourceId === 'PUBLICTRANSPORTMANAGE' ||
i.resourceId === 'FILEMANAGE' || i.resourceId === 'FILEMANAGE' ||
i.resourceId === 'PUBLICITYVIDEO' || i.resourceId === 'PUBLICITYVIDEO' ||
i.resourceId === 'FEEDBACKMANAGE' || i.resourceId === 'FEEDBACKMANAGE' ||
i.resourceId === 'REPORTMANAGE' || i.resourceId === 'REPORTMANAGE' ||
i.resourceId === 'PATROLMANAGE' || i.resourceId === 'PATROLMANAGE' ||
i.resourceId === 'ASSESSMANAGE' || i.resourceId === 'ASSESSMANAGE' ||
i.resourceId === 'VIDEOCENTER' || i.resourceId === 'VIDEOCENTER' ||
i.resourceId === 'BUILDINGPROJECT' || i.resourceId === 'BUILDINGPROJECT' ||
i.resourceId === 'MAINTENANCESPOTCHECK' || i.resourceId === 'MAINTENANCESPOTCHECK' ||
i.resourceId === 'LUZHENG' i.resourceId === 'LUZHENG' ||
) i.resourceId === 'ADJUSTLOG'
)
return ( return (
user?.username == 'SuperAdmin' || isshow ? user?.username == 'SuperAdmin' || isshow ?
<SubMenu key="fillion" icon={<ReadOutlined />} title={'数据管理'}> <SubMenu key="fillion" icon={<ReadOutlined />} title={'数据管理'}>
{ {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ?
user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'OVERLOADMANAGE') ? <Menu.Item key="fillioninfor">
<Menu.Item key="fillioninfor"> <Link to="/fillion/infor">治超管理</Link>
<Link to="/fillion/infor">治超管理</Link> </Menu.Item> : ''}
</Menu.Item> : '' {/* <Menu.Item key="filliontask">
}
{/* <Menu.Item key="filliontask">
<Link to="/fillion/task">任务管理</Link> <Link to="/fillion/task">任务管理</Link>
</Menu.Item> */} </Menu.Item> */}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'LUZHENG') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'LUZHENG') ?
<Menu.Item key="luzheng"> <Menu.Item key="luzheng">
<Link to="/fillion/luzheng">路政管理</Link> <Link to="/fillion/luzheng">路政管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ROADMANAGE') ?
<Menu.Item key="filliontransportation"> <Menu.Item key="filliontransportation">
<Link to="/fillion/transportation">道路管理</Link> <Link to="/fillion/transportation">道路管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BRIDGEMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BRIDGEMANAGE') ?
<Menu.Item key="fillionbridge"> <Menu.Item key="fillionbridge">
<Link to="/fillion/bridge">桥梁管理</Link> <Link to="/fillion/bridge">桥梁管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCEMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCEMANAGE') ?
<Menu.Item key="fillionhighways"> <Menu.Item key="fillionhighways">
<Link to="/fillion/highways">管养管理</Link> <Link to="/fillion/highways">管养管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'TRANSPORTATIONMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'TRANSPORTATIONMANAGE') ?
<Menu.Item key="fillionoperational"> <Menu.Item key="fillionoperational">
<Link to="/fillion/operational">运政管理</Link> <Link to="/fillion/operational">运政管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{/* <Menu.Item key="fillionenforce"> {/* <Menu.Item key="fillionenforce">
<Link to="/fillion/enforce">执法管理</Link> <Link to="/fillion/enforce">执法管理</Link>
</Menu.Item> */} </Menu.Item> */}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'CONSERVATIONMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'CONSERVATIONMANAGE') ?
<Menu.Item key="fillionmaintenance"> <Menu.Item key="fillionmaintenance">
<Link to="/fillion/maintenance">养护管理</Link> <Link to="/fillion/maintenance">养护管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PATROLMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PATROLMANAGE') ?
<Menu.Item key="fillionpatrol"> <Menu.Item key="fillionpatrol">
<Link to="/fillion/patrol">巡查管理</Link> <Link to="/fillion/patrol">巡查管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FEEDBACKMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FEEDBACKMANAGE') ?
<Menu.Item key="fillionpatrolanomaly"> <Menu.Item key="fillionpatrolanomaly">
<Link to="/fillion/patrol_anomaly">异常反馈</Link> <Link to="/fillion/patrol_anomaly">异常反馈</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'REPORTMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'REPORTMANAGE') ?
<Menu.Item key="fillionpatrolroad"> <Menu.Item key="fillionpatrolroad">
<Link to="/fillion/patrol_road">建设上报</Link> <Link to="/fillion/patrol_road">建设上报</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BUILDINGPROJECT') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'BUILDINGPROJECT') ?
<Menu.Item key="fillionbuilding"> <Menu.Item key="fillionbuilding">
<Link to="/fillion/processsing">在建项目</Link> <Link to="/fillion/processsing">在建项目</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICTRANSPORTMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICTRANSPORTMANAGE') ?
<Menu.Item key="fillionpublic"> <Menu.Item key="fillionpublic">
<Link to="/fillion/public">公交管理</Link> <Link to="/fillion/public">公交管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FILEMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'FILEMANAGE') ?
<Menu.Item key="fileCont"> <Menu.Item key="fileCont">
<Link to="/fillion/file">档案管理</Link> <Link to="/fillion/file">档案管理</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{/* <Menu.Item key="fillionvideois"> {/* <Menu.Item key="fillionvideois">
<Link to="/fillion/videois">视频管理</Link> <Link to="/fillion/videois">视频管理</Link>
</Menu.Item> */} </Menu.Item> */}
{/* <Menu.Item key="jiekouguanli"> {/* <Menu.Item key="jiekouguanli">
<Link to="/fillion/jiekouguanli">接口管理</Link> <Link to="/fillion/jiekouguanli">接口管理</Link>
</Menu.Item> */} </Menu.Item> */}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICITYVIDEO') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'PUBLICITYVIDEO') ?
<Menu.Item key="fillionpromotional"> <Menu.Item key="fillionpromotional">
<Link to="/fillion/promotional">宣传视频</Link> <Link to="/fillion/promotional">宣传视频</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ASSESSMANAGE') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ASSESSMANAGE') ?
<Menu.Item key="fillionassess"> <Menu.Item key="fillionassess">
<Link to="/fillion/assess">考核评分</Link> <Link to="/fillion/assess">考核评分</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'VIDEOCENTER') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'VIDEOCENTER') ?
<Menu.Item key="fillionvideoCenter"> <Menu.Item key="fillionvideoCenter">
<Link to="/fillion/videoCenter">视频中心</Link> <Link to="/fillion/videoCenter">视频中心</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ? {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'MAINTENANCESPOTCHECK') ?
<Menu.Item key="maintenanceSpotCheck"> <Menu.Item key="maintenanceSpotCheck">
<Link to="/fillion/maintenanceSpotCheck">养护抽查</Link> <Link to="/fillion/maintenanceSpotCheck">养护抽查</Link>
</Menu.Item> : ''} </Menu.Item> : ''}
</SubMenu> : null {user?.username == 'SuperAdmin' || user?.userResources?.some(i => i.resourceId === 'ADJUSTLOG') ?
); <Menu.Item key="adjustLog">
<Link to="/fillion/adjustLog">调整日志</Link>
</Menu.Item> : ''}
</SubMenu> : null
);
} }

339
web/client/src/sections/fillion/routes.js

@ -14,184 +14,193 @@ import { File } from './containers';
import { Jiekouguanli } from './containers' import { Jiekouguanli } from './containers'
import { Task, Assess, VideoCenter, } from './containers' import { Task, Assess, VideoCenter, } from './containers'
import { Building } from './containers' import { Building } from './containers'
import { MaintenanceSpotCheck } from './containers' import { MaintenanceSpotCheckNew, AdjustLog } from './containers'
import Luzheng from './containers/luzheng'; import Luzheng from './containers/luzheng';
export default [{ export default [{
type: 'inner', type: 'inner',
route: { route: {
path: '/fillion', path: '/fillion',
key: 'fillion', key: 'fillion',
breadcrumb: '数据管理', breadcrumb: '数据管理',
menuSelectKeys: ['fillion'], menuSelectKeys: ['fillion'],
menuOpenKeys: ['fillion'], menuOpenKeys: ['fillion'],
childRoutes: [{ childRoutes: [{
path: '/infor', path: '/infor',
key: 'fillioninfor', key: 'fillioninfor',
menuSelectKeys: ['fillioninfor'], menuSelectKeys: ['fillioninfor'],
component: Infor, component: Infor,
breadcrumb: '治超管理', breadcrumb: '治超管理',
authCode: 'OVERLOADMANAGE' authCode: 'OVERLOADMANAGE'
}, },
{ {
path: '/luzheng', path: '/luzheng',
key: 'luzheng', key: 'luzheng',
menuSelectKeys: ['luzheng'], menuSelectKeys: ['luzheng'],
component: Luzheng, component: Luzheng,
breadcrumb: '路政管理', breadcrumb: '路政管理',
authCode: 'OVERLOADMANAGE' authCode: 'OVERLOADMANAGE'
}, },
{ {
path: '/task', path: '/task',
key: 'filliontask', key: 'filliontask',
menuSelectKeys: ['filliontask'], menuSelectKeys: ['filliontask'],
component: Task, component: Task,
breadcrumb: '任务管理', breadcrumb: '任务管理',
//authCode: 'OVERLOADMANAGE' //authCode: 'OVERLOADMANAGE'
}, { }, {
path: '/transportation', path: '/transportation',
key: 'filliontransportation', key: 'filliontransportation',
menuSelectKeys: ['filliontransportation'], menuSelectKeys: ['filliontransportation'],
component: transportation, component: transportation,
breadcrumb: '道路管理', breadcrumb: '道路管理',
authCode: 'ROADMANAGE' authCode: 'ROADMANAGE'
}, },
{ {
path: '/processsing', path: '/processsing',
key: 'fillionprocesssing', key: 'fillionprocesssing',
menuSelectKeys: ['fillionprocesssing'], menuSelectKeys: ['fillionprocesssing'],
component: Building, component: Building,
breadcrumb: '在建项目', breadcrumb: '在建项目',
authCode: 'BUILDINGPROJECT' authCode: 'BUILDINGPROJECT'
} }
, { , {
path: '/bridge', path: '/bridge',
key: 'fillionbridge', key: 'fillionbridge',
menuSelectKeys: ['fillionbridge'], menuSelectKeys: ['fillionbridge'],
component: BridgeTable, component: BridgeTable,
breadcrumb: '桥梁管理', breadcrumb: '桥梁管理',
authCode: 'BRIDGEMANAGE' authCode: 'BRIDGEMANAGE'
} }
, { , {
path: '/highways', path: '/highways',
key: 'fillionhighways', key: 'fillionhighways',
menuSelectKeys: ['fillionhighways'], menuSelectKeys: ['fillionhighways'],
component: HigHways, component: HigHways,
breadcrumb: '管养管理', breadcrumb: '管养管理',
authCode: 'MAINTENANCEMANAGE' authCode: 'MAINTENANCEMANAGE'
}, { }, {
path: '/operational', path: '/operational',
key: 'fillionoperational', key: 'fillionoperational',
menuSelectKeys: ['fillionoperational'], menuSelectKeys: ['fillionoperational'],
component: OperaTional, component: OperaTional,
breadcrumb: '运政管理', breadcrumb: '运政管理',
authCode: 'TRANSPORTATIONMANAGE' authCode: 'TRANSPORTATIONMANAGE'
}, { }, {
path: '/enforce', path: '/enforce',
key: 'fillionenforce', key: 'fillionenforce',
menuSelectKeys: ['fillionenforce'], menuSelectKeys: ['fillionenforce'],
component: Enforce, component: Enforce,
breadcrumb: '执法管理', breadcrumb: '执法管理',
}, { }, {
path: '/maintenance', path: '/maintenance',
key: 'fillionmaintenance', key: 'fillionmaintenance',
menuSelectKeys: ['fillionmaintenance'], menuSelectKeys: ['fillionmaintenance'],
component: Maintenance, component: Maintenance,
breadcrumb: '养护管理', breadcrumb: '养护管理',
authCode: 'CONSERVATIONMANAGE' authCode: 'CONSERVATIONMANAGE'
}, { }, {
path: '/patrol', path: '/patrol',
key: 'fillionpatrol', key: 'fillionpatrol',
menuSelectKeys: ['fillionpatrol'], menuSelectKeys: ['fillionpatrol'],
component: Patrol, component: Patrol,
breadcrumb: '巡查管理', breadcrumb: '巡查管理',
authCode: 'PATROLMANAGE' authCode: 'PATROLMANAGE'
}, { }, {
path: '/patrol_anomaly', path: '/patrol_anomaly',
key: 'fillionpatrolanomaly', key: 'fillionpatrolanomaly',
menuSelectKeys: ['fillionpatrolanomaly'], menuSelectKeys: ['fillionpatrolanomaly'],
component: Patrol, component: Patrol,
breadcrumb: '异常反馈', breadcrumb: '异常反馈',
authCode: 'FEEDBACKMANAGE' authCode: 'FEEDBACKMANAGE'
}, { }, {
path: '/patrol_road', path: '/patrol_road',
key: 'fillionpatrolroad', key: 'fillionpatrolroad',
menuSelectKeys: ['fillionpatrolroad'], menuSelectKeys: ['fillionpatrolroad'],
component: Patrol, component: Patrol,
breadcrumb: '建设上报', breadcrumb: '建设上报',
authCode: 'REPORTMANAGE' authCode: 'REPORTMANAGE'
}, { }, {
path: '/public', path: '/public',
key: 'fillionpublic', key: 'fillionpublic',
menuSelectKeys: ['fillionpublic'], menuSelectKeys: ['fillionpublic'],
component: Public, component: Public,
breadcrumb: '公交管理', breadcrumb: '公交管理',
authCode: 'PUBLICTRANSPORTMANAGE' authCode: 'PUBLICTRANSPORTMANAGE'
}, },
{ {
path: '/file', path: '/file',
key: 'fileCont', key: 'fileCont',
menuSelectKeys: ['fileCont'], menuSelectKeys: ['fileCont'],
component: File, component: File,
breadcrumb: '档案管理', breadcrumb: '档案管理',
authCode: 'FILEMANAGE' authCode: 'FILEMANAGE'
}, },
{ {
path: '/videois', path: '/videois',
key: 'fillionvideois', key: 'fillionvideois',
menuSelectKeys: ['fillionvideois'], menuSelectKeys: ['fillionvideois'],
component: Videois, component: Videois,
breadcrumb: '视频管理', breadcrumb: '视频管理',
authCode: 'PUBLICITYVIDEO' authCode: 'PUBLICITYVIDEO'
}, },
{ {
path: '/jiekouguanli', path: '/jiekouguanli',
key: 'jiekouguanli', key: 'jiekouguanli',
menuSelectKeys: ['jiekouguanli'], menuSelectKeys: ['jiekouguanli'],
component: Jiekouguanli, component: Jiekouguanli,
breadcrumb: '接口管理', breadcrumb: '接口管理',
}, { }, {
path: '/promotional', path: '/promotional',
key: 'fillionpromotional', key: 'fillionpromotional',
menuSelectKeys: ['fillionpromotional'], menuSelectKeys: ['fillionpromotional'],
component: PromoTional, component: PromoTional,
breadcrumb: '视频管理', breadcrumb: '视频管理',
authCode: 'PUBLICITYVIDEO' authCode: 'PUBLICITYVIDEO'
}, { }, {
path: '/assess', path: '/assess',
key: 'fillionassess', key: 'fillionassess',
menuSelectKeys: ['fillionassess'], menuSelectKeys: ['fillionassess'],
component: Assess, component: Assess,
breadcrumb: '考核评分', breadcrumb: '考核评分',
authCode: 'ASSESSMANAGE' authCode: 'ASSESSMANAGE'
}, { }, {
path: '/videoCenter', path: '/videoCenter',
key: 'fillionvideoCenter', key: 'fillionvideoCenter',
menuSelectKeys: ['fillionvideoCenter'], menuSelectKeys: ['fillionvideoCenter'],
component: VideoCenter, component: VideoCenter,
breadcrumb: '视频中心', breadcrumb: '视频中心',
authCode: 'VIDEOCENTER' authCode: 'VIDEOCENTER'
}, },
{ {
path: '/maintenanceSpotCheck', path: '/maintenanceSpotCheck',
key: 'maintenanceSpotCheck', key: 'maintenanceSpotCheck',
menuSelectKeys: ['maintenanceSpotCheck'], menuSelectKeys: ['maintenanceSpotCheck'],
component: MaintenanceSpotCheck, component: MaintenanceSpotCheckNew,
breadcrumb: '养护抽查', breadcrumb: '养护抽查',
authCode: 'MAINTENANCESPOTCHECK' authCode: 'MAINTENANCESPOTCHECK'
} },
] {
} path: '/adjustLog',
key: 'adjustLog',
menuSelectKeys: ['adjustLog'],
component: AdjustLog,
breadcrumb: '调整日志',
authCode: 'ADJUSTLOG'
}
]
}
}]; }];

492
web/client/src/sections/organization/containers/authority.js

@ -9,282 +9,282 @@ import Resource from '../components/resource';
import user from './user'; import user from './user';
const Authority = (props) => { const Authority = (props) => {
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = props const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = props
const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE', const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE',
'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE', 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE',
'ASSESSMANAGE', 'VIDEOCENTER', 'BUILDINGPROJECT', 'WXPATROLREPORT', 'WXMAINTENANCEREPORT', 'WXFEEDBACKMANAGE', 'WXBUILDINGROAD', 'ASSESSMANAGE', 'VIDEOCENTER', 'BUILDINGPROJECT', 'WXPATROLREPORT', 'WXMAINTENANCEREPORT', 'WXFEEDBACKMANAGE', 'WXBUILDINGROAD',
'WXTODOANDONE', 'MAINTENANCESPOTCHECK' 'WXTODOANDONE', 'MAINTENANCESPOTCHECK', 'ADJUSTLOG'
] ]
const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员
const [depSelectedKeys, setDepSelectedKeys] = useState([]) const [depSelectedKeys, setDepSelectedKeys] = useState([])
const [userSelectedKeys, setUserSelectedKeys] = useState([]) const [userSelectedKeys, setUserSelectedKeys] = useState([])
const [depSelected, setDepSelected] = useState() const [depSelected, setDepSelected] = useState()
const [userSelected, setUserSelected] = useState() const [userSelected, setUserSelected] = useState()
const [resCode, setResCode] = useState(userResource.map(i => i.resourceId)) const [resCode, setResCode] = useState(userResource.map(i => i.resourceId))
const [useName, setUseName] = useState()// 选中名字 const [useName, setUseName] = useState()// 选中名字
const [userType, setUserType] = useState() const [userType, setUserType] = useState()
const [depMessagedata, setdepMessagedata] = useState(depMessage) const [depMessagedata, setdepMessagedata] = useState(depMessage)
const rescodeall = resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })) const rescodeall = resource[0]?.resources?.map(i => ({ label: i.name, value: i.code }))
//console.log(resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })), '这个是总的骂') //console.log(resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })), '这个是总的骂')
const [indeterminate, setIndeterminate] = useState(false); const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(true); const [checkAll, setCheckAll] = useState(true);
const [rescheckAll, setrescheckAll] = useState(false) const [rescheckAll, setrescheckAll] = useState(false)
const [isshow, setisshow] = useState(false); const [isshow, setisshow] = useState(false);
let plainOptions = depUser.map(i => ({ label: i.name, value: i.id })); let plainOptions = depUser.map(i => ({ label: i.name, value: i.id }));
const [checkedList, setCheckedList] = useState(depUser.map(i => i.id)); const [checkedList, setCheckedList] = useState(depUser.map(i => i.id));
const onChange = (list) => { const onChange = (list) => {
// console.log(list,'选择的') // console.log(list,'选择的')
setCheckedList(list); setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length); setIndeterminate(!!list.length && list.length < plainOptions.length);
// setResCode(userResource.map(i=>i.resourceId)) // setResCode(userResource.map(i=>i.resourceId))
setCheckAll(list.length === plainOptions.length); setCheckAll(list.length === plainOptions.length);
dispatch(getUserResource(list)) dispatch(getUserResource(list))
// if(list.length === plainOptions.length){ // if(list.length === plainOptions.length){
// setUseName('全部用户') // setUseName('全部用户')
// } // }
}; };
// console.log(userSelectedKeys,'当前1') // console.log(userSelectedKeys,'当前1')
const onresChange = (d) => { const onresChange = (d) => {
setResCode(d) setResCode(d)
setrescheckAll(d.length === r1.length) setrescheckAll(d.length === r1.length)
} }
const onresCheckAllChange = (d) => { const onresCheckAllChange = (d) => {
setrescheckAll(d.target.checked) setrescheckAll(d.target.checked)
setResCode(d.target.checked ? r1 : []) setResCode(d.target.checked ? r1 : [])
} }
const onCheckAllChange = (e) => { const onCheckAllChange = (e) => {
setCheckedList(e.target.checked ? plainOptions.map(i => i.value) : []); setCheckedList(e.target.checked ? plainOptions.map(i => i.value) : []);
setIndeterminate(false); setIndeterminate(false);
// if(e.target.checked){ // if(e.target.checked){
// setUseName('全部用户') // setUseName('全部用户')
// } // }
setCheckAll(e.target.checked); setCheckAll(e.target.checked);
// setResCode(userResource.map(i=>i.resourceId)) // setResCode(userResource.map(i=>i.resourceId))
}; };
const onshowchange = (e) => { const onshowchange = (e) => {
setisshow(e.target.checked) setisshow(e.target.checked)
} }
//console.log('depMessagedata', depMessagedata) //console.log('depMessagedata', depMessagedata)
useEffect(() => { useEffect(() => {
dispatch(getResource()) dispatch(getResource())
if (!(depMessage && depMessage.length)) { if (!(depMessage && depMessage.length)) {
dispatch(getDepMessage()) dispatch(getDepMessage())
} }
setResCode(userResource.map(i => i.resourceId)) setResCode(userResource.map(i => i.resourceId))
setisshow(userResource.some(i => i.isshow === "true")) setisshow(userResource.some(i => i.isshow === "true"))
setrescheckAll(userResource.map(i => i.resourceId).length === 14) setrescheckAll(userResource.map(i => i.resourceId).length === 14)
}, []) }, [])
useEffect(() => { useEffect(() => {
setResCode(userResource.map(i => i.resourceId)) setResCode(userResource.map(i => i.resourceId))
setisshow(userResource.some(i => i.isshow === "true")) setisshow(userResource.some(i => i.isshow === "true"))
setrescheckAll(userResource.map(i => i.resourceId).length === 14) setrescheckAll(userResource.map(i => i.resourceId).length === 14)
}, [userResource]) }, [userResource])
useEffect(async () => { useEffect(async () => {
if (depMessage.length) { if (depMessage.length) {
//('depMessage', depMessage) //('depMessage', depMessage)
//超级管理员展示所有部门 //超级管理员展示所有部门
if (user?.username === 'SuperAdmin') { if (user?.username === 'SuperAdmin') {
setdepMessagedata(depMessage) setdepMessagedata(depMessage)
dispatch(getDepUser(depMessage[0]?.id)) dispatch(getDepUser(depMessage[0]?.id))
setDepSelectedKeys([depMessage[0]?.id]) setDepSelectedKeys([depMessage[0]?.id])
setDepSelected([depMessage[0]?.name]) setDepSelected([depMessage[0]?.name])
} else { } else {
//不是超级管理员,展示相应部门的数据 //不是超级管理员,展示相应部门的数据
dispatch(getDepUser(user.departmentId)) dispatch(getDepUser(user.departmentId))
const res = await dispatch(getDepById({ deptId: parseInt(user.departmentId) })) const res = await dispatch(getDepById({ deptId: parseInt(user.departmentId) }))
//console.log('resssss', res) //console.log('resssss', res)
setdepMessagedata(res.payload.data) setdepMessagedata(res.payload.data)
// if (authDep.length > 0) { // if (authDep.length > 0) {
// dispatch(getDepUser(authDep[0]?.id)) // dispatch(getDepUser(authDep[0]?.id))
// setDepSelectedKeys([authDep[0]?.id]) // setDepSelectedKeys([authDep[0]?.id])
// setDepSelected([authDep[0]?.name]) // setDepSelected([authDep[0]?.name])
// } // }
} }
} }
}, [depMessage]) }, [depMessage])
// useEffect(() => { // useEffect(() => {
// if(user.username!=='SuperAdmin'){ // if(user.username!=='SuperAdmin'){
// dispatch(getDepMessage(user.departmentId)) // dispatch(getDepMessage(user.departmentId))
// } // }
// }, [depMessage]) // }, [depMessage])
useEffect(() => { useEffect(() => {
const copy = [...new Set(depUser)] const copy = [...new Set(depUser)]
setDepUserCopy(copy) setDepUserCopy(copy)
if (copy.length) { if (copy.length) {
setUserSelectedKeys([copy[0].id]) setUserSelectedKeys([copy[0].id])
setUserSelected(copy[0].username) setUserSelected(copy[0].username)
dispatch(getUserResource(copy[0].id)) dispatch(getUserResource(copy[0].id))
setUseName(copy[0].name) setUseName(copy[0].name)
} }
setCheckedList(copy.map(i => i.id)) setCheckedList(copy.map(i => i.id))
}, [depUser]) }, [depUser])
// console.log(depUser,'用户信息') // console.log(depUser,'用户信息')
const handleSave = () => { const handleSave = () => {
// console.log( userSelectedKeys[0],'当前选中的id') // console.log( userSelectedKeys[0],'当前选中的id')
// checkedList.map(i=>{ // checkedList.map(i=>{
// dispatch(postUserRes({ userId: i, resCode: resCode,isShow:isshow })).then(res => { // dispatch(postUserRes({ userId: i, resCode: resCode,isShow:isshow })).then(res => {
// if (res.success) { // if (res.success) {
// dispatch(getUserResource(i)) // dispatch(getUserResource(i))
// } // }
// }) // })
// dispatch(postUserReso({ userId: i, resCode: resCode,isShow:isshow })) // dispatch(postUserReso({ userId: i, resCode: resCode,isShow:isshow }))
// }) // })
dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })).then(res => { dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })).then(res => {
if (res.success) { if (res.success) {
dispatch(getUserResource(userSelectedKeys[0])) dispatch(getUserResource(userSelectedKeys[0]))
} }
}) })
dispatch(postUserReso({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })) dispatch(postUserReso({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow }))
} }
return ( return (
<Spin spinning={loading}> <Spin spinning={loading}>
<Row gutter={16}> <Row gutter={16}>
<Col span={4} style={{ height: '100%' }}> <Col span={4} style={{ height: '100%' }}>
<Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> <Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{ {
depMessagedata.length ? depMessagedata.length ?
<Tree <Tree
height={clientHeight - 100} height={clientHeight - 100}
defaultExpandedKeys={[depMessagedata[0].id]} defaultExpandedKeys={[depMessagedata[0].id]}
selectedKeys={depSelectedKeys} selectedKeys={depSelectedKeys}
onSelect={(selectedKeys, { selected, selectedNodes, node }) => { onSelect={(selectedKeys, { selected, selectedNodes, node }) => {
setUserType(selectedNodes[0].type) setUserType(selectedNodes[0].type)
setCheckedList(depUserCopy.map(i => i.id)) setCheckedList(depUserCopy.map(i => i.id))
// setResCode(userResource.map(i=>i.resourceId)) // setResCode(userResource.map(i=>i.resourceId))
if (selected) { if (selected) {
setCheckedList(depUserCopy.map(i => i.id)) setCheckedList(depUserCopy.map(i => i.id))
setDepSelectedKeys(selectedKeys) setDepSelectedKeys(selectedKeys)
setDepSelected(selectedNodes[0].name || "") setDepSelected(selectedNodes[0].name || "")
dispatch(getDepUser(selectedKeys[0])) dispatch(getDepUser(selectedKeys[0]))
// setResCode(userResource.map(i=>i.resourceId)) // setResCode(userResource.map(i=>i.resourceId))
} }
}} }}
treeData={depMessagedata} treeData={depMessagedata}
fieldNames={{ fieldNames={{
title: 'name', title: 'name',
key: 'id', key: 'id',
children: 'subordinate' children: 'subordinate'
}} }}
/> : '' /> : ''
} }
</Card> </Card>
</Col> </Col>
<Col span={4} style={{ height: '100%', }}> <Col span={4} style={{ height: '100%', }}>
<Card title={` 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> <Card title={` 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{ {
depUserCopy?.length ? depUserCopy?.length ?
<Tree <Tree
height={clientHeight - 100} height={clientHeight - 100}
defaultSelectedKeys={[depUserCopy[0]?.id]} defaultSelectedKeys={[depUserCopy[0]?.id]}
selectedKeys={userSelectedKeys} selectedKeys={userSelectedKeys}
onSelect={(selectedKeys, { selected, selectedNodes, node, event }) => { onSelect={(selectedKeys, { selected, selectedNodes, node, event }) => {
const name = node.name const name = node.name
setUseName(name) setUseName(name)
if (selected) { if (selected) {
// console.log(selectedKeys,'选中的selectedKeys') // console.log(selectedKeys,'选中的selectedKeys')
// console.log(selectedNodes[0].username || '','node') // console.log(selectedNodes[0].username || '','node')
// console.log(selectedKeys[0],'请求的值') // console.log(selectedKeys[0],'请求的值')
setUserSelectedKeys(selectedKeys) setUserSelectedKeys(selectedKeys)
setUserSelected(selectedNodes[0].username || '') setUserSelected(selectedNodes[0].username || '')
dispatch(getUserResource(selectedKeys[0])) dispatch(getUserResource(selectedKeys[0]))
} }
}} }}
treeData={depUserCopy} treeData={depUserCopy}
fieldNames={{ fieldNames={{
title: 'name', title: 'name',
key: 'id' key: 'id'
}} }}
/> : <Empty /> /> : <Empty />
// <div> // <div>
// <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}> // <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}>
// 全选 // 全选
// </Checkbox> // </Checkbox>
// <CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/> // <CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/>
// </div> : <Empty /> // </div> : <Empty />
} }
</Card> </Card>
</Col> </Col>
<Col span={16} style={{ height: '100%', }}> <Col span={16} style={{ height: '100%', }}>
<Checkbox onChange={onshowchange} checked={isshow} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}> <Checkbox onChange={onshowchange} checked={isshow} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}>
不可编辑 不可编辑
</Checkbox> </Checkbox>
{depUserCopy?.length ? {depUserCopy?.length ?
<Card title={` 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> <Card title={` 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{/* <Resource {/* <Resource
userSelected={userSelected} userSelected={userSelected}
roleData={resource} roleData={resource}
userRole={userResource} userRole={userResource}
setResCode={setResCode} setResCode={setResCode}
userType={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?4:userType} userType={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?4:userType}
/> */} /> */}
<div> <div>
<Checkbox <Checkbox
onChange={onresCheckAllChange} onChange={onresCheckAllChange}
checked={rescheckAll} checked={rescheckAll}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''}
> >
全选 全选
</Checkbox> </Checkbox>
<CheckboxGroup <CheckboxGroup
options={rescodeall} options={rescodeall}
value={resCode} value={resCode}
onChange={onresChange} onChange={onresChange}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''}
/> />
</div> </div>
<Row type="flex" justify="center" style={{ marginBottom: 16, marginTop: 16, textAlign: 'center' }}> <Row type="flex" justify="center" style={{ marginBottom: 16, marginTop: 16, textAlign: 'center' }}>
<Col span="24"> <Col span="24">
<Button <Button
disabled={userSelected === "SuperAdmin" || userType === 4} disabled={userSelected === "SuperAdmin" || userType === 4}
onClick={handleSave} onClick={handleSave}
style={{ width: '60%' }} style={{ width: '60%' }}
type='primary'>保存修改</Button> type='primary'>保存修改</Button>
</Col></Row> </Col></Row>
</Card> </Card>
: <Card title={`[]功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}> : <Card title={`[]功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
<Empty /> <Empty />
</Card> </Card>
} }
</Col> </Col>
</Row> </Row>
</Spin > </Spin >
) )
} }
function mapStateToProps(state) { function mapStateToProps (state) {
const { userResource, resource, depMessage, depUser, global, auth } = state; const { userResource, resource, depMessage, depUser, global, auth } = state;
return { return {
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting, loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting,
userResource: userResource.data || [], userResource: userResource.data || [],
resource: resource.data || [], resource: resource.data || [],
depMessage: depMessage.data || [], depMessage: depMessage.data || [],
depUser: depUser.data || [], depUser: depUser.data || [],
user: auth.user user: auth.user
}; };
} }
export default connect(mapStateToProps)(Authority); export default connect(mapStateToProps)(Authority);
Loading…
Cancel
Save