/* * Author: 黎永顺 * name: 批量更新-薪资项目的值 * Description: * Date: 2023/12/6 */ import React, { Component } from "react"; import { Button, message } from "antd"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { getSearchs, toDecimal_n } from "../../../../../util"; import { salaryacctBatchUpdate } from "../../../../../apis/calculate"; const getLabel = WeaLocaleProvider.getLabel; @inject("calculateStore") @observer class BatchUpdateSalaryItemValDialog extends Component { constructor(props) { super(props); this.state = { loading: false }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visibe && !nextProps.visible) nextProps.calculateStore.initBatchUpdateForm(); } save = () => { const { calculateStore: { batchUpdateForm }, salaryAcctRecordId, salaryItemId, idList, pattern, dataType } = this.props; batchUpdateForm.validateForm().then(f => { if (f.isValid) { const { value } = batchUpdateForm.getFormParams(); this.setState({ loading: true }); const payload = { salaryAcctRecordId, salaryItemId, idList, value: dataType === "number" ? toDecimal_n(value, pattern) : value }; this.setState({ loading: false }); salaryacctBatchUpdate(payload).then(({ status, errormsg }) => { if (status) { message.success(getLabel(30700, "操作成功!")); this.props.onCancel(true); } else { message.error(errormsg); } }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); } }); }; render() { const { loading } = this.state; const { conditions, calculateStore: { batchUpdateForm } } = this.props; return ( {getLabel(537558, "保存")} ]} >
{getSearchs(batchUpdateForm, conditions, 1, false)}
); } } export default BatchUpdateSalaryItemValDialog;