94 lines
4.2 KiB
JavaScript
94 lines
4.2 KiB
JavaScript
import React from 'react';
|
|
import { inject, observer } from 'mobx-react';
|
|
import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaTools,WeaNewScroll,WeaLocaleProvider} from "ecCom"
|
|
import { Button } from 'antd';
|
|
import PrjImport from './PrjImport'
|
|
import TaskImport from './TaskImport'
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
@inject('prjImportStore')
|
|
@observer
|
|
class ProjectImport extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
componentWillReceiveProps(nextProps){
|
|
if(this.props.location.key !== nextProps.location.key){
|
|
const { location,prjImportStore } = nextProps;
|
|
prjImportStore.clearStatus();
|
|
}
|
|
}
|
|
componentWillUnmount(){
|
|
const {prjImportStore } = this.props;
|
|
prjImportStore.clearStatus();
|
|
}
|
|
render(){
|
|
const title = getLabel(81757,"项目导入");
|
|
const topTab = [
|
|
{key: 'prjimport',title: getLabel(81757,"项目导入")},
|
|
{key: 'taskimport', title: getLabel(383858,"任务导入")},
|
|
];
|
|
const {prjImportStore} = this.props;
|
|
const {loading,selectTabkey,reflesh} = prjImportStore;
|
|
return (
|
|
<div>
|
|
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@6vxonf`} datas={this.getRightMenu()} >
|
|
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@iyo9sg`}
|
|
title={title}
|
|
icon={<i className='icon-coms-project' />}
|
|
iconBgcolor='#217346'
|
|
buttons={this.getTopButtons()}
|
|
buttonSpace={10}
|
|
showDropIcon={true}
|
|
dropMenuDatas={this.getRightMenu()}
|
|
onDropMenuClick={this.onRightMenuClick}
|
|
>
|
|
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@h54chk`}
|
|
datas={topTab}
|
|
keyParam="key" //主键
|
|
selectedKey={ selectTabkey }
|
|
onChange={ this.changeTab }
|
|
/>
|
|
<div className="prj-import-content">
|
|
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@q4ob8r`} scrollId='prj-content-main-scroll' height='100%'>
|
|
<div style={{display:selectTabkey == "prjimport" ? "block":"none"}}>
|
|
<PrjImport ecId={`${this && this.props && this.props.ecId || ''}_PrjImport@dt9pqt`} key={reflesh}/>
|
|
</div>
|
|
<div style={{display:selectTabkey == "taskimport" ? "block":"none"}}>
|
|
<TaskImport ecId={`${this && this.props && this.props.ecId || ''}_TaskImport@xq9ko0`} key={reflesh}/>
|
|
</div>
|
|
</WeaNewScroll>
|
|
</div>
|
|
</WeaTop>
|
|
</WeaRightMenu>
|
|
</div>
|
|
)
|
|
}
|
|
getTopButtons(){
|
|
const {doImport,disabled} = this.props.prjImportStore;
|
|
let btnArr = [];
|
|
btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@cyvilw@submit`} type="primary" disabled={disabled} onClick={()=>doImport()}>{getLabel(615,"提交")}</Button>)
|
|
return btnArr;
|
|
}
|
|
getRightMenu(){
|
|
const {doImport,disabled} = this.props.prjImportStore;
|
|
let btnArr = [];
|
|
btnArr.push({
|
|
key: '1',
|
|
icon: <i className={"icon-coms-Approval"} />,
|
|
disabled: disabled,
|
|
content: getLabel(615,"提交"),
|
|
onClick:(key)=>{doImport()}
|
|
});
|
|
return btnArr;
|
|
}
|
|
changeTab=(key)=>{
|
|
const {prjImportStore} = this.props;
|
|
prjImportStore.changeTab(key);
|
|
}
|
|
}
|
|
|
|
export default WeaTools.tryCatch(React,
|
|
props => <WeaErrorPage ecId={`${this && this.props && this.props.ecId || ''}_WeaErrorPage@4a9vbm`} msg={ props.error ? props.error : getLabel(383324,"'对不起,该页面异常,请联系管理员")} />,
|
|
{error: ""}
|
|
)(ProjectImport); |