salary-management-front/pc4mobx/hrmSalary/pages/salaryFile/slideAgent.js

78 lines
2.5 KiB
JavaScript
Raw Normal View History

2022-03-17 18:57:56 +08:00
import React from 'react'
import { dataSource, slieAgentColumns } from "./columns"
2022-04-27 19:27:23 +08:00
import { WeaInputSearch, WeaTable } from 'ecCom'
2022-03-17 18:57:56 +08:00
import { Table } from 'antd'
2022-04-08 09:26:58 +08:00
import { inject, observer } from 'mobx-react';
2022-03-17 18:57:56 +08:00
import "./index.less"
2022-04-08 09:26:58 +08:00
@inject('salaryFileStore')
@observer
2022-03-17 18:57:56 +08:00
export default class SlideAgent extends React.Component {
2022-04-27 19:27:23 +08:00
constructor(props) {
super(props)
this.state = {
searchValue: ''
}
}
2022-04-08 09:26:58 +08:00
componentWillMount() {
const {salaryFileStore: {adjustRecordTaxAgentList}} = this.props;
2022-04-27 19:27:23 +08:00
adjustRecordTaxAgentList({username: this.state.searchValue})
}
// 分页
handlePageChange(value) {
const {salaryFileStore: {adjustRecordTaxAgentList}} = this.props;
adjustRecordTaxAgentList({username: this.state.searchValue, current: value})
}
// 搜索
handleSearch(value) {
const {salaryFileStore: {adjustRecordTaxAgentList}} = this.props;
adjustRecordTaxAgentList({username: value, current: 1})
}
getColumns(columns) {
let newColumns = [...columns]
newColumns.map(item => {
item.width = "120px"
if(item.dataIndex == "username") {
item.fixed = "left";
}
})
return newColumns;
2022-04-08 09:26:58 +08:00
}
2022-03-17 18:57:56 +08:00
render() {
2022-04-08 09:26:58 +08:00
const { salaryFileStore: {taxAgentList} } = this.props;
2022-04-27 19:27:23 +08:00
const { searchValue } = this.state
2022-04-08 09:26:58 +08:00
2022-03-17 18:57:56 +08:00
return (
<div className="salaryFileSlide">
<div className="searchBar">
2022-04-27 19:27:23 +08:00
<WeaInputSearch className="inputSearch" value={searchValue} onChange={(value) => {
this.setState({
searchValue: value
})
}} onSearch={(value) => {
this.handleSearch(value)
}}/>
2022-03-17 18:57:56 +08:00
</div>
<div className="tableWrapper">
2022-04-27 19:27:23 +08:00
<WeaTable
dataSource={taxAgentList.list}
columns={this.getColumns(taxAgentList.columns ? taxAgentList.columns : [])}
scroll={{x: this.getColumns(taxAgentList.columns ? taxAgentList.columns : []).length * 120}}
pagination={{
onChange: (value) => {
this.handlePageChange(value)
},
2022-04-27 19:27:23 +08:00
total: taxAgentList.total,
2022-05-30 17:30:53 +08:00
showTotal: (total) => `${total}`,
2022-04-27 19:27:23 +08:00
current: taxAgentList.pageNum
}}
/>
2022-03-17 18:57:56 +08:00
</div>
</div>
)
}
}