巴林闲侠 2 years ago
parent
commit
d9d1dc22de
  1. 2
      web/client/src/layout/components/header/index.js
  2. 4
      web/client/src/layout/index.js
  3. 19
      web/client/src/sections/auth/containers/login.js
  4. 25
      web/client/src/sections/fillion/routes.js
  5. 57
      web/client/src/sections/organization/containers/authority.js
  6. 39
      web/client/src/sections/organization/containers/user.js
  7. 3
      web/client/src/sections/organization/routes.js
  8. 2
      web/client/src/sections/quanju/containers/example.js
  9. 12
      web/client/src/sections/quanju/containers/heand/index.js

2
web/client/src/layout/components/header/index.js

@ -56,7 +56,7 @@ const Header = props => {
style={{ border: 0 }}
onClick={handelClick}
>
<div style={{ display: 'inline-block', cursor: "pointer" }} onClick={() => history.push(`/screen/cockpit`)}>进入大屏</div>
{user?.username === 'SuperAdmin' ? <div style={{ display: 'inline-block', cursor: "pointer" }} onClick={() => history.push(`/screen/cockpit`)}>进入大屏</div> : ''}
<Menu.SubMenu key="user" title={
<div style={{
margin: '0 8px'

4
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 => {
<Layout
history={history}
routes={innnerRoutes}
combineRoutes={combineRoutes}
>
{combineRoutes}
</Layout>

19
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 => {

25
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: '考核评分',
}
]
}

57
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)
//超级管理员展示所有部门
if (user?.username === 'SuperAdmin') {
setdepMessagedata(depMessage)
dispatch(getDepUser(depMessage[0]?.id))
setDepSelectedKeys([depMessage[0]?.id])
setDepSelected([depMessage[0]?.name])
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) {
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)
}
setCheckedList(depUser.map(i => i.id))
}, [depMessage])
useEffect(() => {
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(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) => {
<Col span={4} style={{ height: '100%', }}>
<Card title={` 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{
depUser.length ?
depUserCopy?.length ?
<Tree
height={clientHeight - 100}
defaultSelectedKeys={[depUser[0].id]}
defaultSelectedKeys={[depUserCopy[0]?.id]}
selectedKeys={userSelectedKeys}
onSelect={(selectedKeys, { selected, selectedNodes, node, event }) => {
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) => {
<Checkbox onChange={onshowchange} checked={isshow} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}>
不可编辑
</Checkbox>
{depUser.length ?
{depUserCopy?.length ?
<Card title={` 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{/* <Resource
userSelected={userSelected}

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

@ -27,7 +27,35 @@ const UserManage = (props) => {
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 ?
<Tree
height={clientHeight - 95}
defaultExpandedKeys={[depMessage[0].id]}
defaultExpandedKeys={[depMessagedata[0]?.id]}
selectedKeys={depSelectedKeys}
onSelect={(selectedKeys, e) => {
// console.log('selectedKeys:',selectedKeys);
@ -310,7 +339,7 @@ const UserManage = (props) => {
style={{ paddingTop: 20 }}
>
{
depMessage?.map((s, index) => {
depMessagedata?.map((s, index) => {
return <TreeNode title={renderTree(s, s.id)} key={s.id} >
{
s.subordinate.map(k => {

3
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'
}
]

2
web/client/src/sections/quanju/containers/example.js

@ -32,7 +32,7 @@ const Example = (props) => {
}}>
<div style={{ width: "100%", height: "10%" }}>
<Header tabChange={tabChange} tabKey={tabKey} dispatch={dispatch} />
<Header tabChange={tabChange} tabKey={tabKey} dispatch={dispatch} user={user} />
</div>
<div style={{ position: 'absolute', width: "100%", height: "90%" }}>
<Gis tabKey={tabKey} />

12
web/client/src/sections/quanju/containers/heand/index.js

@ -7,14 +7,26 @@ 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 = () => {
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 (
<div style={{ position: "relative" }}>
<img style={{ width: "100%", position: "absolute" }} src='/assets/images/quanju/beijingtou.png' />

Loading…
Cancel
Save