import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { Button, message } from "antd"; import { salaryStatisticsPushAddSharedSendMsg } from "../../../apis/statistics"; import { sharePersonCondition } from "./condition"; import { getSearchs } from "../../../util"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @inject("attendanceStore") @observer class SalaryStatisticsDetailSharePersonDialog extends Component { constructor(props) { super(props); this.state = { conditions: [], loading: false }; } componentWillReceiveProps(nextProps, nextContext) { const { attendanceStore: { initSharePerForm, sharePerForm } } = nextProps; if (nextProps.visible !== this.props.visible && nextProps.visible) { sharePerForm.initFormFields(sharePersonCondition); } else { initSharePerForm(); } } save = () => { const { attendanceStore: { sharePerForm }, id } = this.props; sharePerForm.validateForm().then(f => { if (f.isValid) { const { sharedBy } = sharePerForm.getFormParams(); const payload = { id, sharedBy: sharedBy.split(",") }; salaryStatisticsPushAddSharedSendMsg(payload) .then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success(getLabel(30700, "操作成功!")); this.props.onCancel(); this.props.onGetTable(); } else { message.error(errormsg); } }) .catch(() => this.setState({ loading: false })); } else { f.showErrors(); } }); }; render() { const { attendanceStore: { sharePerForm }, loading } = this.props; return ( {getLabel(111, "保存并分享")} ]} style={{ width: 600, height: 100 }} > {getSearchs(sharePerForm, sharePersonCondition, 1, false)} ); } } export default SalaryStatisticsDetailSharePersonDialog;