trunk/pc4mobx/organization/components/importresource/ImportHistory.js

137 lines
4.2 KiB
JavaScript

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