import React from 'react'; import { inject, observer } from 'mobx-react'; import { Button, Steps, Spin, Tabs, Modal, message, Icon } from 'antd'; const confirm = Modal.confirm; const TabPane = Tabs.TabPane; const Step = Steps.Step; import { WeaDialog, WeaSearchGroup, WeaTools, WeaTableEdit, WeaNewScroll, WeaFormItem, WeaAlertPage, WeaTab } from 'ecCom'; import { WeaSwitch } from 'comsMobx' import UploadAvatar from '../../../../pc4public/hrm/uploadAvatar' import InputBtn from '../../coms/inputBtn' import CustComp from './CustComp'; import forEach from 'lodash/forEach' import isEmpty from 'lodash/isEmpty' const getKey = WeaTools.getKey; import * as mobx from 'mobx'; const toJS = mobx.toJS; import { i18n } from '../../public/i18n'; import {addContentPath} from '../../util/index.js' import { AttachToNumberField } from '../../../../pc4backstage/hrmengine/util/index.js' const verificationCode = '/weaver/weaver.file.MakeValidateCode?isView=1&validatetype=0&validatenum=4&seriesnum_='; @inject('hrmAdd') @observer class Full extends React.Component { constructor(props) { super(props); this.state = { time: new Date().getTime() } } componentWillReceiveProps (nextProps) { const { hrmAdd } = this.props; if ('visible' in this.props && this.props.visible !== nextProps.visible) { if (nextProps.visible) { hrmAdd.current = 0; hrmAdd.canSave = true; hrmAdd.getHrmResourceAddForm(); } } } componentDidMount () { const dom = $(''); $(document.body).append(dom); // const {hrmAdd} = this.props; // const {current} = hrmAdd; // hrmAdd.current = 1; } pre = () => { const { hrmAdd } = this.props; const { current } = hrmAdd; this.refs.scrollBar.scrollerToTop(); hrmAdd.current = current - 1; } next = () => { const { hrmAdd } = this.props; const { current } = hrmAdd; hrmAdd.myvalidate(() => { this.refs.scrollBar.scrollerToTop(); hrmAdd.current = current + 1; }) } save = () => { const { hrmAdd } = this.props; hrmAdd.saveFull(this.refreshVerificationCode); } onTabChange = (key) => { const { hrmAdd } = this.props; hrmAdd.onTabChange(key); } tableEditChange = (data) => { const { hrmAdd } = this.props; hrmAdd.tableEditChange(data); } more = () => { } openSimplemode = () => { const { hrmAdd } = this.props; const { openSimplemode } = hrmAdd; openSimplemode() } getBtns = () => { const { hrmAdd } = this.props; const { current, canSave } = hrmAdd; let btns = []; const leftbutton =
{i18n.button.simpleModle()}
const pre = ; const next = ; const ok = ; if (current == 0) { btns = [leftbutton, next]; } else if (current == 3) { btns = [pre, ok]; } else { btns = [pre, next]; } return btns; } refreshVerificationCode = () => this.setState({ time: new Date().getTime() }); getSearchs = (current) => { const { time } = this.state; const { hrmAdd } = this.props; const { formFull, conditionInfo0, conditionInfo1, conditionInfo2, conditionInfo3 } = hrmAdd; const { isFormInit } = formFull; const formParams = formFull.getFormParams(); let group = []; let target; if (current < 1) target = conditionInfo0; if (current === 1) target = conditionInfo1; if (current === 2) target = conditionInfo2; if (current === 3) target = conditionInfo3; window.e9HideFormFieldKeys = []; isFormInit && target && target.forEach((c, i) => { let items = []; c.items.forEach((field, j) => { let hide = false; let hideLabel = false; if (formParams.accounttype == '1' && (field.domkey[0] == 'loginid' || field.domkey[0] == 'password' || field.domkey[0] == 'password1' || field.domkey[0] == 'userUsbType')) hide = true; if ((!formParams.userUsbType || formParams.userUsbType == '') && (field.domkey[0] == 'tokenKey' || field.domkey[0] == 'serial' || field.domkey[0] == 'usbstate')) hide = true; if (formParams.userUsbType == '4' && (field.domkey[0] == 'tokenKey' || field.domkey[0] == 'serial')) hide = true; if (formParams.userUsbType == '2' && field.domkey[0] == 'tokenKey') hide = true; if (formParams.userUsbType == '3' && field.domkey[0] == 'serial') hide = true; if ((!formParams.accounttype || formParams.accounttype == '0') && field.domkey[0] == 'belongto') hide = true; if (field.domkey[0] == 'usbstate') { hideLabel = true; } let dom; if (field.conditionType == 'RESOURCEIMG') { const key = getKey(field); const bindObj = formFull.$(key); dom = } else if (field.domkey[0] == 'tokenKey') { const key = getKey(field); const bindObj = formFull.$(key); dom = } else if (field.domkey[0] == 'serial') { const key = getKey(field); const bindObj = formFull.$(key); dom = } else if (field.domkey[0] == 'validatecode') { dom = (
) } else { dom = ; } if (c.hide || !isEmpty(field.otherParams) && field.otherParams.hide) { window.e9HideFormFieldKeys.push(field.domkey[0]); } else { items.push({ com: {dom} {field.domkey[0] == 'workcode' && } , colSpan: 1, hide: hide }); } }); group.push() }); return group; } handleTable = (datas) => { return datas && datas.map(data => { const {tabinfo:{columns}} = data; const length = columns.length; columns.map(c => { c.width = `${95/length}%` }) return data }) } getTabChildren = () => { const { hrmAdd } = this.props; const { current, tableInfo1, tableInfo2, tabkey1, tabkey2 } = hrmAdd; let tabChildren = []; let target; let tabkey; if (current === 1) { target = toJS(tableInfo1); tabkey = tabkey1; } if (current === 2) { target = toJS(tableInfo2); tabkey = tabkey2; } target && this.handleTable(target).map((t, i) => { if (tabkey == i) { tabChildren.push( ); } }) return tabChildren; } render () { const { hrmAdd } = this.props; const { visible, title, current, loading, conditionInfo1, conditionInfo2, conditionInfo3, tabInfo1, tabInfo2, tabkey1, tabkey2 } = hrmAdd; let dialogHeight = window.innerHeight - 250; if (dialogHeight > 660) dialogHeight = 660; return
{this.getSearchs(0)}
{!isEmpty(conditionInfo1) ?
{this.getSearchs(1)} { !isEmpty(tabInfo1) &&
{this.getTabChildren()}
}
:
{i18n.message.fillPrivateInfoAlarm()}
}
{!isEmpty(conditionInfo2) ?
{this.getSearchs(2)} {this.getTabChildren()}
:
{i18n.message.fillWorkInfoAlarm()}
}
{!isEmpty(conditionInfo3) ?
{this.getSearchs(3)}
:
{i18n.message.fillSysInfoAlarm()}
}
} } export default Full