From 298274651c1cdb7296a3a3f2bcdb3a74e394eadb 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, 19 Jan 2024 11:32:59 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E4=B8=8A=E6=B5=B7=E6=B8=AF=E6=B9=BE-?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/payrollTable/index.js | 8 ++- .../hrmSalary/pages/mySalaryBenefits/index.js | 71 +++++++++++++++---- .../pages/mySalaryBenefits/index.less | 5 ++ 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js index 01140f4f..1c3007a8 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js @@ -22,15 +22,17 @@ class Index extends Component { } componentDidMount() { - this.getMyJuniorTree(); + this.getMyJuniorTree(this.props); } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.salaryYearMonth !== this.props.salaryYearMonth) this.getMySalaryBillList(nextProps); + if (nextProps.employeeStatus !== this.props.employeeStatus) this.getMyJuniorTree(nextProps); } - getMyJuniorTree = () => { - myJuniorTree().then(({ status, data }) => { + getMyJuniorTree = (props) => { + const { employeeStatus: statusList } = props; + myJuniorTree({ statusList }).then(({ status, data }) => { if (status) { this.setState({ juniorMapList: this.convertToTreeDatas(data), diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js index 67de28c3..2f6a987a 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js @@ -5,13 +5,14 @@ * Date: 2023/11/13 */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { WeaLocaleProvider, WeaReqTop, WeaSelect } from "ecCom"; import SubPayroll from "./components/payrollTable"; import SalaryAdjustmentRecords from "./components/SalaryAdjustmentRecords"; import Payroll from "./components/subPayroll"; import { MonthRangePicker } from "../reportView/components/statisticalMicroSettingsSlide"; import moment from "moment"; import "./index.less"; +import { commonEnumList } from "../../apis/archive"; const getLabel = WeaLocaleProvider.getLabel; @@ -19,12 +20,30 @@ class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "1", salaryYearMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] + selectedKey: "1", employeeStatus: "", employeeStatusOptions: [], + salaryYearMonth: [ + moment().subtract(1, "year").startOf("year").format("YYYY-MM"), + moment().endOf("year").format("YYYY-MM") + ] }; } + componentDidMount() { + commonEnumList({ enumClass: "com.engine.salary.enums.UserStatusEnum" }).then(({ status, data }) => { + if (status) { + this.setState({ + employeeStatus: _.map(_.filter(data, o => ["TRIAL", "FORMAL", "TEMPORARY", "DELAY"].includes(o.enum)), it => String(it.value)).join(","), + employeeStatusOptions: _.map(_.filter(data, o => o.value !== 7), it => ({ + key: String(it.value), + showname: it.defaultLabel + })) + }); + } + }); + } + renderContent = () => { - const { selectedKey, salaryYearMonth } = this.state; + const { selectedKey, salaryYearMonth, employeeStatus } = this.state; let Dom = null; switch (selectedKey) { case "1": @@ -34,33 +53,59 @@ class Index extends Component { Dom = ; break; case "3": - Dom = ; + Dom = ; break; default: break; } return Dom; }; + renderReqBtns = () => { + const { selectedKey, salaryYearMonth, employeeStatus, employeeStatusOptions } = this.state; + let btns = []; + switch (selectedKey) { + case "1": + btns = [ +
+
{getLabel(542604, "薪资所属月")}
+ this.setState({ salaryYearMonth: v })}/> +
+ ]; + break; + case "3": + btns = [ +
+
{getLabel(542604, "薪资所属月")}
+ this.setState({ salaryYearMonth: v })}/> +
, +
+
{getLabel(15890, "员工状态")}
+ this.setState({ employeeStatus: v })} + /> +
+ ]; + break; + default: + break; + } + return btns; + }; render() { - const { selectedKey, salaryYearMonth } = this.state; + const { selectedKey } = this.state; const tabs = [ { key: "1", title: getLabel(503, "工资单") }, { key: "2", title: getLabel(543150, "调薪记录") }, { key: "3", title: getLabel(545960, "下属工资单") } ]; - const btns = [ -
-
{getLabel(542604, "薪资所属月")}
- this.setState({ salaryYearMonth: v })}/> -
- ]; return ( } iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper" - buttons={selectedKey !== "2" ? btns : []} buttonSpace={10} selectedKey={selectedKey} + buttons={this.renderReqBtns()} buttonSpace={10} selectedKey={selectedKey} onChange={selectedKey => this.setState({ selectedKey })} > {this.renderContent()} diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less index 52e92374..fe400d1d 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less @@ -11,6 +11,11 @@ .mysalary-search-title { margin-right: 8px; } + + .wea-select { + height: 30px; + line-height: normal; + } } .wea-new-table {