/* * 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 ( { notSetting && {getLabel("111", "您还未设置二次验证密码,点击")} this.setState({ loginVerify: true })}>{getLabel("30747", "设置")} } ); } }; return ( {getLabel(111, "确认")} ]}> {/*登录密码验证弹框*/} this.setState({ loginVerify: false })} onSetPwdSet={() => this.setState({ secondaryVerify: true })}/> {/*二次密码设置*/} this.setState({ secondaryVerify: false })} onSuccess={this.initForm}/> ); } } export default CheckSecondaryVerifyDialog;