custom/领悦业务线

This commit is contained in:
lys 2025-02-14 14:32:55 +08:00
parent e34dbca6f7
commit 537e019aad
2 changed files with 56 additions and 53 deletions

View File

@ -10,12 +10,10 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { WeaSwitch } from "comsMobx";
import { Button, message } from "antd";
import { vouchersConditions } from "./conditions";
import { commonEnumList } from "../../../../apis/ruleconfig";
import { convertToUrlString } from "../../../../util/url";
import { getSearchs } from "../../../../util";
import "../index.less";
import FormInfo from "../../../../components/FormInfo";
import * as API from "../../../../apis/mySalaryBenefits";
const getLabel = WeaLocaleProvider.getLabel;
@ -25,7 +23,7 @@ class LyCheckSecondaryVerifyDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, conditions: []
loading: false, conditions: [], notSetting: false
};
}
@ -35,45 +33,29 @@ class LyCheckSecondaryVerifyDialog extends Component {
}
initLYForm = () => {
const { type } = this.props;
commonEnumList({ enumClass: "com.engine.salary.enums.ly.LyPZTypeEnum" })
.then(({ status, data }) => {
type === "salarySum" && (data = data.filter(item => !["SBJTPZ", "SBFFPZ", "GJJJTPZ", "GJJFFPZ"].includes(item.enum)));
type === "socialFundSum" && (data = data.filter(item => !["XZJTPZ", "XZFFPZ", "GJJJTPZ", "GJJFFPZ"].includes(item.enum)));
type === "fundSum" && (data = data.filter(item => !["XZJTPZ", "XZFFPZ", "SBJTPZ", "SBFFPZ"].includes(item.enum)));
if (status) {
this.setState({
conditions: _.map(vouchersConditions, item => ({
...item, items: _.map(item.items, o => ({
...o, label: getLabel(o.lanId, o.label),
options: _.map(data, item => ({ key: String(item.value), showname: item.defaultLabel }))
}))
}))
}, () => {
const { LYStore: { form } } = this.props;
form.initFormFields(this.state.conditions);
});
}
const { salaryBillToken } = this.props;
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, salaryBillToken)
.then(({ conditions, notSetting }) => {
this.setState({ conditions: [{ title: "", items: conditions }], notSetting }, () => {
const { LYStore: { secVerifyform } } = this.props;
secVerifyform.initFormFields(this.state.conditions);
});
});
};
save = () => {
const { LYStore: { form }, ffgsqc, salaryMonth, ffgsqcLabel } = this.props;
let payload = { ...form.getFormParams(), salaryMonth, ffgsqc };
if (!salaryMonth) {
message.warning(getLabel(111, "薪资所属月参数不能为空"));
return;
}
if (!ffgsqc) {
message.warning(getLabel(111, `${ffgsqcLabel}参数不能为空`));
return;
}
form.validateForm().then(f => {
const { LYStore: { secVerifyform }, salaryBillToken } = this.props;
secVerifyform.validateForm().then(f => {
if (f.isValid) {
const { ffgsqc } = payload;
_.forEach(ffgsqc.split(","), item => {
payload = { ...payload, ffgsqc: item };
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/customPage_vouchers_lingyue?${convertToUrlString(payload)}`, "_blank");
});
const payload = { ...secVerifyform.getFormParams() };
API.doSecondAuth({ ...payload, mouldCode: "HRM", itemCode: "SALARY" }, salaryBillToken)
.then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
this.props.onCancel(this.props.onSuccess);
} else {
message.error(checkMsg);
}
});
} else {
f.showErrors();
}
@ -81,16 +63,32 @@ class LyCheckSecondaryVerifyDialog extends Component {
};
render() {
const { conditions, loading } = this.state;
const { LYStore: { form } } = this.props;
const { conditions, loading, notSetting } = this.state, { LYStore: { secVerifyform } } = this.props;
const itemRender = {
authCode: (field, textAreaProps, form, formParams) => {
return (<React.Fragment>
<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}/>
{
notSetting && <div style={{ clear: "both", paddingTop: 10 }}>
{getLabel("111", "您还未设置二次验证密码,请先在系统中设置验证密码")}
{/*<a href="javascript:void(0);"*/}
{/* onClick={() => this.setState({ pwdSetVisible: true })}>{getLabel("30747", "设置")}</a>*/}
</div>
}
</React.Fragment>);
}
};
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(form, conditions, 1, false)}</div>
{...this.props} style={{ width: 550, height: notSetting ? 80 + 26 : 80 }} initLoadCss
title={getLabel(111, "身份验证")} buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "确认")}</Button>
]}>
<div className="form-dialog-layout">
<FormInfo className="form-dialog-layout" center={false} itemRender={itemRender}
form={secVerifyform} formFields={conditions}/>
</div>
</WeaDialog>
);
}

View File

@ -49,9 +49,9 @@ export default class MobilePayroll extends React.Component {
if (type !== "phone") {
const { data, status } = await payrollCheckType();
if (status && data === "PWD") {
init(false, () => this.getMySalaryBill(this.id));
// init(false, () => this.getMySalaryBill(this.id));
//领悦二开
// await this.initLY();
await this.initLY();
} else {
this.setState({ captchaVisible: true });
}
@ -60,6 +60,7 @@ export default class MobilePayroll extends React.Component {
}
initLY = async () => {
const { mySalaryStore: { setInitEmVerify } } = this.props;
const params = this.getUrlkey();
const { data } = await salaryBillGetToken({
id: _.pick(params, ["id"]).id,
@ -201,7 +202,7 @@ export default class MobilePayroll extends React.Component {
};
render() {
const { mySalaryStore: { clearLoading, pwdForm } } = this.props;
const { mySalaryStore: { clearLoading, pwdForm, setInitEmVerify } } = this.props;
const { salaryBillToken, visible, captchaVisible, notSetting, pwdSetVisible, LYCheckSecVerify } = this.state;
const type = getQueryString("type");
if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <div>
@ -229,7 +230,11 @@ export default class MobilePayroll extends React.Component {
<PassSetDialog form={pwdForm} visible={pwdSetVisible} onCancel={() => this.setState({ pwdSetVisible: false })}/>
{/*领悦二开*/}
<LyCheckSecondaryVerifyDialog visible={LYCheckSecVerify} salaryBillToken={salaryBillToken}
onCancel={() => this.setState({ LYCheckSecVerify: false })}/>
onCancel={(callback) => this.setState({ LYCheckSecVerify: false }, () => callback && callback())}
onSuccess={() => {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}}/>
</div>;
const {
salaryTemplate, salaryGroups, employeeInformation,