/* * Author: 黎永顺 * name: 导出模板保存框 * Description: * Date: 2024/3/29 */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { Button, message } from "antd"; import { getSearchs } from "../../../../../util"; import { tempConditions } from "../../../../../common/conditions"; import * as API from "../../../../../apis/calculate"; const getLabel = WeaLocaleProvider.getLabel; @inject("calculateStore") @observer class TempDialog extends Component { constructor(props) { super(props); this.state = { loading: false }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { nextProps.calculateStore.tempForm.initFormFields(tempConditions); } else { nextProps.calculateStore.initTempForm(); } } save = () => { const { calculateStore: { tempForm }, salaryAcctRecordId, id, salaryItemIds } = this.props; tempForm.validateForm().then(f => { if (f.isValid) { const payload = tempForm.getFormParams(); this.setState({ loading: true }); API.saveExportTemplate({ ...payload, salaryAcctRecordId, id, salaryItemIds }) .then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success(getLabel(111, "操作成功!")); this.props.onCancel(true); } else { message.error(errormsg); } }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); } }); }; render() { const { loading } = this.state; const { calculateStore: { tempForm } } = this.props; return ( {getLabel(111, "保存")} ]} >
{getSearchs(tempForm, tempConditions, 1, false)}
); } } export default TempDialog;