From 19e2958a561df8bc91b384f54dc6edff17964494 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, 13 Jun 2023 09:18:58 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/stores/taxAgent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index d197db2e..38fa966d 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -147,7 +147,7 @@ export class TaxAgentStore { this.setSalaryItemBtn((isOpenDevolution && (isChief || isAdminEnable))); //薪酬统计报表权限 this.setStatisticsReportBtn(!isOpenDevolution ? true : !!(isAdminEnable || isChief)); - this.setPayrollPermission(isAdminEnable && isOpenDevolution); + this.setPayrollPermission(isAdminEnable && isOpenDevolution || !isOpenDevolution); resolve({ status, data }); } else { reject(); From a80c4a37d551bce56a2c2d0d31568184fc6fadca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Jun 2023 11:12:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?= =?UTF-8?q?=E5=8D=95=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/payroll.js | 4 + .../components/captchaModal/index.js | 82 +++++++++++++++++++ .../components/captchaModal/index.less | 29 +++++++ pc4mobx/hrmSalary/pages/mySalary/index.js | 17 ++-- 4 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 pc4mobx/hrmSalary/components/captchaModal/index.js create mode 100644 pc4mobx/hrmSalary/components/captchaModal/index.less diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index eaf11a11..6440ff2a 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -367,3 +367,7 @@ export const getAvailableSalaryItemSet = (params) => { export const salaryBillSendSum = (params) => { return postFetch("/api/bs/hrmsalary/salaryBill/send/sum", params); }; +//工资单-验证方式 +export const payrollCheckType = params => { + return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/payrollCheckType", "GET", params); +}; diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js new file mode 100644 index 00000000..9098df54 --- /dev/null +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -0,0 +1,82 @@ +/* + * Author: 黎永顺 + * name: 验证码弹框 + * Description: + * Date: 2023/6/16 + */ +import React, { Component } from "react"; +import { WeaDialog, WeaError, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import { Button } from "antd"; +import "./index.less"; + +const { getLabel } = WeaLocaleProvider; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + captcha: "", + time: 60 + }; + this.timeRef = null; + } + + componentWillUnmount() { + clearInterval(this.timeRef); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ captcha: "" }); + } else { + clearInterval(this.timeRef); + this.setState({ time: 60 }); + } + } + + handleSendCaptcha = () => { + this.timeRef = setInterval(() => { + const { time } = this.state; + this.setState({ time: time - 1 }, () => { + if (this.state.time === -1) { + clearInterval(this.timeRef); + this.setState({ time: 60 }); + } + }); + }, 1000); + }; + + render() { + const { captcha, time } = this.state; + return ( + {getLabel(826, "确定")} + ]} + > + + + +
+ this.setState({ captcha })}/> + +
+
+
+
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.less b/pc4mobx/hrmSalary/components/captchaModal/index.less new file mode 100644 index 00000000..4f8d23b7 --- /dev/null +++ b/pc4mobx/hrmSalary/components/captchaModal/index.less @@ -0,0 +1,29 @@ +.captchaWrapper { + .wea-dialog-body { + padding: 30px 20px; + + .wea-form-item-wrapper { + .wea-error { + width: 100%; + + .captchaInputBox { + display: flex; + align-items: center; + + .wea-input-normal { + flex: 1; + } + + button { + padding: 8px 10px; + border-radius: 0; + min-width: 80px; + text-align: center; + height: 30px; + line-height: 15px; + } + } + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index 6902836e..da92ac0f 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -2,12 +2,14 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { DatePicker } from "antd"; import { WeaNewScroll, WeaTop } from "ecCom"; -import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import { renderNoright } from "../../util"; import CustomTab from "../../components/customTab"; import moment from "moment"; import PayrollModal from "./payrollModal"; import Authority from "./authority"; import CustomPaginationTable from "../../components/customPaginationTable"; +import CaptchaModal from "../../components/captchaModal"; +import { payrollCheckType } from "../../apis/payroll"; import "./index.less"; const { RangePicker } = DatePicker; @@ -22,15 +24,19 @@ export default class MySalary extends React.Component { selectedKey: "0", salaryBillVisible: false, salaryInfoId: "", - salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] + salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], + captchaVisible: false }; this.pageInfo = { current: 1, pageSize: 10 }; this.historyPageInfo = { current: 1, pageSize: 10 }; } - componentWillMount() { + async componentWillMount() { const { mySalaryStore: { init } } = this.props; - init(); + const data = await payrollCheckType(); + console.log(data); + this.setState({ captchaVisible: true }); + // init(); } // 查看工资单 @@ -113,7 +119,7 @@ export default class MySalary extends React.Component { recordListPageInfo, myBillPageInfo } = mySalaryStore; - const { salaryBillVisible, salaryInfoId, salaryRange } = this.state; + const { salaryBillVisible, salaryInfoId, salaryRange, captchaVisible } = this.state; if (!hasRight && !loading) return renderNoright(); const topTab = [ @@ -210,6 +216,7 @@ export default class MySalary extends React.Component { }} /> } + this.setState({ captchaVisible: false })}/> ); } From e9546e53290edda71d27e6908c960c999f8d6122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Jun 2023 15:32:05 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?= =?UTF-8?q?=E5=8D=95=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/payroll.js | 4 ++++ .../components/captchaModal/index.js | 21 +++++++++++-------- pc4mobx/hrmSalary/pages/mySalary/index.js | 17 +++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index 6440ff2a..ac0debc2 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -367,6 +367,10 @@ export const getAvailableSalaryItemSet = (params) => { export const salaryBillSendSum = (params) => { return postFetch("/api/bs/hrmsalary/salaryBill/send/sum", params); }; +//工资单发放-发送短信验证码 +export const sendMobileCode = (params) => { + return postFetch("/api/bs/hrmsalary/salaryBill/sendMobileCode", params); +}; //工资单-验证方式 export const payrollCheckType = params => { return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/payrollCheckType", "GET", params); diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js index 9098df54..10675b57 100644 --- a/pc4mobx/hrmSalary/components/captchaModal/index.js +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -6,6 +6,7 @@ */ import React, { Component } from "react"; import { WeaDialog, WeaError, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import { sendMobileCode } from "../../apis/payroll"; import { Button } from "antd"; import "./index.less"; @@ -35,15 +36,17 @@ class Index extends Component { } handleSendCaptcha = () => { - this.timeRef = setInterval(() => { - const { time } = this.state; - this.setState({ time: time - 1 }, () => { - if (this.state.time === -1) { - clearInterval(this.timeRef); - this.setState({ time: 60 }); - } - }); - }, 1000); + sendMobileCode({ id: this.props.id }).then(({}) => { + this.timeRef = setInterval(() => { + const { time } = this.state; + this.setState({ time: time - 1 }, () => { + if (this.state.time === -1) { + clearInterval(this.timeRef); + this.setState({ time: 60 }); + } + }); + }, 1000); + }); }; render() { diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index da92ac0f..6902836e 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -2,14 +2,12 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { DatePicker } from "antd"; import { WeaNewScroll, WeaTop } from "ecCom"; -import { renderNoright } from "../../util"; +import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; import moment from "moment"; import PayrollModal from "./payrollModal"; import Authority from "./authority"; import CustomPaginationTable from "../../components/customPaginationTable"; -import CaptchaModal from "../../components/captchaModal"; -import { payrollCheckType } from "../../apis/payroll"; import "./index.less"; const { RangePicker } = DatePicker; @@ -24,19 +22,15 @@ export default class MySalary extends React.Component { selectedKey: "0", salaryBillVisible: false, salaryInfoId: "", - salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], - captchaVisible: false + salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] }; this.pageInfo = { current: 1, pageSize: 10 }; this.historyPageInfo = { current: 1, pageSize: 10 }; } - async componentWillMount() { + componentWillMount() { const { mySalaryStore: { init } } = this.props; - const data = await payrollCheckType(); - console.log(data); - this.setState({ captchaVisible: true }); - // init(); + init(); } // 查看工资单 @@ -119,7 +113,7 @@ export default class MySalary extends React.Component { recordListPageInfo, myBillPageInfo } = mySalaryStore; - const { salaryBillVisible, salaryInfoId, salaryRange, captchaVisible } = this.state; + const { salaryBillVisible, salaryInfoId, salaryRange } = this.state; if (!hasRight && !loading) return renderNoright(); const topTab = [ @@ -216,7 +210,6 @@ export default class MySalary extends React.Component { }} /> } - this.setState({ captchaVisible: false })}/> ); } From d71b879290b994058f0bd82f34556ceffec0369e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Jun 2023 16:34:03 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?= =?UTF-8?q?=E5=8D=95=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/captchaModal/index.js | 37 ++++-- .../hrmSalary/pages/mobilePayroll/index.js | 23 +++- pc4mobx/hrmSalary/pages/mySalary/index.js | 122 +++++++++--------- .../hrmSalary/pages/mySalary/mySalaryView.js | 51 ++++++-- 4 files changed, 140 insertions(+), 93 deletions(-) diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js index 10675b57..35661772 100644 --- a/pc4mobx/hrmSalary/components/captchaModal/index.js +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -28,26 +28,35 @@ class Index extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && !nextProps.visible) { - this.setState({ captcha: "" }); - } else { clearInterval(this.timeRef); - this.setState({ time: 60 }); + this.setState({ captcha: "", time: 60 }); } } handleSendCaptcha = () => { - sendMobileCode({ id: this.props.id }).then(({}) => { - this.timeRef = setInterval(() => { - const { time } = this.state; - this.setState({ time: time - 1 }, () => { - if (this.state.time === -1) { - clearInterval(this.timeRef); - this.setState({ time: 60 }); - } - }); - }, 1000); + sendMobileCode({ id: this.props.id }).then(({ status, data }) => { + if (status) { + console.log(data); + this.timeRef = setInterval(() => { + const { time } = this.state; + this.setState({ time: time - 1 }, () => { + if (this.state.time === -1) { + clearInterval(this.timeRef); + this.setState({ time: 60 }); + } + }); + }, 1000); + } }); }; + handleConfirm = () => { + if (!this.state.captcha) { + this.refs.weaError.showError(); + // return + } + this.props.onCancel(); + this.props.onConfirm(); + }; render() { const { captcha, time } = this.state; @@ -56,7 +65,7 @@ class Index extends Component { initLoadCss {...this.props} style={{ width: 550 }} className="captchaWrapper" title={getLabel(111, "验证码验证")} buttons={[ - + ]} > diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 1978860a..bf310e92 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -8,7 +8,9 @@ import ComputerTemplate from "../payroll/templatePreview/computerTemplate"; 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"; @inject("mySalaryStore") @observer @@ -17,6 +19,7 @@ export default class MobilePayroll extends React.Component { super(props); this.state = { visible: false, + captchaVisible: false, authCode: "", mySalaryBillData: { employeeInformation: {}, @@ -26,13 +29,20 @@ export default class MobilePayroll extends React.Component { this.id = ""; } - componentWillMount() { + async componentWillMount() { const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - type !== "phone" && init(false); - type === "phone" && this.initMobile(); this.getMySalaryBill(this.id); + const { data, status } = await payrollCheckType(); + if (type !== "phone") { + if (status && data === "PWD") { + init(false); + } else { + this.setState({ captchaVisible: true }); + } + } + type === "phone" && this.initMobile(); } initMobile = () => { @@ -96,7 +106,7 @@ export default class MobilePayroll extends React.Component { render() { const { mySalaryStore: { clearLoading } } = this.props; - const { mySalaryBillData, visible } = this.state; + const { mySalaryBillData, visible, captchaVisible } = this.state; const type = getQueryString("type"); const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {}; const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : []; @@ -148,6 +158,11 @@ export default class MobilePayroll extends React.Component { } + this.setState({ captchaVisible: false })} + onConfirm={() => this.props.mySalaryStore.setInitEmVerify()} + /> ); } diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index 97ce00b8..3b7ad55d 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -6,7 +6,6 @@ import { renderNoright } from "../../util"; // 渲染form数据的方法:因 import CustomTab from "../../components/customTab"; import moment from "moment"; import PayrollModal from "./payrollModal"; -import Authority from "./authority"; import CustomPaginationTable from "../../components/customPaginationTable"; import "./index.less"; @@ -29,9 +28,9 @@ export default class MySalary extends React.Component { this.historyPageInfo = { current: 1, pageSize: 10 }; } - componentWillMount() { - const { mySalaryStore: { init } } = this.props; - init(); + componentDidMount() { + const { mySalaryStore: { mySalaryBillList } } = this.props; + mySalaryBillList([moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")]); } // 查看工资单 @@ -114,7 +113,6 @@ export default class MySalary extends React.Component { myBillPageInfo } = mySalaryStore; const { salaryBillVisible, salaryInfoId, salaryRange } = this.state; - if (!hasRight && !loading) return renderNoright(); const topTab = [ { @@ -141,64 +139,62 @@ export default class MySalary extends React.Component { }; return (
- - } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - > - { - this.handleTabChange(v); - this.setState({ selectedKey: v }); - }} - /> -
- - { - this.state.selectedKey === "0" && - { - this.pageInfo.current = value; - this.handlePageChange(); - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = { current, pageSize }; - this.handlePageChange(); - }} - /> - } - { - this.state.selectedKey === "2" && - { - this.historyPageInfo.current = value; - this.handleHistoryPageChange(); - }} - onShowSizeChange={(current, pageSize) => { - this.historyPageInfo = { current, pageSize }; - this.handleHistoryPageChange(); - }} - /> - } - -
-
-
+ } // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 + showDropIcon={false} // 是否显示下拉按钮 + > + { + this.handleTabChange(v); + this.setState({ selectedKey: v }); + }} + /> +
+ + { + this.state.selectedKey === "0" && + { + this.pageInfo.current = value; + this.handlePageChange(); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + this.handlePageChange(); + }} + /> + } + { + this.state.selectedKey === "2" && + { + this.historyPageInfo.current = value; + this.handleHistoryPageChange(); + }} + onShowSizeChange={(current, pageSize) => { + this.historyPageInfo = { current, pageSize }; + this.handleHistoryPageChange(); + }} + /> + } + +
+
{ salaryBillVisible && -
- -
-
+ + +
+
+ +
+
+
+ this.setState({ captchaVisible: false })} + onConfirm={() => mySalaryStore.setInitEmVerify()} + /> +
); } } From cae153cebf084a42ee1d6be62829aa9370736ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Jun 2023 16:57:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84?= =?UTF-8?q?=E5=8D=95=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/mySalary/mySalaryView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/mySalary/mySalaryView.js b/pc4mobx/hrmSalary/pages/mySalary/mySalaryView.js index 7375cd4e..c5a80327 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/mySalaryView.js +++ b/pc4mobx/hrmSalary/pages/mySalary/mySalaryView.js @@ -43,7 +43,7 @@ class MySalaryView extends Component { return ( -
+