import React from 'react'; import { inject, observer} from 'mobx-react'; import {WeaTop, WeaTab,WeaRightMenu,WeaErrorPage,WeaSearchGroup,WeaFormItem,WeaSelect,WeaAlertPage,} from 'ecCom'; import {Row,Form,Col,Button} from 'antd'; import * as mobx from 'mobx'; import * as PublicFunc from '../util/pulic-func'; window.openFullWindowForXtable = PublicFunc.openFullWindowForXtable; import moment from 'moment'; import {WeaTableNew,WeaSwitch} from 'comsMobx'; import {i18n} from '../public/i18n'; const WeaTable = WeaTableNew.WeaTable; @inject('hrmBirthdayInfo') @observer class BirthdayInfo extends React.Component { constructor(props) { super(props); } componentDidMount() { const { hrmBirthdayInfo } = this.props; hrmBirthdayInfo.getHasRight(); } componentWillReceiveProps(nextProps) { if(this.props.location.key !== nextProps.location.key) { const { hrmBirthdayInfo } = this.props; hrmBirthdayInfo.getHasRight(); } } hideSearchAd = () => this.props.hrmBirthdayInfo.setShowSearchAd(false) onKeyDown = (e) => { if (e.keyCode == 13 && e.target.tagName === "INPUT") { this.props.hrmBirthdayInfo.doSearch(); this.props.hrmBirthdayInfo.setShowSearchAd(false) } } onSearchChange= v => { this.props.hrmBirthdayInfo.form.updateFields({ lastname:{name:'lastname',value:v}, }); } render(){ const { hrmBirthdayInfo } = this.props; const {title,form,table,showSearchAd,searchParamsAd,verified,hasRight} = hrmBirthdayInfo; if (verified && hasRight) { const formParams = form.getFormParams(); return (
} iconBgcolor='#217346' buttons={this.getTopButtons()} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} >
{this.getSearchs()}
} showSearchAd={showSearchAd} onSearch={hrmBirthdayInfo.doSearch} onSearchChange={this.onSearchChange} /> ); } if (verified && !hasRight) { return (
{i18n.message.authFailed()}
) } return (
) } updateMonth = v => { this.props.hrmBirthdayInfo.form.updateFields({ bMonth:{name:'bMonth',value:v}, }); } updateBDate = v => { this.props.hrmBirthdayInfo.form.updateFields({ bDate:{name:'bDate',value:v}, }); } getSearchs = () => { const { hrmBirthdayInfo } = this.props; const { form,condition } = hrmBirthdayInfo; const {isFormInit} = form; let group = []; let monthOptions= hrmBirthdayInfo.getMonth(); let dayOptions= hrmBirthdayInfo.getDay(); const formParams = form.getFormParams(); const month = new moment().format('MM'); isFormInit && condition.map((c, i) =>{ let items = []; c.items.map((fields, j) => { let hide = false; let dom; if (fields.domkey[0] == 'bDate') { hide = true; }if (fields.domkey[0] == 'bMonth') { dom = }else { dom = ; } items.push({ com:( {dom} ), colSpan:1, hide: hide }) }); group.push() }); return group; } reRenderColumns = (columns) => { columns.forEach(c=>{ if(c.dataIndex=='lastname'){ c.render = (text, record) => { return this.jumpToHrmCard(record.randomFieldId)}>{record.lastname} } } else { // c.render = function(text, record){ // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; // return // } } }) return columns; } jumpToHrmCard = (hrmId) => { PublicFunc.jumpToHrmCard(hrmId); } getRightMenu = () => { const { hrmBirthdayInfo } = this.props; const arr = [{ icon: , content:i18n.button.search(), key: 'search', onClick: hrmBirthdayInfo.doSearch }, { icon: , content:i18n.button.columnVisibleSetting(), key: 'definedColumn', onClick: this.definedColumn }, { icon: , content:i18n.button.export(), key: 'export', onClick: hrmBirthdayInfo.doExport } ]; return arr; } onRightMenuClick = (key) => { const { hrmBirthdayInfo } = this.props; switch(key){ case '0': hrmBirthdayInfo.doSearch(); break; case '1': this.definedColumn(); break; } } getSelectedRowKeys = () => { const { hrmBirthdayInfo } = this.props; const { table} = hrmBirthdayInfo; const selectedRowKeys = table.selectedRowKeys; return selectedRowKeys; } definedColumn = () => { const { hrmBirthdayInfo } = this.props; const { table} = hrmBirthdayInfo; table.setColSetVisible(true); table.tableColSet(true); } onClickHandle1 = () => { this.props.hrmBirthdayInfo.doSearch(); this.props.hrmBirthdayInfo.setShowSearchAd(false); } onClickHandle2 = () => { this.props.hrmBirthdayInfo.form.reset(); this.props.hrmBirthdayInfo.form.updateFields({ bMonth:{value: new moment().format('MM')}, }) } onClickHandle3 = () => { this.props.hrmBirthdayInfo.setShowSearchAd(false) } getTabButtonsAd = () => { const { hrmBirthdayInfo } = this.props; const { form,searchParamsAd } = hrmBirthdayInfo; return [ (), (), () ] } getTopButtons = () => { const { hrmBirthdayInfo } = this.props; return [ (), () ] } } export default BirthdayInfo