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

154 lines
4.1 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,
2022-07-27 14:54:59 +08:00
WeaBrowser
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';
2022-07-25 17:53:00 +08:00
@inject("newImport")
@observer
export default class newImport extends React.Component {
constructor(props) {
super(props);
this.state = ({
2022-11-09 10:07:18 +08:00
title: '数据导入',
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,
cardConfig,
setMouseStatus,
} = newImport;
let arr = [];
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-07-27 14:54:59 +08:00
case 2:
2022-07-25 17:53:00 +08:00
newImport.importType = 'jobtitle';
break;
2022-07-27 14:54:59 +08:00
case 3:
2022-07-25 17:53:00 +08:00
newImport.importType = 'resource';
break;
2022-11-10 16:11:59 +08:00
case 4:
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
2022-07-27 14:54:59 +08:00
} = newImport, {
2022-07-25 17:53:00 +08:00
title,
} = this.state;
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`}
2022-07-25 17:53:00 +08:00
title={title}
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>
)
}
}