import {
Tabs,
Row,
Col
} from 'antd';
import {
WeaInput,
WeaErrorPage,
WeaTools,
WeaTableEdit,
WeaSearchGroup,
WeaRightMenu,
WeaFormItem,
WeaTab,
WeaNewScroll,
WeaAlertPage,
WeaAvatar,
WeaLeftRightLayout
} from 'ecCom'
import isEmpty from 'lodash/isEmpty'
import * as mobx from 'mobx';
import {
inject,
observer
} from 'mobx-react';
import SystemCard from './SystemCard';
import PortraitSetting from './PortraitSetting';
import {
routerShape
} from 'react-router';
import '../../style/card.less';
const toJS = mobx.toJS;
import {
WeaPopoverHrm
} from 'ecCom';
import TopButton from '../../coms/topButton';
import { i18n } from '../../public/i18n';
import { addContentPath } from '../../util/index.js'
const TabPane = Tabs.TabPane;
const { ua } = WeaTools;
const isIE9 = ua.browser === "IE"
@inject('hrmCard')
@observer
class Main extends React.Component {
static contextTypes = {
router: routerShape,
}
constructor(props) {
super(props);
this.state = {
weaWorkplanLoaded: false,
rightMenu: []
}
}
getkey(path) {
return path.match(/hrm\/card\/\w+/)[0].split('/')[2] || '';
}
componentWillReceiveProps(nextProps) {
const key = this.getkey(nextProps.location.pathname);
if (this.props.location.key !== nextProps.location.key && key == 'cardInfo') {
this.init(nextProps);
}
}
componentWillMount() {
// 异步加载日程模块静态资源
eventRegister.loadModule('f_workplan', () => {
this.setState({ weaWorkplanLoaded: true });
}, () => { });
}
componentDidMount() {
this.init();
}
init = (nextProps) => {
const {
hrmCard
} = nextProps || this.props;
const {
pathname
} = (nextProps || this.props).location;
const key = this.getkey(pathname);
const hrmId = (nextProps || this.props).params.hrmId || '';
//const hrmId = pathname.match(/cardInfo\/\w+/)[0].split('/')[1]
hrmCard.init(key);
hrmCard.verifyIsAdmin({
id: hrmId
});
hrmCard.getData({
id: hrmId
});
}
setParentRightMenu = rightMenu => this.setState({ rightMenu })
getTabChildren() {
const {
hrmCard,
children
} = this.props;
let {
tabInfo,
tabKey,
} = hrmCard;
let isIframe = false;
let ifame;
let innerPage = false;
if (window.location.href.indexOf("/spa/hrm/index_mobx.html") == -1) {
innerPage = true;
}
tabInfo = toJS(tabInfo);
tabInfo && tabInfo.forEach((t) => {
if (tabKey === t.key) {
if (t.isIframe) {
isIframe = true;
if (t.key == 'iframe-9-workplansearch') { // 日程模块加载方式
const selectedUser = t.url.split('?')[1].split('&')[1].split('=')[1];
this.state.weaWorkplanLoaded && window.weaWorkplan && window.weaWorkplan.com ?
ifame = */}