Browse Source

(+)权限控制

master
ww664853070 1 year ago
parent
commit
13ec2ce69c
  1. 2
      api/app/lib/controllers/role/index.js
  2. 10
      web/client/src/layout/containers/layout/index.jsx
  3. 11
      web/client/src/sections/humanAffairs/actions/role.js
  4. 20
      web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx
  5. 5
      web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx
  6. 39
      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. 38
      web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx
  10. 3
      web/client/src/sections/humanAffairs/containers/monthlyProcess.jsx
  11. 38
      web/client/src/sections/humanAffairs/containers/overtimeStatistics.jsx
  12. 13
      web/client/src/sections/humanAffairs/containers/personalTrainRecord.jsx
  13. 54
      web/client/src/sections/humanAffairs/containers/personnelFiles.jsx
  14. 50
      web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx
  15. 50
      web/client/src/sections/humanAffairs/containers/pmLog.jsx
  16. 17
      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. 48
      web/client/src/sections/humanAffairs/containers/saleLog.jsx
  21. 36
      web/client/src/sections/humanAffairs/containers/salersDistribution/personnelDistribution.jsx
  22. 50
      web/client/src/sections/humanAffairs/containers/weeklyManagement.jsx
  23. 230
      web/client/src/sections/humanAffairs/nav-item.jsx
  24. 4
      web/client/src/utils/func.js
  25. 19
      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) {

10
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'
@ -48,7 +49,7 @@ const LayoutContainer = props => {
document.getElementById('HrApp').clientWidth - (collapsed ? 120 : 240)
));
}
function deepCopy (data) {//
function deepCopy(data) {//
//string,number,bool,null,undefined,symbol
//object,array,date
if (data && typeof data === "object") {
@ -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`
}
@ -343,7 +349,7 @@ const LayoutContainer = props => {
)
}
function mapStateToProps (state) {
function mapStateToProps(state) {
const { global, auth, ajaxResponse, webSocket } = state;
return {
title: global.title,

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 } },
});
}

20
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 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, marginLeft: 18, cursor: "pointer" }}
onClick={() => {
exportAllData()
}}>
导出
</div>
</div>
{
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 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>

39
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,24 +591,27 @@ const employeeInformation = (props) => {
</Form.Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.hiredateStart = ''
obj.hiredateEnd = ''
{
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) {
obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.hiredateStart = ''
obj.hiredateEnd = ''
}
setDownloadUrl(`members/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&marital=${obj.marital ? obj.marital : ''}&native=${obj.native ? obj.native : ''}&workPlace=${obj.workPlace ? obj.workPlace : ''}&hiredateStart=${obj.hiredateStart}&hiredateEnd=${obj.hiredateEnd}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
setDownloadUrl(`members/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&marital=${obj.marital ? obj.marital : ''}&native=${obj.native ? obj.native : ''}&workPlace=${obj.workPlace ? obj.workPlace : ''}&hiredateStart=${obj.hiredateStart}&hiredateEnd=${obj.hiredateEnd}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
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>
}
}];

38
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,24 +372,27 @@ const leaveStatistics = (props) => {
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
{
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) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
}
setDownloadUrl(`attendance/vacate/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
setDownloadUrl(`attendance/vacate/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
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>
}
}];

38
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,24 +410,27 @@ const overtimeStatistics = (props) => {
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
{
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) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
}
setDownloadUrl(`attendance/overtime/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
setDownloadUrl(`attendance/overtime/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
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)}
/>

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

@ -1,13 +1,14 @@
import React, { useEffect, useState,useRef } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import { Table, Pagination, Skeleton } from '@douyinfe/semi-ui';
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
const { dispatch, actions, personalTrainRecordList } = props
const [limits, setLimits] = useState()//
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [importModalV, setImportModalV] = useState(false); //
@ -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 }}>
@ -184,11 +185,11 @@ const PersonalTrainRecord = (props) => {
}
function mapStateToProps(state) {
const { auth, global,personalTrainRecordList } = state;
const { auth, global, personalTrainRecordList } = state;
return {
user: auth.user,
actions: global.actions,
personalTrainRecordList:personalTrainRecordList.data || {}
personalTrainRecordList: personalTrainRecordList.data || {}
};
}

54
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" }}
onClick={() => {
setPersonnelModal(true);
}}>
新增档案
</div>
<div onClick={() => setExportModalVs(true)} style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}>
导入员工信息
</div>
{
isAuthorized('ADDINGFILES') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => {
setPersonnelModal(true);
}}>
新增档案
</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>
@ -135,19 +141,23 @@ const Rest = (props) => {
<Radio value='onJob'>在职</Radio>
</RadioGroup>
</div>
<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 }}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
</div>
<div style={{ marginLeft: 4, color: '#005ABD', fontSize: 13 }} >
导出
</div>
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
{
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 }}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
</div>
<div style={{ marginLeft: 4, color: '#005ABD', fontSize: 13 }} >
导出
</div>
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div> : ''
}
</div>
</div>
<div style={{ display: 'flex', flexWrap: 'wrap', marginLeft: 30 }}>

50
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'
@ -147,14 +148,14 @@ const Rest = (props) => {
getWorkOption()//
getLeaveOption()//
}, [startDate, endDate])
function peopleDetail () {
function peopleDetail() {
dispatch(humanAffairs.getMemberList({ keywordTarget: 'number', keyword: history?.location?.search.slice(1).split('-')[0] })).then((res) => {//
if (res.success) {
setPepObj(res.payload?.data?.rows[0])
}
})
}
function getWorkOption () {//线
function getWorkOption() {//线
let date = [];
let showdate = []
let showdate1 = []
@ -278,7 +279,7 @@ const Rest = (props) => {
}
})
}
function getLeaveOption () {//线
function getLeaveOption() {//线
let date = [];
let showdate = []
dispatch(humanAffairs.getMemberVacate({ pepUserId: history?.location?.search.slice(1).split('-')[1], startDate: startDate, endDate: endDate })).then((res) => {//
@ -407,7 +408,7 @@ const Rest = (props) => {
}
})
}
function handleChange (date) {
function handleChange(date) {
if (date.length > 1) {
setStartDate(moment(date[0]).format('YYYY-MM-DD'))
setEndDate(moment(date[1]).format('YYYY-MM-DD'))
@ -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" }}
onClick={() => {
setPersonnelModal(true);
}}
>
编辑档案
</div>
<div style={{ padding: '6px 20px', background: '#FF5254', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 20 }}
onClick={() => { setDeleteModal(true) }}
>
删除档案
</div>
{
isAuthorized('EDITPROFILE') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => {
setPersonnelModal(true);
}}
>
编辑档案
</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 style={{ borderBottom: '1px solid #DCDEE0', margin: '16px 0px 16px -20px' }}></div>
@ -651,11 +657,11 @@ const Rest = (props) => {
</div>
<div style={{ color: '#005ABD', fontSize: 13 }}>
{
pepObj.userJob? UserAttribute.jobDataSource[pepObj.userJob - 1] : '暂无'
pepObj.userJob ? UserAttribute.jobDataSource[pepObj.userJob - 1] : '暂无'
}
</div>
</div>
<div style={{ display: 'flex', width: '17.072%'}}>
<div style={{ display: 'flex', width: '17.072%' }}>
<div style={{ color: 'rgba(0, 0, 0,0.6)', fontSize: 12, width: 60 }}>
员工岗位
</div>
@ -665,13 +671,13 @@ const Rest = (props) => {
}
</div>
</div>
<div style={{ display: 'flex', width: '32.395%'}}>
<div style={{ display: 'flex', width: '32.395%' }}>
<div style={{ color: 'rgba(0, 0, 0,0.6)', fontSize: 12, width: 84, textAlign: 'end' }}>
所属机构
</div>
<div style={{ color: '#4A4A4A', fontSize: 13 }}>
{
pepObj.userOrganization? UserAttribute.organizationDataSource[pepObj.userOrganization - 1] : '暂无'
pepObj.userOrganization ? UserAttribute.organizationDataSource[pepObj.userOrganization - 1] : '暂无'
}
</div>
</div>
@ -721,7 +727,7 @@ const Rest = (props) => {
入职年限
</div>
<div style={{ color: '#4A4A4A', fontSize: 13 }}>
{pepObj.hiredate ? String(moment(new Date()).diff(pepObj.hiredate, 'years',true)).substring(0,3) + '年' : '暂无'}
{pepObj.hiredate ? String(moment(new Date()).diff(pepObj.hiredate, 'years', true)).substring(0, 3) + '年' : '暂无'}
</div>
</div>
<div style={{ marginTop: 9, display: 'flex', width: '32.395%' }}>
@ -955,7 +961,7 @@ const Rest = (props) => {
)
}
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, global, members, webSocket } = state;
return {
// loading: members.isRequesting,

50
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,31 +265,34 @@ 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'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
{
isAuthorized('EXPORTENGINEERINGLOG') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=pm`
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=pm`
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button> : ''
}
</div>
</div>
</div>

17
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" }}
onClick={() => { handleImportModal(); }}
>
导入
</div>
{
isAuthorized('IMPORTJOBRATINGS') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { handleImportModal(); }}
>
导入
</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 }}

48
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,31 +265,32 @@ 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'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
{
isAuthorized('EXPORTSALESLOG') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=sale`
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=sale`
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button> : ''}
</div>
</div>
</div>

36
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) => {
@ -38,7 +39,7 @@ const PersonnelDistribution = (props) => {
let kt = keywordTarget == 'place' ? '' : keywordTarget;
let k = keywordTarget == 'place' ? '' : keyword;
let placeSearch = keywordTarget == 'place' ? keyword : '';
dispatch(humanAffairs.getSalesList({ keywordTarget: kt, keyword: k,userActiveStatus, placeSearch, ...query })).then(r => {
dispatch(humanAffairs.getSalesList({ keywordTarget: kt, keyword: k, userActiveStatus, placeSearch, ...query })).then(r => {
if (r.success) {
setTableData(r.payload?.data?.rows);
setLimits(r.payload?.data?.count)
@ -118,12 +119,12 @@ const PersonnelDistribution = (props) => {
let arrStr = text.map(t => t.name);
return getMultis(arrStr);
}
},{
}, {
title: '在职状态',
dataIndex: 'userActiveStatus',
key: 'userActiveStatus',
width: 200,
render: (text, r, index) => text == '1'?'在职':text == '2'?'离职':'特殊账号-特殊状态'
render: (text, r, index) => text == '1' ? '在职' : text == '2' ? '离职' : '特殊账号-特殊状态'
}, {
title: '销售区域(省/直辖市)',
dataIndex: 'provinces',
@ -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 }}
onClick={() => {
setModalV(true);
setDataToEdit(null);
}}>
新增
</div>
{
isAuthorized('ADDSALESPERSONNEL') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginRight: 18 }}
onClick={() => {
setModalV(true);
setDataToEdit(null);
}}>
新增
</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" }}
onClick={() => { setImportModalV(true); }}>
导入
</div>
{
isAuthorized('IMPORTSALESPERSONNELDISTRIBUTION') ? <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, cursor: "pointer" }}
onClick={() => { setImportModalV(true); }}>
导入
</div> : ''
}
{/* <div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }}>
导出
</div> */}

50
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,31 +290,34 @@ 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'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
{
isAuthorized('EXPORTWEEKLYREPORT') ? <Button theme='solid'
type='primary'
style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
// disable={btnDisable}
onClick={() => {
const weeklyRange = form.current.getValue("weeklyRange");
if (weeklyRange && weeklyRange.length == 2) {
dispatch(getServiceUrl()).then(res => {
const { payload } = res;
if (payload && payload.url) {
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=week`
let url = `${payload.url}/week_report/week`;
if (weeklyRange && weeklyRange.length == 2) {
url += `?start=${moment(weeklyRange[0]).format('YYYY-MM-DD HH:mm:ss')}&end=${moment(weeklyRange[1]).format('YYYY-MM-DD HH:mm:ss')}&type=week`
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
console.log(url);
setDownloadUrl(url);
} else {
setWarningBanner("导出地址有误,导出失败");
}
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button>
})
} else {
setWarningBanner("请选择查询时间范围");
}
}}>导出</Button> : ''
}
</div>
</div>
</div>

