salary-management-front/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/adjustmentDefaultSlide.js

127 lines
3.4 KiB
JavaScript

/*
* Author: 黎永顺
* name: 默认调差弹框
* Description:
* Date: 2022/12/27
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { Alert, message } from "antd";
import { WeaSlideModal, WeaTable } from "ecCom";
import SlideModalTitle from "../../../../components/slideModalTitle";
import { compensationConfigSave } from "../../../../apis/standingBook";
import "./index.less";
@inject("taxAgentStore")
@observer
class AdjustmentDefaultSlide extends Component {
constructor(props) {
super(props);
this.state = {
loading: false
};
}
handleSaveDefAdjustment = () => {
const { dataSource } = this.props;
const payload = _.map(dataSource, it => {
return {
paymentOrganization: it.paymentOrganization,
categoryType: it.categoryType,
welfareType: it.welfareType,
target: it.targetOptions[0].key,
adjustTo: it.adjustTo,
employeeId: it.employeeId
};
});
this.setState({ loading: true });
compensationConfigSave(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success("保存成功");
} else {
message.error(errormsg || "保存失败");
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { visible, onCancel, taxAgentStore: { showOperateBtn }, dataSource } = this.props;
const { loading } = this.state;
const columns = [
{
dataIndex: "target", title: "调差对象",
render: (text, record) => {
return (
<span>{_.map(record.targetOptions, it => it.showname).join(",")}</span>
);
}
},
{
dataIndex: "welfareType", title: "统计调差福利",
render: (text, record) => {
return (
<span>社保</span>
);
}
},
{
dataIndex: "categoryType", title: "统计调差福利类型(单位)",
render: (text, record) => {
return (
<span>{_.map(record.categoryTypeOptions, it => it.showname).join(",")}</span>
);
}
},
{
dataIndex: "adjustTo", title: "调差到(单位)",
render: (text, record) => {
return (
<span>{_.find(record.adjustToOptions, it => it.key === record.adjustTo).showname}</span>
);
}
}
];
return (
<WeaSlideModal
className="adjustDefSlideWrapper"
visible={visible}
top={0}
width={65}
height={100}
direction="right"
measure="%"
title={
<SlideModalTitle
subtitle="调差"
tabs={[]}
loading={loading}
showOperateBtn={showOperateBtn}
editable={true}
onSave={this.handleSaveDefAdjustment}
customOperate={[]}
/>
}
content={
<div>
<Alert
message="提示:请确保调差对象在下月还在职且缴纳方案不变,否则下月调差无法按默认设置自动统计"
type="warning"
showIcon
/>
<WeaTable
rowKey="id"
dataSource={dataSource}
pagination={false}
columns={columns}
/>
</div>
}
onClose={onCancel}
/>
);
}
}
export default AdjustmentDefaultSlide;