Browse Source

(+)权限控制

master
ww664853070 1 year ago
parent
commit
13ec2ce69c
  1. 2
      api/app/lib/controllers/role/index.js
  2. 6
      web/client/src/layout/containers/layout/index.jsx
  3. 11
      web/client/src/sections/humanAffairs/actions/role.js
  4. 8
      web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx
  5. 5
      web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx
  6. 9
      web/client/src/sections/humanAffairs/containers/employeeInformation.jsx
  7. 3
      web/client/src/sections/humanAffairs/containers/highMonthly.jsx
  8. 3
      web/client/src/sections/humanAffairs/containers/highQuarter.jsx
  9. 8
      web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx
  10. 3
      web/client/src/sections/humanAffairs/containers/monthlyProcess.jsx
  11. 8
      web/client/src/sections/humanAffairs/containers/overtimeStatistics.jsx
  12. 5
      web/client/src/sections/humanAffairs/containers/personalTrainRecord.jsx
  13. 22
      web/client/src/sections/humanAffairs/containers/personnelFiles.jsx
  14. 14
      web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx
  15. 8
      web/client/src/sections/humanAffairs/containers/pmLog.jsx
  16. 11
      web/client/src/sections/humanAffairs/containers/positionRating.jsx
  17. 3
      web/client/src/sections/humanAffairs/containers/quarter.jsx
  18. 4
      web/client/src/sections/humanAffairs/containers/regularKPI.jsx
  19. 19
      web/client/src/sections/humanAffairs/containers/resourceRepository.jsx
  20. 6
      web/client/src/sections/humanAffairs/containers/saleLog.jsx
  21. 16
      web/client/src/sections/humanAffairs/containers/salersDistribution/personnelDistribution.jsx
  22. 8
      web/client/src/sections/humanAffairs/containers/weeklyManagement.jsx
  23. 172
      web/client/src/sections/humanAffairs/nav-item.jsx
  24. 4
      web/client/src/utils/func.js
  25. 1
      web/client/src/utils/webapi.js

2
api/app/lib/controllers/role/index.js

@ -31,7 +31,7 @@ async function add(ctx) {
throw '当前角色已存在'
}
let storageData = { name }
let storageData = { name ,delete:true}
await models.Role.create(storageData)
ctx.status = 204;
} catch (error) {

6
web/client/src/layout/containers/layout/index.jsx

@ -15,6 +15,7 @@ import { RouteRequest } from '@peace/utils';
import Cookie from 'js-cookie';
import { login, LOGIN_SUCCESS } from '../../../sections/auth/actions/auth';
import { error } from 'webpack-dev-server/lib/utils/colors';
import actions from '../../../sections/humanAffairs/actions'
@ -217,6 +218,11 @@ const LayoutContainer = props => {
localStorage.setItem('poms_open_sider', JSON.stringify(["archivesCenter"]))
localStorage.setItem('poms_selected_sider', JSON.stringify(["humanAffairs"]))
dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token, hrUserId: data.hrUserInfo && hrUserInfo.id }))
dispatch(actions.humanAffairs.getUserResource(res.payload.user.id)).then(res => {
if (res.success) {
sessionStorage.setItem('userResource', JSON.stringify(res.payload.data))
}
})
} else {
window.location.href = `${webPepUrl}/signin`
}

11
web/client/src/sections/humanAffairs/actions/role.js

@ -116,4 +116,13 @@ export function addRoleResource(data) {
});
}
export function getUserResource(userId) {//查询
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_USER_RESOURCE_LIST",
url: ApiTable.getUserResource.replace('{userId}',userId),
msg: { option: "查询角色权限列表" },
reducer: { name: "userResource", params: { noClear: true } },
});
}

8
web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx

