salary-management-front/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/index.js

78 lines
2.1 KiB
JavaScript

/*
* Author: 黎永顺
* Description: 台账详情
* Date: 2022-04-19 16:57:29
* LastEditTime: 2022-04-20 21:01:57
*/
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { WeaTab } from 'ecCom';
import NormalIndex from './components/normal';
import OverViewIndex from './components/overView';
import AbnormalListIndex from './components/abnormalList';
@inject('standingBookStore')
@observer
class StandingBookDetail extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: '',
tabList: [],
remarks: '',
billMonth: '',
}
this.type = ""
}
componentDidMount() {
this.getTabList();
}
getTabList = (payload = {}) => {
const { getTabList } = this.props.standingBookStore;
const billMonth = this.props.location.query.billMonth;
this.type = this.props.location.query.type;
getTabList({ billMonth }).then(({ data }) => {
const { tabList, remarks, billMonth } = data;
let newTabList = tabList.filter(item => item.id != "2")
this.setState({
selectedKey: newTabList[0].id,
tabList: _.map(newTabList, it => ({ title: it.content, viewcondition: it.id })),
remarks, billMonth
});
})
}
render() {
const { selectedKey, tabList, remarks, billMonth } = this.state;
return (
<div className="standingBookDetailWapper">
<WeaTab
datas={tabList}
keyParam="viewcondition" //主键
selectedKey={selectedKey}
onChange={(selectedKey) => {
this.setState({ selectedKey })
}}
/>
{
(selectedKey === '1' || selectedKey === '3') &&
<NormalIndex selectedKey={selectedKey} remarks={remarks} billMonth={billMonth} type={this.type}/>
}
{
selectedKey === '2' &&
<AbnormalListIndex billMonth={billMonth} type={this.type}/>
}
{
selectedKey === '4' &&
<OverViewIndex billMonth={billMonth} type={this.type}/>
}
</div>
);
}
}
export default StandingBookDetail;