salary-management-front/pc4mobx/hrmSalary/pages/ledger/slideBaseForm.js

151 lines
8.3 KiB
JavaScript
Raw Normal View History

2022-03-15 17:50:54 +08:00
import React from 'react'
import { Row, Col } from 'antd'
2022-03-24 16:58:57 +08:00
import { WeaSelect, WeaTextarea, WeaInput, WeaCheckbox } from "ecCom"
2022-03-15 17:50:54 +08:00
import "./index.less"
import TipLabel from '../../components/TipLabel'
2022-03-24 16:58:57 +08:00
import { daysOptions, cycleTypeOption } from './options'
2022-03-30 20:04:34 +08:00
import { inject, observer } from 'mobx-react';
2022-04-06 14:26:16 +08:00
import RequiredLabelTip from "../../components/requiredLabelTip"
2022-04-27 19:27:23 +08:00
import { getCurrentYearMonth, getCurrentMonth, getSubtractMonthYearMonth, getAddMonthYearMonth} from '../../util/date'
2022-03-15 17:50:54 +08:00
2022-03-30 20:04:34 +08:00
@inject('ledgerStore')
@observer
2022-03-24 16:58:57 +08:00
export default class SlideBaseForm extends React.Component {
constructor(props) {
super(props)
this.state = {
name: "",
2022-03-30 20:04:34 +08:00
taxableItems: 1
}
}
componentWillMount() {
const { edit } = this.props;
2022-03-31 21:03:17 +08:00
const { ledgerStore: {initBaseInfoRequest}} = this.props;
2022-03-30 20:04:34 +08:00
if(edit) {
const { ledgerStore: { getLedgerBasicForm }} = this.props;
getLedgerBasicForm()
2022-03-31 21:03:17 +08:00
} else {
initBaseInfoRequest();
2022-03-24 16:58:57 +08:00
}
2022-03-15 17:50:54 +08:00
}
2022-03-24 16:58:57 +08:00
handleChange(params) {
2022-03-30 20:04:34 +08:00
const { ledgerStore: {baseInfoRequest, setBaseInfoRequest}} = this.props;
let request= {...baseInfoRequest}
Object.keys(params).map(key => {
request[key] = params[key]
})
setBaseInfoRequest(request)
2022-03-24 16:58:57 +08:00
}
2022-04-27 19:27:23 +08:00
// 获取开始日期
getStartDate(salaryCycleType, day) {
day = Number(day)
return this.getMonth(salaryCycleType) + "-" + (day < 10 ? "0" + day : day)
}
// 获取开始月份
getMonth(salaryCycleType) {
switch(salaryCycleType) {
case "1": // 上上月
return getSubtractMonthYearMonth(2)
case "2": // 上月
return getSubtractMonthYearMonth(1)
case "3": // 本月
return getCurrentYearMonth()
case "4": // 下月
return getAddMonthYearMonth(1)
}
}
2022-03-15 17:50:54 +08:00
render() {
2022-03-30 20:04:34 +08:00
const { request, ledgerStore } = this.props;
const { baseInfoRequest } = ledgerStore;
2022-03-24 16:58:57 +08:00
const { name, taxableItems, salaryCycleType, salaryCycleFromDay,
taxCycleType, attendCycleType, attendCycleFromDay, socialSecurityCycleType,
2022-03-30 20:04:34 +08:00
description} = baseInfoRequest
2022-03-15 17:50:54 +08:00
return (
<div className="slideBaseForm">
<Row>
<Col span={18}>
<div className="leftContentWrapper">
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>账套名称<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaInput style={{width: "190px"}} value={name} onChange={(value) => {this.handleChange({name: value})}}/>
2022-03-15 17:50:54 +08:00
</Col>
</Row>
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>薪资类型<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
<WeaSelect options={[{
key: "1",
selected: true,
2022-03-24 16:58:57 +08:00
showname: "正常工资薪金所得"
}]} style={{width: "190px"}} value={taxableItems} onChange={(value) => {this.handleChange({taxableItems: value})}}/>
2022-03-15 17:50:54 +08:00
</Col>
</Row>
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>薪资周期<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaSelect options={cycleTypeOption} style={{width: "90px"}} value={salaryCycleType} onChange={(value) => {this.handleChange({salaryCycleType: value})}}/>
<WeaSelect options={daysOptions} style={{width: "90px", marginLeft: '10px'}} value={salaryCycleFromDay} onChange={(value) => {this.handleChange({salaryCycleFromDay: value})}}/>
2022-03-15 17:50:54 +08:00
<span style={{marginLeft: "10px"}}>至本月最后一天</span>
</Col>
</Row>
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>税款所属期<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaSelect options={cycleTypeOption} style={{width: "90px"}} value={taxCycleType} onChange={(value) => {this.handleChange({taxCycleType: value})}}/>
2022-03-15 17:50:54 +08:00
</Col>
</Row>
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>考勤周期<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaSelect options={cycleTypeOption} style={{width: "90px"}} value={attendCycleType} onChange={(value) => {this.handleChange({attendCycleType: value})}}/>
<WeaSelect options={daysOptions} style={{width: "90px", marginLeft: "10px"}} value={attendCycleFromDay} onChange={(value) => {this.handleChange({attendCycleFromDay: value})}}/>
2022-03-15 17:50:54 +08:00
<span style={{marginLeft: "10px"}}>至本月最后一天</span>
</Col>
</Row>
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>福利台账月份<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaSelect options={cycleTypeOption} style={{width: "90px"}} value={socialSecurityCycleType} onChange={(value) => {this.handleChange({socialSecurityCycleType: value})}}/>
2022-03-15 17:50:54 +08:00
</Col>
</Row>
2022-03-24 16:58:57 +08:00
2022-03-15 17:50:54 +08:00
<Row className="formItem">
2022-04-06 14:26:16 +08:00
<Col span={6}>核算人员范围<RequiredLabelTip /></Col>
2022-03-15 17:50:54 +08:00
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaCheckbox value={true} viewAttr={1} content="【入职日期≤薪资周期止】且【离职日期≥薪资周期起】" />
2022-03-15 17:50:54 +08:00
</Col>
</Row>
<Row className="formItem">
<Col span={6}>备注</Col>
<Col span={18}>
2022-03-24 16:58:57 +08:00
<WeaTextarea style={{width: "190px"}} value={description} onChange={(value) => {this.handleChange({description: value})}} />
2022-03-15 17:50:54 +08:00
</Col>
</Row>
</div>
</Col>
<Col span={6}>
<div className="rightContentWrapper">
<TipLabel title="月份周期说明">
2022-04-27 19:27:23 +08:00
<p className="greytip">薪资所属月是<span className="higelinered">{getCurrentYearMonth()}</span><span className="higelinered">{getCurrentMonth()}</span></p>
2022-03-15 17:50:54 +08:00
<p className="greytip">根据您当前的选择相应的周期为</p>
<div className="tipLabel">薪资周期</div>
2022-04-27 19:27:23 +08:00
<p className="greytip"><span className="higelinered">{this.getStartDate(salaryCycleType, salaryCycleFromDay)}</span><span className="higelinered">{this.getMonth(salaryCycleType)}-30</span></p>
2022-03-15 17:50:54 +08:00
<div className="tipLabel">税款所属期</div>
2022-04-27 19:27:23 +08:00
<p className="greytip higelinered">{this.getMonth(taxCycleType)}</p>
2022-03-15 17:50:54 +08:00
<div className="tipLabel">考勤取值周期</div>
2022-04-27 19:27:23 +08:00
<p className="greytip"><span className="higelinered">{this.getStartDate(attendCycleType, attendCycleFromDay)}</span><span className="higelinered">{this.getMonth(attendCycleType)}-30</span></p>
2022-03-15 17:50:54 +08:00
<div className="tipLabel">福利台账月份</div>
2022-04-27 19:27:23 +08:00
<p className="greytip">引用<span className="higelinered">{this.getMonth(socialSecurityCycleType)}</span></p>
2022-03-15 17:50:54 +08:00
</TipLabel>
</div>
</Col>
</Row>
</div>
)
}
}