@ -5,6 +5,7 @@ import { Select, Input, Button, Tooltip, Table, Pagination, Skeleton, DatePicker
import { IconSearch } from '@douyinfe/semi-icons';
import DetailModal from './detailModal';
import { SkeletonScreen } from "$components";
import { isAuthorized } from '$utils'
import '../../style.less'
const EmployeeCommunication = (props) => {
@ -253,14 +254,17 @@ const EmployeeCommunication = (props) => {
getEmployeeCommunicateData({ limit: 10, page: 0 });
}}>查询</Button>
</div>
<div style={{ display: 'flex', marginRight: 20 }}>
{
isAuthorized('EXPORTEMPLOYEECOMMUNICATIONSTATISTICS') ? <div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, marginLeft: 18, cursor: "pointer" }}
onClick={() => {
exportAllData()
}}>
导出
</div>
</div>
</div>:''
}
</div>
<div style={{ marginTop: 20 }}>
<Skeleton

5
web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx

@ -5,6 +5,7 @@ import { Table, Pagination, Skeleton } from '@douyinfe/semi-ui';
import EditModal from './editModal'
import ImportModal from './importModal'
import { SkeletonScreen } from "$components";
import { isAuthorized } from '$utils'
import '../../style.less'
const DepartmentTrainType = ["部门内部培训", "跨部门培训", "外部培训", "公司内训"];
const DepartmentTrainMethod = ["线上", "线下"];
@ -170,10 +171,10 @@ const DepartmentTrainRecord = (props) => {
</div>
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{isAuthorized('IMPORTDEPARTMENTTRAININGRECORDS') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { setImportModalV(true); }}>
导入
</div>
</div> : ''}
</div>
</div>

9
web/client/src/sections/humanAffairs/containers/employeeInformation.jsx

