salary-management-front/pc4mobx/hrmSalary/pages/custom-pages/lingyue/vouncherSummary/acctBookDialog.js

70 lines
2.0 KiB
JavaScript
Raw Normal View History

2024-10-10 16:29:36 +08:00
/*
* 领悦二开
* 核算账簿-推送弹框
* @Author: 黎永顺
* @Date: 2024/10/10
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
import { acctBookConditions } from "./conditions";
import { getSearchs } from "../../../../util";
const getLabel = WeaLocaleProvider.getLabel;
@inject("LYStore")
@observer
class AcctBookDialog extends Component {
constructor(props) {
super(props);
this.state = { conditions: [] };
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.acctBookForm();
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.LYStore.initAcctBookForm();
}
acctBookForm = () => {
this.setState({
conditions: _.map(acctBookConditions, item => ({
...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
}))
}, () => {
const { LYStore: { acctBookForm } } = this.props;
acctBookForm.initFormFields(this.state.conditions);
});
};
save = () => {
const { LYStore: { acctBookForm } } = this.props;
acctBookForm.validateForm().then(f => {
if (f.isValid) {
this.props.onPushNotifications();
} else {
f.showErrors();
}
});
};
render() {
const { conditions } = this.state;
const { LYStore: { acctBookForm }, loading } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480, height: 80 }} initLoadCss title={getLabel(111, "凭证推送")}
buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "推送")}</Button>
]}
>
<div className="form-dialog-layout">{getSearchs(acctBookForm, conditions, 1, false)}</div>
</WeaDialog>
);
}
}
export default AcctBookDialog;