salary-management-front/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js

153 lines
5.8 KiB
JavaScript
Raw Normal View History

2022-03-11 10:44:42 +08:00
import React from 'react';
import { Row, Col, Table, DatePicker } from "antd"
import { inject, observer } from 'mobx-react';
import { WeaInput, WeaTextarea, WeaSearchGroup, WeaSelect } from "ecCom";
import { slideColumns} from './columns';
import "./editSlideContent.less"
import { WeaTableNew } from "comsMobx"
const WeaTable = WeaTableNew.WeaTable;
import moment from 'moment'
const { MonthPicker } = DatePicker;
let emptyItem = {
incomeLowerLimit: "0.00",
incomeUpperLimit: "0.00",
dutyFreeValue: "0.00",
dutyFreeRate: "0.00",
taxableIncomeLl: "0.00",
taxableIncomeUl: "0.00",
taxRate: "0.00",
taxDeduction: "0.00"
}
2022-03-11 17:19:25 +08:00
@inject('otherDeductStore', "taxAgentStore")
2022-03-11 10:44:42 +08:00
@observer
export default class EditSlideContent extends React.Component {
constructor(props) {
super(props);
this.state = {
taxAgentId: "",
2022-05-13 15:25:21 +08:00
startDate: "",
endDate: "",
editable: this.props.editable === undefined ? "true": this.props.editable
2022-03-11 10:44:42 +08:00
}
}
componentWillMount() { // 初始化渲染页面
const { taxAgentStore: { fetchTaxAgentOption } } = this.props;
fetchTaxAgentOption();
}
addItem() {
const { taxRateStore: {setDataSource}} = this.props;
let dataSource = [...this.props.taxRateStore.dataSource];
let indexNum = 1;
if(dataSource.length > 0) {
indexNum = dataSource[dataSource.length - 1].indexNum + 1
}
let item = {...emptyItem}
item.indexNum = indexNum
dataSource.push(item);
setDataSource(dataSource)
}
fetchCumDeductDetailList(param) {
2022-03-11 17:19:25 +08:00
const { otherDeductStore} = this.props;
const { getOtherDeductDetailList, currentRecord } = otherDeductStore;
getOtherDeductDetailList(currentRecord.id, param);
2022-03-11 10:44:42 +08:00
}
2022-05-13 15:25:21 +08:00
// 日期格式变化加载数据
handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) {
let declareMonth = []
if(startDate != "" && startDate != undefined) {
declareMonth.push(startDate);
}
if(endDate != "" && endDate != undefined) {
declareMonth.push(endDate);
}
let item = {
taxAgentId: taxAgentId
}
if(declareMonth.length != 0) {
item.declareMonth = declareMonth
}
this.fetchCumDeductDetailList(item)
}
2022-03-11 10:44:42 +08:00
render() {
const { taxAgentStore: {taxAgentOption}} = this.props;
2022-03-11 17:19:25 +08:00
const { otherDeductStore } = this.props;
const { slideTableStore, currentRecord } = otherDeductStore;
2022-03-11 10:44:42 +08:00
const { startDate, endDate, taxAgentId } = this.state;
return (
<div className="cumDeductSlide">
<Row className="topLabelBar">
<Col span={4}>
<span className="username">{currentRecord.username}</span>
</Col>
<Col span={12}>
<span className="formLabel">申报月份</span>
<div className="weaRangePickerWrapper">
<div className="monthPickerWrapper">
<MonthPicker width={100} format="YYYY-MM" value={startDate}
onChange={(v) => {
2022-05-13 15:25:21 +08:00
let startDate = "";
if(v != "" && v!= undefined) {
startDate = moment(v).format("YYYY-MM")
}
2022-03-11 10:44:42 +08:00
this.setState({startDate})
2022-05-13 15:25:21 +08:00
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
2022-03-11 10:44:42 +08:00
}}
/>
</div>
<span className="betweenLable">
</span>
<div className="monthPickerWrapper">
<MonthPicker width={100}
value={endDate}
onChange={(v) => {
2022-05-13 15:25:21 +08:00
let endDate = ""
if(v != "" && v!= undefined) {
endDate = moment(v).format("YYYY-MM")
}
2022-03-11 10:44:42 +08:00
this.setState({endDate})
2022-05-13 15:25:21 +08:00
this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId)
2022-03-11 10:44:42 +08:00
}}
/>
</div>
</div>
</Col>
<Col span={8}>
<span className="formLabel">个税扣缴义务人</span>
<WeaSelect
showSearch // 设置select可搜索
style={{ width: 100 }}
options={taxAgentOption}
value={taxAgentId}
onChange={v => {
this.setState({taxAgentId: v})
2022-05-13 15:25:21 +08:00
this.handleFetchCumDeductDetailList(startDate, endDate, v)
2022-03-11 10:44:42 +08:00
}}
/>
</Col>
</Row>
<div>
<WeaTable // table内部做了loading加载处理页面就不需要再加了
comsWeaTableStore={slideTableStore} // table store
hasOrder={true} // 是否启用排序
needScroll={true} // 是否启用table内部列表滚动将自适应到父级高度
2022-05-10 15:31:13 +08:00
scroll={{x: slideTableStore.columns.length * 100}}
2022-03-11 10:44:42 +08:00
/>
</div>
</div>
)
}
}