salary-management-front/pc4mobx/hrmSalary/pages/calculateDetail/placeOnFileDetail.js

213 lines
7.7 KiB
JavaScript
Raw Normal View History

2022-03-17 12:30:37 +08:00
import React from 'react'
import CustomTab from '../../components/customTab'
import { Dropdown, Menu, Button, Table } from 'antd'
2022-04-19 16:34:19 +08:00
import { WeaHelpfulTip, WeaInputSearch, WeaSlideModal, WeaTable } from 'ecCom'
2022-03-17 12:30:37 +08:00
import { placeOnFileColumns, dataSource } from './columns'
2022-03-17 15:02:59 +08:00
import SlideModalTitle from "../../components/slideModalTitle"
import FileMergeDetail from './fileMergeDetail'
2022-04-19 16:34:19 +08:00
import { getQueryString } from "../../util/url";
import { inject, observer } from 'mobx-react';
2022-06-07 09:08:36 +08:00
import CustomPaginationTable from '../../components/customPaginationTable'
2022-03-17 12:30:37 +08:00
2022-04-19 16:34:19 +08:00
@inject('calculateStore')
@observer
2022-03-17 12:30:37 +08:00
export default class PlaceOnFileDetail extends React.Component {
2022-03-17 15:02:59 +08:00
constructor(props) {
super(props);
placeOnFileColumns.map(item => {
if(item.dataIndex == "username") {
item.render = (text, record) => (
<a onClick={() => {this.onDetail()}}>{text}</a>
)
}
})
this.state = {
slideVisiable: false,
2022-06-07 09:08:36 +08:00
selectedRowKeys: [],
searchValue: ""
2022-03-17 15:02:59 +08:00
}
2022-05-30 09:38:45 +08:00
this.id = "";
2022-06-07 09:08:36 +08:00
this.length = 0
this.pageInfo = {
current: 1,
pageSize: 10
}
2022-04-19 16:34:19 +08:00
}
2022-05-09 14:23:43 +08:00
2022-04-19 16:34:19 +08:00
componentWillMount() {
let id = getQueryString("id");
2022-05-30 09:38:45 +08:00
this.id = id;
2022-04-19 16:34:19 +08:00
const { calculateStore: { getSalarySobCycle, acctResultList } } = this.props;
getSalarySobCycle(id)
acctResultList(id)
}
// 获取列表的列
getColumns() {
2022-05-09 14:23:43 +08:00
const { calculateStore: {acctResultListTableStore, acctResultListColumns }} = this.props;
let columns = acctResultListColumns ? acctResultListColumns : []
columns = columns.filter(item => item.hide == "FALSE").map(item => {
let result = {...item}
result.title = item.text;
result.dataIndex = item.column
result.oldWidth = result.width;
result.width = null;
2022-06-07 09:08:36 +08:00
this.length = 0
2022-05-09 14:23:43 +08:00
if(result.children) {
result.children.map(child => {
2022-06-07 09:08:36 +08:00
child.width = 150
2022-05-09 14:23:43 +08:00
child.title = child.text
child.dataIndex = child.column
2022-06-07 09:08:36 +08:00
this.length ++
2022-05-09 14:23:43 +08:00
})
2022-06-07 09:08:36 +08:00
} else {
this.length ++
result.width = 150
2022-05-09 14:23:43 +08:00
}
return result;
})
2022-04-19 16:34:19 +08:00
columns.push({
title: '操作',
key: "cz",
render: (text, record) => {
return <a onClick={() => {this.handleEdit(record)}}>编辑</a>
}
})
return columns;
2022-03-17 15:02:59 +08:00
}
onDetail() {
this.setState({slideVisiable: true})
}
2022-06-07 09:08:36 +08:00
handleSearch(value){
const { calculateStore: {acctResultList}} = this.props;
acctResultList(this.id, value, this.pageInfo.current, this.pageInfo)
}
2022-05-10 15:31:13 +08:00
// 分页
handleDataPageChange(value) {
const { calculateStore: {acctResultList}} = this.props;
2022-06-07 09:08:36 +08:00
acctResultList(this.id, this.state.searchValue, value, this.pageInfo)
}
handleShowSizeChange(pageInfo) {
const { calculateStore: {acctResultList}} = this.props;
acctResultList(this.id, this.state.searchValue, pageInfo.current, pageInfo )
2022-05-10 15:31:13 +08:00
}
2022-03-17 15:02:59 +08:00
2022-05-30 09:38:45 +08:00
handleMenuClick() {
const {calculateStore: {exportAll}} = this.props;
const { selectedRowKeys } = this.state;
if(selectedRowKeys.length == 0) {
message.warning("未选择条目")
return
}
exportAll(this.id, selectedRowKeys.join(","))
}
handleExportAll() {
const {calculateStore: {exportAll}} = this.props;
exportAll(this.id)
}
onSelectChange = selectedRowKeys => {
this.setState({ selectedRowKeys });
}
2022-03-17 12:30:37 +08:00
render() {
2022-04-19 16:34:19 +08:00
const { calculateStore } = this.props;
2022-05-10 15:31:13 +08:00
const { baseSalarySobCycle, acctResultListDateSource, acctResultListColumns, acctResultListPageInfo } = calculateStore
2022-05-30 09:38:45 +08:00
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange,
};
2022-05-09 14:23:43 +08:00
2022-03-17 12:30:37 +08:00
const menu = (
2022-05-30 09:38:45 +08:00
<Menu onClick={(e) => this.handleMenuClick(e)}>
2022-03-17 12:30:37 +08:00
<Menu.Item key="3">导出所选</Menu.Item>
</Menu>
);
const renderRightOperation = () => {
return (
<div style={{display: "inline-block"}}>
2022-05-30 09:38:45 +08:00
<Dropdown.Button type="primary" style={{marginRight: "10px"}} onClick={() => {this.handleExportAll()}} overlay={menu}>导出全部</Dropdown.Button>
2022-06-07 09:08:36 +08:00
<WeaInputSearch onChange={(value) => {this.setState({searchValue: value})}} value={this.state.searchValue} onSearch={(value) => {this.handleSearch(value)}}/>
2022-03-17 12:30:37 +08:00
</div>
)
}
2022-03-17 15:02:59 +08:00
const { slideVisiable } = this.state
2022-03-17 12:30:37 +08:00
return (
2022-03-17 15:02:59 +08:00
<div className="placeOnFileDetail">
2022-03-17 12:30:37 +08:00
<CustomTab
searchOperationItem={
renderRightOperation()
}
/>
2022-03-17 15:02:59 +08:00
<div className="tabWrapper">
2022-04-19 16:34:19 +08:00
<span>薪资所属月{baseSalarySobCycle.salaryMonth}</span>
2022-03-17 12:30:37 +08:00
<WeaHelpfulTip
2022-04-19 16:34:19 +08:00
width={100}
title={`薪资周期\n
${baseSalarySobCycle.salaryCycle && baseSalarySobCycle.salaryCycle.fromDate}至${baseSalarySobCycle.salaryCycle && baseSalarySobCycle.salaryCycle.endDate}\n
2022-03-17 12:30:37 +08:00
税款所属期\n
2022-04-19 16:34:19 +08:00
${baseSalarySobCycle.taxCycle}\n
2022-03-17 12:30:37 +08:00
考勤取值周期\n
2022-04-19 16:34:19 +08:00
${baseSalarySobCycle.attendCycle && baseSalarySobCycle.attendCycle.fromDate}至${baseSalarySobCycle.attendCycle && baseSalarySobCycle.attendCycle.endDate}\n
2022-03-17 12:30:37 +08:00
福利台账月份\n
2022-04-19 16:34:19 +08:00
引用${baseSalarySobCycle.socialSecurityCycle}的福利台账数据`}
2022-03-17 12:30:37 +08:00
placement="topLeft"
/>
</div>
2022-03-17 15:02:59 +08:00
<div className="tableWrapper">
2022-06-07 09:08:36 +08:00
<CustomPaginationTable
columns={this.getColumns()}
scroll={{x: this.length * 150}}
dataSource={acctResultListDateSource}
rowSelection={rowSelection}
total={acctResultListPageInfo.total}
current={acctResultListPageInfo.pageNum}
pageSize={this.pageInfo.pageSize}
onPageChange={(value) => {
this.pageInfo.current = value
this.handleDataPageChange(value)
}}
onShowSizeChange={(current, pageSize) => {
this.pageInfo = {current, pageSize}
this.handleShowSizeChange(this.pageInfo)
}}
/>
2022-03-17 12:30:37 +08:00
</div>
2022-03-17 15:02:59 +08:00
{
slideVisiable && <WeaSlideModal visible={slideVisiable}
top={0}
width={40}
height={100}
direction={'right'}
measure={'%'}
title={
<SlideModalTitle
subtitle={"合并计税详情"}
editable={true}
/>
}
content={(<FileMergeDetail />)}
onClose={() => this.setState({slideVisiable: false})}
showMask={true}
closeMaskOnClick={() => this.setState({slideVisiable: false})} />
}
2022-03-17 12:30:37 +08:00
</div>
)
}
}