2024-04-01 17:47:08 +08:00
|
|
|
/*
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
* name: 报表查看-左侧tab标题
|
|
|
|
|
* Description:
|
|
|
|
|
* Date: 2023/4/20
|
|
|
|
|
*/
|
|
|
|
|
import React, { Component } from "react";
|
|
|
|
|
import { WeaLocaleProvider } from "ecCom";
|
|
|
|
|
import { Menu } from "antd";
|
|
|
|
|
import * as API from "../../../apis/declare";
|
|
|
|
|
import { getQueryString } from "../../../util/url";
|
|
|
|
|
|
|
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
|
|
|
|
|
|
class LeftTab extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
reportName: "",
|
|
|
|
|
selectedKeys: "",
|
|
|
|
|
dataSource: []
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
this.getTaxReports();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getTaxReports = () => {
|
2024-04-11 09:48:37 +08:00
|
|
|
const { onChangeTab, onCollapse } = this.props;
|
2024-04-01 17:47:08 +08:00
|
|
|
API.getTaxReports({ id: getQueryString("id") }).then(({ status, data: dataSource }) => {
|
|
|
|
|
if (status) this.setState({
|
|
|
|
|
dataSource, selectedKeys: !_.isEmpty(dataSource) ? _.head(dataSource).id + "" : ""
|
|
|
|
|
}, () => {
|
|
|
|
|
!_.isEmpty(this.state.dataSource) && onChangeTab(_.head(this.state.dataSource).reportType);
|
2024-04-11 09:48:37 +08:00
|
|
|
onCollapse(!_.isEmpty(this.state.dataSource) && this.state.dataSource.length > 1);
|
2024-04-01 17:47:08 +08:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { selectedKeys, dataSource } = this.state;
|
|
|
|
|
const { onChangeTab } = this.props;
|
2024-04-02 10:21:26 +08:00
|
|
|
const reportTypeNameMap = {
|
|
|
|
|
1: getLabel(111, "综合所得"),
|
|
|
|
|
2: getLabel(111, "分类所得"),
|
|
|
|
|
3: getLabel(111, "非居民所得"),
|
|
|
|
|
4: getLabel(111, "限售股所得")
|
|
|
|
|
};
|
2024-04-01 17:47:08 +08:00
|
|
|
return (
|
|
|
|
|
<div className="leftTabWrapper">
|
|
|
|
|
<Menu mode="inline" selectedKeys={selectedKeys}
|
|
|
|
|
onClick={({ key }) => {
|
|
|
|
|
this.setState({ selectedKeys: key }, () => {
|
|
|
|
|
onChangeTab(_.find(dataSource, o => String(o.id) === key).reportType, true);
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
_.map(dataSource, item => {
|
|
|
|
|
const { reportType, id } = item;
|
2024-04-02 10:21:26 +08:00
|
|
|
return <Menu.Item key={id + ""}>{reportTypeNameMap[reportType]}</Menu.Item>;
|
2024-04-01 17:47:08 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Menu>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default LeftTab;
|