salary-management-front/pc4mobx/hrmSalary/pages/declare/generateDeclarationDetail.js

110 lines
3.1 KiB
JavaScript
Raw Normal View History

2022-07-06 18:11:54 +08:00
import React from "react";
import CustomTab from "../../components/customTab";
import { Button } from "antd";
import "./index.less";
import { inject, observer } from "mobx-react";
import { getQueryString } from "../../util/url";
import CustomPaginationTable from "../../components/customPaginationTable";
2022-03-18 10:38:43 +08:00
2022-07-06 18:11:54 +08:00
@inject("declareStore")
2022-04-20 15:28:40 +08:00
@observer
2022-03-18 10:38:43 +08:00
export default class GenerateDeclarationDetail extends React.Component {
2022-07-06 18:11:54 +08:00
constructor(props) {
super(props);
this.id = getQueryString("id");
this.pageInfo = { current: 1, pageSize: 10 };
}
2022-04-20 15:28:40 +08:00
2022-07-06 18:11:54 +08:00
componentWillMount() {
const { declareStore: { getDetailList, getDeclareInfo } } = this.props;
getDetailList(this.id);
getDeclareInfo(this.id);
}
2022-06-07 09:08:36 +08:00
2022-07-06 18:11:54 +08:00
// 导出
handleExport() {
const url = `${window.location.origin}/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=${this.id}`;
window.open(url, "_self");
2022-07-06 18:11:54 +08:00
}
2022-04-20 15:28:40 +08:00
2022-07-06 18:11:54 +08:00
getColumns() {
const { declareStore: { datailColumns } } = this.props;
let columns = [...datailColumns];
return columns.map(item => {
item = { ...item };
item.width = "150px";
if (item.dataIndex == "employeeName") {
item.fixed = "left";
}
return item;
});
}
2022-04-20 15:28:40 +08:00
2022-07-06 18:11:54 +08:00
handlePageChange() {
const { declareStore: { getDetailList, getDeclareInfo } } = this.props;
getDetailList(this.id, this.pageInfo);
}
2022-04-20 15:28:40 +08:00
2022-06-07 09:08:36 +08:00
2022-07-06 18:11:54 +08:00
render() {
const {
declareStore: {
detailDataSource,
detailTableStore,
declareInfo,
datailColumns,
detailPageInfo
}
} = this.props;
2022-06-07 09:08:36 +08:00
2022-07-06 18:11:54 +08:00
const renderRightOperation = () => {
return (
<div style={{ display: "inline-block" }}>
<Button type="primary" onClick={() => {
this.handleExport();
}}>导出</Button>
</div>
);
};
2022-04-20 15:28:40 +08:00
2022-07-06 18:11:54 +08:00
const renderLeftOperation = () => {
return (
<div style={{ display: "inline-block", lineHeight: "47px" }}>
<span>薪资所属月{declareInfo.salaryMonth && declareInfo.salaryMonth.year} - {declareInfo.salaryMonth && declareInfo.salaryMonth.monthValue}</span>
<span style={{ marginLeft: "10px" }}>个税扣缴义务人{declareInfo.taxAgentName}</span>
</div>
);
};
return (
<div className="generateDeclarationDetail">
<CustomTab
searchOperationItem={
renderRightOperation()
}
leftOperation={
renderLeftOperation()
}
/>
<div className="tableWrapper">
<CustomPaginationTable
dataSource={detailDataSource}
columns={this.getColumns()}
total={detailPageInfo.total}
current={detailPageInfo.pageNum}
pageSize={this.pageInfo.pageSize}
scroll={{ x: 2300 }}
onPageChange={(value) => {
this.pageInfo.current = value;
this.handlePageChange();
}}
onShowSizeChange={(current, pageSize) => {
this.pageInfo = { current, pageSize };
this.handlePageChange();
}}
/>
</div>
</div>
);
}
}