56 lines
2.4 KiB
JavaScript
56 lines
2.4 KiB
JavaScript
import React, {Component} from 'react';
|
|
import {WeaTools, WeaTop, WeaAlertPage, WeaLocaleProvider} from 'ecCom';
|
|
import {Spin, Button, message} from 'antd';
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
const callApi = WeaTools.callApi;
|
|
const iconProps = WeaTools.getIconBGC('hrm');
|
|
|
|
export default class ReplaceSearchPinyin extends Component{
|
|
constructor(props){
|
|
super(props);
|
|
this.state = {
|
|
hasRight: false,
|
|
spinning: false
|
|
}
|
|
}
|
|
|
|
componentDidMount(){
|
|
callApi('/api/hrm/resource/getGenSearchPinyinHasRight', 'GET', {}).then(data => {
|
|
if(data.status == '1')
|
|
this.setState({hasRight: true});
|
|
else
|
|
this.setState({hasRight: false});
|
|
}, error => {this.setState({hasRight: false})});
|
|
}
|
|
|
|
doTrans = () => {
|
|
this.setState({spinning: true});
|
|
callApi('/api/hrm/resource/genSearchPinyin', 'POST', {}).then(data => {
|
|
if(data.status == '1')
|
|
message.success(getLabel(30700, '操作成功'));
|
|
else
|
|
message.error(data.message);
|
|
this.setState({spinning: false});
|
|
}, error => this.setState({spinning: false}));
|
|
}
|
|
|
|
render(){
|
|
return (
|
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@qngtxb`} spinning={this.state.spinning} tip='处理中,请稍后'>
|
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@xmfer0`} title="格式化人员全拼搜索数据" icon={<i className={iconProps.icon}/>} iconBgcolor={iconProps.iconBgcolor}>
|
|
{
|
|
this.state.hasRight ?
|
|
<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@sbohf0`} icon='icon-coms-task-list'>
|
|
<div><Button ecId={`${this && this.props && this.props.ecId || ''}_Button@4fcjro`} type='primary' onClick={() => this.doTrans()}>开始生成</Button></div>
|
|
</WeaAlertPage>
|
|
:
|
|
<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@em7siv`}>
|
|
<div style={{ color: '#000' }}>{getLabel(2012, '对不起,您暂时没有权限!')}</div>
|
|
</WeaAlertPage>
|
|
}
|
|
</WeaTop>
|
|
</Spin>
|
|
)
|
|
}
|
|
} |