From 9226ef19b3a1d842c3c48fbdd664e0772ce99de7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Mon, 10 Jul 2023 09:21:57 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E7=A7=BB=E5=8A=A8?=
=?UTF-8?q?=E7=AB=AF=E4=BA=8C=E6=AC=A1=E9=AA=8C=E8=AF=81=E5=AF=86=E7=A0=81?=
=?UTF-8?q?=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/mySalaryBenefits.js | 6 +
.../hrmSalary/pages/mobilePayroll/index.js | 29 ++++-
.../hrmSalary/pages/mobilePayroll/index.less | 24 ++++
.../pages/mobilePayroll/passSetDialog.js | 113 ++++++++++++++++++
.../pages/mobilePayroll/pwdCondtion.js | 45 +++++++
pc4mobx/hrmSalary/stores/mySalary.js | 1 +
pc4mobx/hrmSalary/util/RSAUtil.js | 32 +++++
7 files changed, 244 insertions(+), 6 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
create mode 100644 pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
create mode 100644 pc4mobx/hrmSalary/util/RSAUtil.js
diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
index a2f5be7a..274544aa 100644
--- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
+++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
@@ -31,6 +31,12 @@ export const mySalaryBill = params => {
export const isNeedSecondPwdVerify = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params);
};
+export const getSecondAuthForm = params => {
+ return WeaTools.callApi("/api/encrypt/secondauthsetting/getSecondAuthForm", "POST", params);
+};
export const doSecondAuth = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params);
};
+export const saveSecondaryPwd = params => {
+ return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
+};
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js
index db4f3c2f..5a41f8ac 100644
--- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js
@@ -1,7 +1,7 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { getQueryString } from "../../util/url";
-import { WeaDialog, WeaError, WeaInput } from "ecCom";
+import { WeaDialog, WeaError, WeaInput, WeaLocaleProvider } from "ecCom";
import { Button, message } from "antd";
import Authority from "../mySalary/authority";
import ComputerTemplate from "../payroll/templatePreview/computerTemplate";
@@ -9,8 +9,11 @@ import PhoneTemplate from "../payroll/templatePreview/phoneTemplate";
import "../payroll/templatePreview/index.less";
import * as API from "../../apis/mySalaryBenefits";
import { payrollCheckType } from "../../apis/payroll";
-import "./index.less";
import CaptchaModal from "../../components/captchaModal";
+import PassSetDialog from "./passSetDialog";
+import "./index.less";
+
+const getLabel = WeaLocaleProvider.getLabel;
@inject("mySalaryStore")
@observer
@@ -18,9 +21,11 @@ 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: []
@@ -49,7 +54,11 @@ export default class MobilePayroll extends React.Component {
// if (window.em) {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
- this.setState({ visible: true });
+ this.setState({ visible: true }, () => {
+ API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, notSetting }) => {
+ this.setState({ notSetting });
+ });
+ });
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
@@ -106,8 +115,8 @@ export default class MobilePayroll extends React.Component {
};
render() {
- const { mySalaryStore: { clearLoading } } = this.props;
- const { mySalaryBillData, visible, captchaVisible } = this.state;
+ const { mySalaryStore: { clearLoading, pwdForm } } = this.props;
+ const { mySalaryBillData, visible, captchaVisible, notSetting, pwdSetVisible } = this.state;
const type = getQueryString("type");
const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {};
const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : [];
@@ -126,9 +135,17 @@ export default class MobilePayroll extends React.Component {
]}
>
- this.setState({ authCode })}/>
+ this.setState({ authCode })}/>
+ {
+ notSetting &&
+
+ }
+ this.setState({ pwdSetVisible: false })}/>
{
type === "phone" ?
{
+ const { isFormInit } = form, formParams = form.getFormParams();
+ let group = [];
+ isFormInit && condition && condition.map(c => {
+ let items = [];
+ c.items.map(fields => {
+ items.push({
+ com: (
+
+ {
+ fields.domkey[0] === "validatecode" ?
+
+
+
{
+ 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=""
+ />
+
+ :
+ }
+ ),
+ colSpan: 1
+ });
+ });
+ group.push(
+ );
+ });
+ return group;
+ };
+ saveSecondaryPassword = () => {
+ const { form } = this.props;
+ const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams();
+ if (!validatecode || !secondaryPwd1 || !secondaryPwd2) {
+ message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
+ return;
+ }
+ if (secondaryPwd1 !== secondaryPwd2) {
+ message.error(getLabel("504376", "密码确认不正确!"));
+ return;
+ }
+ const params = { secondaryPwd1, secondaryPwd2 };
+ RSAEcrypt("1", params).then(RSAParam => {
+ saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
+ if (sign === "1") {
+ message.success(msg);
+ this.props.onCancel();
+ form.resetForm();
+ } else {
+ message.warning(msg);
+ }
+ });
+ });
+ };
+
+ render() {
+ return (
+ {getLabel(537558, "保存")}
+ ]}
+ >
+ {this.getSearchs(this.props.form, condition)}
+
+ );
+ }
+}
+
+export default PassSetDialog;
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js b/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
new file mode 100644
index 00000000..c2b9df7a
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
@@ -0,0 +1,45 @@
+import { WeaLocaleProvider } from "ecCom";
+
+const { getLabel } = WeaLocaleProvider;
+export const condition = [
+ {
+ items: [
+ {
+ colSpan: 1,
+ checkbox: false,
+ checkboxValue: false,
+ conditionType: "INPUT",
+ domkey: ["secondaryPwd1"],
+ fieldcol: 18,
+ label: getLabel(409, "密码"),
+ labelcol: 6,
+ detailtype: 3,
+ rules: "required|string",
+ viewAttr: 3
+ },
+ {
+ colSpan: 1,
+ conditionType: "INPUT",
+ domkey: ["secondaryPwd2"],
+ fieldcol: 18,
+ label: getLabel(511112, "确认密码"),
+ labelcol: 6,
+ rules: "required|string",
+ viewAttr: 3
+ },
+ {
+ colSpan: 1,
+ conditionType: "INPUT",
+ domkey: ["validatecode"],
+ fieldcol: 18,
+ label: getLabel(511113, "验证码"),
+ labelcol: 6,
+ value: "",
+ rules: "required|string",
+ viewAttr: 3
+ }
+ ],
+ title: "",
+ defaultshow: true
+ }
+];
diff --git a/pc4mobx/hrmSalary/stores/mySalary.js b/pc4mobx/hrmSalary/stores/mySalary.js
index 61988d5b..916c3be9 100644
--- a/pc4mobx/hrmSalary/stores/mySalary.js
+++ b/pc4mobx/hrmSalary/stores/mySalary.js
@@ -14,6 +14,7 @@ const { TableStore } = WeaTableNew;
export class MySalaryStore {
@observable tableStore = new TableStore(); // new table
@observable form = new WeaForm(); // nrew 一个form
+ @observable pwdForm = new WeaForm(); // new 一个密码验证form
@observable condition = []; // 存储后台得到的form数据
@observable hasRight = false; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
@observable showSearchAd = false; // 高级搜索面板显示
diff --git a/pc4mobx/hrmSalary/util/RSAUtil.js b/pc4mobx/hrmSalary/util/RSAUtil.js
new file mode 100644
index 00000000..97b76234
--- /dev/null
+++ b/pc4mobx/hrmSalary/util/RSAUtil.js
@@ -0,0 +1,32 @@
+import loadjs from "loadjs";
+
+const RSAEcrypt = (openRSA, param) => {
+ return new Promise((resolve, reject) => {
+ //异步加载ras文件
+ loadjs.isDefined("rsa") ? loadjs.ready("rsa", () => {
+ if (openRSA && openRSA == "1") {
+ Object.keys(param).forEach(key => {
+ param[key] = __RSAEcrypt__.rsa_data_encrypt(param[key]);
+ });
+ }
+ resolve(param);
+ }) : loadjs(["/js/rsa/jsencrypt.js", "/js/rsa/rsa.js"], "rsa", {
+ async: false,
+ success: () => {
+ if (openRSA && openRSA == "1") {
+ const callback = () => {
+ Object.keys(param).forEach(key => {
+ param[key] = __RSAEcrypt__.rsa_data_encrypt(param[key]);
+ });
+ resolve(param);
+ };
+ __RSAEcrypt__.initRsaCode(callback);
+ } else {
+ resolve(param);
+ }
+ }
+ });
+ });
+};
+
+export { RSAEcrypt };
From 405e2a9bc60d6c63853d75182a765274643a91c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 11 Jul 2023 10:44:49 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?=
=?UTF-8?q?=E5=8D=95=E6=A8=A1=E6=9D=BF=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=BA=8C?=
=?UTF-8?q?=E6=AC=A1=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
index 1043d662..ff0acaba 100644
--- a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
@@ -90,6 +90,9 @@ class PassSetDialog extends Component {
form.resetForm();
} else {
message.warning(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}` });
+ });
}
});
});
From d8fdc8096b6dc9c2a75e385ff6d45030bc2e02c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 11 Jul 2023 11:43:05 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?=
=?UTF-8?q?=E5=8D=95=E6=A8=A1=E6=9D=BF=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=BA=8C?=
=?UTF-8?q?=E6=AC=A1=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/mySalaryBenefits.js | 3 +++
.../pages/mobilePayroll/passSetDialog.js | 3 ++-
.../pages/mobilePayroll/pwdCondtion.js | 22 +++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
index 274544aa..c87cd3ab 100644
--- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
+++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js
@@ -37,6 +37,9 @@ export const getSecondAuthForm = params => {
export const doSecondAuth = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params);
};
+export const checkPassword = params => {
+ return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params);
+};
export const saveSecondaryPwd = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
};
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
index ff0acaba..82c6ca98 100644
--- a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
@@ -20,7 +20,8 @@ class PassSetDialog extends Component {
super(props);
this.state = {
src: (window.ecologyContentPath || "") + "/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4",
- num: 0
+ num: 0,
+ isPassLoginPassword: false
};
}
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js b/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
index c2b9df7a..a54f2909 100644
--- a/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/pwdCondtion.js
@@ -1,6 +1,28 @@
import { WeaLocaleProvider } from "ecCom";
const { getLabel } = WeaLocaleProvider;
+export const loginCondition = [
+ {
+ items: [
+ {
+ colSpan: 1,
+ checkbox: false,
+ checkboxValue: false,
+ conditionType: "INPUT",
+ domkey: ["password"],
+ fieldcol: 18,
+ label: getLabel(388431, "登录密码"),
+ labelcol: 6,
+ detailtype: 3,
+ rules: "required|string",
+ type: "password",
+ viewAttr: 3
+ }
+ ],
+ title: "",
+ defaultshow: true
+ }
+];
export const condition = [
{
items: [
From a13f31eefa1983c19719e25880aabf828cb25318 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 11 Jul 2023 12:08:01 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?=
=?UTF-8?q?=E5=8D=95=E6=A8=A1=E6=9D=BF=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=BA=8C?=
=?UTF-8?q?=E6=AC=A1=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/mobilePayroll/passSetDialog.js | 74 ++++++++++++-------
1 file changed, 49 insertions(+), 25 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
index 82c6ca98..f857ff41 100644
--- a/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
+++ b/pc4mobx/hrmSalary/pages/mobilePayroll/passSetDialog.js
@@ -7,10 +7,10 @@
import React, { Component } from "react";
import { WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
import { WeaSwitch } from "comsMobx";
-import { condition } from "./pwdCondtion";
+import { condition, loginCondition } from "./pwdCondtion";
import { Button, message } from "antd";
import { RSAEcrypt } from "../../util/RSAUtil";
-import { saveSecondaryPwd } from "../../apis/mySalaryBenefits";
+import { checkPassword, saveSecondaryPwd } from "../../apis/mySalaryBenefits";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@@ -26,6 +26,7 @@ class PassSetDialog extends Component {
}
componentDidMount() {
+ this.props.form.initFormFields(loginCondition);
this.props.form.initFormFields(condition);
}
@@ -72,43 +73,66 @@ class PassSetDialog extends Component {
return group;
};
saveSecondaryPassword = () => {
+ const { isPassLoginPassword } = this.state;
const { form } = this.props;
- const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams();
- if (!validatecode || !secondaryPwd1 || !secondaryPwd2) {
- message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
- return;
+ const { secondaryPwd1, secondaryPwd2, validatecode, password } = form.getFormParams();
+ if (isPassLoginPassword) {
+ if (!validatecode || !secondaryPwd1 || !secondaryPwd2) {
+ message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
+ return;
+ }
+ if (secondaryPwd1 !== secondaryPwd2) {
+ message.error(getLabel("504376", "密码确认不正确!"));
+ return;
+ }
+ } else {
+ if (!password) {
+ message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
+ return;
+ }
}
- if (secondaryPwd1 !== secondaryPwd2) {
- message.error(getLabel("504376", "密码确认不正确!"));
- return;
- }
- const params = { secondaryPwd1, secondaryPwd2 };
+ const params = isPassLoginPassword ? { secondaryPwd1, secondaryPwd2 } : { password };
RSAEcrypt("1", params).then(RSAParam => {
- saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
- if (sign === "1") {
- message.success(msg);
- this.props.onCancel();
- form.resetForm();
- } else {
- message.warning(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}` });
- });
- }
- });
+ isPassLoginPassword ?
+ saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
+ if (sign === "1") {
+ message.success(msg);
+ this.props.onCancel();
+ form.resetForm();
+ } else {
+ message.warning(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}` });
+ });
+ }
+ }) :
+ checkPassword({ ...RSAParam }).then(({ result }) => {
+ if (result) {
+ this.setState({ isPassLoginPassword: true });
+ form.resetForm();
+ } else {
+ message.error(getLabel(504343, "登录密码错误"));
+ }
+ });
});
};
render() {
+ const { isPassLoginPassword } = this.state;
return (
{getLabel(537558, "保存")}
]}
>
- {this.getSearchs(this.props.form, condition)}
+ {
+ isPassLoginPassword ?
+ this.getSearchs(this.props.form, condition) :
+ this.getSearchs(this.props.form, loginCondition)
+ }
);
}