Browse Source

(*)表头动态取

master
ww664853070 1 year ago
parent
commit
6a86f3d717
  1. 38
      web/client/src/sections/humanAffairs/containers/employeeAuth.jsx

38
web/client/src/sections/humanAffairs/containers/employeeAuth.jsx

@ -25,10 +25,6 @@ const EmployeeAuth = (props) => {
dispatch(actions.humanAffairs.getResource()) dispatch(actions.humanAffairs.getResource())
}, []) }, [])
let hrUser = JSON.parse(sessionStorage.getItem('hrUser')) let hrUser = JSON.parse(sessionStorage.getItem('hrUser'))
console.log(hrUser, '登录返回');
console.log(roleList, '角色列表');
console.log(userRoleList, '用户角色关联');
console.log(resourceList, '权限列表');
const button = ( const button = (
<ButtonGroup <ButtonGroup
size="small" size="small"
@ -58,7 +54,6 @@ const EmployeeAuth = (props) => {
children: children children: children
}) })
}) })
console.log(roleAndUser, 'zuihoushuju ');
let roleLists = [] let roleLists = []
if (roleAndUser.length) { if (roleAndUser.length) {
roleAndUser.forEach(e => { roleAndUser.forEach(e => {
@ -147,9 +142,7 @@ const EmployeeAuth = (props) => {
setTwo(twos) setTwo(twos)
} }
} }
console.log(treeList, '权限树形结构')
const onCheckAllChange = (value, recod) => { const onCheckAllChange = (value, recod) => {
console.log(value.target, '第二阶', recod);
let selList = [] let selList = []
recod.child.forEach(i => { recod.child.forEach(i => {
if (i.id == value.target.value) { if (i.id == value.target.value) {
@ -179,7 +172,6 @@ const EmployeeAuth = (props) => {
if (e.target.checked) { if (e.target.checked) {
setCheckedList([...checkedList, ...check]) setCheckedList([...checkedList, ...check])
resourceList.rows.forEach(e => { resourceList.rows.forEach(e => {
console.log(e, '==============', check[0]);
if (e.id == check[0]) { if (e.id == check[0]) {
twosid = e.parentId twosid = e.parentId
} }
@ -191,7 +183,6 @@ const EmployeeAuth = (props) => {
setCheckedList(getDiffer(checkedList, check)); setCheckedList(getDiffer(checkedList, check));
} }
} }
console.log(two, 'two');
const getDiffer = (arr1, arr2) => { const getDiffer = (arr1, arr2) => {
let arr = arr1.filter(e => { let arr = arr1.filter(e => {
return !arr2.includes(e) return !arr2.includes(e)
@ -227,14 +218,13 @@ const EmployeeAuth = (props) => {
let two = {} let two = {}
let checkList = [] let checkList = []
if (res.payload.data && res.payload.data.rows.length) { if (res.payload.data && res.payload.data.rows.length) {
console.log(res.payload.data, '-------');
checkList = res.payload.data.rows.map(e => { checkList = res.payload.data.rows.map(e => {
two[e.resId] = true two[e.resId] = true
return e.resId return e.resId
}) })
setCheckedList(checkList) setCheckedList(checkList)
setTwo(two) setTwo(two)
}else{ } else {
setCheckedList([]) setCheckedList([])
setTwo(two) setTwo(two)
} }
@ -243,9 +233,6 @@ const EmployeeAuth = (props) => {
}) })
} }
const handlOk = () => { const handlOk = () => {
console.log(roleId, '请求的角色id');
console.log(checkedList, '请求三阶参数');
console.log(two, '请求一二阶参数');
let resourceId = []; let resourceId = [];
for (let item in two) { for (let item in two) {
if (two[item]) { if (two[item]) {
@ -259,6 +246,8 @@ const EmployeeAuth = (props) => {
dispatch(actions.humanAffairs.addRoleResource({ roleId, resourceId })) dispatch(actions.humanAffairs.addRoleResource({ roleId, resourceId }))
} }
} }
return ( return (
<> <>
<div style={{ padding: '0px 12px' }}> <div style={{ padding: '0px 12px' }}>
@ -283,16 +272,17 @@ const EmployeeAuth = (props) => {
<span>平台管理员由项企统一认证平台授权拥有对本系统所有功能进行设置和管理</span> <span>平台管理员由项企统一认证平台授权拥有对本系统所有功能进行设置和管理</span>
</div> </div>
<div className='authorityAdminList'> <div className='authorityAdminList'>
<div > {
<span>人力资源部</span> hrUser && hrUser.adminHr && hrUser.adminHr.map(e => {
<h2>姜珍</h2> return (
<h4>角色说明拥有全平台的权限</h4> <div >
</div> <span>人力资源部</span>
<div > <h2>{e.name}</h2>
<span>人力资源部</span> <h4>角色说明拥有全平台的权限</h4>
<h2>郭菲</h2> </div>
<h4>角色说明拥有全平台的权限</h4> )
</div> })
}
</div> </div>
<div className='authorityTit'> <div className='authorityTit'>
<h2><b></b>角色授权</h2> <h2><b></b>角色授权</h2>

Loading…
Cancel
Save