From eecd18cfa5279936bec0447ddb4d1e77bc744ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 18 May 2023 09:06:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84=E5=8D=95?= =?UTF-8?q?=E5=8F=91=E6=94=BE=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9D=83=E9=99=90=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/mySalaryBenefits.js | 29 ++++--- .../hrmSalary/pages/mobilePayroll/index.js | 78 ++++++++++++++++--- .../hrmSalary/pages/mobilePayroll/index.less | 17 ++++ .../templatePreview/phoneTemplate/index.js | 30 ++++--- pc4mobx/hrmSalary/single.js | 4 +- pc4mobx/hrmSalary/stores/mySalary.js | 10 ++- 6 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/mobilePayroll/index.less diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js index 7a29d7db..a2f5be7a 100644 --- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js +++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js @@ -1,29 +1,36 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; // 工资单列表 export const mySalaryBillList = params => { - return fetch('/api/bs/hrmsalary/salaryBill/mySalaryBillList', { - method: 'POST', - mode: 'cors', + return fetch("/api/bs/hrmsalary/salaryBill/mySalaryBillList", { + method: "POST", + mode: "cors", headers: { - 'Content-Type': 'application/json' - }, + "Content-Type": "application/json" + }, body: JSON.stringify(params) - }).then(res => res.json()) + }).then(res => res.json()); }; // 社保福利列表 export const welfareList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/report/welfare/list', 'GET', params); + return WeaTools.callApi("/api/bs/hrmsalary/report/welfare/list", "GET", params); }; // 调薪记录列表 export const recordList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/report/record/list', 'GET', params); + return WeaTools.callApi("/api/bs/hrmsalary/report/record/list", "GET", params); }; // 工资查看详情 export const mySalaryBill = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/mySalaryBill', 'GET', params); -}; \ No newline at end of file + return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/mySalaryBill", "GET", params); +}; + +export const isNeedSecondPwdVerify = params => { + return WeaTools.callApi("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params); +}; +export const doSecondAuth = params => { + return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params); +}; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 4d08a972..1978860a 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -1,10 +1,14 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { getQueryString } from "../../util/url"; +import { WeaDialog, WeaError, WeaInput } from "ecCom"; +import { Button, message } from "antd"; import Authority from "../mySalary/authority"; import ComputerTemplate from "../payroll/templatePreview/computerTemplate"; import PhoneTemplate from "../payroll/templatePreview/phoneTemplate"; import "../payroll/templatePreview/index.less"; +import * as API from "../../apis/mySalaryBenefits"; +import "./index.less"; @inject("mySalaryStore") @observer @@ -12,6 +16,8 @@ export default class MobilePayroll extends React.Component { constructor(props) { super(props); this.state = { + visible: false, + authCode: "", mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] @@ -24,11 +30,43 @@ export default class MobilePayroll extends React.Component { const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - // type !== "phone" && init(false); - init(false); + type !== "phone" && init(false); + type === "phone" && this.initMobile(); this.getMySalaryBill(this.id); } + initMobile = () => { + const { mySalaryStore: { setInitEmVerify } } = this.props; + if (window.em) { + API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, isNeedSecondAuth }) => { + if (status && isNeedSecondAuth) { + this.setState({ visible: true }); + } else { + setInitEmVerify(); + } + }); + } else { + setInitEmVerify(); + } + }; + doSecondAuth = () => { + const { mySalaryStore: { setInitEmVerify } } = this.props; + if (!this.state.authCode) { + this.refs.weaError.showError(); + return; + } + API.doSecondAuth({ + authCode: this.state.authCode, mouldCode: "HRM", itemCode: "SALARY" + }).then(({ status, checkStatus, checkMsg }) => { + if (status && checkStatus === "1") { + message.success(checkMsg); + setInitEmVerify(); + this.setState({ visible: false }); + } else { + message.error(checkMsg); + } + }); + }; getMySalaryBill = (salaryInfoId) => { const { mySalaryStore: { getMySalaryBill } } = this.props; const params = this.getUrlkey(); @@ -57,7 +95,8 @@ export default class MobilePayroll extends React.Component { }; render() { - const { mySalaryBillData } = this.state; + const { mySalaryStore: { clearLoading } } = this.props; + const { mySalaryBillData, visible } = this.state; const type = getQueryString("type"); const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {}; const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : []; @@ -67,18 +106,33 @@ export default class MobilePayroll extends React.Component { overflowY: "hidden", paddingBottom: "20px" }}> + this.setState({ visible: false }, () => clearLoading())} + title="请输入二次验证密码" visible={visible} initLoadCss + className="verifyWrapper" + hasScroll buttons={[ + + ]} + > + + this.setState({ authCode })}/> + + { type === "phone" ? -
-
- + +
+
+ +
-
+ : diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.less b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less new file mode 100644 index 00000000..c51890f3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less @@ -0,0 +1,17 @@ +.verifyWrapper { + .ant-modal-content { + width: 80vw !important; + + .ant-modal-body { + padding: 10% !important; + + .wea-dialog-body, .wea-new-scroll { + height: 75px !important; + + .wea-error { + width: 100%; + } + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js b/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js index 4d8fb5f4..607d2d42 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js @@ -13,17 +13,17 @@ export default class PhoneTemplate extends React.Component { this.state = { salaryItemSet: [], salaryTemplateShowSet: { - theme:'', - background:'', - textContentPosition: '', - textContent: '' + theme: "", + background: "", + textContentPosition: "", + textContent: "" } }; } componentWillMount() { - if(this.props.isPreview) return; + if (this.props.isPreview) return; let salaryTemplateShowSetStr = window.localStorage.getItem("salary-showset"); let salaryItemSetStr = window.localStorage.getItem("salaryItemSet"); this.setState({ @@ -31,18 +31,28 @@ export default class PhoneTemplate extends React.Component { salaryTemplateShowSet: JSON.parse(salaryTemplateShowSetStr) }); } + + componentDidMount() { + if (this.props.isMsgPreview && this.props.salaryItemSet && window.em) { + this.setState({ + salaryItemSet: JSON.parse(this.props.salaryItemSet), + salaryTemplateShowSet: JSON.parse(this.props.salaryTemplateShowSet) + }); + } + } + componentWillReceiveProps(nextProps) { - if(nextProps.salaryTemplateShowSet !== this.props.salaryTemplateShowSet){ + if (nextProps.salaryTemplateShowSet !== this.props.salaryTemplateShowSet) { this.setState({ salaryItemSet: JSON.parse(nextProps.salaryItemSet), - salaryTemplateShowSet: JSON.parse(nextProps.salaryTemplateShowSet), + salaryTemplateShowSet: JSON.parse(nextProps.salaryTemplateShowSet) }); } } render() { - const { salaryTemplateShowSet, salaryItemSet }= this.state; + const { salaryTemplateShowSet, salaryItemSet } = this.state; return (
@@ -57,7 +67,7 @@ export default class PhoneTemplate extends React.Component {
{ - salaryTemplateShowSet.textContentPosition == 1 && salaryTemplateShowSet.textContent + salaryTemplateShowSet.textContentPosition == 1 && salaryTemplateShowSet.textContent }
@@ -73,7 +83,7 @@ export default class PhoneTemplate extends React.Component { _.map(group.items, item => { return {item.name} - {item.salaryItemValue || '-'} + {item.salaryItemValue || "-"} ; }) } diff --git a/pc4mobx/hrmSalary/single.js b/pc4mobx/hrmSalary/single.js index 516834ad..329e1bea 100644 --- a/pc4mobx/hrmSalary/single.js +++ b/pc4mobx/hrmSalary/single.js @@ -30,8 +30,8 @@ const Home = props => props.children; class Root extends React.Component { componentWillMount() { top.$(".ant-message").remove(); - allStore.taxAgentStore.getPermission(); - if(window.location.hash.indexOf("payroll")!== -1){ + window.location.hash.indexOf("mobilepayroll") === -1 && allStore.taxAgentStore.getPermission(); + if (window.location.hash.indexOf("payroll") !== -1) { window.localStorage.removeItem("template-basedata"); window.localStorage.removeItem("salary-showset"); } diff --git a/pc4mobx/hrmSalary/stores/mySalary.js b/pc4mobx/hrmSalary/stores/mySalary.js index ca127047..ef50b397 100644 --- a/pc4mobx/hrmSalary/stores/mySalary.js +++ b/pc4mobx/hrmSalary/stores/mySalary.js @@ -4,7 +4,7 @@ import { WeaForm, WeaLogView, WeaTableNew } from "comsMobx"; import { WeaLocaleProvider } from "ecCom"; import moment from "moment"; -import * as API from "../apis/mySalaryBenefits"; // 引入API接口文件 +import * as API from "../apis/mySalaryBenefits"; const { LogStore } = WeaLogView; const getLabel = WeaLocaleProvider.getLabel; @@ -37,6 +37,14 @@ export class MySalaryStore { this.loading = true; this.hasRight = false; }; + @action clearLoading = () => { + this.loading = false; + this.hasRight = false; + }; + @action setInitEmVerify = () => { + this.loading = false; + this.hasRight = true; + }; @action setMySalaryBill = (mySalaryBill) => { this.mySalaryBill = mySalaryBill; };