基础数据导入
This commit is contained in:
parent
07dec3350f
commit
98bb6e3ae4
|
|
@ -0,0 +1,7 @@
|
|||
import {
|
||||
WeaTools
|
||||
} from 'ecCom'
|
||||
|
||||
export const getBasicDataImportHasRight = (params) => {
|
||||
return WeaTools.callApi('/api/hrm/import/resource/getBasicDataImportHasRight', 'GET', params);
|
||||
}
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
import { WeaTools } from 'ecCom'
|
||||
|
||||
//作废
|
||||
//获取导入表单
|
||||
export const getImportForm = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
|
||||
}
|
||||
//导入文件提交
|
||||
export const saveImport = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/import/resource/saveImport`, 'POST', params);
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
|
||||
}
|
||||
|
||||
|
||||
//获取导入结果回调数据
|
||||
export const getImportProcessLog = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
import { WeaTools } from 'ecCom'
|
||||
//获取导入表单
|
||||
export const getImportForm = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
|
||||
}
|
||||
//导入文件提交
|
||||
export const saveImport = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
|
||||
}
|
||||
//获取导入结果回调数据
|
||||
export const getImportProcessLog = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
|
||||
}
|
||||
//获取导入结果
|
||||
export const getImportResult = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getImportResult`, 'GET', params);
|
||||
}
|
||||
//历史导入信息查询
|
||||
export const getImportHistory = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getImportHistory`, 'GET', params);
|
||||
}
|
||||
//导入日志
|
||||
export const getImportLogDetail = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getImportColResultLog`, 'GET', params);
|
||||
}
|
||||
//导入日志 - 高级搜索
|
||||
export const getImportLogSearchCondition = (params) => {
|
||||
return WeaTools.callApi(`/api/hrm/importlog/getHistorySearchCondition`, 'GET', params);
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ import '../../style/common.less'
|
|||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject('datasImport')
|
||||
@inject('resource')
|
||||
@observer
|
||||
export default class DatasImport extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -243,11 +244,15 @@ export default class DatasImport extends React.Component {
|
|||
|
||||
submit() {
|
||||
const {
|
||||
datasImport
|
||||
datasImport,
|
||||
resource
|
||||
} = this.props;
|
||||
datasImport.saveImport({}, () => {
|
||||
this.refs.scroll && this.refs.scroll.scrollToLast()
|
||||
this.refs.scroll && this.refs.scroll.scrollToLast();
|
||||
});
|
||||
|
||||
// resource.getTableInfo();
|
||||
// resource.getHasRight();
|
||||
}
|
||||
|
||||
cancel() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
import React from 'react'
|
||||
import {
|
||||
toJS
|
||||
} from 'mobx'
|
||||
import {
|
||||
inject,
|
||||
observer,
|
||||
} from 'mobx-react'
|
||||
import {
|
||||
WeaTop,
|
||||
WeaAlertPage,
|
||||
} from 'ecCom'
|
||||
import {
|
||||
Spin,
|
||||
} from 'antd';
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
import ImportResource from '../importresource/Import';
|
||||
//import Import from '../importRelatedComponet/index'
|
||||
import {addContentPath} from '../../util/index.js'
|
||||
import '../../style/import.css'
|
||||
|
||||
@inject('hrmBasicDataImport')
|
||||
@inject('hrmImportResource')
|
||||
@inject('hrmImportCommon')
|
||||
@observer
|
||||
export default class BasicInfoImport extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
let bool = window.location.href.indexOf('/spa/hrm/engine.html') > -1;
|
||||
if (bool) {
|
||||
document.title = i18n.module.basicInfoImport();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
hrmBasicDataImport
|
||||
} = this.props, {
|
||||
getRight
|
||||
} = hrmBasicDataImport;
|
||||
|
||||
getRight();
|
||||
}
|
||||
|
||||
getImportCard = () => {
|
||||
const {
|
||||
hrmBasicDataImport
|
||||
} = this.props, {
|
||||
isMouseOver,
|
||||
curIndex,
|
||||
cardConfig,
|
||||
setMouseStatus,
|
||||
} = hrmBasicDataImport;
|
||||
|
||||
let arr = [];
|
||||
|
||||
cardConfig.map((c, index) => {
|
||||
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>)
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
getIcon = (icon) => {
|
||||
return (<div className='hrm-card-icon'>
|
||||
<i className={icon} />
|
||||
</div>)
|
||||
}
|
||||
|
||||
getTitle = (title) => {
|
||||
return (<div className='hrm-card-title'>{title}</div>)
|
||||
}
|
||||
|
||||
getLinkName = (linkName, index) => {
|
||||
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>)
|
||||
}
|
||||
|
||||
getSubTitle = (subTitle, url) => {
|
||||
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>)
|
||||
}
|
||||
|
||||
handleClick = (index) => {
|
||||
const {
|
||||
hrmImportResource,
|
||||
hrmImportCommon,
|
||||
} = this.props, {
|
||||
setTempletName,
|
||||
setImportDialogTitle,
|
||||
setImportType,
|
||||
setImportDialogVisible
|
||||
} = hrmImportCommon;
|
||||
|
||||
switch (index) {
|
||||
case 0: //@lvyi
|
||||
hrmImportResource.visible = true;
|
||||
hrmImportResource.title = i18n.button.importOrg();
|
||||
hrmImportResource.importType = 'company';
|
||||
hrmImportResource.getImportForm();
|
||||
break;
|
||||
case 1:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.postSystemImport());
|
||||
setImportType('jobtitle');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
case 2: //@lvyi
|
||||
hrmImportResource.visible = true;
|
||||
hrmImportResource.title = i18n.button.importResource();
|
||||
hrmImportResource.importType = 'resource';
|
||||
hrmImportResource.getImportForm();
|
||||
break;
|
||||
case 3:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.groupInfoImport());
|
||||
setImportType('group');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
case 4:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.personalAndWorkInfoImport());
|
||||
setImportType('resourcedetial');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
case 5:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.areaInfoImport());
|
||||
setImportType('area');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
case 6:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.workingPlaceImport());
|
||||
setImportType('location');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
case 7:
|
||||
setTempletName(i18n.label.importTemplate());
|
||||
setImportDialogTitle(i18n.button.majorImport());
|
||||
setImportType('special');
|
||||
setImportDialogVisible(true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
hrmBasicDataImport,
|
||||
hrmImportResource,
|
||||
hrmImportCommon,
|
||||
} = this.props, {
|
||||
title,
|
||||
isMouseOver,
|
||||
loading,
|
||||
authorized,
|
||||
} = hrmBasicDataImport;
|
||||
|
||||
if (!authorized) {
|
||||
return (
|
||||
<div style={{height: '100%'}}>
|
||||
{loading ? <div className='hrm-loading-center'>
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@976rc9`} spinning={loading} size='large'></Spin>
|
||||
</div>
|
||||
: <div className="hrm-wea-alert-page">
|
||||
<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@0t0ln7`}>
|
||||
<div style={{ color: '#000' }}>
|
||||
{i18n.message.authFailed()}
|
||||
</div>
|
||||
</WeaAlertPage>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@sp0zb8`}
|
||||
title={title}
|
||||
icon={<i className='icon-coms-hrm'/>}
|
||||
iconBgcolor='#217346'
|
||||
loading={true}
|
||||
showDropIcon={true}
|
||||
>
|
||||
<div className='hrm-import-wrap'>{this.getImportCard()}</div>
|
||||
{hrmImportResource.visible && <ImportResource ecId={`${this && this.props && this.props.ecId || ''}_ImportResource@633i8k`} />}
|
||||
{/*其它导入暂时未实现 {hrmImportCommon.importDialog.visible && <Import ecId={`${this && this.props && this.props.ecId || ''}_Import@6c06u8`} />} */}
|
||||
</WeaTop>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,353 @@
|
|||
import {
|
||||
inject,
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaUpload,
|
||||
WeaDialog,
|
||||
WeaFormItem,
|
||||
WeaSearchGroup,
|
||||
WeaNewScroll,
|
||||
WeaSelect,
|
||||
WeaInput
|
||||
} from 'ecCom'
|
||||
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Button,
|
||||
Spin
|
||||
} from 'antd'
|
||||
|
||||
import {
|
||||
WeaSwitch
|
||||
} from 'comsMobx'
|
||||
import React from 'react'
|
||||
import ImportResult from './ImportResult'
|
||||
import ImportHistory from './ImportHistory'
|
||||
import {
|
||||
WeaLocaleProvider
|
||||
} from 'ecCom';
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
import {addContentPath} from '../../util/index.js'
|
||||
import '../../style/common.less'
|
||||
|
||||
@inject('hrmImportResource')
|
||||
@observer
|
||||
export default class ImportResource extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.list = [];
|
||||
}
|
||||
|
||||
getCircle() {
|
||||
let style = {
|
||||
width: 20,
|
||||
height: 20,
|
||||
backgroundColor: '#D8D8D8',
|
||||
webkitBorderRadius: 10,
|
||||
mozBorderRadius: 10,
|
||||
msBorderRadius: 10,
|
||||
oBorderRadius: 10,
|
||||
borderRadius: 10,
|
||||
//paddingLeft: 6,
|
||||
textAlign: 'center',
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
getForm() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
condition
|
||||
} = hrmImportResource;
|
||||
let _arr = [];
|
||||
|
||||
condition.map((c, i) => {
|
||||
let arr = [];
|
||||
if (i == 0) { //基本信息
|
||||
c.items.map((field, index) => {
|
||||
arr.push({
|
||||
com: (
|
||||
<div>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m9t2kn@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@rc5who@${index}`} span={1} offset={4}>
|
||||
<div style={{ marginTop: 15 }}>
|
||||
<div style={this.getCircle()}><div style={{ paddingTop: 2 }}>{index + 1}</div></div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@f1sc6s@${index}`} span={14}>
|
||||
<div style={{ marginTop: 15 }}>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@5gsx6o@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@qrdxst@${index}`} span={field.labelcol} style={{overflow: 'hidden',whiteSpace: 'nowrap',textOverflow: 'ellipsis'}} title={field.label}>{field.label}:</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7jy5um@${index}`} span={field.fieldcol}>
|
||||
{this.getDom(field)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
),
|
||||
colSpan: 1,
|
||||
})
|
||||
})
|
||||
}
|
||||
if (i == 1) { //导入说明
|
||||
c.items.map((field, index) => {
|
||||
arr.push({
|
||||
com: (
|
||||
<div>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||
<div style={this.getCircle()}>
|
||||
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||
{this.getIllustration(field.value, field.link, index, field)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
),
|
||||
colSpan: 1
|
||||
})
|
||||
})
|
||||
}
|
||||
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||
|
||||
});
|
||||
return _arr;
|
||||
}
|
||||
|
||||
getDom(field) {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
templetName,
|
||||
filelist,
|
||||
getTemplateUrl,
|
||||
importParams
|
||||
} = hrmImportResource;
|
||||
let dom;
|
||||
let domkey = field.domkey;
|
||||
if (domkey[0] == 'templet') {
|
||||
dom = <a href={addContentPath(field.value)}>{i18n.label.importTemplate()}</a>;
|
||||
} else if (domkey[0] === 'exportData') {
|
||||
const href = hrmImportResource.operateType === 'add' ? field.otherParams.fileVal[0].add : field.otherParams.fileVal[0].update;
|
||||
if(hrmImportResource.importType === 'matrix'){
|
||||
dom = <a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}</a>
|
||||
}else
|
||||
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||
} else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
|
||||
dom = (<div>
|
||||
<div style={{ float: 'left', marginTop: -10 }}>
|
||||
<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@iu8n01`}
|
||||
uploadUrl='/api/doc/upload/uploadFile'
|
||||
category='string'
|
||||
limitType='xls,xlsx'
|
||||
maxFilesNumber={1}
|
||||
datas={filelist}
|
||||
{...field.otherParams}
|
||||
onChange = {
|
||||
(ids, list) => {
|
||||
this.setFileId(ids, list)
|
||||
}
|
||||
} >
|
||||
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@87232v`}>{i18n.button.selectFile()}</Button>
|
||||
</WeaUpload>
|
||||
</div>
|
||||
<div style={{ float: 'left', paddingLeft: 10 }}>
|
||||
{filelist.length == 0 ? <p>{i18n.label.noFileSelected()}</p> : filelist.map(file => <p>{file.filename}</p>)}
|
||||
</div>
|
||||
</div>)
|
||||
} else if (domkey[0].indexOf('keyField') > -1) {
|
||||
const vals = field.options.filter(v => v.selected == true);
|
||||
let val = '';
|
||||
vals.length>0 && (val = vals[0].key);
|
||||
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@yzc92h`}
|
||||
style={{width: 200}}
|
||||
options={field.options}
|
||||
value={hrmImportResource.importParams[domkey[0]] || field.value || val}
|
||||
onChange={(v) => { hrmImportResource.setParam(domkey[0], v)}}
|
||||
/>
|
||||
} else if (domkey[0] == 'importType') {
|
||||
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@holhhb`}
|
||||
style={{width: 200}}
|
||||
options={field.options}
|
||||
value={hrmImportResource.operateType}
|
||||
onChange={(v) => { hrmImportResource.operateType = v }}
|
||||
/>
|
||||
} else {
|
||||
dom = <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@rg6f3p`} hasBorder={true} viewAttr={1} value={field.value}/>
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
|
||||
getIllustration(val, url, index, link) {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
templetName,
|
||||
getTemplateUrl,
|
||||
importParams
|
||||
} = hrmImportResource;
|
||||
let p;
|
||||
if (index == 0) {
|
||||
if (url instanceof Object) {
|
||||
const href = hrmImportResource.operateType === 'add' ? url.add : url.update;
|
||||
let dom;
|
||||
if(hrmImportResource.importType === 'matrix'){
|
||||
dom = <a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}</a>
|
||||
}else
|
||||
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:{dom}</p>);
|
||||
} else if (url != null) {
|
||||
if(hrmImportResource.importType === 'matrix'){
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:<a onClick={() => {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType)}}>{i18n.label.importTemplate()}</a></p>);
|
||||
}else
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:<a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||
} else {
|
||||
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||
}
|
||||
} else {
|
||||
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
setFileId(ids, list) {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.excelfile = ids;
|
||||
hrmImportResource.filelist = list;
|
||||
}
|
||||
|
||||
onUploading(s) {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.status = s;
|
||||
}
|
||||
|
||||
submit() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.saveImport({}, () => {
|
||||
this.refs.scroll && this.refs.scroll.scrollToLast()
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
const {
|
||||
hrmImportResource,
|
||||
onClose
|
||||
} = this.props;
|
||||
hrmImportResource.visible = false
|
||||
hrmImportResource.init();
|
||||
onClose && onClose();
|
||||
}
|
||||
|
||||
importHistoryQuery() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.visibleHistory = true;
|
||||
hrmImportResource.getImportHistory();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
hrmImportResource,
|
||||
mainTitle,
|
||||
importLog,
|
||||
viewLog,
|
||||
viewLogTitle,
|
||||
} = this.props;
|
||||
const {
|
||||
title,
|
||||
visible,
|
||||
titleResult,
|
||||
visibleResult,
|
||||
importResultColumns,
|
||||
importProcessLogDatas,
|
||||
failnum,
|
||||
succnum,
|
||||
importResultTip,
|
||||
importResultStore,
|
||||
importStatus,
|
||||
errorInfo,
|
||||
setScrollRef,
|
||||
single,
|
||||
showLoadingSpin,
|
||||
condition
|
||||
} = hrmImportResource;
|
||||
const buttons = condition.length ? [
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ip7b32`} type="primary" onClick={() => this.submit()}>{i18n.button.submit()}</Button>),
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@itogxo`} type="primary" onClick={() => this.importHistoryQuery()}>{importLog || i18n.button.importHistoryQuery()}</Button>),
|
||||
] : [];
|
||||
|
||||
let dialogHeight = window.innerHeight - 150;
|
||||
if (dialogHeight > 560) dialogHeight = 560;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
single && visible ?
|
||||
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@mkyv9k`} height={'100%'} ref="scrollBar">
|
||||
{this.getForm()}
|
||||
</WeaNewScroll>
|
||||
:
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@s55z5q`}
|
||||
title={mainTitle || title}
|
||||
icon="icon-coms-hrm"
|
||||
iconBgcolor="#217346"
|
||||
visible={visible}
|
||||
closable={true}
|
||||
onCancel={() => this.cancel()}
|
||||
buttons={buttons}
|
||||
style={{ width: 870, height: dialogHeight }}
|
||||
moreBtn={{datas:condition ? [{
|
||||
key: '1',
|
||||
content: i18n.button.submit(),
|
||||
icon: <i className='icon-coms-Preservation'/>,
|
||||
onClick: () => this.submit(),
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
content: importLog || i18n.button.importHistoryQuery(),
|
||||
icon: <i className='icon-coms-Preservation'/>,
|
||||
onClick: () => this.importHistoryQuery(),
|
||||
}
|
||||
]: []}}
|
||||
>
|
||||
{ condition.length ? (
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@1fvd3j`} spinning={showLoadingSpin}>
|
||||
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} height={dialogHeight} ref="scrollBar">
|
||||
{this.getForm()}
|
||||
</WeaNewScroll>
|
||||
</Spin>
|
||||
): ''}
|
||||
</WeaDialog>
|
||||
}
|
||||
|
||||
<ImportResult ecId={`${this && this.props && this.props.ecId || ''}_ImportResult@66ry2w`} {...this.props} />
|
||||
<ImportHistory ecId={`${this && this.props && this.props.ecId || ''}_ImportHistory@72i8fh`} {...this.props} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
import {
|
||||
inject,
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaDialog,
|
||||
} from 'ecCom'
|
||||
|
||||
import {
|
||||
Modal,
|
||||
Table,
|
||||
Button,
|
||||
} from 'antd'
|
||||
|
||||
import React from 'react'
|
||||
import {
|
||||
WeaTableNew
|
||||
} from 'comsMobx';
|
||||
import ImportLog from './ImportLog'
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
|
||||
@inject('hrmImportResource')
|
||||
@observer
|
||||
class ImportHistory extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
reRenderColumns(c) {
|
||||
let _this = this;
|
||||
c.forEach(item => {
|
||||
if (item.dataIndex == 'operator') {
|
||||
item.render = function(text, record) {
|
||||
return <span><a onClick={() => _this.jumpToHrmCard(record.operator)}>{record.operatorspan}</a></span>
|
||||
}
|
||||
}
|
||||
if (item.dataIndex == 'allnum') {
|
||||
item.render = function(text, record) {
|
||||
return <span><a onClick={() => _this.jumpToImportResult(record.randomFieldId)}>{record.allnumspan}</a></span>
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jumpToHrmCard(id) {
|
||||
window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
|
||||
}
|
||||
|
||||
jumpToImportResult(pId) {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.dialogKey = new Date().getTime();
|
||||
hrmImportResource.visibleResult = true;
|
||||
hrmImportResource.getImportResult({
|
||||
pId,
|
||||
importType: 'resource'
|
||||
});
|
||||
}
|
||||
|
||||
queryImportLog() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
let params = {};
|
||||
params.importType = 'resource';
|
||||
hrmImportResource.pId = '';
|
||||
hrmImportResource.getImportLogDetail(params);
|
||||
hrmImportResource.getImportLogSearchCondition(params);
|
||||
hrmImportResource.visibleImportLog = true;
|
||||
}
|
||||
|
||||
cancel() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.visibleHistory = false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
hrmImportResource,
|
||||
importLog,
|
||||
viewLog,
|
||||
} = this.props;
|
||||
const {
|
||||
titleHistory,
|
||||
visibleHistory,
|
||||
onCancel,
|
||||
importHistoryStore
|
||||
} = hrmImportResource;
|
||||
const buttons = [
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@oowgk9`} type="primary" disabled={importHistoryStore.loading} onClick={() => this.queryImportLog()}>{viewLog || i18n.button.queryImportLog()}</Button>),
|
||||
];
|
||||
let dialogHeight = window.innerHeight - 150;
|
||||
if (dialogHeight > 510) dialogHeight = 510;
|
||||
return (
|
||||
<div>
|
||||
<ImportLog ecId={`${this && this.props && this.props.ecId || ''}_ImportLog@s3uk7x`} {...this.props} />
|
||||
{visibleHistory &&
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@no8hhj`}
|
||||
title={importLog || titleHistory()}
|
||||
icon="icon-coms-hrm"
|
||||
iconBgcolor="#217346"
|
||||
visible={visibleHistory}
|
||||
closable={true}
|
||||
onCancel={() => this.cancel()}
|
||||
buttons={buttons}
|
||||
style={{ width: 870, height: dialogHeight }}
|
||||
moreBtn={{datas:[{
|
||||
key: '1',
|
||||
content: viewLog || i18n.button.queryImportLog(),
|
||||
icon: <i className='icon-coms-Preservation'/>,
|
||||
onClick: () => this.queryImportLog(),
|
||||
}
|
||||
]}}
|
||||
>
|
||||
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@6eke2r`}
|
||||
comsWeaTableStore={importHistoryStore}
|
||||
hasOrder={true}
|
||||
needScroll={true}
|
||||
scroll={{ y: dialogHeight - 80 }}
|
||||
rowKey={(record, index) => index}
|
||||
getColumns={c => this.reRenderColumns(c)}
|
||||
/>
|
||||
</WeaDialog>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ImportHistory
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
import {
|
||||
inject,
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaTab,
|
||||
WeaDialog,
|
||||
WeaFormItem,
|
||||
WeaSearchGroup,
|
||||
} from 'ecCom'
|
||||
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Button,
|
||||
} from 'antd'
|
||||
import * as mobx from 'mobx';
|
||||
const toJS = mobx.toJS;
|
||||
import {
|
||||
WeaSwitch
|
||||
} from 'comsMobx'
|
||||
import {
|
||||
WeaTableNew
|
||||
} from 'comsMobx';
|
||||
import React from 'react'
|
||||
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
|
||||
@inject('hrmImportResource')
|
||||
@observer
|
||||
class ImportLog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
|
||||
getSearchs() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
form,
|
||||
searchCondition
|
||||
} = hrmImportResource;
|
||||
|
||||
const {
|
||||
isFormInit
|
||||
} = form;
|
||||
let group = [];
|
||||
|
||||
const formParams = form.getFormParams();
|
||||
isFormInit && toJS(searchCondition).map((c, i) => {
|
||||
let items = [];
|
||||
c.items.map((fields, index) => {
|
||||
let hide = false;
|
||||
let dom = <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@irw1ly@${index}`} fieldConfig={fields} form={form} formParams={formParams}/>;
|
||||
items.push({
|
||||
com: (<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@3cqs16@${index}`}
|
||||
label={`${fields.label}`}
|
||||
labelCol={{span: `${fields.labelcol}`}}
|
||||
wrapperCol={{span: `${fields.fieldcol}`}}>
|
||||
{dom}
|
||||
</WeaFormItem>),
|
||||
colSpan: 1,
|
||||
hide: hide
|
||||
})
|
||||
});
|
||||
group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@8sj3te@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items}/>)
|
||||
});
|
||||
return group;
|
||||
}
|
||||
|
||||
jumpToHrmCard(id) {
|
||||
window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
|
||||
}
|
||||
|
||||
reRenderColumns(c) {
|
||||
let _this = this;
|
||||
let status = "";
|
||||
c.forEach(item => {
|
||||
if (item.dataIndex == 'operator') {
|
||||
item.render = function(text, record) {
|
||||
return <span><a onClick={ () => _this.jumpToHrmCard(record.operator)}>{record.operatorspan}</a></span>
|
||||
}
|
||||
} else if (item.dataIndex == 'status') {
|
||||
item.render = function(text, record) {
|
||||
status = text;
|
||||
return <span style={{ color: text=='1'?"":"#FF0000"}}>{text=='1'?i18n.label.success():i18n.label.fail()}</span>
|
||||
}
|
||||
} else if (item.dataIndex == 'operatedetail') {
|
||||
item.render = function(text, record) {
|
||||
return <span style={{ color: "#FF0000" }}>{status=="1"?"":text}</span>
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.visibleImportLog = false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
hrmImportResource,
|
||||
viewLogTitle
|
||||
} = this.props;
|
||||
const {
|
||||
form,
|
||||
titleImportLog,
|
||||
visibleImportLog,
|
||||
importLogStore,
|
||||
showSearchAd
|
||||
} = hrmImportResource;
|
||||
const btn = [
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@a9qnqh`} type="primary" onClick={()=>{hrmImportResource.doSearch();hrmImportResource.showSearchAd=false}}>{i18n.button.search()}</Button>),
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bi5gen`} type="ghost" onClick={()=>{form.reset();}}>{i18n.button.reset()}</Button>),
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@co57et`} type="ghost" onClick={()=>hrmImportResource.showSearchAd=false}>{i18n.button.cancel()}</Button>)
|
||||
]
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
visibleImportLog &&
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@h4j5ho`}
|
||||
title={viewLogTitle || titleImportLog()}
|
||||
icon="icon-coms-hrm"
|
||||
iconBgcolor="#217346"
|
||||
visible={visibleImportLog}
|
||||
closable={true}
|
||||
onCancel={() => { this.cancel()} }
|
||||
//buttons={buttons}
|
||||
style={{width: 970, height: 510}}
|
||||
>
|
||||
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@98vruz`}
|
||||
searchType={['advanced']}
|
||||
showSearchAd={showSearchAd}
|
||||
searchsAd={<div
|
||||
onKeyDown={(e) =>{
|
||||
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||
hrmImportResource.doSearch();
|
||||
hrmImportResource.showSearchAd=false
|
||||
}
|
||||
}
|
||||
}
|
||||
>{this.getSearchs()}</div>}
|
||||
setShowSearchAd={bool => {hrmImportResource.showSearchAd = bool}}
|
||||
hideSearchAd={() => hrmImportResource.showSearchAd = false}
|
||||
advanceHeight={200}
|
||||
hasMask={false}
|
||||
buttonsAd={btn}
|
||||
/>
|
||||
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@8ajuei`}
|
||||
comsWeaTableStore={importLogStore}
|
||||
hasOrder={true}
|
||||
needScroll={true}
|
||||
scroll={{ y: 380 }}
|
||||
rowKey={(record,index) => index}
|
||||
getColumns={c => this.reRenderColumns(c)}
|
||||
/>
|
||||
</WeaDialog>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ImportLog
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
import {
|
||||
inject,
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaDialog,
|
||||
WeaNewScroll,
|
||||
} from 'ecCom'
|
||||
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Icon,
|
||||
Spin,
|
||||
Modal,
|
||||
Table,
|
||||
Button,
|
||||
} from 'antd'
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import React from 'react'
|
||||
import {
|
||||
WeaTableNew
|
||||
} from 'comsMobx';
|
||||
import {
|
||||
toJS
|
||||
} from 'mobx';
|
||||
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
|
||||
@inject('hrmImportResource')
|
||||
@observer
|
||||
class ImportResult extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.errorInfo = '';
|
||||
}
|
||||
|
||||
getButtons() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
failnum,
|
||||
importStatus
|
||||
} = hrmImportResource;
|
||||
const buttons = [];
|
||||
if (importStatus == 'over') {
|
||||
// if (failnum > 0) {
|
||||
// buttons.push(<Button type="primary" onClick={() => this.submit()}>下载错误数据</Button>);
|
||||
// }
|
||||
// buttons.push(<Button type="primary" onClick={() => this.submit()}>下载全部数据</Button>);
|
||||
buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@w1j5fh`} type="primary" onClick={() => this.getImportLog()}>{i18n.button.getImportLog()}</Button>);
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
reRenderColumns(c) {
|
||||
c.forEach(item => {
|
||||
if (item.dataIndex == 'operatedetail') {
|
||||
item.render = function(text, record) {
|
||||
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
this.dialogKey = new Date().getTime();
|
||||
hrmImportResource.visibleResult = false;
|
||||
}
|
||||
|
||||
getImportLog() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
hrmImportResource.visibleImportLog = true;
|
||||
let params = {};
|
||||
params.importType = 'resource';
|
||||
hrmImportResource.getImportLogSearchCondition(params);
|
||||
hrmImportResource.getImportLogDetail(params);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
hrmImportResource
|
||||
} = this.props;
|
||||
const {
|
||||
titleResult,
|
||||
visibleResult,
|
||||
importResultColumns,
|
||||
importProcessLogDatas,
|
||||
failnum,
|
||||
succnum,
|
||||
importResultTip,
|
||||
importResultStore,
|
||||
importStatus,
|
||||
errorInfo,
|
||||
setScrollRef,
|
||||
dialogKey
|
||||
} = hrmImportResource;
|
||||
const buttons = [];
|
||||
if (importStatus == 'over') {
|
||||
buttons.push(
|
||||
{
|
||||
key: '1',
|
||||
content: i18n.button.getImportLog(),
|
||||
icon: <i className='icon-coms-Preservation'/>,
|
||||
onClick: () => this.getImportLog(),
|
||||
}
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
visibleResult &&
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@a3ftyh`}
|
||||
key={dialogKey}
|
||||
title={titleResult()}
|
||||
icon="icon-coms-hrm"
|
||||
iconBgcolor="#217346"
|
||||
visible={visibleResult}
|
||||
closable={true}
|
||||
onCancel={() => this.cancel()}
|
||||
buttons={this.getButtons()}
|
||||
style={{ width: 720, height: 480 }}
|
||||
moreBtn={{datas:buttons}}
|
||||
>
|
||||
<div className="hrm-import-dialog">
|
||||
{
|
||||
importStatus == '' || importStatus == 'importing' || importStatus == 'error'?<div>
|
||||
{
|
||||
importStatus == 'error'?<div className="hrm-import-result-icon" style={{ paddingTop: 15 }}>
|
||||
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor:'#FF0000' }}>
|
||||
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@gxbhrn`} type={'cross'} style={{ color: '#fff' }} />
|
||||
</div><span style={{ paddingLeft: 5}}>{importResultTip}</span>
|
||||
</div>:
|
||||
<div className="hrm-import-process"><Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@u5jll2`} tip={i18n.message.serverImportProcessing()}></Spin></div>
|
||||
}
|
||||
<div className="wea-new-table">
|
||||
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@iflhfl`} height={340} ref={(scroll)=>{hrmImportResource.setScrollTarget(scroll)}}>
|
||||
<Table ecId={`${this && this.props && this.props.ecId || ''}_Table@quyttr`} dataSource={toJS(importProcessLogDatas)} columns={toJS(importResultColumns)} pagination={false} />
|
||||
</WeaNewScroll>
|
||||
</div>
|
||||
</div> : <div>
|
||||
<div className="hrm-import-result-icon" style={{ paddingTop: failnum == 0 ? 150 : 15 }}>
|
||||
<div style={{ width: 30, height: 30, borderRadius: 25, padding: 8, display: 'inline-block', backgroundColor: succnum > 0 ? '#54D3A2' : '#FF0000' }}>
|
||||
<Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@2fblod`} type={succnum > 0 ? 'check' : 'cross'} style={{ color: '#fff' }} />
|
||||
</div><span style={{ paddingLeft: 5 }}>{importResultTip}</span>
|
||||
</div>
|
||||
{
|
||||
failnum > 0 &&
|
||||
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@h7l6fo`}
|
||||
comsWeaTableStore={importResultStore}
|
||||
bordered
|
||||
needScroll={true}
|
||||
// pagination={true}
|
||||
scroll={{ y: 330 }}
|
||||
// rowKey={(record, index) => index}
|
||||
getColumns={c => this.reRenderColumns(c)}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</WeaDialog>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ImportResult
|
||||
|
|
@ -145,7 +145,7 @@ export default class Resource extends React.Component {
|
|||
tableStore.selectedRowKeys.length > 0 ? resource.export() : message.error("请选择需要导出的数据")
|
||||
}
|
||||
}}
|
||||
//menuOnClick={(key, e) => console.log("选择了按钮:", e)}
|
||||
menuOnClick={(key, e) => key == '1' ? tableStore.selectedRowKeys = []: ''}
|
||||
/>)
|
||||
|
||||
return btns;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import DepartmentExtendStore from "./components/department/departmentExtend";
|
|||
import FieldDefined from "./components/fieldDefinedSet/FieldDefined";
|
||||
import Resource from "./components/resource/resource";
|
||||
import ResourceExtend from "./components/resource/ResourceExtend";
|
||||
import BasicInfoImport from "./components/import";
|
||||
|
||||
import stores from "./stores";
|
||||
import "./style/index";
|
||||
|
|
@ -83,7 +84,9 @@ const Routes = (
|
|||
<Route name="fieldDef" path="fieldDef/:type" component={FieldDefined} />
|
||||
<Route key="resource" path="resource" component={Resource} />
|
||||
<Route key="resourceExtend" path="resourceExtend/:id" component={ResourceExtend} />
|
||||
<Route key="basicinfoimport" path="basicinfoimport" component={BasicInfoImport} />
|
||||
|
||||
|
||||
</Route>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ import {
|
|||
i18n
|
||||
} from '../public/i18n';
|
||||
|
||||
import {ResourceStore} from "./resource";
|
||||
|
||||
const resource = new ResourceStore();
|
||||
// const hrmAdAreaSet = new HrmAdAreaSet();
|
||||
|
||||
export class DatasImportStore {
|
||||
@observable title = "人员导入";
|
||||
|
|
@ -148,7 +152,7 @@ import {
|
|||
})
|
||||
}
|
||||
|
||||
saveImport = (params = {}) => {
|
||||
@action saveImport = (params = {}) => {
|
||||
params.keyField = this.keyField;
|
||||
params.importType = this.importType;
|
||||
params.operateType = this.operateType;
|
||||
|
|
@ -185,17 +189,21 @@ import {
|
|||
|
||||
@action doImport = params => {
|
||||
API.saveImport(params).then(data => {
|
||||
if (data.status == '1') {
|
||||
if (data.code == 200) {
|
||||
this.visible = false;
|
||||
resource.getTableInfo();
|
||||
//window.location.reload();
|
||||
//导入进程暂未实现
|
||||
if(data.message != null && data.message.trim().length > 0 && params.importType == 'matrix'){
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: data.message,
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => {
|
||||
this.doImport({...params, confirm: 1})
|
||||
}
|
||||
});
|
||||
// confirm({
|
||||
// title: i18n.confirm.defaultTitle(),
|
||||
// content: data.message,
|
||||
// okText: i18n.button.ok(),
|
||||
// cancelText: i18n.button.cancel(),
|
||||
// onOk: () => {
|
||||
// this.doImport({...params, confirm: 1})
|
||||
// }
|
||||
// });
|
||||
}else if (!isEmpty(data.errorInfo)) {
|
||||
this.importStatus = 'error';
|
||||
this.importResultTip = i18n.message.selectImportTempleteError();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
import * as Api from '../apis/basicImport';
|
||||
import {
|
||||
observable,
|
||||
action
|
||||
} from 'mobx';
|
||||
import {
|
||||
message,
|
||||
} from 'antd';
|
||||
import {
|
||||
i18n
|
||||
} from '../public/i18n';
|
||||
|
||||
export class HrmBasicDataImport {
|
||||
@observable title = i18n.module.basicInfoImport();
|
||||
@observable isMouseOver = false;
|
||||
@observable curIndex = '';
|
||||
@observable loading = true;
|
||||
@observable authorized = false;
|
||||
@observable cardConfig = []
|
||||
|
||||
@action
|
||||
getRight = () => {
|
||||
this.loading = true;
|
||||
const params = {
|
||||
type: 'HrmBasicDataImport'
|
||||
}
|
||||
Api.getBasicDataImportHasRight(params).then(action(rs => {
|
||||
const {
|
||||
status,
|
||||
hasRight
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
if (hasRight) {
|
||||
this.authorized = true;
|
||||
if (rs.cardConfig) {
|
||||
this.cardConfig = rs.cardConfig
|
||||
} else {
|
||||
this.authorized = false;
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.loading = false;
|
||||
}
|
||||
})).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
setMouseStatus = (index, bool) => {
|
||||
this.curIndex = index;
|
||||
this.isMouseOver = bool;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,458 @@
|
|||
import * as Api from '../apis/importresource';
|
||||
import {
|
||||
observable,
|
||||
action,
|
||||
extendObservable
|
||||
} from 'mobx';
|
||||
import {
|
||||
WeaForm,
|
||||
WeaTableNew
|
||||
} from 'comsMobx';
|
||||
import {
|
||||
message
|
||||
} from 'antd'
|
||||
import {
|
||||
i18n
|
||||
} from '../public/i18n';
|
||||
const {
|
||||
TableStore
|
||||
} = WeaTableNew;
|
||||
|
||||
// import {
|
||||
// HrmAdAreaSet
|
||||
// } from './adareaset';
|
||||
// import {
|
||||
// HrmOfficeAddress
|
||||
// } from './officeaddress';
|
||||
// import {
|
||||
// HrmPostSet
|
||||
// } from './postset';
|
||||
// import {
|
||||
// HrmMajorSet
|
||||
// } from './majorset';
|
||||
// const hrmAdAreaSet = new HrmAdAreaSet();
|
||||
// const hrmOfficeAddress = new HrmOfficeAddress();
|
||||
// const hrmPostSet = new HrmPostSet();
|
||||
// const hrmMajorSet = new HrmMajorSet();
|
||||
|
||||
export class HrmImportCommon {
|
||||
sourceStore = null;
|
||||
@observable pageName = '';
|
||||
@observable importType = '';
|
||||
@observable importDialog = {
|
||||
visible: false,
|
||||
condition: [],
|
||||
form: new WeaForm(),
|
||||
title: '',
|
||||
loading: true,
|
||||
templetName: '',
|
||||
selectedValue: 'workcode',
|
||||
}
|
||||
|
||||
@observable resultDialog = {
|
||||
title: observable.ref(i18n.label.importResult()),
|
||||
errorTip: observable.ref(i18n.message.selectImportTempleteError()),
|
||||
visible: false,
|
||||
index: 1,
|
||||
datas: [],
|
||||
importStatus: '',
|
||||
pId: '',
|
||||
interval: '',
|
||||
tableStore: new TableStore(),
|
||||
errorInfo: [],
|
||||
succnum: 0,
|
||||
failnum: 0,
|
||||
loading: true,
|
||||
component: '',
|
||||
}
|
||||
|
||||
@observable recordDialog = {
|
||||
title: observable.ref(i18n.button.importHistoryQuery()),
|
||||
visible: false,
|
||||
tableStore: new TableStore(),
|
||||
}
|
||||
|
||||
@observable logDialog = {
|
||||
title: observable.ref(i18n.button.getImportLog()),
|
||||
visible: false,
|
||||
tableStore: new TableStore(),
|
||||
isPanelShow: false,
|
||||
form: new WeaForm(),
|
||||
condition: [],
|
||||
loading: true,
|
||||
}
|
||||
|
||||
@action
|
||||
getImportForm = () => {
|
||||
this.importDialog.loading = true;
|
||||
let params = {
|
||||
importType: this.importType
|
||||
}
|
||||
Api.getImportForm(params).then(rs => {
|
||||
const {
|
||||
status,
|
||||
condition = [],
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
this.importDialog.condition = condition;
|
||||
const copy = [...condition];
|
||||
copy.splice(1);
|
||||
copy[0].items.splice(2);
|
||||
this.importDialog.form.initFormFields(copy);
|
||||
this.importDialog.loading = false;
|
||||
} else {
|
||||
// message.error(rs.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
getImportProcessInfo = () => {
|
||||
let params = {
|
||||
importType: this.importType,
|
||||
index: this.resultDialog.index,
|
||||
};
|
||||
Api.getImportProcessLog(params).then(rs => {
|
||||
const {
|
||||
datas,
|
||||
index,
|
||||
pId = '',
|
||||
status
|
||||
} = rs;
|
||||
|
||||
this.resultDialog.loading = false;
|
||||
if (status == '1') {
|
||||
const {
|
||||
importStatus,
|
||||
interval,
|
||||
errorInfo,
|
||||
component
|
||||
} = this.resultDialog;
|
||||
|
||||
component.scrollToLast();
|
||||
|
||||
if (importStatus == 'over' || importStatus == 'error') {
|
||||
clearInterval(interval);
|
||||
if (!this.hasErrorInfo(errorInfo)) this.getResultInfo();
|
||||
|
||||
this.sourceStore && this.sourceStore.getTable();
|
||||
|
||||
//根据pageName判断刷新那个页面的列表
|
||||
// switch (this.pageName) {
|
||||
// case 'adareaset':
|
||||
// hrmAdAreaSet.setOperation('getTable');
|
||||
// hrmAdAreaSet.setFuncName('getCountryList');
|
||||
// hrmAdAreaSet.getTable();
|
||||
// break;
|
||||
// case 'officeaddress':
|
||||
// hrmOfficeAddress.getTableInfo();
|
||||
// break;
|
||||
// case 'post':
|
||||
// hrmPostSet.initSet('getTableInfo', 'getJobGroupList');
|
||||
// hrmPostSet.getTableInfo();
|
||||
// break;
|
||||
// case 'major':
|
||||
// hrmMajorSet.setOperation('getTableInfo');
|
||||
// hrmMajorSet.getTableInfo();
|
||||
// break;
|
||||
// }
|
||||
return
|
||||
}
|
||||
|
||||
if (rs.importStatus == 'over' || rs.importStatus == 'error') {
|
||||
this.resultDialog.loading = true;
|
||||
}
|
||||
|
||||
this.resultDialog.importStatus = rs.importStatus;
|
||||
|
||||
if (pId) this.resultDialog.pId = pId;
|
||||
|
||||
if (this.resultDialog.datas.length == 0) {
|
||||
this.resultDialog.datas = datas;
|
||||
} else {
|
||||
this.resultDialog.datas = [...this.resultDialog.datas, ...datas]
|
||||
}
|
||||
|
||||
this.resultDialog.index = index;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
getResultInfo = () => {
|
||||
let params = {
|
||||
pId: this.resultDialog.pId
|
||||
};
|
||||
this.resultDialog.loading = true;
|
||||
Api.getImportResult(params).then(rs => {
|
||||
const {
|
||||
datas,
|
||||
status
|
||||
} = rs, {
|
||||
succnum,
|
||||
failnum,
|
||||
sessionkey = ''
|
||||
} = datas;
|
||||
|
||||
if (status == '1') {
|
||||
this.resultDialog.succnum = succnum;
|
||||
this.resultDialog.failnum = failnum;
|
||||
sessionkey && this.resultDialog.tableStore.getDatas(sessionkey, 1);
|
||||
}
|
||||
this.resultDialog.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
getRecordTable = () => {
|
||||
let params = {
|
||||
importType: this.importType
|
||||
};
|
||||
Api.getImportHistory(params).then(rs => {
|
||||
const {
|
||||
status,
|
||||
sessionkey,
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
this.recordDialog.tableStore.getDatas(sessionkey, 1);
|
||||
} else {
|
||||
message.error(rs.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
getLogTable = () => {
|
||||
let params = {
|
||||
importType: this.importType,
|
||||
...this.logDialog.form.getFormParams(),
|
||||
};
|
||||
if (this.resultDialog.pId) {
|
||||
params = { ...params,
|
||||
pId: this.resultDialog.pId
|
||||
}
|
||||
}
|
||||
Api.getImportLogDetail(params).then(rs => {
|
||||
const {
|
||||
status,
|
||||
sessionkey
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
this.logDialog.tableStore.getDatas(sessionkey, 1);
|
||||
} else {
|
||||
message.error(rs.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
submitImportInfo = () => {
|
||||
let params = {
|
||||
importType: this.importType,
|
||||
excelfile: this.importDialog.excelFileId,
|
||||
operateType: 'add'
|
||||
};
|
||||
if (this.importType == 'group') {
|
||||
params = {
|
||||
...params,
|
||||
...this.importDialog.form.getFormParams()
|
||||
}
|
||||
}
|
||||
this.setResultInfoDialogVisible(true);
|
||||
Api.saveImport(params).then(rs => {
|
||||
const {
|
||||
status,
|
||||
errorInfo
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
if (this.hasErrorInfo(errorInfo)) {
|
||||
this.resultDialog.errorInfo = errorInfo;
|
||||
this.resultDialog.importStatus = 'error';
|
||||
}
|
||||
} else {
|
||||
message.error(rs.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
this.resultDialog.interval = setInterval(() => this.getImportProcessInfo(), 2000);
|
||||
}
|
||||
|
||||
@action
|
||||
getLogSearchPanelCondition = () => {
|
||||
this.logDialog.loading = true;
|
||||
let params = {
|
||||
importType: this.importType
|
||||
};
|
||||
Api.getImportLogSearchCondition(params).then(rs => {
|
||||
const {
|
||||
status,
|
||||
searchCondition
|
||||
} = rs;
|
||||
|
||||
if (status == '1') {
|
||||
this.logDialog.condition = searchCondition;
|
||||
this.logDialog.form.initFormFields(searchCondition);
|
||||
} else {
|
||||
message.error(rs.message);
|
||||
}
|
||||
this.logDialog.loading = false;
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
setExcelFileNo = (id) => {
|
||||
extendObservable(this.importDialog, {
|
||||
excelFileId: id
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
submitExcel = () => {
|
||||
if (!this.importDialog.excelFileId) {
|
||||
message.warning(i18n.message.selectImportTemplete());
|
||||
return;
|
||||
}
|
||||
this.submitImportInfo();
|
||||
}
|
||||
|
||||
@action
|
||||
queryRecord = () => {
|
||||
this.setRecordDialogVisible(true);
|
||||
}
|
||||
|
||||
@action
|
||||
queryLog = () => {
|
||||
this.setLogDialogVisible(true);
|
||||
}
|
||||
|
||||
@action
|
||||
jumpToImportResult = (id) => {
|
||||
this.resultDialog.pId = id;
|
||||
this.resultDialog.importStatus = 'over';
|
||||
this.setResultInfoDialogVisible(true);
|
||||
this.getResultInfo();
|
||||
}
|
||||
|
||||
|
||||
@action
|
||||
setImportDialogVisible = (bool) => {
|
||||
this.importDialog.visible = bool;
|
||||
if (bool) {
|
||||
this.getImportForm();
|
||||
} else {
|
||||
this.importDialogReset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//设置标识,标识当前是那个页面在导入
|
||||
@action
|
||||
setImportPage = (pageName) => {
|
||||
this.pageName = pageName;
|
||||
}
|
||||
|
||||
@action
|
||||
setResultInfoDialogVisible = (bool) => {
|
||||
this.resultDialog.visible = bool;
|
||||
if (!bool) {
|
||||
clearInterval(this.resultDialog.interval);
|
||||
this.resetResultDialogStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
importDialogReset = () => {
|
||||
this.importDialog.condition = [];
|
||||
this.importDialog.form = new WeaForm();
|
||||
this.importDialog.selectedValue = 'workcode';
|
||||
this.importDialog.excelFileId = '';
|
||||
}
|
||||
|
||||
@action
|
||||
resetResultDialogStatus = () => {
|
||||
this.resultDialog.index = 1;
|
||||
this.resultDialog.datas = [];
|
||||
this.resultDialog.importStatus = '';
|
||||
this.resultDialog.pId = '';
|
||||
this.resultDialog.interval = '';
|
||||
this.resultDialog.errorInfo = '';
|
||||
this.resultDialog.loading = true;
|
||||
}
|
||||
|
||||
@action
|
||||
setRecordDialogVisible = (bool) => {
|
||||
this.recordDialog.visible = bool;
|
||||
bool && this.getRecordTable();
|
||||
}
|
||||
|
||||
@action
|
||||
setLogDialogVisible = (bool) => {
|
||||
this.logDialog.visible = bool;
|
||||
bool && this.getLogTable();
|
||||
if (!bool) {
|
||||
this.logDialog.isPanelShow = false;
|
||||
this.logDialog.form = new WeaForm();
|
||||
this.logDialog.condition = [];
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
setLogPanelStatus = (bool) => {
|
||||
this.logDialog.isPanelShow = bool;
|
||||
bool && this.logDialog.condition.length == 0 && this.getLogSearchPanelCondition();
|
||||
}
|
||||
|
||||
@action
|
||||
searchLogInfo = () => {
|
||||
this.getLogTable();
|
||||
}
|
||||
|
||||
hasErrorInfo = (errorInfo) => {
|
||||
if (errorInfo.length == 0) return false;
|
||||
return true
|
||||
}
|
||||
|
||||
@action
|
||||
setTempletName = (templetName) => {
|
||||
this.importDialog.templetName = templetName;
|
||||
}
|
||||
|
||||
@action
|
||||
setImportDialogTitle = (title) => {
|
||||
this.importDialog.title = title;
|
||||
}
|
||||
|
||||
@action
|
||||
setImportType = (type) => {
|
||||
this.importType = type;
|
||||
}
|
||||
|
||||
@action
|
||||
setSelectedValue = (value) => {
|
||||
this.importDialog.selectedValue = value;
|
||||
}
|
||||
|
||||
@action
|
||||
setScoll = (component) => {
|
||||
this.resultDialog.component = component;
|
||||
}
|
||||
|
||||
setSourceStore = (store) => {
|
||||
this.sourceStore = store;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,370 @@
|
|||
import {
|
||||
observable,
|
||||
action
|
||||
} from 'mobx';
|
||||
import {
|
||||
WeaForm
|
||||
} from 'comsMobx';
|
||||
import * as API from '../apis/importresource';
|
||||
import * as Util from '../util/index';
|
||||
import {
|
||||
validate,
|
||||
getFormParamValue
|
||||
} from '../util'
|
||||
import {
|
||||
message,
|
||||
Modal,
|
||||
Button
|
||||
} from 'antd';
|
||||
import {
|
||||
WeaTableNew
|
||||
} from 'comsMobx'
|
||||
import * as mobx from 'mobx';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import {
|
||||
has
|
||||
} from 'lodash';
|
||||
const toJS = mobx.toJS;
|
||||
const {
|
||||
TableStore
|
||||
} = WeaTableNew;
|
||||
const confirm = Modal.confirm;
|
||||
import {
|
||||
i18n
|
||||
} from '../public/i18n';
|
||||
|
||||
|
||||
export class HrmImportResource {
|
||||
@observable title = "人员导入";
|
||||
@observable templetName = "导入模板";
|
||||
titleResult = i18n.label.importResult;
|
||||
titleHistory = i18n.button.importHistoryQuery;
|
||||
titleImportLog = i18n.button.getImportLog;
|
||||
importResultColumns = [];
|
||||
index = 1;
|
||||
@observable scrollTarget;
|
||||
@observable visible = false;
|
||||
@observable visibleResult = false;
|
||||
@observable visibleHistory = false;
|
||||
@observable visibleImportLog = false;
|
||||
@observable condition = [];
|
||||
@observable single = false;
|
||||
@observable keyField = 'workcode';
|
||||
@observable importType = '';
|
||||
@observable operateType = 'add';
|
||||
@observable filelist = [];
|
||||
@observable excelfile = '';
|
||||
@observable searchCondition = [];
|
||||
@observable form = new WeaForm();
|
||||
@observable showSearchAd = false;
|
||||
@observable searchParamsAd = {};
|
||||
@observable importResultStore = new TableStore();
|
||||
@observable importHistoryStore = new TableStore();
|
||||
@observable importLogStore = new TableStore();
|
||||
@observable buttons = [];
|
||||
@observable importProcessLogDatas = [];
|
||||
@observable succnum = 0;
|
||||
@observable failnum = 0;
|
||||
@observable importResultTip = '';
|
||||
@observable importStatus = '';
|
||||
@observable pId = '';
|
||||
@observable ref;
|
||||
@observable errorInfo = '';
|
||||
@observable dialogKey = new Date().getTime();
|
||||
@observable otherParams;
|
||||
@observable showLoadingSpin = false;
|
||||
interval;
|
||||
importCallback;
|
||||
getTemplateUrl;
|
||||
@observable importParams = {};
|
||||
|
||||
importResultColumns = [{
|
||||
"title": i18n.label.confirmInfo(),
|
||||
"width": "100%",
|
||||
"dataIndex": "message",
|
||||
render: (text, record, index) => {
|
||||
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
|
||||
@action
|
||||
init() {
|
||||
this.condition = [];
|
||||
this.keyField = 'workcode';
|
||||
this.importType = '';
|
||||
this.operateType = 'add';
|
||||
this.filelist = [];
|
||||
this.excelfile = '';
|
||||
this.searchCondition = [];
|
||||
this.buttons = [];
|
||||
this.importProcessLogDatas = [];
|
||||
this.succnum = 0;
|
||||
this.failnum = 0;
|
||||
this.importResultTip = '';
|
||||
this.importStatus = '';
|
||||
this.pId = '';
|
||||
this.errorInfo = '';
|
||||
this.importParams = {};
|
||||
}
|
||||
|
||||
@action setParam = (k, v) => {
|
||||
const p = toJS(this.importParams);
|
||||
Object.assign(p, {
|
||||
[k]: v
|
||||
});
|
||||
this.importParams = p;
|
||||
}
|
||||
|
||||
getImportForm(params = {}) {
|
||||
this.showLoadingSpin = true;
|
||||
params.importType = this.importType;
|
||||
this.otherParams != null && Object.assign(params, {
|
||||
otherParams: JSON.stringify({ ...this.otherParams,
|
||||
type: this.operateType
|
||||
})
|
||||
})
|
||||
API.getImportForm(params).then(data => {
|
||||
if (data.status == '1') {
|
||||
this.condition = data.condition;
|
||||
if (data.condition != null && Array.isArray(data.condition) && data.condition.length > 0) {
|
||||
this.condition[0].items.map(item => {
|
||||
if (item.conditionType === 'SELECT' && item.domkey[0] === 'importType') {
|
||||
item.options.map(op => {
|
||||
if (op.selected)
|
||||
this.operateType = op.key;
|
||||
})
|
||||
}
|
||||
item.domkey[0].indexOf('keyField') > -1 && this.setParam(item.domkey[0], item.value);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// message.warning(data.message);
|
||||
}
|
||||
|
||||
this.showLoadingSpin = false;
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
this.showLoadingSpin = false;
|
||||
})
|
||||
}
|
||||
|
||||
saveImport = (params = {}) => {
|
||||
params.keyField = this.keyField;
|
||||
params.importType = this.importType;
|
||||
params.operateType = this.operateType;
|
||||
params.excelfile = this.excelfile || '';
|
||||
if (params.excelfile == '') {
|
||||
message.warning(i18n.message.selectImportTemplete());
|
||||
return;
|
||||
}
|
||||
if (this.otherParams != null) {
|
||||
Object.assign(params, {
|
||||
otherParams: JSON.stringify(this.otherParams)
|
||||
})
|
||||
has(this.otherParams, 'logSmallType') && Object.assign(params, {
|
||||
logSmallType: this.otherParams.logSmallType
|
||||
})
|
||||
}
|
||||
|
||||
this.importResultColumns = [{
|
||||
"title": i18n.label.confirmInfo(),
|
||||
"width": "100%",
|
||||
"dataIndex": "message",
|
||||
render: (text, record, index) => {
|
||||
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
this.index = 1;
|
||||
this.importStatus = '';
|
||||
this.importProcessLogDatas = [];
|
||||
this.importStatus = 'importing';
|
||||
this.getImportProcess();
|
||||
this.doImport({...params, ...this.importParams, confirm: 0});
|
||||
this.dialogKey = new Date().getTime();
|
||||
this.visibleResult = true;
|
||||
}
|
||||
|
||||
@action doImport = params => {
|
||||
API.saveImport(params).then(data => {
|
||||
if (data.code == 200) {
|
||||
if(data.message != null && data.message.trim().length > 0 && params.importType == 'matrix'){
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: data.message,
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => {
|
||||
this.doImport({...params, confirm: 1})
|
||||
}
|
||||
});
|
||||
}else if (!isEmpty(data.errorInfo)) {
|
||||
this.importStatus = 'error';
|
||||
this.importResultTip = i18n.message.selectImportTempleteError();
|
||||
this.importResultColumns = [{
|
||||
"title": i18n.label.confirmInfo(),
|
||||
"width": "100%",
|
||||
"dataIndex": "message",
|
||||
render: (text, record, index) => {
|
||||
return <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
this.importProcessLogDatas = data.errorInfo;
|
||||
}else{
|
||||
this.importCallback && this.importCallback();
|
||||
}
|
||||
}else {
|
||||
this.importStatus = 'error';
|
||||
message.warning(data.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getImportProcess() {
|
||||
this.interval = setInterval(() => this.getImportProcessLog(), 2000);
|
||||
}
|
||||
|
||||
getImportProcessLog(params = {}) {
|
||||
if (this.visibleResult == false || this.importStatus == 'over' || this.importStatus == 'error') {
|
||||
clearInterval(this.interval);
|
||||
return;
|
||||
}
|
||||
params.index = this.index;
|
||||
params.importType = this.importType;
|
||||
let textColor = "";
|
||||
this.importResultColumns = [{
|
||||
"title": i18n.label.row(),
|
||||
"width": "15%",
|
||||
"dataIndex": "rownum"
|
||||
}, {
|
||||
"title": i18n.label.status(),
|
||||
"width": "15%",
|
||||
"dataIndex": "status",
|
||||
render: (text, record, index) => {
|
||||
if (text == '1') {
|
||||
textColor = "#54D3A2";
|
||||
} else {
|
||||
textColor = "#FF0000";
|
||||
}
|
||||
return <span style={{ color: textColor}}>{text=='1'?i18n.label.success():i18n.label.fail()}</span>
|
||||
}
|
||||
}, {
|
||||
"title": i18n.label.confirmInfo(),
|
||||
"width": "70%",
|
||||
"dataIndex": "message",
|
||||
render: (text, record, index) => {
|
||||
return <span style={{ color: textColor }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
API.getImportProcessLog(params).then((data) => {
|
||||
if (data.status == '1') {
|
||||
if (!isEmpty(this.importProcessLogDatas)) {
|
||||
this.importProcessLogDatas = [...this.importProcessLogDatas, ...data.datas]
|
||||
} else {
|
||||
this.importProcessLogDatas = data.datas;
|
||||
}
|
||||
this.index = data.index;
|
||||
if (data.pId) {
|
||||
this.pId = data.pId;
|
||||
}
|
||||
|
||||
const {importStatus} = data;
|
||||
if(['over', 'error'].indexOf(importStatus) > -1)
|
||||
this.importStatus = importStatus;
|
||||
//this.scrollTarget.scrollToLast();
|
||||
if (data.importStatus == 'over') {
|
||||
this.getImportResult({
|
||||
pId: this.pId
|
||||
});
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
} else {
|
||||
message.warning(data.message);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
setScrollTarget(scroll) {
|
||||
this.scrollTarget = scroll;
|
||||
}
|
||||
|
||||
getImportResult(params = {}) {
|
||||
this.importStatus = 'over';
|
||||
if (params.pId) {
|
||||
this.pId = params.pId;
|
||||
}
|
||||
API.getImportResult(params).then((data) => {
|
||||
if (data.status == '1') {
|
||||
this.failnum = data.datas.failnum;
|
||||
this.succnum = data.datas.succnum;
|
||||
if (this.failnum > 0) {
|
||||
let info = i18n.label.importResourceResultInfo();
|
||||
info = info.replace('{rownum}', this.succnum + this.failnum).replace('{succnum}', this.succnum);
|
||||
this.importResultTip = info;
|
||||
this.importResultStore.getDatas(data.datas.sessionkey, 1);
|
||||
} else {
|
||||
let info = i18n.label.importResourceResultInfo1();
|
||||
info = info.replace('{rownum}', this.succnum);
|
||||
this.importResultTip = info;
|
||||
}
|
||||
} else {
|
||||
message.warning(data.message);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
getImportHistory(params = {}) {
|
||||
params.importType = this.importType;
|
||||
this.otherParams != null && has(this.otherParams, 'logSmallType') && Object.assign(params, {
|
||||
logSmallType: this.otherParams.logSmallType
|
||||
})
|
||||
API.getImportHistory(params).then((data) => {
|
||||
if (data.status == '1') {
|
||||
data.sessionkey && this.importHistoryStore.getDatas(data.sessionkey, 1);
|
||||
} else {
|
||||
message.warning(data.message);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
getImportLogDetail(params = {}) {
|
||||
if (this.pId) params.pId = this.pId;
|
||||
params.importType = this.importType;
|
||||
API.getImportLogDetail(params).then((data) => {
|
||||
if (data.status == '1') {
|
||||
data.sessionkey && this.importLogStore.getDatas(data.sessionkey, 1);
|
||||
} else {
|
||||
message.warning(data.message);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
getImportLogSearchCondition(params = {}) {
|
||||
if (this.pId) params.pId = this.pId;
|
||||
this.form.updateIsFormInit(false);
|
||||
this.form = new WeaForm();
|
||||
API.getImportLogSearchCondition(params).then((data) => {
|
||||
if (data.status == '1') {
|
||||
this.searchCondition = data.searchCondition;
|
||||
this.form.initFormFields(data.searchCondition);
|
||||
} else {
|
||||
message.warning(data.message);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.message);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
doSearch(params = {}) {
|
||||
let formParams = this.form.getFormParams();
|
||||
this.getImportLogDetail(formParams);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,9 @@ import {FieldDefinedStore} from "./fieldDefined";
|
|||
import {ResourceStore} from "./resource";
|
||||
import {ResourceExtendStore} from "./resourceExtend";
|
||||
import {DatasImportStore} from "./datasImport";
|
||||
import {HrmImportResource} from "./importresource";
|
||||
import {HrmImportCommon} from "./importCommon";
|
||||
import {HrmBasicDataImport} from "./import"
|
||||
|
||||
module.exports = {
|
||||
simpleOrgStore: new SimpleOrgStore(),
|
||||
|
|
@ -41,5 +44,8 @@ module.exports = {
|
|||
fieldDefined: new FieldDefinedStore(),
|
||||
resource: new ResourceStore(),
|
||||
resourceExtend: new ResourceExtendStore(),
|
||||
datasImport: new DatasImportStore()
|
||||
datasImport: new DatasImportStore(),
|
||||
hrmImportResource:new HrmImportResource(),
|
||||
hrmImportCommon:new HrmImportCommon(),
|
||||
hrmBasicDataImport:new HrmBasicDataImport()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ const {
|
|||
...this.form.getFormParams()
|
||||
}
|
||||
Api.exportResource(toJS(this.tableStore.selectedRowKeys).toString());
|
||||
this.tableStore.selectedRowKeys = [];
|
||||
}
|
||||
|
||||
updateFields(val) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
.hrm-card-out{
|
||||
width: 24%;
|
||||
height: 130px;
|
||||
float: left;
|
||||
margin-left: 1.3%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.hrm-card-inwrap{
|
||||
height: 100%;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hrm-card-icon{
|
||||
width: 40px;
|
||||
font-size: 40px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -20px;
|
||||
margin-top: 30px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.hrm-card-title{
|
||||
/*width: 80px;*/
|
||||
text-align: right;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
font-size: 17px;
|
||||
bottom: 15px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.hrm-import-wrap{
|
||||
width: 90%;
|
||||
height: 100%;
|
||||
margin-left: 5%;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.hrm-import-table-th .ant-table-tbody>tr>td, .ant-table-thead>tr>th{
|
||||
padding: 8px 8px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.hrm-import-table-th .ant-table-thead>tr>th{
|
||||
background-color: #F0F6F6;
|
||||
}
|
||||
|
||||
.hrm-import-table-th .ant-table{
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.hrm-import-table-th .ant-table table{
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.hrm-import-loading .ant-spin.ant-spin-show-text .ant-spin-text{
|
||||
float: right;
|
||||
margin-left: 20px;
|
||||
padding-top: 2px
|
||||
}
|
||||
|
||||
.hrm-import-error-tip{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 25px;
|
||||
padding: 6px;
|
||||
/* margin-left: 230px; */
|
||||
margin-right: 10px;
|
||||
display: inline-block;
|
||||
background-color: rgb(255, 0, 0);
|
||||
}
|
||||
|
||||
.hrm-import-ant-table .ant-table-tbody>tr>td, .ant-table-thead>tr>th{
|
||||
padding: 8px 8px;
|
||||
}
|
||||
|
||||
.hrm-import-link{
|
||||
color: #B4B4B4;
|
||||
}
|
||||
|
||||
.hrm-import-link:hover{
|
||||
color: #FFF;
|
||||
}
|
||||
Loading…
Reference in New Issue