230
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 (
[
{
itemKey: 'humanAffairs',
text: '人事管理',
icon: <IconCode />,
items: [{
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: [
isAuthorized('PERSONNELFILEMANAGEMENT') ? {
itemKey: 'personnelArchives',
text: '人员档案',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbrengongdangan"></iconpark-icon>,
to: '/humanAffairs/archivesCenter/personnelArchives/personnelFiles',
items: [{
itemKey: 'personnelFiles', to: '/humanAffairs/archivesCenter/personnelArchives/personnelFiles', text: '人员档案'
}, {
itemKey: 'employeeInformation', to: '/humanAffairs/archivesCenter/personnelArchives/employeeInformation', text: '员工信息'
}, {
itemKey: 'positionRating', to: '/humanAffairs/archivesCenter/personnelArchives/positionRating', text: '岗位评级'
}]
}, {
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: [{
itemKey: 'department', to: '/humanAffairs/archivesCenter/deptArchives/department', text: '部门档案'
}]
}, {
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: [{
itemKey: 'attendanceStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/attendanceStatistics', text: '出勤统计'
}, {
itemKey: 'leaveStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/leaveStatistics', text: '请假统计'
}, {
itemKey: 'overtimeStatistics', to: '/humanAffairs/employeeRelationship/leaveManagement/overtimeStatistics', text: '加班统计'
}]
}, {
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: [{
itemKey: 'employeeCommunication', to: '/humanAffairs/employeeRelationship/communication/employeeCommunication', text: '员工沟通统计'
}]
}, {
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: [{
itemKey: 'appointmentRecords', to: '/humanAffairs/recruit/recruitRecord/appointmentRecords', text: '任用记录'
}]
}, {
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: [{
itemKey: 'personnelDistribution', to: '/humanAffairs/recruit/salesStatistics/personnelDistribution', text: '销售人员分布'
}]
}, {
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: [{
itemKey: 'resourceRepository', to: '/humanAffairs/train/trainFiles/resourceRepository', text: '培训资源储存库'
}]
}, {
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: [{
itemKey: 'personalTrainRecord', to: '/humanAffairs/train/trainingManagement/personalTrainRecord', text: '个人培训记录'
}, {
itemKey: 'departmentTrainRecord', to: '/humanAffairs/train/trainingManagement/departmentTrainRecord', text: '部门培训记录'
}]
}, {
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: [{
itemKey: 'weeklyManagement', to: '/humanAffairs/achievements/basicAction/weeklyManagement', text: '周报管理'
}, {
itemKey: 'saleLog', to: '/humanAffairs/achievements/basicAction/saleLog', text: '销售日志'
}, {
itemKey: 'pmLog', to: '/humanAffairs/achievements/basicAction/pmLog', text: '工程日志'
}]
}, {
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: [{
itemKey: 'probationer', to: '/humanAffairs/achievements/employeeKPI/probationer', text: '试用期员工考核'
}, {
itemKey: 'regular', to: '/humanAffairs/achievements/employeeKPI/regular', text: '正式员工考核'
}]
}, {
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: [{
itemKey: 'monthlyProcess', to: '/humanAffairs/achievements/middleKPI/monthlyProcess', text: '月度过程考核'
}, {
itemKey: 'quarter', to: '/humanAffairs/achievements/middleKPI/quarter', text: '季度考核'
}]
}, {
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: [{
itemKey: 'highMonthly', to: '/humanAffairs/achievements/highKPI/highMonthly', text: '月度过程考核'
},{
itemKey: 'Highquarter', to: '/humanAffairs/achievements/highKPI/Highquarter', text: '季度考核'
}]
}, {
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: [{
itemKey: 'penaltiesRecord', to: '/humanAffairs/achievements/penalties/penaltiesRecord', text: '奖惩信息'
}]
}, {
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;

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

@ -67,15 +67,16 @@ export const ApiTable = {
getemployeeAssessmentList: 'employessAssessment/list/{type}',
//权限
getRoleList:'role/list',
addRole:'role/add',
editRole:'role/edit',
delRole:'role/del',
getUserRoleList:'roleUser/list',
addUserRole:'roleUser/add',
getResource:'resource/list',
getRoleResource:'roleResource/list',
addRoleResource:'roleResource/add',
getRoleList: 'role/list',
addRole: 'role/add',
editRole: 'role/edit',
delRole: 'role/del',
getUserRoleList: 'roleUser/list',
addUserRole: 'roleUser/add',
getResource: 'resource/list',
getRoleResource: 'roleResource/list',
addRoleResource: 'roleResource/add',
getUserResource: 'user/{userId}/role/resources',
// 请假统计添加备注
createVacateRemark: 'attendance/vacate/creat/remark'

Loading…
Cancel
Save