custom/上海港湾-多语言版本

This commit is contained in:
黎永顺 2024-01-19 11:32:59 +08:00
parent 54667dd07e
commit 298274651c
3 changed files with 68 additions and 16 deletions

View File

@ -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),

View File

@ -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 = <SalaryAdjustmentRecords/>;
break;
case "3":
Dom = <SubPayroll salaryYearMonth={salaryYearMonth}/>;
Dom = <SubPayroll salaryYearMonth={salaryYearMonth} employeeStatus={employeeStatus}/>;
break;
default:
break;
}
return Dom;
};
renderReqBtns = () => {
const { selectedKey, salaryYearMonth, employeeStatus, employeeStatusOptions } = this.state;
let btns = [];
switch (selectedKey) {
case "1":
btns = [
<div className="flex-salary">
<div className="mysalary-search-title">{getLabel(542604, "薪资所属月")}</div>
<MonthRangePicker dateRange={salaryYearMonth} viewAttr={2}
onChange={v => this.setState({ salaryYearMonth: v })}/>
</div>
];
break;
case "3":
btns = [
<div className="flex-salary">
<div className="mysalary-search-title">{getLabel(542604, "薪资所属月")}</div>
<MonthRangePicker dateRange={salaryYearMonth} viewAttr={2}
onChange={v => this.setState({ salaryYearMonth: v })}/>
</div>,
<div className="flex-salary">
<div className="mysalary-search-title">{getLabel(15890, "员工状态")}</div>
<WeaSelect options={employeeStatusOptions} value={employeeStatus} multiple
onChange={v => this.setState({ employeeStatus: v })}
/>
</div>
];
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 = [
<div className="flex-salary">
<div className="mysalary-search-title">{getLabel(542604, "薪资所属月")}</div>
<MonthRangePicker dateRange={salaryYearMonth} viewAttr={2}
onChange={v => this.setState({ salaryYearMonth: v })}/>
</div>
];
return (
<WeaReqTop
title={getLabel(537998, "薪资福利")} icon={<i className="icon-coms-fa"/>}
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()}

View File

@ -11,6 +11,11 @@
.mysalary-search-title {
margin-right: 8px;
}
.wea-select {
height: 30px;
line-height: normal;
}
}
.wea-new-table {