HRHead.js
9.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import React,{PropTypes} from 'react';
import ReactDOM from 'react-dom';
import cx from 'classnames';
import {Row,Col,message, Menu, Dropdown} from 'antd';
// import s from './header.scss';
import s from '../../../containers/hrboard/Index.scss';
class HRHead extends React.Component {
constructor(props) {
super(props);
this.goFirstIndex=this.goFirstIndex.bind(this);
this.goIndex=this.goIndex.bind(this);
this.goOrganization=this.goOrganization.bind(this);
this.goAttendanceSettings=this.goAttendanceSettings.bind(this);
this.goChat=this.goChat.bind(this);
this.goUserInfo=this.goUserInfo.bind(this);
this.goSignOut=this.goSignOut.bind(this);
this.trueOrfalse=this.trueOrfalse.bind(this);
this.goPay=this.goPay.bind(this);
this.goCompanyAccount = this.goCompanyAccount.bind(this);
this.goContract = this.goContract.bind(this);
this.state={
menu:'1',
}
}
static propTypes = {
title:PropTypes.string,
close:PropTypes.func,
userInfo:PropTypes.object,
messageCounts:PropTypes.object,
// pathname:PropTypes.object
}
static defaultProps={
close:()=>{
}
}
changeMenu(menu){
this.setState({
menu
})
}
goFirstIndex(){
window.location.href='#/user/hrboard/firstIndex';
}
goIndex(){
window.location.href='#/user/hrboard/staffs/';//'#/user/hrboard/index';
}
goOrganization(){
window.location.href='#/user/hrboard/organization';
}
goAttendanceSettings(){
// message.success('正在开发中,精彩稍后呈现!', 2);
// window.location.href='#/user/hrboard/attendanceSettings';
window.location.href='#/user/hrboard/setattend';
}
goPay(){
window.location.href='#/user/hrboard/payRoll';
// message.success('正在紧密开发中,精彩稍后呈现!', 2);
}
goApprovalSetting(){
window.location.href='#/user/hrboard/approvalSetting';
}
goChat(){
window.location.href='#/user/chat';
}
goUserInfo(){
const {userInfo}=this.props;
window.location.href='#/user/hrboard/personal/'+userInfo.user_id;
}
goSignOut(){
window.location.href =`${__PREFIX__}signOut`;
}
goIntelligentPay(){
// window.location.href='#/user/hrboard/intelligentPay';
window.location.href='#/user/hrboard/calculateSalaryIndex';
}
goCompanyAccount(){
// window.location.href='#/user/hrboard/account';
}
goContract(){
window.location.href='#/user/hrboard/contract';
}
trueOrfalse(type){
let showImg='';
if(type){
showImg=true
}else{
showImg=false
}
return showImg
}
componentDidMount(){
}
componentWillReceiveProps(nextProps){
}
componentDidUpdate(prevProps,prevState){
}
componentWillUnmount() {
}
renderLink(){
return(
<Menu>
<Menu.Item key="0">
<a href="#/user/hrboard/account/0">我的钱包</a>
</Menu.Item>
<Menu.Item key="1">
<a href="#/user/hrboard/orders">订单管理</a>
</Menu.Item>
<Menu.Item key="2">
<a href="#/user/hrboard/invoice">发票管理</a>
</Menu.Item>
</Menu>
)
}
render(){
const {title,messageCounts,userInfo:{company_logo=''},pathname}=this.props;
const src=company_logo?
`https://${window.oss.public_bucket}`+company_logo+'?t='+new Date().getTime():
'LOGO';
//公司的logo 需要的拼接的地址
//src={'https://oss-cn-beijing.aliyuncs.com/krhrimg/user_image/'+userInfo.tenant_id+'/'+userInfo.user_id+'.png?t='+new Date().getTime()}
let showImg=this.trueOrfalse(company_logo)
const {menu}=this.state;
let counts=0;
Object.values(messageCounts).map((count,i)=>{
counts=counts+parseInt(count);
});
let selectMenu=0;
if(pathname.indexOf('hrboard/firstIndex')!=-1){
selectMenu=0;
}else if(pathname.indexOf('hrboard/staffs')!=-1){
selectMenu=1;
}else if(pathname.indexOf('hrboard/organization')!=-1){
selectMenu=2;
}else if(pathname.indexOf('hrboard/attendanceSettings')!=-1 ||
pathname.indexOf('hrboard/setattend')!=-1
){
selectMenu=3;
}else if(pathname.indexOf('hrboard/payRoll')!=-1||
pathname.indexOf('hrboard/PaySheetLastChange')!=-1||
pathname.indexOf('hrboard/payRollAction')!=-1){
selectMenu=4;
}else if(pathname.indexOf('hrboard/approvalSetting')!=-1){
selectMenu=5;
}else if(pathname.indexOf('hrboard/account')!=-1 ||
pathname.indexOf('hrboard/orders')!=-1 ||
pathname.indexOf('hrboard/invoice')!=-1 ||
pathname.indexOf('hrboard/payconfirm')!=-1
){
selectMenu=6;
}else if(pathname.indexOf('hrboard/intelligentPay')!=-1||
pathname.indexOf('hrboard/payrollList')!=-1||
pathname.indexOf('hrboard/calculateSalaryIndex')!=-1||
pathname.indexOf('hrboard/showDetail')!=-1||
pathname.indexOf('hrboard/manageSalary')!=-1||
pathname.indexOf('hrboard/SalarySetup')!=-1||
pathname.indexOf('hrboard/salarySetup')!=-1||
pathname.indexOf('hrboard/intelligentauto')!=-1||
pathname.indexOf('hrboard/updateauto')!=-1 ||
pathname.indexOf('hrboard/calcsalarytable')!=-1 ||
pathname.indexOf('hrboard/PeosonalMes')!=-1 ||
pathname.indexOf('hrboard/salaryHistory')!=-1 ||
pathname.indexOf('hrboard/personalTaxDetail')!=-1 ||
pathname.indexOf('hrboard/fundDetail')!=-1 ||
pathname.indexOf('hrboard/tableDetailAtd')!=-1 ||
pathname.indexOf('hrboard/tableDetailPay')!=-1 ||
pathname.indexOf('hrboard/payBeanDetail')!=-1 ||
pathname.indexOf('hrboard/optimizePayDetail')!=-1
){
selectMenu=7;
}else if(pathname.indexOf('hrboard/listOfTable')!=-1 ||
pathname.indexOf('hrboard/contract')!=-1 ||
pathname.indexOf('hrboard/setContract')!=-1
){
selectMenu=8;
}
// console.log('selectMenu--------------',selectMenu)
return (
<div className={cx(s.indexHead)} >
<div className={cx(s.indexHeadNav)}>
<div className={cx(s.indexHeadLogo)} onClick={this.goFirstIndex}>
{showImg? <img style={{width:'100px',height:'60px',position:'absolute',left:'20px'}} src={src} />:
<span style={{display:'inline-block',marginTop:'10px',marginLeft:'30px',height:'30px',fontSize:'25px',fontWeight:'bold'}}>{src}</span>}
</div>
<div className={cx(s.indexHeadLine)}></div>
<div className={cx(s.indexHeadList)}>
<a className={cx(selectMenu==0?s.headStyle:null)} onClick={this.goFirstIndex}>首页</a>
<a className={cx(selectMenu==1?s.headStyle:null)} onClick={this.goIndex}>员工管理</a>
<a className={cx(selectMenu==2?s.headStyle:null)} onClick={this.goOrganization}>组织管理</a>
<a className={cx(selectMenu==3?s.headStyle:null)} onClick={this.goAttendanceSettings}>考勤设置</a>
{/*<a className={cx(selectMenu==4?s.headStyle:null)} onClick={this.goPay}>薪酬管理</a>*/}
<a className={cx(selectMenu==5?s.headStyle:null)} onClick={this.goApprovalSetting}>审批管理</a>
<a className={cx(selectMenu==7?s.headStyle:null)} onClick={this.goIntelligentPay}>智能薪酬</a>
{/*by chenming*/}
<Dropdown overlay={this.renderLink()} trigger={['click']}>
<a className={cx(selectMenu==6?s.headStyle:null)} onClick={this.goCompanyAccount}>企业帐户</a>
</Dropdown>
<a className={cx(selectMenu==8?s.headStyle:null)} onClick={this.goContract}>劳动合同</a>
</div>
<div className={cx(s.indexHeadIcon)}>
<span onClick={this.goChat} style={{marginRight:'20px'}}>
<i className={cx(s.shortcut_menu,'kr_icon')}></i>
{counts>0&&
<i className={cx(s.message_point,'kr_icon')}></i>
}
</span>
<span onClick={this.goUserInfo} style={{marginRight:'20px'}}><i className={cx(s.shortcut_menu,'kr_icon')}></i></span>
<span onClick={this.goSignOut}><i className={cx(s.shortcut_menu_abort)}>退出</i></span>
</div>
</div>
</div>
)
}
}
export default HRHead;