Merge branch 'custom/上海港湾-工资单查看添加领导查询下属的功能' into custom/上海港湾-多语言版本

# Conflicts:
#	pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js
#	pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js
This commit is contained in:
黎永顺 2023-12-14 14:25:29 +08:00
commit 47e95550fd
4 changed files with 164 additions and 21 deletions

View File

@ -56,3 +56,6 @@ export const saveSecondaryPwd = params => {
export const salaryBillGetToken = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/getToken", "GET", params);
};
export const myJuniorTree = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/myJuniorTree", "GET", params);
};

View File

@ -5,8 +5,9 @@
* Date: 2023/11/13
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { mySalaryBillList } from "../../../../apis/mySalaryBenefits";
import { WeaLeftRightLayout, WeaLocaleProvider, WeaTable, WeaTree } from "ecCom";
import { message } from "antd";
import { myJuniorTree, mySalaryBillList } from "../../../../apis/mySalaryBenefits";
import moment from "moment";
const getLabel = WeaLocaleProvider.getLabel;
@ -21,20 +22,46 @@ class Index extends Component {
}
componentDidMount() {
this.getMySalaryBillList(this.props);
this.getMyJuniorTree();
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.salaryYearMonth !== this.props.salaryYearMonth) this.getMySalaryBillList(nextProps);
}
getMyJuniorTree = () => {
myJuniorTree().then(({ status, data }) => {
if (status) {
this.setState({
juniorMapList: this.convertToTreeDatas(data),
employeeId: !_.isNil(data) ? _.head(data).employeeId : ""
}, () => this.getMySalaryBillList(this.props));
}
});
};
convertToTreeDatas = (datas, pid = "0") => {
return _.map(datas, item => {
if (_.isEmpty(item.children)) {
return {
id: item.employeeId.toString(), name: item.username,
isParent: false, pid
};
} else {
return {
id: item.employeeId.toString(), name: item.username,
isParent: true, pid,
subs: this.convertToTreeDatas(item.children, item.employeeId.toString())
};
}
});
};
getMySalaryBillList = (props) => {
this.setState({ loading: true });
const { pageInfo, employeeId } = this.state;
const { salaryYearMonth } = props;
mySalaryBillList({ salaryYearMonth, employeeId, ...pageInfo }).then(({ status, data }) => {
mySalaryBillList({ salaryYearMonth, employeeId, ...pageInfo }).then(({ status, data, errormsg }) => {
this.setState({ loading: false });
if (status) {
if (status && !_.isEmpty(data)) {
const { columns, datas: dataSource, pageInfo: { pageNum: current, pageSize, total } } = data;
this.setState({
dataSource, pageInfo: { ...pageInfo, current, pageSize, total },
@ -50,12 +77,17 @@ class Index extends Component {
};
})
});
} else {
message.error(errormsg);
this.setState({
dataSource: [], pageInfo: { ...pageInfo, total: 0 }, columns: []
});
}
}).catch(() => this.setState({ loading: false }));
};
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, "条")}`,
@ -74,17 +106,28 @@ class Index extends Component {
}
};
return (
<WeaTable rowKey="id" dataSource={dataSource} pagination={pagination}
scroll={{ 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>)
}]}
/>
<WeaLeftRightLayout
isNew={true} leftWidth={200} height="100%" checkedKeys={[]}
leftCom={
<div style={{ height: "100%", overflow: "hidden auto" }}>
<WeaTree
style={{ height: "100%" }} datas={juniorMapList} selectedKeys={[employeeId.toString()]}
onSelect={([employeeId]) => this.setState({ employeeId }, () => this.getMySalaryBillList(this.props))}/>
</div>
}
>
<WeaTable rowKey="id" dataSource={dataSource} pagination={pagination}
scroll={{ 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>)
}]}
/>
</WeaLeftRightLayout>
);
}
}

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={{ 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";
@ -32,6 +33,9 @@ class Index extends Component {
case "2":
Dom = <SalaryAdjustmentRecords/>;
break;
case "3":
Dom = <SubPayroll salaryYearMonth={salaryYearMonth}/>;
break;
default:
break;
}
@ -42,7 +46,8 @@ class Index extends Component {
const { selectedKey, salaryYearMonth } = this.state;
const tabs = [
{ key: "1", title: getLabel(503, "工资单") },
{ key: "2", title: getLabel(543150, "调薪记录") }
{ key: "2", title: getLabel(543150, "调薪记录") },
{ key: "3", title: getLabel(111, "下属工资单") }
];
const btns = [
<div className="flex-salary">
@ -53,9 +58,9 @@ class Index extends Component {
];
return (
<WeaReqTop
title={getLabel(537998, "我的薪资福利")} icon={<i className="icon-coms-fa"/>}
title={getLabel(537998, "薪资福利")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper"
buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey}
buttons={selectedKey !== "2" ? btns : []} buttonSpace={10} selectedKey={selectedKey}
onChange={selectedKey => this.setState({ selectedKey })}
>
{this.renderContent()}