trunk/pc4mobx/organization/components/newImport/index.js

192 lines
5.9 KiB
JavaScript
Raw Normal View History

2022-07-25 17:53:00 +08:00
import React from 'react'
import {
toJS
} from 'mobx'
import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaAlertPage,
2024-06-14 16:25:07 +08:00
WeaBrowser,
WeaLocaleProvider
2022-07-25 17:53:00 +08:00
} from 'ecCom'
import {
Spin,
} from 'antd';
import {
i18n
} from '../../public/i18n';
import '../../style/import.css';
2022-07-27 14:54:59 +08:00
import { addContentPath } from '../../util/index.js';
2022-07-25 17:53:00 +08:00
import StepDialog from './stepDialog';
2022-08-18 17:42:15 +08:00
import { renderNoright } from '../../util';
2024-06-14 16:25:07 +08:00
const getLabel = WeaLocaleProvider.getLabel;
2022-07-25 17:53:00 +08:00
@inject("newImport")
@observer
export default class newImport extends React.Component {
constructor(props) {
super(props);
2022-07-27 14:54:59 +08:00
2022-07-25 17:53:00 +08:00
}
2022-08-18 17:42:15 +08:00
componentDidMount() {
const {newImport} = this.props;
newImport.getHasRight();
2022-07-25 17:53:00 +08:00
}
2022-08-18 17:42:15 +08:00
componentWillMount() {
2022-07-25 17:53:00 +08:00
}
2022-07-27 14:54:59 +08:00
2022-07-25 17:53:00 +08:00
getImportCard = () => {
const {
newImport
} = this.props, {
isMouseOver,
curIndex,
setMouseStatus,
} = newImport;
let arr = [];
2024-06-14 16:25:07 +08:00
const cardConfig = [
{
"subTitle": getLabel(547211,'分部设置'),
"bgColor": "#92B75B",
"icon": "icon-coms-Department-number",
"title": getLabel(547332,'分部'),
"linkName": getLabel(547207,'分部导入'),
"url": "/spa/organization/static/index.html#/main/organization/company"
},
{
"subTitle": getLabel(547212,'部门设置'),
"bgColor": "#92B75B",
"icon": "icon-coms-Department-number",
"title": getLabel(547331,'部门'),
"linkName": getLabel(547208,'部门导入'),
"url": "/spa/organization/static/index.html#/main/organization/department"
},
// {
// "subTitle": "岗位设置",
// "bgColor": "#49B2FE",
// "icon": "icon-coms-hrm",
// "title": "岗位",
// "linkName": "岗位体系导入",
// "url": "/spa/organization/static/index.html#/main/organization/job"
// },
{
"subTitle": getLabel(547213,'组织维护'),
"bgColor": "#51A39A",
"icon": "icon-coms-crm",
"title": getLabel(547205,'人员'),
"linkName": getLabel(547209,'人员导入'),
"url": "/spa/organization/static/index.html#/main/organization/resource"
},
{
"subTitle": getLabel(547214,'等级设置'),
"bgColor": "rgb(230, 168, 69)",
"icon": "icon-portal-kpi-o",
"title": getLabel(547210,'职等职级导入'),
"linkName": getLabel(547206,'职等职级'),
"url": "/spa/organization/static/index.html#/main/organization/rankscheme"
},
]
2022-07-25 17:53:00 +08:00
cardConfig.map((c, index) => {
2022-07-27 14:54:59 +08:00
arr.push(<div className='hrm-card-out' style={(index == 0 || index == 4) ? { marginLeft: 0 } : {}} onMouseEnter={() => setMouseStatus(index, true)} onMouseLeave={() => setMouseStatus(index, false)}>
<div className='hrm-card-inwrap' style={curIndex == index && isMouseOver ? { backgroundColor: '#858585' } : { backgroundColor: c.bgColor }}>
{curIndex == index && isMouseOver ? this.getLinkName(c.linkName, index) : this.getIcon(c.icon)}
{curIndex == index && isMouseOver ? this.getSubTitle(c.subTitle, c.url) : this.getTitle(c.title)}
</div>
</div>)
2022-07-25 17:53:00 +08:00
});
return arr;
}
getIcon = (icon) => {
return (<div className='hrm-card-icon'>
2022-07-27 14:54:59 +08:00
<i className={icon} />
</div>)
2022-07-25 17:53:00 +08:00
}
getTitle = (title) => {
return (<div className='hrm-card-title'>{title}</div>)
}
getLinkName = (linkName, index) => {
2022-07-27 14:54:59 +08:00
return (<div style={{ width: '100%', height: 95 }}>
<div style={{ textAlign: 'center', paddingTop: 45 }}>
<a onClick={() => this.handleClick(index)} style={{ color: '#fff', textDecoration: 'underline', fontSize: 15 }}>{linkName}</a>
</div>
</div>)
2022-07-25 17:53:00 +08:00
}
getSubTitle = (subTitle, url) => {
2022-07-27 14:54:59 +08:00
return (<div style={{ height: 35, textAlign: 'right', paddingRight: 10, backgroundColor: '#6A6A6A', color: '#fff', paddingTop: 5 }}><a href={addContentPath(url)} target='_blank' className='hrm-import-link'>{subTitle}</a></div>)
2022-07-25 17:53:00 +08:00
}
handleClick = (index) => {
const {
2022-07-27 14:54:59 +08:00
newImport
2022-07-25 17:53:00 +08:00
} = this.props, {
} = newImport;
switch (index) {
2022-07-27 14:54:59 +08:00
case 0:
2022-07-25 17:53:00 +08:00
newImport.importType = 'company';
break;
case 1:
newImport.importType = 'department';
break;
2022-12-08 18:06:21 +08:00
// case 2:
// newImport.importType = 'jobtitle';
// break;
2022-07-27 14:54:59 +08:00
case 2:
2022-07-25 17:53:00 +08:00
newImport.importType = 'resource';
break;
2022-12-08 18:06:21 +08:00
case 3:
2022-11-10 16:11:59 +08:00
newImport.importType = 'joblevel';
break;
2022-07-25 17:53:00 +08:00
}
newImport.buttonTitle = i18n.button.nextStep();
newImport.current = 0;
newImport.visible = true;
newImport.getImportField();
}
render() {
const {
newImport,
2022-07-27 14:54:59 +08:00
} = this.props, {
2022-08-18 17:42:15 +08:00
visible,
hasRight
2024-06-14 16:25:07 +08:00
} = newImport;
2022-07-25 17:53:00 +08:00
2022-08-18 17:42:15 +08:00
if (hasRight === false) {
return renderNoright();
}
2022-07-25 17:53:00 +08:00
return (
2022-08-18 17:42:15 +08:00
hasRight && <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@sp0zb8`}
2024-06-14 16:25:07 +08:00
title={i18n.label.dataImport()}
2022-07-25 17:53:00 +08:00
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
showDropIcon={true}
>
<div className='hrm-import-wrap'>{this.getImportCard()}</div>
2022-07-27 14:54:59 +08:00
{visible && <StepDialog ecId={`${this && this.props && this.props.ecId || ''}_StepDialog@633i8k`} />}
2022-07-25 17:53:00 +08:00
</WeaTop>
)
}
}