106 lines
3.9 KiB
JavaScript
106 lines
3.9 KiB
JavaScript
/*
|
|
* pc端工资单查看启用二次验证弹框
|
|
* @Author: 黎永顺
|
|
* @Date: 2025/4/15
|
|
* @Wechat:
|
|
* @Email: 971387674@qq.com
|
|
* @description:
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaDialog, WeaLocaleProvider } from "ecCom";
|
|
import { WeaForm, WeaSwitch } from "comsMobx";
|
|
import { Button, message } from "antd";
|
|
import * as API from "../../apis/mySalaryBenefits";
|
|
import FormInfo from "../../components/FormInfo";
|
|
import LoginVerifyPC from "./loginVerifyPC";
|
|
import SecondarypwdVerifyPC from "./secondarypwdVerifyPC";
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
const form = new WeaForm();
|
|
|
|
class CheckSecondaryVerifyDialog extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
loading: false, conditions: [], notSetting: false, loginVerify: false, secondaryVerify: false
|
|
};
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
if (nextProps.visible !== this.props.visible && nextProps.visible) this.initForm();
|
|
if (nextProps.visible !== this.props.visible && !nextProps.visible) form.resetForm();
|
|
}
|
|
|
|
initForm = () => {
|
|
const { salaryBillToken } = this.props;
|
|
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, salaryBillToken)
|
|
.then(({ conditions, notSetting }) => {
|
|
this.setState({ conditions: [{ title: "", items: conditions }], notSetting }, () => {
|
|
form.initFormFields(this.state.conditions);
|
|
});
|
|
});
|
|
};
|
|
save = () => {
|
|
const { salaryBillToken } = this.props;
|
|
form.validateForm().then(f => {
|
|
if (f.isValid) {
|
|
const payload = { ...form.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();
|
|
}
|
|
}).catch(() => this.setState({ loading: false }));
|
|
};
|
|
|
|
render() {
|
|
const {
|
|
conditions, loading, notSetting, loginVerify, secondaryVerify
|
|
} = this.state, { salaryBillToken } = 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({ loginVerify: true })}>{getLabel("30747", "设置")}</a>
|
|
</div>
|
|
}
|
|
</React.Fragment>);
|
|
}
|
|
};
|
|
return (
|
|
<WeaDialog
|
|
{...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={form} formFields={conditions}/>
|
|
</div>
|
|
{/*登录密码验证弹框*/}
|
|
<LoginVerifyPC salaryBillToken={salaryBillToken} visible={loginVerify}
|
|
onCancel={() => this.setState({ loginVerify: false })}
|
|
onSetPwdSet={() => this.setState({ secondaryVerify: true })}/>
|
|
{/*二次密码设置*/}
|
|
<SecondarypwdVerifyPC salaryBillToken={salaryBillToken} visible={secondaryVerify}
|
|
onCancel={() => this.setState({ secondaryVerify: false })}
|
|
onSuccess={this.initForm}/>
|
|
</WeaDialog>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default CheckSecondaryVerifyDialog;
|
|
|