custom/上海港湾-工资单查看添加领导查询下属的功能
This commit is contained in:
parent
348007221a
commit
a97d782098
|
|
@ -56,6 +56,6 @@ export const saveSecondaryPwd = params => {
|
|||
export const salaryBillGetToken = params => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/getToken", "GET", params);
|
||||
};
|
||||
export const getMyJuniorMap = params => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/myJuniorMap", "GET", params);
|
||||
export const myJuniorTree = params => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/myJuniorTree", "GET", params);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaLeftRightLayout, WeaLocaleProvider, WeaTable, WeaTree } from "ecCom";
|
||||
import { getMyJuniorMap, mySalaryBillList } from "../../../../apis/mySalaryBenefits";
|
||||
import { message } from "antd";
|
||||
import { myJuniorTree, mySalaryBillList } from "../../../../apis/mySalaryBenefits";
|
||||
import moment from "moment";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
|
@ -21,7 +22,7 @@ class Index extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getMyJuniorMap();
|
||||
this.getMyJuniorTree();
|
||||
this.getMySalaryBillList(this.props);
|
||||
}
|
||||
|
||||
|
|
@ -29,22 +30,38 @@ class Index extends Component {
|
|||
if (nextProps.salaryYearMonth !== this.props.salaryYearMonth) this.getMySalaryBillList(nextProps);
|
||||
}
|
||||
|
||||
getMyJuniorMap = () => {
|
||||
getMyJuniorMap().then(({ status, data }) => {
|
||||
getMyJuniorTree = () => {
|
||||
myJuniorTree().then(({ status, data }) => {
|
||||
if (status) {
|
||||
this.setState({
|
||||
juniorMapList: _.map(_.keys(data), o => ({ id: o, name: data[o] }))
|
||||
juniorMapList: this.convertToTreeDatas(data)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
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 },
|
||||
|
|
@ -60,6 +77,11 @@ class Index extends Component {
|
|||
};
|
||||
})
|
||||
});
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
this.setState({
|
||||
dataSource: [], pageInfo: { ...pageInfo, total: 0 }, columns: []
|
||||
});
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue