custom/上海港湾-工资单查看添加领导查询下属的功能

This commit is contained in:
黎永顺 2023-12-11 16:25:31 +08:00
parent 62baaa9a33
commit 0f71f92438
3 changed files with 100 additions and 7 deletions

View File

@ -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={
<div style={{ height: "100%", overflow: "hidden auto" }}>
<WeaTree
style={{ height: "100%" }} datas={juniorMapList}
style={{ height: "100%" }} datas={juniorMapList} selectedKeys={[employeeId.toString()]}
onSelect={([employeeId]) => this.setState({ employeeId }, () => this.getMySalaryBillList(this.props))}/>
</div>
}

View File

@ -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) => (<span>{moment(record[it["column"]]).format("YYYY-MM")}</span>)
};
}
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 (
<WeaTable rowKey="id" dataSource={dataSource} pagination={pagination}
scroll={{ x: 1200, y: `calc(100vh - 166px)` }}
loading={loading} columns={[...columns, {
dataIndex: "options",
title: getLabel(30585, "操作"),
width: 120,
render: (_, record) => (<a
href={`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/mySalary/${record.id}`}
target="_blank">{getLabel(33564, "查看")}</a>)
}]}
/>
);
}
}
export default Index;

View File

@ -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 = <SalaryAdjustmentRecords/>;
break;
case "3":
Dom = <SalaryAdjustmentRecords/>;
Dom = <SubPayroll salaryYearMonth={salaryYearMonth}/>;
break;
default:
break;