import React from 'react' import { Modal, Row, Col, Select, message, Button } from 'antd' import RequiredLabelTip from '../../components/requiredLabelTip' import { inject, observer } from 'mobx-react'; import { WeaDatePicker, WeaInput } from 'ecCom' import { notNull } from '../../util/validate'; const { Option } = Select; @inject('calculateStore') @observer export default class baseFormModal extends React.Component { constructor(props) { super(props) this.state = { salaryMonthStr: "", inited: false, selectOptions: [], salarySob: '', description: "" } } componentWillMount() { const { calculateStore } = this.props; const { salaryacctGetForm } = calculateStore salaryacctGetForm().then(data => { this.setState({ inited: true, selectOptions: data.salarySobs }) }) } handleSelectChange(value) { this.setState({ salarySob: value }) } // 保存回调 handleSave() { if(!this.validate()) { return } let params = { salaryMonthStr: this.state.salaryMonthStr, salarySobId: this.state.salarySob, description: this.state.description } const { calculateStore: { saveBasic }} = this.props; saveBasic(params).then((id) => { this.props.onCancel() this.props.onRefresh() window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/calculateDetail?id=" + id) }) } validate() { if(!notNull(this.state.salaryMonthStr)) { message.warning("薪酬所属月不能为空") return false; } else if(!notNull(this.state.salarySob)) { message.warning("核算账套不能为空") return false; } return true; } render() { const { salaryMonthStr, salarySobId, description } = this.state; return ( {this.props.onCancel()}} footer={} > 薪酬所属月 {this.setState({ salaryMonthStr: value })}} /> 核算账套 { this.state.inited && } 备注 this.setState({description: value})}/> ) } }