调差保存默认

This commit is contained in:
黎永顺 2022-12-27 13:46:00 +08:00
parent 8fa65f4efb
commit 506490116f
5 changed files with 190 additions and 29 deletions

View File

@ -323,6 +323,10 @@ export const getCompensationComTotal = (params) => {
export const compensationSave = (params) => {
return postFetch("/api/bs/hrmsalary/siaccount/compensationSave", params);
};
//社保调差默认配置保存
export const compensationConfigSave = (params) => {
return postFetch("/api/bs/hrmsalary/siaccount/compensationConfigSave", params);
};
//撤回调差数据
export const compensationBack = (params) => {
return postFetch("/api/bs/hrmsalary/siaccount/compensationBack", params);

View File

@ -69,7 +69,7 @@ class AdjustTable extends Component {
adjustTo: it.adjustTo.toString(),
adjustToOptions: _.map(it.categoryTypeOptions, child => ({ key: child.id, showname: child.content })),
categoryTypeOptions: _.map(it.categoryTypeOptions, child => ({ key: child.id, showname: child.content })),
targetOptions: _.map(it.targetOptions, child => ({ key: child.id, showname: child.name }))
targetOptions: _.map([it.targetOptions], child => ({ key: child.id, showname: child.name }))
};
}),
columns: _.map(columns, item => {

View File

@ -0,0 +1,126 @@
/*
* 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.target,
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;

View File

@ -10,9 +10,10 @@ import { WeaSlideModal } from "ecCom";
import { Button, message, Modal } from "antd";
import SlideModalTitle from "../../../../components/slideModalTitle";
import AdjustTable from "./adjustTable";
import "./index.less";
import { getQueryString } from "../../../../util/url";
import { compensationSave } from "../../../../apis/standingBook";
import AdjustmentDefaultSlide from "./adjustmentDefaultSlide";
import "./index.less";
@inject("taxAgentStore")
@ -23,7 +24,11 @@ class AdjustmentSlide extends Component {
this.state = {
current: 0,
loading: false,
taxAgentId: ""
taxAgentId: "",
adjustDefSlide: {
visible: false,
dataSource: []
}
};
this.adjustTableRef = null;
}
@ -76,37 +81,63 @@ class AdjustmentSlide extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
handleSetasDefault = () => {
const { adjustDefSlide } = this.state;
this.setState({
adjustDefSlide: {
...adjustDefSlide,
visible: true,
dataSource: _.filter(this.adjustTableRef.state.dataSource, it => it.status)
}
})
;
};
renderCustomOperate = () => {
return [
<Button type="primary" onClick={this.handleSave}>保存全部</Button>
<Button type="primary" onClick={this.handleSave}>保存全部</Button>,
<Button type="ghost" onClick={this.handleSetasDefault}>设为默认</Button>
];
};
render() {
const { title, visible, onCancel, taxAgentStore: { showOperateBtn } } = this.props;
const { loading } = this.state;
const { loading, adjustDefSlide } = this.state;
return (
<WeaSlideModal
className="adjustmentWrapper"
visible={visible}
top={0}
width={100}
height={100}
direction="right"
measure="%"
title={
<SlideModalTitle
subtitle={title}
tabs={[]}
loading={loading}
showOperateBtn={showOperateBtn}
editable={false}
customOperate={this.renderCustomOperate()}
/>
}
content={<AdjustTable ref={dom => this.adjustTableRef = dom} visible={visible}/>}
onClose={onCancel}
/>
<div>
<WeaSlideModal
className="adjustmentWrapper"
visible={visible}
top={0}
width={100}
height={100}
direction="right"
measure="%"
title={
<SlideModalTitle
subtitle={title}
tabs={[]}
loading={loading}
showOperateBtn={showOperateBtn}
editable={false}
customOperate={this.renderCustomOperate()}
/>
}
content={<AdjustTable ref={dom => this.adjustTableRef = dom} visible={visible}/>}
onClose={onCancel}
/>
<AdjustmentDefaultSlide
{...adjustDefSlide}
onCancel={() => {
this.setState({
adjustDefSlide: {
...adjustDefSlide,
visible: false,
dataSource: []
}
});
}}
/>
</div>
);
}
}

View File

@ -107,7 +107,7 @@
}
//调差抽屉
.adjustmentWrapper {
.adjustmentWrapper, .adjustDefSlideWrapper {
.wea-slide-modal-title {
height: initial;
line-height: initial;
@ -131,7 +131,7 @@
}
@media (min-width: 1260px) {
.adjustmentWrapper {
.adjustmentWrapper, .adjustDefSlideWrapper {
.reqTopWrapper .wea-new-top-req-title > div:first-child > div {
max-width: 100% !important;
}
@ -139,7 +139,7 @@
}
@media screen and (min-width: 1060px) and (max-width: 1260px) {
.adjustmentWrapper {
.adjustmentWrapper, .adjustDefSlideWrapper {
.reqTopWrapper .wea-new-top-req-title > div:first-child > div {
max-width: calc(100% - 96px) !important;
}