@ -7,7 +7,7 @@ import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { set } from 'nprogress';
import { UserAttribute } from '$utils'
import { UserAttribute, isAuthorized } from '$utils'
const employeeInformation = (props) => {
const { dispatch, actions, history, user, loading, socket, xqMembers } = props
@ -591,7 +591,8 @@ const employeeInformation = (props) => {
</Form.Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
{
isAuthorized('EXPORTEMPLOYEEINFORMATION') ? <div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
@ -608,7 +609,9 @@ const employeeInformation = (props) => {
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
</div> : ''
}
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>

3
web/client/src/sections/humanAffairs/containers/highMonthly.jsx

@ -4,6 +4,7 @@ import { Table, Pagination, Skeleton, DatePicker, Button } from '@douyinfe/semi-
import { SkeletonScreen } from "$components";
import '../style.less'
import moment from 'moment'
import { isAuthorized } from '$utils'
const HighMonthly = (props) => {
const [year, setYear] = useState(null)
@ -62,7 +63,7 @@ const HighMonthly = (props) => {
width: 120,
render: (text, record) => {
return <div>
<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>
{isAuthorized('DOWNLOADTHEMONTHLYPROCESSASSESSMENTFORSENIORMANAGEMENT')?<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>:''}
</div>
}
}];

3
web/client/src/sections/humanAffairs/containers/highQuarter.jsx

@ -4,6 +4,7 @@ import { Table, Pagination, Skeleton, DatePicker, Button } from '@douyinfe/semi-
import { SkeletonScreen } from "$components";
import '../style.less'
import moment from 'moment'
import { isAuthorized } from '$utils'
const HighQuarter = (props) => {
const [year, setYear] = useState(null)
@ -62,7 +63,7 @@ const HighQuarter = (props) => {
width: 120,
render: (text, record) => {
return <div>
<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>
{isAuthorized('DOWNLOADQUARTERLYASSESSMENTSFORSENIORMANAGEMENT')?<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>:''}
</div>
}
}];

8
web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx

@ -7,6 +7,7 @@ import { SkeletonScreen } from "$components";
import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { isAuthorized } from '$utils'
import { set } from 'nprogress';
const leaveStatistics = (props) => {
@ -371,7 +372,8 @@ const leaveStatistics = (props) => {
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
{
isAuthorized('EXPORTLEAVESTATISTICS') ? <div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
@ -388,7 +390,9 @@ const leaveStatistics = (props) => {
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
</div> : ''
}
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>

3
web/client/src/sections/humanAffairs/containers/monthlyProcess.jsx

@ -4,6 +4,7 @@ import { Table, Pagination, Skeleton, DatePicker, Button } from '@douyinfe/semi-
import { SkeletonScreen } from "$components";
import '../style.less'
import moment from 'moment'
import { isAuthorized } from '$utils'
const MonthlyProcess = (props) => {
const [year, setYear] = useState(null)
@ -62,7 +63,7 @@ const MonthlyProcess = (props) => {
width: 120,
render: (text, record) => {
return <div>
<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>
{isAuthorized('DOWNLOADMIDDLELEVELMONTHLYPROCESSASSESSMENT') ? <span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>:''}
</div>
}
}];

8
web/client/src/sections/humanAffairs/containers/overtimeStatistics.jsx

@ -6,6 +6,7 @@ import { SkeletonScreen } from "$components";
import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { isAuthorized } from '$utils'
import { set } from 'nprogress';
const overtimeStatistics = (props) => {
@ -409,7 +410,8 @@ const overtimeStatistics = (props) => {
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
{
isAuthorized('EXPORTOVERTIMESTATISTICS')?<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
@ -426,7 +428,9 @@ const overtimeStatistics = (props) => {
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
</div>:''
}
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>

5
web/client/src/sections/humanAffairs/containers/personalTrainRecord.jsx

@ -5,6 +5,7 @@ import { SkeletonScreen } from "$components";
import '../style.less'
import ImportPersonalTrainRecord from './importPersonalTrainRecord'
import moment from 'moment'
import { isAuthorized } from '$utils'
const PersonalTrainRecord = (props) => {
const { dispatch, actions, personalTrainRecordList } = props
@ -122,11 +123,11 @@ const PersonalTrainRecord = (props) => {
<div style={{ margin: '18px 0px' }}>
<div style={{ display: 'flex', margin: '16px 0px', justifyContent: 'flex-end' }}>
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{isAuthorized('IMPORTPERSONALTRAININGRECORDS') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { setImportModalV(true); }}
>
导入
</div>
</div> : ''}
</div>
</div>
<div style={{ marginTop: 20 }}>

22
web/client/src/sections/humanAffairs/containers/personnelFiles.jsx

@ -6,6 +6,7 @@ import PersonnelModal from '../components/personnelModal';
import ImportMembersModal from './import-members-modal'
import '../style.less'
import moment from 'moment'
import { isAuthorized } from '$utils'
const Rest = (props) => {
const { dispatch, actions, history, user, loading, socket, xqMembers } = props
@ -64,15 +65,20 @@ const Rest = (props) => {
<div style={{ marginLeft: 6, fontSize: 12, color: '#969799', fontFamily: "DINExp", }}>EMPLOYEE FILE</div>
</div>
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{
isAuthorized('ADDINGFILES') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => {
setPersonnelModal(true);
}}>
新增档案
</div>
<div onClick={() => setExportModalVs(true)} style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}>
</div> : ''
}
{
isAuthorized('IMPORTEMPLOYEEINFORMATION') ? <div onClick={() => setExportModalVs(true)} style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}>
导入员工信息
</div>
</div> : ''
}
</div>
</div>
</div>
@ -135,7 +141,8 @@ const Rest = (props) => {
<Radio value='onJob'>在职</Radio>
</RadioGroup>
</div>
<div style={{ display: 'flex', marginLeft: 30, alignItems: 'center', cursor: 'pointer' }} onClick={() => {
{
isAuthorized('EXPORTEMPLOYEEPROFILE') ? <div style={{ display: 'flex', marginLeft: 30, alignItems: 'center', cursor: 'pointer' }} onClick={() => {
setDownloadUrl(`members/export?token=${user.token}&state=${typeChoose}&keywordTarget=${keywordTarget}&keyword=${keyword}&keys=overtimeStatistic,vacateStatistic`)
}}>
<div style={{ width: 20, height: 20 }}>
@ -144,10 +151,13 @@ const Rest = (props) => {
<div style={{ marginLeft: 4, color: '#005ABD', fontSize: 13 }} >
导出
</div>
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
</div> : ''
}
</div>
</div>
<div style={{ display: 'flex', flexWrap: 'wrap', marginLeft: 30 }}>

14
web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx

@ -8,6 +8,7 @@ import DeleteModal from '../components/deleteModal';
import PersonnelModal from '../components/personnelModal';
import moment from 'moment'
import { UserAttribute } from '$utils'
import { isAuthorized } from '$utils'
import '../style.less'
@ -441,18 +442,23 @@ const Rest = (props) => {
<div style={{ fontFamily: "YouSheBiaoTiHei", fontSize: 24, color: '#033C9A', marginLeft: 8 }}>{pepObj?.userName}的个人档案</div>
</div>
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{
isAuthorized('EDITPROFILE') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => {
setPersonnelModal(true);
}}
>
编辑档案
</div>
<div style={{ padding: '6px 20px', background: '#FF5254', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}
</div> : ''
}
{
isAuthorized('DELETEFILES') ? <div style={{ padding: '6px 20px', background: '#FF5254', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}
onClick={() => { setDeleteModal(true) }}
>
删除档案
</div>
</div> : ''
}
</div>
</div>
<div style={{ borderBottom: '1px solid #DCDEE0', margin: '16px 0px 16px -20px' }}></div>

8
web/client/src/sections/humanAffairs/containers/pmLog.jsx

@ -7,6 +7,7 @@ import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { getServiceUrl } from '../actions/service';
import { isAuthorized } from '$utils'
const PMLog = (props) => {
const { dispatch, actions, history, user, loading, socket } = props;
@ -264,7 +265,8 @@ const PMLog = (props) => {
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid'
{
isAuthorized('EXPORTENGINEERINGLOG') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
@ -288,7 +290,9 @@ const PMLog = (props) => {
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
}}>导出</Button> : ''
}
</div>
</div>
</div>

11
web/client/src/sections/humanAffairs/containers/positionRating.jsx

@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { Table, Button, Pagination, Skeleton, Popconfirm, Tooltip } from '@douyinfe/semi-ui';
import { SkeletonScreen, Setup } from "$components";
import ImportPositionRatingModal from '../components/importPositionRating';
import { isAuthorized } from '$utils'
import '../style.less';
const PositionRating = (props) => {
@ -198,12 +199,18 @@ const PositionRating = (props) => {
</div>
<div style={{ marginRight: 20, marginTop: 18 }}>
<div style={{ display: 'flex', margin: '16px 0px', justifyContent: 'flex-end' }}>
{
}
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{
isAuthorized('IMPORTJOBRATINGS') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { handleImportModal(); }}
>
导入
</div>
</div> : ''
}
</div>
</div>
<div style={{ border: '1px solid #C7E1FF', background: '#F4F8FF', borderRadius: 2, height: 32, width: 669, padding: '8px 0px 7px 12px', display: 'flex', alignItems: 'center', color: '#0F7EFB', fontSize: 12 }}>

3
web/client/src/sections/humanAffairs/containers/quarter.jsx

@ -4,6 +4,7 @@ import { Table, Pagination, Skeleton, DatePicker, Button } from '@douyinfe/semi-
import { SkeletonScreen } from "$components";
import '../style.less'
import moment from 'moment'
import { isAuthorized } from '$utils'
const Quarter = (props) => {
const [year, setYear] = useState(null)
@ -62,7 +63,7 @@ const Quarter = (props) => {
width: 120,
render: (text, record) => {
return <div>
<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>
{isAuthorized('DOWNLOADMIDLEVELQUARTERLYASSESSMENT')?<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>:''}
</div>
}
}];

4
web/client/src/sections/humanAffairs/containers/regularKPI.jsx

@ -4,6 +4,7 @@ import { Table, Pagination, Skeleton, DatePicker, Button } from '@douyinfe/semi-
import { SkeletonScreen } from "$components";
import moment from 'moment'
import '../style.less'
import { isAuthorized } from '$utils'
const RegularKPI = (props) => {
const [year, setYear] = useState(null)
@ -62,7 +63,8 @@ const RegularKPI = (props) => {
width: 120,
render: (text, record) => {
return <div>
<span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>
{isAuthorized('DOWNLOADOFFICIALEMPLOYEEASSESSMENT') ? <span onClick={() => exportReport(record.path)} style={{ color: '#1890FF', cursor: 'pointer' }}>下载</span>:''}
</div>
}
}];

19
web/client/src/sections/humanAffairs/containers/resourceRepository.jsx

@ -9,6 +9,7 @@ import {
} from '../actions/resourceRepository';
import FolderModal from '../components/resourceRepository/folder-model';
import ResourceUploadModal from '../components/resourceRepository/upload-modal';
import { isAuthorized } from '$utils'
import '../style.less';
const ResourceRepository = (props) => {
@ -56,8 +57,12 @@ const ResourceRepository = (props) => {
render: (text, record) => {
return <div style={{ color: "#1890FF" }}>
<Space>
<a href={'/_file-server/' + record.attachPath + '?filename=' + encodeURIComponent(record.fileName + record.fileType)}>下载</a>
{currentSelect.includes("公司培训资料") &&
{
isAuthorized('DOWNLOADTRAININGMATERIALS') ? <a href={'/_file-server/' + record.attachPath + '?filename=' + encodeURIComponent(record.fileName + record.fileType)}>下载</a> : ''
}
{
isAuthorized('DELETETRAININGMATERIALS')?currentSelect.includes("公司培训资料") &&
<Popconfirm
style={{ minWidth: "max-content" }}
title="提示"
@ -66,7 +71,8 @@ const ResourceRepository = (props) => {
position={"leftBottom"}
>
<a style={{ cursor: 'pointer' }}>删除</a>
</Popconfirm>}
</Popconfirm>:''
}
</Space>
</div>
}
@ -238,6 +244,9 @@ const ResourceRepository = (props) => {
<Row className='resourceRepository'>
{/* 左侧 */}
<Col className='left' span={6}>
{
isAuthorized('FOLDERMANAGEMENT') ? <Button theme='solid' type='primary' onClick={() => handleFolderClick("新建", false)}>新建文件夹</Button> : ''
}
<Button theme='solid' type='primary' onClick={() => handleFolderClick("新建", false)}>新建文件夹</Button>
<br />
<Input suffix={<IconSearch />} showClear onChange={v => ref.current.search(v)} placeholder="请输入"></Input>
@ -262,9 +271,9 @@ const ResourceRepository = (props) => {
<Row> <span className="path-lable"><strong>当前文件夹{currentSelect}</strong></span></Row>
<Row className='search'>
<Space>
{currentSelect && currentSelect.includes("公司培训资料") && currentSelect.split("/").length == 3 ?
{isAuthorized('UPLOADTRAININGMATERIALS') ? currentSelect && currentSelect.includes("公司培训资料") && currentSelect.split("/").length == 3 ?
<Button theme='solid' type='primary' onClick={() => { setUploadModalVisiable(true) }} >上传文件</Button>
: null}
: null : ''}
<span className='search-label'>关键字</span>
<Input
style={{ width: 160 }}

6
web/client/src/sections/humanAffairs/containers/saleLog.jsx

@ -7,6 +7,7 @@ import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { getServiceUrl } from '../actions/service';
import { isAuthorized } from '$utils'
const SaleLog = (props) => {
const { dispatch, actions, history, user, loading, socket } = props;
@ -264,7 +265,8 @@ const SaleLog = (props) => {
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid'
{
isAuthorized('EXPORTSALESLOG') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
@ -288,7 +290,7 @@ const SaleLog = (props) => {
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
}}>导出</Button> : ''}
</div>
</div>
</div>

16
web/client/src/sections/humanAffairs/containers/salersDistribution/personnelDistribution.jsx

@ -6,6 +6,7 @@ import SalesMemberModal from './salesMemberModal'
import ImportSalersModal from './importSalersModal'
import { IconSearch } from '@douyinfe/semi-icons';
import { SkeletonScreen } from "$components";
import { isAuthorized } from '$utils'
import '../../style.less'
const PersonnelDistribution = (props) => {
@ -221,13 +222,17 @@ const PersonnelDistribution = (props) => {
<div style={{ margin: '18px 0px' }}>
<div style={{ display: 'flex', margin: '16px 0px', justifyContent: 'space-between' }}>
<div style={{ display: 'flex' }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginRight: 18 }}
{
isAuthorized('ADDSALESPERSONNEL') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginRight: 18 }}
onClick={() => {
setModalV(true);
setDataToEdit(null);
}}>
新增
</div>
</div> : ''
}
<div>
<Select value={keywordTarget} onChange={setKeywordTarget} style={{ width: 100 }} >
<Select.Option value='dep'>部门</Select.Option>
@ -256,10 +261,13 @@ const PersonnelDistribution = (props) => {
}}>查询</Button>
</div>
<div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
{
isAuthorized('IMPORTSALESPERSONNELDISTRIBUTION') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { setImportModalV(true); }}>
导入
</div>
</div> : ''
}
{/* <div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }}>
导出
</div> */}

8
web/client/src/sections/humanAffairs/containers/weeklyManagement.jsx

@ -7,6 +7,7 @@ import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { getServiceUrl } from '../actions/service';
import { isAuthorized } from '$utils'
const WeeklyManagement = (props) => {
const { dispatch, actions, history, user, loading, socket, xqMembers } = props;
@ -289,7 +290,8 @@ const WeeklyManagement = (props) => {
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid'
{
isAuthorized('EXPORTWEEKLYREPORT') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
@ -313,7 +315,9 @@ const WeeklyManagement = (props) => {
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
}}>导出</Button> : ''
}
</div>
</div>
</div>

172
web/client/src/sections/humanAffairs/nav-item.jsx

@ -1,138 +1,186 @@
import React from 'react';
import { IconCode } from '@douyinfe/semi-icons';
import { isAuthorized } from '$utils'
export function getNavItem(user, dispatch) {
return (
[
let hrUser = JSON.parse(sessionStorage.getItem('hrUser'))
let admin = false
hrUser && hrUser.adminHr.forEach(e => {
if (e.id == hrUser.id) {
admin = true
}
})
let list = [
{
itemKey: 'humanAffairs',
text: '人事管理',
icon: <IconCode />,
items: [{
items: [
isAuthorized('PERSONNELFILEMANAGEMENT') ? {
itemKey: 'personnelArchives',
text: '人员档案',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbrengongdangan"></iconpark-icon>,
to: '/humanAffairs/archivesCenter/personnelArchives/personnelFiles',
items: [{
items: [
isAuthorized('PERSONNELFILES') ? {
itemKey: 'personnelFiles', to: '/humanAffairs/archivesCenter/personnelArchives/personnelFiles', text: '人员档案'
}, {
} : {},
isAuthorized('EMPLOYEEINFORMATION') ? {
itemKey: 'employeeInformation', to: '/humanAffairs/archivesCenter/personnelArchives/employeeInformation', text: '员工信息'
}, {
} : {},
isAuthorized('JOBRATING') ? {
itemKey: 'positionRating', to: '/humanAffairs/archivesCenter/personnelArchives/positionRating', text: '岗位评级'
}]
}, {
} : {}]
} : {},
isAuthorized('DEPARTMENTARCHIVESMANAGEMENT') ? {
itemKey: 'deptArchives',
text: '部门档案',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbbumen"></iconpark-icon>,
to: '/humanAffairs/archivesCenter/deptArchives/department',
items: [{
items: [
isAuthorized('DEPARTMENTARCHIVES') ? {
itemKey: 'department', to: '/humanAffairs/archivesCenter/deptArchives/department', text: '部门档案'
}]
}, {
} : {}]
} : {},
isAuthorized('LEAVEMANAGEMENT') ? {
itemKey: 'leaveManagement',
text: '假勤管理',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbjiaqinguanli"></iconpark-icon>,
to: '/humanAffairs/employeeRelationship/leaveManagement/attendanceStatistics',
items: [{
items: [
isAuthorized('ATTENDANCESTATISTICS') ? {
itemKey: 'attendanceStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/attendanceStatistics', text: '出勤统计'
}, {
} : {},
isAuthorized('LEAVESTATISTICS') ? {
itemKey: 'leaveStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/leaveStatistics', text: '请假统计'
}, {
} : {},
isAuthorized('OVERTIMESTATISTICS') ? {
itemKey: 'overtimeStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/overtimeStatistics', text: '加班统计'
}]
}, {
} : {}]
} : {},
isAuthorized('EMPLOYEECOMMUNICATION') ? {
itemKey: 'communication',
text: '员工沟通',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconyuangonggoutong"></iconpark-icon>,
to: '/humanAffairs/employeeRelationship/communication/employeeCommunication',
items: [{
items: [
isAuthorized('EMPLOYEECOMMUNICATIONSTATISTICS') ? {
itemKey: 'employeeCommunication', to: '/humanAffairs/employeeRelationship/communication/employeeCommunication', text: '员工沟通统计'
}]
}, {
} : {}
]
} : {},
isAuthorized('RECRUITMENTRECORDS') ? {
itemKey: 'recruitRecord',
text: '招聘记录',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbzhaopin"></iconpark-icon>,
to: '/humanAffairs/recruit/recruitRecord/appointmentRecords',
items: [{
items: [
isAuthorized('APPOINTMENTRECORD') ? {
itemKey: 'appointmentRecords', to: '/humanAffairs/recruit/recruitRecord/appointmentRecords', text: '任用记录'
}]
}, {
} : {}
]
} : {},
isAuthorized('SALESSTATISTICS') ? {
itemKey: 'salesStatistics',
text: '销售统计',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconxiaoshou"></iconpark-icon>,//wwwtodo
to: '/humanAffairs/recruit/salesStatistics/personnelDistribution',
items: [{
items: [
isAuthorized('SALESPERSONNELDISTRIBUTION') ? {
itemKey: 'personnelDistribution', to: '/humanAffairs/recruit/salesStatistics/personnelDistribution', text: '销售人员分布'
}]
}, {
} : {}
]
} : {},
isAuthorized('TRAININGDOSSIER') ? {
itemKey: 'trainFiles',
text: '培训档案',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbpeixundangan"></iconpark-icon>,
to: '/humanAffairs/train/trainFiles/resourceRepository',
items: [{
items: [
isAuthorized('TRAININGRESOURCEREPOSITORY') ? {
itemKey: 'resourceRepository', to: '/humanAffairs/train/trainFiles/resourceRepository', text: '培训资源储存库'
}]
}, {
} : {}
]
} : {},
isAuthorized('TRAININGMANAGEMENT') ? {
itemKey: 'trainingManagement',
text: '培训管理',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="peixgl"></iconpark-icon>,
to: '/humanAffairs/train/trainingManagement/personalTrainRecord',
items: [{
items: [
isAuthorized('PERSONALTRAININGRECORDS') ? {
itemKey: 'personalTrainRecord', to: '/humanAffairs/train/trainingManagement/personalTrainRecord', text: '个人培训记录'
}, {
} : {},
isAuthorized('DEPARTMENTTRAININGRECORDS') ? {
itemKey: 'departmentTrainRecord', to: '/humanAffairs/train/trainingManagement/departmentTrainRecord', text: '部门培训记录'
}]
}, {
} : {}]
} : {},
isAuthorized('BASICACTIONMANAGEMENT') ? {
itemKey: 'basicAction',
text: '基本动作',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbjiben"></iconpark-icon>,
to: '/humanAffairs/achievements/basicAction/weeklyManagement',
items: [{
items: [
isAuthorized('WEEKLYREPORTMANAGEMENT') ? {
itemKey: 'weeklyManagement', to: '/humanAffairs/achievements/basicAction/weeklyManagement', text: '周报管理'
}, {
} : {},
isAuthorized('SALESLOG') ? {
itemKey: 'saleLog', to: '/humanAffairs/achievements/basicAction/saleLog', text: '销售日志'
}, {
} : {},
isAuthorized('ENGINEERINGLOG') ? {
itemKey: 'pmLog', to: '/humanAffairs/achievements/basicAction/pmLog', text: '工程日志'
}]
}, {
} : {}]
} : {},
isAuthorized('EMPLOYEEASSESSMENT') ? {
itemKey: 'employeeKPI',
text: '员工考核',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbyuangongkaohe"></iconpark-icon>,
to: '/humanAffairs/achievements/employeeKPI/probationer',
items: [{
items: [
isAuthorized('EMPLOYEEASSESSMENTDURINGPROBATIONARYPERIOD') ? {
itemKey: 'probationer', to: '/humanAffairs/achievements/employeeKPI/probationer', text: '试用期员工考核'
}, {
} : {},
isAuthorized('FORMALEMPLOYEEASSESSMENT') ? {
itemKey: 'regular', to: '/humanAffairs/achievements/employeeKPI/regular', text: '正式员工考核'
}]
}, {
} : {}]
} : {},
isAuthorized('MIDDLELEVELASSESSMENT') ? {
itemKey: 'middleKPI',
text: '中层考核',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbzhongceng"></iconpark-icon>,
to: '/humanAffairs/achievements/middleKPI/monthlyProcess',
items: [{
items: [
isAuthorized('MIDDLELEVELMONTHLYPROCESSASSESSMENT') ? {
itemKey: 'monthlyProcess', to: '/humanAffairs/achievements/middleKPI/monthlyProcess', text: '月度过程考核'
}, {
} : {},
isAuthorized('MIDLEVELQUARTERLYASSESSMENT') ? {
itemKey: 'quarter', to: '/humanAffairs/achievements/middleKPI/quarter', text: '季度考核'
}]
}, {
} : {}]
} : {},
isAuthorized('SENIORASSESSMENT') ? {
itemKey: 'highKPI',
text: '高管考核',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbgaojiguanli"></iconpark-icon>,
to: '/humanAffairs/achievements/highKPI/highMonthly',
items: [{
items: [
isAuthorized('MONTHLYPROCESSASSESSMENTFORSENIORMANAGEMENT') ? {
itemKey: 'highMonthly', to: '/humanAffairs/achievements/highKPI/highMonthly', text: '月度过程考核'
},{
} : {},
isAuthorized('QUARTERLYASSESSMENTOFSENIORMANAGEMENT') ? {
itemKey: 'Highquarter', to: '/humanAffairs/achievements/highKPI/Highquarter', text: '季度考核'
}]
}, {
} : {}]
} : {},
isAuthorized('REWARDANDPUNISHMENTMANAGEMENT') ? {
itemKey: 'penalties',
text: '奖惩信息',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbjiangcheng"></iconpark-icon>,
to: '/humanAffairs/achievements/penalties/penaltiesRecord',
items: [{
items: [
isAuthorized('REWARDANDPUNISHMENTINFORMATION') ? {
itemKey: 'penaltiesRecord', to: '/humanAffairs/achievements/penalties/penaltiesRecord', text: '奖惩信息'
}]
}, {
} : {}]
} : {},
admin ? {
itemKey: 'authCenter',
text: '权限中心',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbquanxian"></iconpark-icon>,
@ -142,8 +190,24 @@ export function getNavItem(user, dispatch) {
}, {
itemKey: 'formMaintenance', to: '/humanAffairs/authCenter/formMaintenance', text: '表单维护'
}]
}]
} : {}
]
},
]
);
list[0].items.map(e => {
if (e.items != undefined) {
e.items = e.items.filter(element => {
if (Object.keys(element).length !== 0) {
return true;
}
})
}
return e
})
list[0].items = list[0].items.filter(element => {
if (Object.keys(element).length !== 0) {
return true;
}
})
return list
}

4
web/client/src/utils/func.js

@ -1,8 +1,8 @@
'use strict';
export const isAuthorized = (authcode) => {
if (JSON.parse(sessionStorage.getItem('user'))) {
const { resources } = JSON.parse(sessionStorage.getItem('hrUser'));
if (JSON.parse(sessionStorage.getItem('userResource'))) {
const resources = JSON.parse(sessionStorage.getItem('userResource'));
return resources.includes(authcode);
} else {
return false;

1
web/client/src/utils/webapi.js

@ -76,6 +76,7 @@ export const ApiTable = {
getResource: 'resource/list',
getRoleResource: 'roleResource/list',
addRoleResource: 'roleResource/add',
getUserResource: 'user/{userId}/role/resources',
// 请假统计添加备注
createVacateRemark: 'attendance/vacate/creat/remark'

Loading…
Cancel
Save