/* * Author: 黎永顺 * name:审批规则分类编辑 * Description: * Date: 2024/4/25 */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; import { Button } from "antd"; import { getSearchs } from "../../../util"; import { classifyConditions } from "../config"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; @inject("ledgerStore") @observer class LedgerAccountApprRuleClassifyNameEditDialog extends Component { constructor(props) { super(props); this.state = { conditions: [] }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) this.init(nextProps); if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.ledgerStore.initAARClassifyForm(); } init = (props) => { const { ledgerStore: { AARClassifyForm }, groupName, groupId } = props; this.setState({ conditions: _.map(classifyConditions, item => ({ ...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) })) }, () => { AARClassifyForm.initFormFields(this.state.conditions); groupId && AARClassifyForm.updateFields({ groupName }); }); }; save = () => { const { ledgerStore: { AARClassifyForm }, groupId } = this.props; AARClassifyForm.validateForm().then(f => { if (f.isValid) { this.props.onCancel(); this.props.onEdit(AARClassifyForm.getFormParams().groupName, groupId); } else { f.showErrors(); } }); }; render() { const { conditions } = this.state; const { ledgerStore: { AARClassifyForm } } = this.props; return ( {getLabel(537558, "保存")} ]} >
{getSearchs(AARClassifyForm, conditions, 1, false)}
); } } export default LedgerAccountApprRuleClassifyNameEditDialog;