/* * Author: 黎永顺 * name: 新增调薪计薪规 * Description: * Date: 2022/12/12 */ import React, { Component } from "react"; import { WeaDialog, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; import { Button, Modal, Radio } from "antd"; import { monthDays } from "../config"; import { listSalarySobItem } from "../../../apis/ledger"; import "./index.less"; class LedgerAdjustRuleAddModal extends Component { constructor(props) { super(props); this.state = { beforeAdjustmentType: 2, afterAdjustmentType: 1, salaryItemId: "", salaryItemName: "", dayOfMonth: "1", salaryItemOptions: [] }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.salarySobId) this.listSalarySobItem(nextProps.salarySobId); } listSalarySobItem = (salarySobId) => { const { salaryRuleItemsList } = this.props; const payload = { excludeSalaryItemIds: _.map(salaryRuleItemsList, item => item.salaryItemId), salarySobId }; listSalarySobItem(payload).then(({ status, data }) => { if (status) { this.setState({ salaryItemOptions: _.map(data, it => ({ key: it.salaryItemId.toString(), showname: it.salaryItemName })) }); } }); }; handleSave = () => { const { salaryRuleItemsList, onSave } = this.props; const { salaryItemOptions, ...extraItems } = this.state; if (_.isEmpty(extraItems.salaryItemId)) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" }); return; } const items = { ...extraItems, salaryItemName: this.state.salaryItemName }; const { salaryItemName, salaryItemId, ...extraFileds } = items; const salaryItemNameFiled = salaryItemName.split(","), salaryItemIdFiled = salaryItemId.split(","); const fields = _.map(salaryItemNameFiled, (item, index) => { return { ...extraFileds, salaryItemName: item, salaryItemId: salaryItemIdFiled[index] }; }); this.handleReset(); onSave([...salaryRuleItemsList, ...fields]); }; handleReset = () => { this.setState({ beforeAdjustmentType: 2, afterAdjustmentType: 1, salaryItemId: "", salaryItemName: "", dayOfMonth: "1", salaryItemOptions: [] }, () => { const { onCancel } = this.props; onCancel(); }); }; render() { const { salaryItemId, salaryItemOptions, dayOfMonth, beforeAdjustmentType, afterAdjustmentType } = this.state; const { title, visible } = this.props; const buttons = []; return ( this.setState({ salaryItemId, salaryItemName })} /> } labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} colon={false}>
如果:调薪生效日期在 this.setState({ dayOfMonth })} /> (含)之前
计薪规则为: this.setState({ beforeAdjustmentType: e.target.value })} value={beforeAdjustmentType}> 取调整后薪资 分段计薪 取平均
否则:调薪生效日期在{dayOfMonth}号之后
计薪规则为: this.setState({ afterAdjustmentType: e.target.value })} value={afterAdjustmentType}> 取调整前薪资 分段计薪 取平均
); } } export default LedgerAdjustRuleAddModal; const AdjustTitle = () => { return
计薪规则 :
; };