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

102 lines
3.4 KiB
JavaScript
Raw Normal View History

2022-03-18 10:38:43 +08:00
import React from 'react'
import CustomTab from '../../components/customTab'
import { Button, Table } from "antd"
2022-04-20 15:28:40 +08:00
import { WeaTable } from 'ecCom'
2022-03-18 10:38:43 +08:00
import { declarationColumns, dataSource} from './columns'
import "./index.less"
2022-04-20 15:28:40 +08:00
import { inject, observer } from 'mobx-react';
import { getQueryString } from '../../util/url'
2022-06-07 09:08:36 +08:00
import CustomPaginationTable from '../../components/customPaginationTable'
2022-03-18 10:38:43 +08:00
2022-04-20 15:28:40 +08:00
@inject('declareStore')
@observer
2022-03-18 10:38:43 +08:00
export default class GenerateDeclarationDetail extends React.Component {
2022-04-20 15:28:40 +08:00
constructor(props) {
super(props)
this.id = getQueryString("id")
2022-06-07 09:08:36 +08:00
this.pageInfo = {current: 1, pageSize: 10}
2022-04-20 15:28:40 +08:00
}
componentWillMount() {
const { declareStore: { getDetailList, getDeclareInfo }} = this.props;
getDetailList(this.id)
getDeclareInfo(this.id)
2022-06-07 09:08:36 +08:00
2022-04-20 15:28:40 +08:00
}
// 导出
handleExport() {
const { declareStore: {exportSalaryArchive}} = this.props;
exportSalaryArchive(this.id)
}
getColumns() {
const { declareStore: {datailColumns}} = this.props;
let columns = [...datailColumns]
return columns.map(item => {
item = {...item}
item.width = "150px"
2022-06-07 09:08:36 +08:00
if(item.dataIndex == "employeeName") {
item.fixed = 'left'
}
2022-04-20 15:28:40 +08:00
return item;
})
}
2022-06-07 09:08:36 +08:00
handlePageChange() {
const { declareStore: { getDetailList, getDeclareInfo }} = this.props;
getDetailList(this.id, this.pageInfo)
}
2022-03-18 10:38:43 +08:00
render() {
2022-06-07 09:08:36 +08:00
const { declareStore: { detailDataSource, detailTableStore, declareInfo, datailColumns, detailPageInfo }} = this.props;
2022-04-20 15:28:40 +08:00
2022-03-18 10:38:43 +08:00
const renderRightOperation = () => {
return (
<div style={{display: "inline-block"}}>
2022-04-20 15:28:40 +08:00
<Button type="primary" onClick={() => {this.handleExport()}}>导出</Button>
2022-03-18 10:38:43 +08:00
</div>
)
}
const renderLeftOperation = () => {
return (
<div style={{display: "inline-block", lineHeight: '47px'}}>
2022-04-20 15:28:40 +08:00
<span>薪资所属月{declareInfo.salaryMonth && declareInfo.salaryMonth.year} - {declareInfo.salaryMonth && declareInfo.salaryMonth.monthValue}</span>
<span style={{marginLeft: "10px"}}>个税扣缴义务人{declareInfo.taxAgentName}</span>
2022-03-18 10:38:43 +08:00
</div>
)
}
return (
<div className="generateDeclarationDetail">
<CustomTab
searchOperationItem={
renderRightOperation()
}
leftOperation={
renderLeftOperation()
}
/>
<div>
2022-06-07 09:08:36 +08:00
<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()
}}
/>
2022-03-18 10:38:43 +08:00
</div>
</div>
)
}
}