85 lines
2.7 KiB
JavaScript
85 lines
2.7 KiB
JavaScript
/*
|
|
* 领悦二开
|
|
* 核算账簿-推送弹框
|
|
* @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, WeaTools } from "ecCom";
|
|
import { getHszb } from "../../../../apis/custom-apis/lingyue";
|
|
import { acctBookConditions } from "./conditions";
|
|
import { getSearchs } from "../../../../util";
|
|
import { Button } from "antd";
|
|
import moment from "moment";
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
const getKey = WeaTools.getKey;
|
|
|
|
@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 = async () => {
|
|
const { data } = await getHszb({ ffgsqc: decodeURI(WeaTools.getUrlParams().ffgsqc) });
|
|
this.setState({
|
|
conditions: _.map(acctBookConditions, item => ({
|
|
...item, items: _.map(item.items, o => {
|
|
if (getKey(o) === "zdrq") {
|
|
return { ...o, label: getLabel(o.lanId, o.label), value: moment().format("YYYY-MM-DD") };
|
|
} else if (getKey(o) === "zbbm") {
|
|
return {
|
|
...o, label: getLabel(o.lanId, o.label),
|
|
browserConditionParam: { ...o.browserConditionParam, replaceDatas: [data] }
|
|
};
|
|
}
|
|
return { ...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} initLoadCss title={getLabel(111, "凭证推送")}
|
|
style={{ width: 480, height: _.reduce(conditions, (pre, cur) => (pre += cur.items.length), 0) * 47 + 33 }}
|
|
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;
|