From 0f71f924389d0ee770ca03290b9a7142da353933 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, 11 Dec 2023 16:25:31 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E4=B8=8A=E6=B5=B7=E6=B8=AF=E6=B9=BE-?= =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E6=9F=A5=E7=9C=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A2=86=E5=AF=BC=E6=9F=A5=E8=AF=A2=E4=B8=8B=E5=B1=9E=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/payrollTable/index.js | 10 +- .../components/subPayroll/index.js | 92 +++++++++++++++++++ .../hrmSalary/pages/mySalaryBenefits/index.js | 5 +- 3 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/mySalaryBenefits/components/subPayroll/index.js diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js index 59aac762..68a4a76a 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js @@ -23,7 +23,6 @@ class Index extends Component { componentDidMount() { this.getMyJuniorTree(); - this.getMySalaryBillList(this.props); } componentWillReceiveProps(nextProps, nextContext) { @@ -34,8 +33,9 @@ class Index extends Component { myJuniorTree().then(({ status, data }) => { if (status) { this.setState({ - juniorMapList: this.convertToTreeDatas(data) - }); + juniorMapList: this.convertToTreeDatas(data), + employeeId: !_.isNil(data) ? _.head(data).employeeId : "" + }, () => this.getMySalaryBillList(this.props)); } }); }; @@ -87,7 +87,7 @@ class Index extends Component { }; render() { - const { juniorMapList, dataSource, loading, columns, pageInfo } = this.state; + const { juniorMapList, dataSource, loading, columns, pageInfo, employeeId } = this.state; const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, @@ -111,7 +111,7 @@ class Index extends Component { leftCom={
this.setState({ employeeId }, () => this.getMySalaryBillList(this.props))}/>
} diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/subPayroll/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/subPayroll/index.js new file mode 100644 index 00000000..d5552072 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/subPayroll/index.js @@ -0,0 +1,92 @@ +/* + * Author: 黎永顺 + * name: 下属工资单 + * Description: + * Date: 2023/11/13 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { mySalaryBillList } from "../../../../apis/mySalaryBenefits"; +import moment from "moment"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false + }; + } + + componentDidMount() { + this.getMySalaryBillList(this.props); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.salaryYearMonth !== this.props.salaryYearMonth) this.getMySalaryBillList(nextProps); + } + + getMySalaryBillList = (props) => { + this.setState({ loading: true }); + const { pageInfo } = this.state; + const { salaryYearMonth } = props; + mySalaryBillList({ salaryYearMonth, ...pageInfo }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, datas: dataSource, pageInfo: { pageNum: current, pageSize, total } } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns: _.map(columns, it => { + if (it.column === "salaryYearMonth" || it.column === "sendTime") { + return { + dataIndex: it.column, title: it.text, width: it.width, + render: (__, record) => ({moment(record[it["column"]]).format("YYYY-MM")}) + }; + } + return { + dataIndex: it.column, title: it.text, width: it.width + }; + }) + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { dataSource, loading, columns, pageInfo } = this.state; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.getMySalaryBillList(this.props)); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getMySalaryBillList(this.props)); + } + }; + return ( + ({getLabel(33564, "查看")}) + }]} + /> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js index 331b9eb9..0f68e632 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js @@ -6,8 +6,9 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaReqTop } from "ecCom"; -import Payroll from "./components/payrollTable"; +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"; @@ -33,7 +34,7 @@ class Index extends Component { Dom = ; break; case "3": - Dom = ; + Dom = ; break; default: break;