diff --git a/web/client/src/layout/components/header/index.js b/web/client/src/layout/components/header/index.js
index 04913c1e..066188d8 100644
--- a/web/client/src/layout/components/header/index.js
+++ b/web/client/src/layout/components/header/index.js
@@ -56,7 +56,7 @@ const Header = props => {
style={{ border: 0 }}
onClick={handelClick}
>
-
history.push(`/screen/cockpit`)}>进入大屏
+ {user?.username === 'SuperAdmin' ? history.push(`/screen/cockpit`)}>进入大屏
: ''}
{
);
};
-function mapStateToProps (state) {
+function mapStateToProps(state) {
const { global, auth } = state;
return {
actions: global.actions,
diff --git a/web/client/src/layout/index.js b/web/client/src/layout/index.js
index f7f4d123..d3d483c8 100644
--- a/web/client/src/layout/index.js
+++ b/web/client/src/layout/index.js
@@ -60,6 +60,9 @@ const Root = props => {
}
flat(routes);
+ //将路由信息全部放在session,方便后面拿了用(权限控制的时候)
+ console.log('combineRoutes1', combineRoutes)
+ sessionStorage.setItem('allRoutes', JSON.stringify(combineRoutes));
return combineRoutes;
}
@@ -160,6 +163,7 @@ const Root = props => {
{combineRoutes}
diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js
index 5bb5ca5e..54dc9b31 100644
--- a/web/client/src/sections/auth/containers/login.js
+++ b/web/client/src/sections/auth/containers/login.js
@@ -5,6 +5,7 @@ import { push } from 'react-router-redux';
import { Button, Input, Form, Row, Col, message } from 'antd';
import { login } from '../actions/auth';
import './style.less';
+import leftTop from '../../quanju/containers/footer/conserve/left/left-top';
const FormItem = Form.Item;
const Login = props => {
@@ -25,7 +26,23 @@ const Login = props => {
}, [error])
useEffect(() => {
- user && user.authorized ? dispatch(push('/screen/cockpit')) : null
+ const allroutes = JSON.parse(sessionStorage.getItem('allRoutes')) || []
+ let hasAuth = []
+ if (user && user.authorized) {
+ hasAuth = allroutes?.filter((item) => { return user?.userResources.find((child) => { return child.resourceId === item.authCode }) })
+ if (user?.username === 'SuperAdmin') {
+ dispatch(push('/fillion/infor'))
+ }
+ else if (hasAuth && hasAuth.length > 0) {
+ const path = hasAuth[0].path
+ console.log('sasa', `${path}`)
+ dispatch(push(path))
+ } else {
+ dispatch(push('/noContent'))
+ }
+ }
+
+ //user && user.authorized ? dispatch(push('/screen/cockpit')) : null
}, [user])
const enterHandler = e => {
diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js
index ce477b61..25bec14a 100644
--- a/web/client/src/sections/fillion/routes.js
+++ b/web/client/src/sections/fillion/routes.js
@@ -28,18 +28,22 @@ export default [{
menuSelectKeys: ['fillioninfor'],
component: Infor,
breadcrumb: '治超管理',
+ authCode: 'OVERLOADMANAGE'
}, {
path: '/task',
key: 'filliontask',
menuSelectKeys: ['filliontask'],
component: Task,
breadcrumb: '任务管理',
+ //authCode: 'OVERLOADMANAGE'
}, {
path: '/transportation',
key: 'filliontransportation',
menuSelectKeys: ['filliontransportation'],
component: transportation,
breadcrumb: '道路管理',
+ authCode: 'ROADMANAGE'
+
}
, {
path: '/bridge',
@@ -47,6 +51,8 @@ export default [{
menuSelectKeys: ['fillionbridge'],
component: BridgeTable,
breadcrumb: '桥梁管理',
+ authCode: 'BRIDGEMANAGE'
+
}
, {
path: '/highways',
@@ -54,12 +60,16 @@ export default [{
menuSelectKeys: ['fillionhighways'],
component: HigHways,
breadcrumb: '管养管理',
+ authCode: 'MAINTENANCEMANAGE'
+
}, {
path: '/operational',
key: 'fillionoperational',
menuSelectKeys: ['fillionoperational'],
component: OperaTional,
breadcrumb: '运政管理',
+ authCode: 'TRANSPORTATIONMANAGE'
+
}, {
path: '/enforce',
key: 'fillionenforce',
@@ -72,30 +82,39 @@ export default [{
menuSelectKeys: ['fillionmaintenance'],
component: Maintenance,
breadcrumb: '养护管理',
+ authCode: 'CONSERVATIONMANAGE'
}, {
path: '/patrol',
key: 'fillionpatrol',
menuSelectKeys: ['fillionpatrol'],
component: Patrol,
breadcrumb: '巡查管理',
+ authCode: 'PATROLMANAGE'
+
}, {
path: '/patrol_anomaly',
key: 'fillionpatrolanomaly',
menuSelectKeys: ['fillionpatrolanomaly'],
component: Patrol,
breadcrumb: '异常反馈',
+ authCode: 'FEEDBACKMANAGE'
+
}, {
path: '/patrol_road',
key: 'fillionpatrolroad',
menuSelectKeys: ['fillionpatrolroad'],
component: Patrol,
breadcrumb: '建设上报',
+ authCode: 'REPORTMANAGE'
+
}, {
path: '/public',
key: 'fillionpublic',
menuSelectKeys: ['fillionpublic'],
component: Public,
breadcrumb: '公交管理',
+ authCode: 'PUBLICTRANSPORTMANAGE'
+
},
{
path: '/file',
@@ -103,6 +122,8 @@ export default [{
menuSelectKeys: ['fileCont'],
component: File,
breadcrumb: '档案管理',
+ authCode: 'FILEMANAGE'
+
},
{
path: '/videois',
@@ -110,6 +131,8 @@ export default [{
menuSelectKeys: ['fillionvideois'],
component: Videois,
breadcrumb: '视频管理',
+ authCode: 'PUBLICITYVIDEO'
+
},
{
path: '/jiekouguanli',
@@ -123,12 +146,14 @@ export default [{
menuSelectKeys: ['fillionpromotional'],
component: PromoTional,
breadcrumb: '视频管理',
+ authCode: 'PUBLICITYVIDEO'
}, {
path: '/assess',
key: 'fillionassess',
menuSelectKeys: ['fillionassess'],
component: Assess,
breadcrumb: '考核评分',
+
}
]
}
diff --git a/web/client/src/sections/organization/containers/authority.js b/web/client/src/sections/organization/containers/authority.js
index aece8e9a..2f5272f0 100644
--- a/web/client/src/sections/organization/containers/authority.js
+++ b/web/client/src/sections/organization/containers/authority.js
@@ -10,7 +10,10 @@ const Authority = (props) => {
const CheckboxGroup = Checkbox.Group;
const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = props
const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE',
- 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE']
+ 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE',
+ 'WXPATROLREPORT', 'WXMAINTENANCEREPORT', 'WXFEEDBACKMANAGE', 'WXBUILDINGROAD'
+ ]
+ const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员
const [depSelectedKeys, setDepSelectedKeys] = useState([])
const [userSelectedKeys, setUserSelectedKeys] = useState([])
const [depSelected, setDepSelected] = useState()
@@ -26,6 +29,7 @@ const Authority = (props) => {
const [checkAll, setCheckAll] = useState(true);
const [rescheckAll, setrescheckAll] = useState(false)
const [isshow, setisshow] = useState(false);
+
let plainOptions = depUser.map(i => ({ label: i.name, value: i.id }));
const [checkedList, setCheckedList] = useState(depUser.map(i => i.id));
const onChange = (list) => {
@@ -79,24 +83,45 @@ const Authority = (props) => {
useEffect(() => {
if (depMessage.length) {
console.log('depMessage', depMessage)
- setdepMessagedata(depMessage)
- setDepSelectedKeys([depMessage[0]?.id])
- setDepSelected([depMessage[0]?.name])
- dispatch(getDepUser(depMessage[0]?.id))
+ //超级管理员展示所有部门
+ if (user?.username === 'SuperAdmin') {
+ setdepMessagedata(depMessage)
+ dispatch(getDepUser(depMessage[0]?.id))
+ setDepSelectedKeys([depMessage[0]?.id])
+ setDepSelected([depMessage[0]?.name])
+ } else {
+ //不是超级管理员,展示相应部门的数据
+ let authDep = []
+ depMessage.map((item) => {
+ if (item.id === user?.departmentId) {
+ authDep.push(item)
+ }
+ })
+ setdepMessagedata(authDep)
+ if (authDep.length > 0) {
+ dispatch(getDepUser(authDep[0]?.id))
+ setDepSelectedKeys([authDep[0]?.id])
+ setDepSelected([authDep[0]?.name])
+ }
+ }
+
+
}
}, [depMessage])
useEffect(() => {
- if (depUser.length) {
- setUserSelectedKeys([depUser[0].id])
- setUserSelected(depUser[0].username)
- dispatch(getUserResource(depUser[0].id))
- setUseName(depUser[0].name)
+ const copy = depUser.filter((item) => {
+ return item.name !== user.name//把自己筛选出去
+ })
+ setDepUserCopy(copy)
+ if (copy.length) {
+ setUserSelectedKeys([copy[0].id])
+ setUserSelected(copy[0].username)
+ dispatch(getUserResource(copy[0].id))
+ setUseName(copy[0].name)
}
- setCheckedList(depUser.map(i => i.id))
-
-
+ setCheckedList(copy.map(i => i.id))
}, [depUser])
// console.log(depUser,'用户信息')
const handleSave = () => {
@@ -131,12 +156,12 @@ const Authority = (props) => {
selectedKeys={depSelectedKeys}
onSelect={(selectedKeys, { selected, selectedNodes, node }) => {
setUserType(selectedNodes[0].type)
- setCheckedList(depUser.map(i => i.id))
+ setCheckedList(depUserCopy.map(i => i.id))
// setResCode(userResource.map(i=>i.resourceId))
if (selected) {
- setCheckedList(depUser.map(i => i.id))
+ setCheckedList(depUserCopy.map(i => i.id))
setDepSelectedKeys(selectedKeys)
setDepSelected(selectedNodes[0].name || "")
dispatch(getDepUser(selectedKeys[0]))
@@ -159,10 +184,10 @@ const Authority = (props) => {
{
- depUser.length ?
+ depUserCopy?.length ?
{
const name = node.name
@@ -178,7 +203,7 @@ const Authority = (props) => {
}
}}
- treeData={depUser}
+ treeData={depUserCopy}
fieldNames={{
title: 'name',
key: 'id'
@@ -200,7 +225,7 @@ const Authority = (props) => {
i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}>
不可编辑
- {depUser.length ?
+ {depUserCopy?.length ?
{/* {
const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员
const [uid, setuid] = useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'USERMANAGE')[0].isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作
+ const [depMessagedata, setdepMessagedata] = useState(depMessage)
+ useEffect(() => {
+ if (depMessage.length) {
+ console.log('depMessage', depMessage)
+ //超级管理员展示所有部门
+ if (user?.username === 'SuperAdmin') {
+ setdepMessagedata(depMessage)
+ setDepSelectedKeys([depMessage[0].id])
+ dispatch(getDepUser(depMessage[0].id))
+ } else {
+ //不是超级管理员,展示相应部门的数据
+ let authDep = []
+ depMessage.map((item) => {
+ if (item.id === user?.departmentId) {
+ authDep.push(item)
+ }
+ })
+ setdepMessagedata(authDep)
+ if (authDep.length > 0) {
+ setDepSelectedKeys([authDep[0].id])
+ dispatch(getDepUser(authDep[0].id))
+ }
+
+ }
+ }
+
+
+ }, [depMessage])
useEffect(() => {
let code = ['USERMANAGE', 'AUTHORIMANAGE']
//console.log('你來u盧克嗎', depUser, uid)
@@ -43,15 +71,16 @@ const UserManage = (props) => {
}, [])
useEffect(() => {
+ console.log('depuser', depUser)
const copy = depUser.filter((item) => {
- return item.name !== user//把自己筛选出去
+ return item.name !== user.name//把自己筛选出去
})
setDepUserCopy(copy)
}, [depUser])
useEffect(() => {
if (depMessage.length) {
- setDepSelectedKeys([depMessage[0].id])
- dispatch(getDepUser(depMessage[0].id))
+
+
}
}, [depMessage])
@@ -295,7 +324,7 @@ const UserManage = (props) => {
depMessage.length ?
{
// console.log('selectedKeys:',selectedKeys);
@@ -310,7 +339,7 @@ const UserManage = (props) => {
style={{ paddingTop: 20 }}
>
{
- depMessage?.map((s, index) => {
+ depMessagedata?.map((s, index) => {
return
{
s.subordinate.map(k => {
diff --git a/web/client/src/sections/organization/routes.js b/web/client/src/sections/organization/routes.js
index e3b843f6..a8baf484 100644
--- a/web/client/src/sections/organization/routes.js
+++ b/web/client/src/sections/organization/routes.js
@@ -15,6 +15,8 @@ export default [{
menuSelectKeys: ['userManage'],
component: UserManage,
breadcrumb: '用户管理',
+ authCode: 'USERMANAGE'
+
},
{
path: '/authority',
@@ -22,6 +24,7 @@ export default [{
menuSelectKeys: ['userAuthority'],
component: Authority,
breadcrumb: '权限管理',
+ authCode: 'AUTHORIMANAGE'
}
]
diff --git a/web/client/src/sections/quanju/containers/example.js b/web/client/src/sections/quanju/containers/example.js
index a10e1106..c7439221 100644
--- a/web/client/src/sections/quanju/containers/example.js
+++ b/web/client/src/sections/quanju/containers/example.js
@@ -32,10 +32,10 @@ const Example = (props) => {
}}>
-
+
-
+
@@ -45,7 +45,7 @@ const Example = (props) => {
)
}
-function mapStateToProps (state) {
+function mapStateToProps(state) {
const { auth, global, members } = state;
return {
loading: members.isRequesting,
diff --git a/web/client/src/sections/quanju/containers/heand/index.js b/web/client/src/sections/quanju/containers/heand/index.js
index 2589ffb6..2897b285 100644
--- a/web/client/src/sections/quanju/containers/heand/index.js
+++ b/web/client/src/sections/quanju/containers/heand/index.js
@@ -7,13 +7,25 @@ import { Tabs } from 'antd';
const { TabPane } = Tabs;
const Header = (props) => {
const { dispatch, tabChange, tabKey, user } = props
+ console.log('user111', user)
// const [tab, setTad] = useState("base")
const onClick = (tab) => {
// setTad({ tab })
tabChange(tab)
}
const dianji = () => {
- dispatch(push('/noContent'))
+ const allroutes = JSON.parse(sessionStorage.getItem('allRoutes')) || []
+ const hasAuth = allroutes?.filter((item) => { return user?.userResources.find((child) => { return child.resourceId === item.authCode }) })
+ if (user?.username === 'SuperAdmin') {
+ dispatch(push('/fillion/infor'))
+ }
+ else if (hasAuth && hasAuth.length > 0) {
+ const path = hasAuth[0].path
+ console.log('sasa', `${path}`)
+ dispatch(push(path))
+ } else {
+ dispatch(push('/noContent'))
+ }
}
return (