diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js index f197ba27..75e3eb73 100644 --- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js +++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js @@ -45,11 +45,13 @@ export const doSecondAuth = (params, headers) => { export const getPasswordForm = params => { return WeaTools.callApi("/api/hrm/secondarypwd/getPasswordForm", "GET", params); }; -export const checkPassword = params => { - return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params); +export const checkPassword = (params, headers) => { + return formHeaderPost("/api/hrm/secondarypwd/checkPassword", "POST", params, headers); + // return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params); }; -export const saveSecondaryPwd = params => { - return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params); +export const saveSecondaryPwd = (params, headers) => { + return formHeaderPost("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params, headers); + // return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params); }; export const salaryBillGetToken = params => { return postFetch("/api/bs/hrmsalary/salaryBill/getToken", params); diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/checkSecondaryVerifyDialog.js b/pc4mobx/hrmSalary/pages/mobilePayroll/checkSecondaryVerifyDialog.js index 30e7b54b..980fb316 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/checkSecondaryVerifyDialog.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/checkSecondaryVerifyDialog.js @@ -1,5 +1,5 @@ /* - * 工资单查看启用二次验证弹框 + * pc端工资单查看启用二次验证弹框 * @Author: 黎永顺 * @Date: 2025/4/15 * @Wechat: @@ -12,6 +12,8 @@ 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(); @@ -20,7 +22,7 @@ class CheckSecondaryVerifyDialog extends Component { constructor(props) { super(props); this.state = { - loading: false, conditions: [], notSetting: false + loading: false, conditions: [], notSetting: false, loginVerify: false, secondaryVerify: false }; } @@ -59,16 +61,18 @@ class CheckSecondaryVerifyDialog extends Component { }; render() { - const { conditions, loading, notSetting } = this.state; + const { + conditions, loading, notSetting, loginVerify, secondaryVerify + } = this.state, { salaryBillToken } = this.props; const itemRender = { authCode: (field, textAreaProps, form, formParams) => { return ( { notSetting && - {getLabel("111", "您还未设置二次验证密码,请先在系统中设置验证密码")} - {/* this.setState({ pwdSetVisible: true })}>{getLabel("30747", "设置")}*/} + {getLabel("111", "您还未设置二次验证密码,点击")} + this.setState({ loginVerify: true })}>{getLabel("30747", "设置")} } ); @@ -84,6 +88,14 @@ class CheckSecondaryVerifyDialog extends Component { + {/*登录密码验证弹框*/} + this.setState({ loginVerify: false })} + onSetPwdSet={() => this.setState({ secondaryVerify: true })}/> + {/*二次密码设置*/} + this.setState({ secondaryVerify: false })} + onSuccess={this.initForm}/> ); } diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js b/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js new file mode 100644 index 00000000..3462cb08 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js @@ -0,0 +1,87 @@ +export const secondaryVerifyConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["authCode"], + fieldcol: 14, + label: "二次验证密码", + labelcol: 10, + value: "", + otherParams: { + type: "password" + }, + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; +export const loginCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["password"], + fieldcol: 14, + label: "登录密码", + labelcol: 10, + value: "", + otherParams: { + type: "password" + }, + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; +export const secondarypwdCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["secondaryPwd1"], + fieldcol: 14, + label: "密码", + labelcol: 10, + value: "", + otherParams: { + type: "password", + passwordStrength: true + }, + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["secondaryPwd2"], + fieldcol: 14, + label: "确认密码", + labelcol: 10, + value: "", + otherParams: { + type: "password" + }, + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["validatecode"], + fieldcol: 14, + label: "验证码", + labelcol: 10, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 927ae3ee..9e9da440 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -2,18 +2,20 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; import { getQueryString } from "../../util/url"; -import { WeaDialog, WeaError, WeaInput, WeaLocaleProvider } from "ecCom"; -import { Button, message, Modal } from "antd"; +import { WeaLocaleProvider } from "ecCom"; +import { message, Modal } from "antd"; import Authority from "../mySalary/authority"; import "../payroll/templatePreview/index.less"; import * as API from "../../apis/mySalaryBenefits"; import { salaryBillGetToken } from "../../apis/mySalaryBenefits"; import { confirmSalaryBill, feedBackSalaryBill, payrollCheckType } from "../../apis/payroll"; import CaptchaModal from "../../components/captchaModal"; -import PassSetDialog from "./passSetDialog"; import { ConfirmBtns } from "../mySalary/mySalaryView"; import Content from "../../components/pcTemplate/content"; import MobileTemplate from "../../components/mobileTemplate"; +import SecondaryVerify from "./secondaryVerify"; +import LoginVerify from "./loginVerify"; +import SecondarypwdVerify from "./secondarypwdVerify"; import CheckSecondaryVerifyDialog from "./checkSecondaryVerifyDialog"; import "../mySalary/index.less"; @@ -25,15 +27,8 @@ export default class MobilePayroll extends React.Component { constructor(props) { super(props); this.state = { - pwdSetVisible: false, - visible: false, - captchaVisible: false, - authCode: "", - notSetting: false, - mySalaryBillData: { - employeeInformation: {}, - salaryTemplate: [] - }, + visible: false, captchaVisible: false, loginVisible: false, pwdSetVisible: false, + mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] }, salaryBillToken: {}, // 统一二次验证 checkSecVerify: false @@ -83,12 +78,7 @@ export default class MobilePayroll extends React.Component { API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) .then(({ status, isNeedSecondAuth }) => { if (status && isNeedSecondAuth) { - this.setState({ visible: true }, () => { - API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) - .then(({ status, notSetting }) => { - this.setState({ notSetting }); - }); - }); + this.setState({ visible: true }); } else { this.getMySalaryBill(getQueryString("id")); setInitEmVerify(); @@ -105,12 +95,7 @@ export default class MobilePayroll extends React.Component { API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) .then(({ status, isNeedSecondAuth }) => { if (status && isNeedSecondAuth) { - this.setState({ visible: true }, () => { - API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) - .then(({ status, notSetting }) => { - this.setState({ notSetting }); - }); - }); + this.setState({ visible: true }); } else { this.getMySalaryBill(getQueryString("id")); setInitEmVerify(); @@ -119,33 +104,12 @@ export default class MobilePayroll extends React.Component { }); } }; - doSecondAuth = () => { - const { salaryBillToken } = this.state; - const { mySalaryStore: { setInitEmVerify } } = this.props; - if (!this.state.authCode) { - this.refs.weaError.showError(); - return; - } - API.doSecondAuth({ - authCode: this.state.authCode, mouldCode: "HRM", itemCode: "SALARY" - }, salaryBillToken).then(({ status, checkStatus, checkMsg }) => { - if (status && checkStatus === "1") { - message.success(checkMsg); - setInitEmVerify(); - this.setState({ visible: false }); - this.getMySalaryBill(getQueryString("id")); - } else { - message.error(checkMsg); - } - }); - }; getMySalaryBill = (salaryInfoId) => { const { salaryBillToken } = this.state; const { mySalaryStore: { getMySalaryBill } } = this.props; const params = this.getUrlkey(); const payload = { - salaryInfoId, header: salaryBillToken, - ..._.pick(params, ["recipient"]) + salaryInfoId, header: salaryBillToken, ..._.pick(params, ["recipient"]) }; getMySalaryBill(payload).then(result => { this.setState({ @@ -155,10 +119,8 @@ export default class MobilePayroll extends React.Component { }; getUrlkey = () => { let url = window.location.href; - let params = {}, - arr = url.split("?"); - if (arr.length <= 1) - return params; + let params = {}, arr = url.split("?"); + if (arr.length <= 1) return params; arr = arr[1].split("&"); for (var i = 0, l = arr.length; i < l; i++) { var a = arr[i].split("="); @@ -202,84 +164,68 @@ export default class MobilePayroll extends React.Component { }; render() { - const { mySalaryStore: { clearLoading, pwdForm, setInitEmVerify } } = this.props; - const { salaryBillToken, visible, captchaVisible, notSetting, pwdSetVisible, checkSecVerify } = this.state; + const { mySalaryStore: { setInitEmVerify } } = this.props, { + captchaVisible, visible, loginVisible, pwdSetVisible, checkSecVerify + } = this.state; const type = getQueryString("type"); - if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return - this.setState({ visible: false }, () => clearLoading())} - title="请输入二次验证密码" visible={visible} initLoadCss - className="verifyWrapper" - hasScroll buttons={[ - 确定 - ]} - > - - this.setState({ authCode })}/> - - { - notSetting && - - {getLabel("514970", "您还未设置二次验证密码,点击")} - this.setState({ pwdSetVisible: true })}>{getLabel("30747", "设置")} - - } - - this.setState({ pwdSetVisible: false })}/> + if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return + {visible && this.setState({ visible: false, loginVisible: true })} + onSuccess={() => { + setInitEmVerify(); + this.getMySalaryBill(getQueryString("id")); + }}/>} + {loginVisible && this.setState({ loginVisible: false, pwdSetVisible: true })}/>} + {pwdSetVisible && this.setState({ pwdSetVisible: false }, () => this.initMobile())}/>} {/*统一外部调用token*/} - this.setState({ checkSecVerify: false }, () => callback && callback())} - onSuccess={() => { - this.getMySalaryBill(getQueryString("id")); - setInitEmVerify(); - }}/> + this.setState({ checkSecVerify: false }, () => callback && callback())} + onSuccess={() => { + this.getMySalaryBill(getQueryString("id")); + setInitEmVerify(); + }}/> {/*发送验证码*/} this.setState({ captchaVisible: false })} onConfirm={() => this.props.mySalaryStore.setInitEmVerify()} /> - ; + ; const { - salaryTemplate, salaryGroups, employeeInformation, - sendTime, confirmStatus, showAck, showFeedback + salaryTemplate, salaryGroups, employeeInformation, sendTime, confirmStatus, showAck, showFeedback } = toJS(this.props.mySalaryStore.mySalaryBill); const salaryProps = { - theme: salaryTemplate.theme, tip: salaryTemplate.textContent, sendTime, - background: salaryTemplate.background, tipPosi: salaryTemplate.textContentPosition || "", + theme: salaryTemplate.theme, + tip: salaryTemplate.textContent, + sendTime, + background: salaryTemplate.background, + tipPosi: salaryTemplate.textContentPosition || "", itemTypeList: [employeeInformation, ...salaryGroups] }; - return ( - - { - type === "phone" ? - - - - - - : - - - - - - - - } - - ); + return ( + {type === "phone" ? + + + + : + + + + + + } + ); } } diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.less b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less index 923d3d82..6e78c87e 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.less +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less @@ -39,3 +39,142 @@ } } } + +.am-modal-mask { + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; + height: 100%; + z-index: 999; + background-color: rgba(0, 0, 0, .4); +} + +.am-modal-transparent { + width: 80%; +} + +.am-modal-transparent .am-modal-content { + border-radius: 7px; + padding-top: 15px; +} + +.am-modal-content { + position: relative; + background-color: #fff; + border: 0; + background-clip: padding-box; + text-align: center; + height: 100%; + overflow: hidden; +} + +.am-modal-header { + padding: 15px; +} + +.am-modal-title { + margin: 0; + letter-spacing: -.1px; + color: #333; + font-size: 14px; + line-height: 20px; + text-align: center; + height: auto; + max-height: 150px; + overflow-y: auto; +} + +.am-modal-body { + font-size: 14px; + color: #868686; + height: 100%; + line-height: 1.5; + overflow: auto; + padding: 0 15px 30px; + + .wea-search-group, .wea-content, .wea-form-cell { + padding: 0; + } + + .secondarypwd-form { + .wea-form-cell-wrapper { + & > div:last-child { + .ant-col-16 { + width: 37.5% !important; + } + } + } + } +} + +.am-modal-wrap { + position: fixed; + overflow: auto; + top: 0; + right: 0; + bottom: 0; + left: 0; + height: 100%; + z-index: 999; + -webkit-overflow-scrolling: touch; + outline: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-transform: translateZ(1px); + transform: translateZ(1px); +} + +.am-modal-button-group-h { + position: relative; + border-top: 1px solid #ddd; + display: flex; +} + +.am-modal-button-group-h .am-modal-button { + -webkit-touch-callout: none; + flex: 1 1; + box-sizing: border-box; + text-align: center; + text-decoration: none; + outline: none; + color: #55b1f9; + height: 50px; + line-height: 50px; + display: block; + width: auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 14px; +} + +.am-modal-button-group-h .am-modal-button:first-child { + color: #333; +} + +.am-modal-button-group-h .am-modal-button:last-child { + position: relative; + border-left: 1px solid #ddd; +} + +.secondarypwd-form { + .wea-form-cell-wrapper { + & > div:last-child { + .ant-col-16 { + width: 37.5% !important; + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js new file mode 100644 index 00000000..90d231ca --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js @@ -0,0 +1,59 @@ +/* + * 登录密码验证 + * + * @Author: 黎永顺 + * @Date: 2025/4/17 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaForm } from "comsMobx"; +import FormInfo from "../../components/FormInfo"; +import { loginCondition } from "./conditions"; +import MobileModal from "./mobileModal"; +import * as API from "../../apis/mySalaryBenefits"; +import { RSAEcrypt } from "../../util/RSAUtil"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class LoginVerify extends Component { + + componentDidMount() { + form.initFormFields(loginCondition); + } + + componentWillUnmount() { + form.resetForm(); + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + RSAEcrypt("1", { ...form.getFormParams() }, this.props.salaryBillToken) + .then(RSAParam => { + API.checkPassword({ ...RSAParam }).then(({ result }) => { + if (result) { + this.props.onSetPwdSet(); + } else { + form.showError("password", getLabel(504343, "登录密码错误")); + } + }); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const itemRender = {}; + return ( + + ); + } +} + +export default LoginVerify; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerifyPC.js b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerifyPC.js new file mode 100644 index 00000000..b9d0db85 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerifyPC.js @@ -0,0 +1,72 @@ +/* + * 二次验证 + * 登录密码验证 + * @Author: 黎永顺 + * @Date: 2025/4/23 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { WeaForm } from "comsMobx"; +import { Button } from "antd"; +import FormInfo from "../../components/FormInfo"; +import { loginCondition } from "./pwdCondtion"; +import { RSAEcrypt } from "../../util/RSAUtil"; +import * as API from "../../apis/mySalaryBenefits"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class LoginVerifyPC extends Component { + constructor(props) { + super(props); + this.state = { loading: false }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + form.initFormFields(loginCondition); + } else { + form.resetForm(); + } + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + RSAEcrypt("1", { ...form.getFormParams() }, this.props.salaryBillToken) + .then(RSAParam => { + API.checkPassword({ ...RSAParam }).then(({ result }) => { + if (result) { + this.props.onCancel(); + this.props.onSetPwdSet(); + } else { + form.showError("password", getLabel(504343, "登录密码错误")); + } + }); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const { loading } = this.state; + return ( + (pre += cur.items.length), 0) * 47 + 33 }} + initLoadCss title={getLabel(111, "请先输入登录密码")} buttons={[ + {getLabel(111, "下一步")} + ]}> + + + ); + } +} + +export default LoginVerifyPC; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js b/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js new file mode 100644 index 00000000..b6f388db --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js @@ -0,0 +1,65 @@ +/* + * 自定义移动端弹框组件 + * + * @Author: 黎永顺 + * @Date: 2025/4/16 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { removeElementById } from "../../util"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class MobileModal extends Component { + componentDidMount() { + this.setMetaViewport(); + } + + setMetaViewport = () => { + // 检查是否已存在 viewport meta 标签 + let viewportMeta = document.querySelector("meta[name=\"viewport\"]"); + if (!viewportMeta) { + // 如果不存在,创建一个新的 meta 标签 + viewportMeta = document.createElement("meta"); + viewportMeta.setAttribute("name", "viewport"); + document.head.appendChild(viewportMeta); + } + // 设置或更新 viewport 的 content 属性 + const content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"; + viewportMeta.setAttribute("content", content); + }; + + render() { + return ( + + + + + + + + {this.props.title} + + {this.props.children} + + + removeElementById("am-modal-container")}>{getLabel(111, "取消")} + {getLabel(111, "确定")} + + + + + + + + ); + } +} + +export default MobileModal; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js new file mode 100644 index 00000000..b5310466 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js @@ -0,0 +1,82 @@ +/* + * 二次验证密码 + * + * @Author: 黎永顺 + * @Date: 2025/4/16 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaForm, WeaSwitch } from "comsMobx"; +import { message } from "antd"; +import FormInfo from "../../components/FormInfo"; +import { secondaryVerifyConditions } from "./conditions"; +import * as API from "../../apis/mySalaryBenefits"; +import MobileModal from "./mobileModal"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class SecondaryVerify extends Component { + constructor(props) { + super(props); + this.state = { notSetting: false }; + } + + componentDidMount() { + API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.props.salaryBillToken) + .then(({ notSetting }) => { + this.setState({ notSetting }); + }); + form.initFormFields(secondaryVerifyConditions); + } + + componentWillUnmount() { + this.setState({ notSetting: false }, () => form.resetForm()); + } + + doSecondAuth = () => { + form.validateForm().then(f => { + if (f.isValid) { + const { salaryBillToken } = this.props; + API.doSecondAuth({ mouldCode: "HRM", itemCode: "SALARY", ...form.getFormParams() }, salaryBillToken) + .then(({ status, checkStatus, checkMsg }) => { + if (status && checkStatus === "1") { + message.success(checkMsg); + this.props.onSuccess(); + } else { + form.showError("authCode", checkMsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const { notSetting } = this.state; + const itemRender = { + authCode: (field, textAreaProps, form, formParams) => { + return ( + + { + notSetting && + + {getLabel(111, "您还未设置二次验证密码,点击")} + {getLabel(111, "设置")} + + } + ); + } + }; + return ( + + ); + } +} + +export default SecondaryVerify; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js new file mode 100644 index 00000000..a8f84027 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js @@ -0,0 +1,91 @@ +/* + * 二次验证密码设置 + * + * @Author: 黎永顺 + * @Date: 2025/4/17 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { message } from "antd"; +import { WeaForm, WeaSwitch } from "comsMobx"; +import FormInfo from "../../components/FormInfo"; +import { secondarypwdCondition } from "./conditions"; +import * as API from "../../apis/mySalaryBenefits"; +import MobileModal from "./mobileModal"; +import { RSAEcrypt } from "../../util/RSAUtil"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class SecondarypwdVerify extends Component { + constructor(props) { + super(props); + this.state = { + src: (window.ecologyContentPath || "") + "/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4", + num: 0 + }; + } + + componentDidMount() { + form.initFormFields(secondarypwdCondition); + } + + componentWillUnmount() { + form.resetForm(); + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams(); + if (secondaryPwd1 !== secondaryPwd2) { + form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!")); + return; + } + RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => { + API.saveSecondaryPwd({ ...RSAParam, validatecode }, this.props.salaryBillToken) + .then(({ sign, message: msg }) => { + if (sign === "1") { + message.success(msg); + this.props.onSuccess(); + } else { + form.showError("validatecode", msg); + this.setState({ num: this.state.num + 1 }, () => { + this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); + }); + } + }); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const itemRender = { + validatecode: (field, textAreaProps, form, formParams) => { + return ( + + { + this.setState({ num: this.state.num + 1 }, () => { + this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); + }); + }} alt=""/> + ); + } + }; + return ( + + ); + } +} + +export default SecondarypwdVerify; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerifyPC.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerifyPC.js new file mode 100644 index 00000000..fd139ae7 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerifyPC.js @@ -0,0 +1,96 @@ +/* + * 二次验证密码设置 + * + * @Author: 黎永顺 + * @Date: 2025/4/17 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { Button, message } from "antd"; +import { WeaForm, WeaSwitch } from "comsMobx"; +import FormInfo from "../../components/FormInfo"; +import { secondarypwdCondition } from "./conditions"; +import * as API from "../../apis/mySalaryBenefits"; +import { RSAEcrypt } from "../../util/RSAUtil"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class SecondarypwdVerifyPC extends Component { + constructor(props) { + super(props); + this.state = { + src: (window.ecologyContentPath || "") + "/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4", + num: 0 + }; + } + + componentDidMount() { + form.initFormFields(secondarypwdCondition); + } + + componentWillUnmount() { + form.resetForm(); + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams(); + if (secondaryPwd1 !== secondaryPwd2) { + form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!")); + return; + } + RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => { + API.saveSecondaryPwd({ ...RSAParam, validatecode }, this.props.salaryBillToken) + .then(({ sign, message: msg }) => { + if (sign === "1") { + message.success(msg); + this.props.onCancel(); + this.props.onSuccess(); + } else { + form.showError("validatecode", msg); + this.setState({ num: this.state.num + 1 }, () => { + this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); + }); + } + }); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const itemRender = { + validatecode: (field, textAreaProps, form, formParams) => { + return ( + + { + this.setState({ num: this.state.num + 1 }, () => { + this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); + }); + }} alt=""/> + ); + } + }; + return ( (pre += cur.items.length), 0) * 47 + 33 + }} initLoadCss title={getLabel(111, "二次验证密码设置")} buttons={[ + {getLabel(111, "保存")} + ]}> + + ); + } +} + +export default SecondarypwdVerifyPC; diff --git a/pc4mobx/hrmSalary/pages/mySalary/authority.js b/pc4mobx/hrmSalary/pages/mySalary/authority.js index 00a74712..ec098fc2 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/authority.js +++ b/pc4mobx/hrmSalary/pages/mySalary/authority.js @@ -9,7 +9,6 @@ export default class Authority extends React.Component { render() { const { store } = this.props; const { loading, hasRight } = store; - const style = { position: "absolute", top: "50%", diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js index 552a7122..df034794 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js @@ -32,10 +32,10 @@ class PayrollPartTable extends Component { } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.visible !== this.props.visible) { - nextProps.visible && this.sendRangeList(nextProps); - this.setState({ selectedRowKeys: [] }); - } + if (nextProps.visible !== this.props.visible && nextProps.visible) this.sendRangeList(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({ + selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 } + }); } sendRangeList = (props) => { @@ -52,9 +52,9 @@ class PayrollPartTable extends Component { sendRangeList(payload).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); if (status) { - const { pageNum: current, pageSize, total, columns, list: dataSource } = data; + const { pageNum: current, total, columns, list: dataSource } = data; this.setState({ - pageInfo: { ...pageInfo, current, pageSize, total }, + pageInfo: { ...pageInfo, current, total }, dataSource: _.map(dataSource, it => ({ ...it, includeObj: _.map(it.includeObj, child => child.targetName || child.targetTypeName).join(","), @@ -125,8 +125,7 @@ class PayrollPartTable extends Component { onChange: current => { this.setState({ pageInfo: { ...pageInfo, current } - }, () => { - }); + }, () => this.sendRangeList({ grantType, salarySendId })); } }; const rowSelection = { diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js index 0b63ffda..4578ddac 100644 --- a/pc4mobx/hrmSalary/util/index.js +++ b/pc4mobx/hrmSalary/util/index.js @@ -143,3 +143,7 @@ export const getIframeParentHeight = (selector, total, extraHeight) => { } return height; }; +export const removeElementById = (id) => { + const element = document.getElementById(id); + if (element) element.remove(); +};