custom/领悦

This commit is contained in:
黎永顺 2024-10-10 16:29:36 +08:00
parent 32940c9bcf
commit 44fb334837
4 changed files with 138 additions and 7 deletions

View File

@ -0,0 +1,69 @@
/*
* 领悦二开
* 核算账簿-推送弹框
* @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;

View File

@ -0,0 +1,54 @@
export const acctBookConditions = [
{
items: [
{
browserConditionParam: {
completeParams: {
type: 161,
fielddbtype: "browser.NCZBBrowser",
f_weaver_belongto_usertype: "0"
},
conditionDataParams: {
type: "browser.NCZBBrowser",
fielddbtype: "browser.NCZBBrowser",
f_weaver_belongto_usertype: "0"
},
dataParams: {
type: "browser.NCZBBrowser",
f_weaver_belongto_usertype: "0"
},
destDataParams: {
type: "browser.NCZBBrowser",
f_weaver_belongto_usertype: "0"
},
hasAddBtn: false,
hasAdvanceSerach: true,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: true,
icon: "icon-coms-hrm",
linkUrl: "",
pageSize: 10,
quickSearchName: "zbmc",
replaceDatas: [],
title: "",
type: "161",
viewAttr: 3
},
conditionType: "BROWSER",
domkey: ["zbbm"],
fieldcol: 16,
label: "核算账簿",
lanId: 111,
labelcol: 6,
rules: "required|string",
value: "",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];

View File

@ -8,20 +8,23 @@
* @description:
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLoadingGlobal, WeaLocaleProvider, WeaTableEdit, WeaTop } from "ecCom";
import { Button, message } from "antd";
import * as API from "../../../../apis/custom-apis/lingyue";
import { getQueryString, getURLParameters } from "../../../../util/url";
import CustomBrowser from "../../../../components/CustomBrowser";
import AcctBookDialog from "./acctBookDialog";
const getLabel = WeaLocaleProvider.getLabel;
const pzlxEnum = ["0", "1", "2"];//非计提类型的凭证列表可编辑
@inject("LYStore")
@observer
class Index extends Component {
constructor(props) {
super(props);
this.state = {
datas: [], totalData: [], columns: [], loading: false
datas: [], totalData: [], columns: [], loading: false, visible: false
};
}
@ -91,9 +94,9 @@ class Index extends Component {
});
};
pushNotifications = () => {
const { datas } = this.state;
const { datas } = this.state, { LYStore: { acctBookForm } } = this.props;
const payload = {
...getURLParameters(window.location.hash),
...getURLParameters(window.location.hash), ...acctBookForm.getFormParams(),
ffgsqc: decodeURI(getURLParameters(window.location.hash).ffgsqc),
dataSource: _.head(datas).dataSource,
details: _.map(datas, o => ({
@ -110,6 +113,7 @@ class Index extends Component {
this.setState({ loading: false });
if (status) {
message.success(getLabel(111, "操作成功!"));
this.setState({ visible: false });
setTimeout(() => window.close(), 1500);
} else {
message.error(errormsg);
@ -118,14 +122,14 @@ class Index extends Component {
};
render() {
const { datas, columns, loading, totalData } = this.state;
const { datas, columns, loading, totalData, visible } = this.state;
const pzlx = getQueryString("pzlx");
return (
<WeaTop
title={getLabel(111, "凭证预览汇总表")} icon={<i className="icon-coms-fa"/>} showDropIcon={false}
iconBgcolor="#F14A2D" className="custom_vouchers_lingyue"
buttons={[<Button type="primary" loading={loading} disabled={_.isEmpty(datas)}
onClick={this.pushNotifications}>{getLabel(111, "推送")}</Button>]}>
buttons={[<Button type="primary" disabled={_.isEmpty(datas)}
onClick={() => this.setState({ visible: true })}>{getLabel(111, "推送")}</Button>]}>
<div className="vouchers-body">
<WeaTableEdit
ref={el => this.tableEdit = el} showCopy={false} deleteConfirm
@ -145,6 +149,8 @@ class Index extends Component {
datas={totalData} tableProps={{ showHeader: false }}
columns={_.map(columns, o => ({ ...o, com: [{ key: o.column, type: "TEXT" }] }))}/>
</div>
<AcctBookDialog visible={visible} loading={loading} onPushNotifications={this.pushNotifications}
onCancel={() => this.setState({ visible: false })}/>
</div>
</WeaTop>
);

View File

@ -4,4 +4,6 @@ import { WeaForm } from "comsMobx";
export class LYStore {
@observable form = new WeaForm();
@action initForm = () => this.form = new WeaForm();
@observable acctBookForm = new WeaForm(); //推送核算账簿form
@action initAcctBookForm = () => this.acctBookForm = new WeaForm();//重置推送核算账簿form
}