补缴新增功能完成

This commit is contained in:
黎永顺 2023-01-03 16:46:26 +08:00
parent 9101769934
commit a7daf5e3c0
4 changed files with 307 additions and 5 deletions

View File

@ -0,0 +1,64 @@
/*
* Author: 黎永顺
* name: 按补缴人员的历史月份核算基数和当前档案方案核算
* Description:
* Date: 2023/1/3
*/
import React, { Component } from "react";
import { WeaInputNumber, WeaSearchGroup } from "ecCom";
import "./index.less";
class BusinessAccounting extends Component {
renderBaseItem = (dataSource = [], type) => {
return <ul className="baseFieldItemWrapper">
{
_.map(dataSource, it => {
const { insuranceName, insuranceBase } = it;
return <li>
<div>{insuranceName}</div>
<div>
<WeaInputNumber
value={insuranceBase} min={0}
precision={2} onChange={(val) => this.handleChangeBaseItem(it, val, type)}
/>
</div>
</li>;
})
}
</ul>;
};
handleChangeBaseItem = (item, value, type) => {
const { onChangeBaseItem, socialSecurityBase, fundBase, otherBase } = this.props;
_.map(this.props[type], it => {
if (item.insuranceId === it.insuranceId) {
it.insuranceBase = value;
}
});
onChangeBaseItem(socialSecurityBase, fundBase, otherBase);
};
render() {
const { socialSecurityBase, fundBase, otherBase } = this.props;
return (
<div>
{
!_.isEmpty(socialSecurityBase) &&
<WeaSearchGroup title="社保补缴基数" showGroup
col={1}>{this.renderBaseItem(socialSecurityBase, "socialSecurityBase")}</WeaSearchGroup>
}
{
!_.isEmpty(fundBase) &&
<WeaSearchGroup title="公积金补缴基数" showGroup
col={1}>{this.renderBaseItem(fundBase, "fundBase")}</WeaSearchGroup>
}
{
!_.isEmpty(otherBase) &&
<WeaSearchGroup title="其他福利补缴基数" showGroup
col={1}>{this.renderBaseItem(otherBase, "otherBase")}</WeaSearchGroup>
}
</div>
);
}
}
export default BusinessAccounting;

View File

@ -114,6 +114,10 @@
text-align: left;
}
.wea-slide-modal-title + div {
padding-bottom: 70px !important;
}
.rodal-close {
z-index: 99;
top: 10px !important;
@ -145,3 +149,32 @@
}
}
}
//补缴新增
.baseFieldItemWrapper {
border: 1px solid #e5e5e5;
border-bottom: none;
& > li {
border-bottom: 1px solid #e5e5e5;
padding: 5px 16px;
display: flex;
align-items: center;
& > div:first-child {
width: 25%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #666;
}
& > div:last-child {
flex: 1;
.wea-input-number {
width: 20% !important;
}
}
}
}

View File

@ -0,0 +1,82 @@
/*
* Author: 黎永顺
* name: 手动输入补缴金额
* Description:
* Date: 2023/1/3
*/
import React, { Component } from "react";
import { WeaInputNumber, WeaSearchGroup, WeaTable } from "ecCom";
class InputPaymentAmount extends Component {
renderInputItem = (dataSource = [], type) => {
const columns = [
{
dataIndex: "insuranceName", title: "福利项"
},
{
dataIndex: "per", title: "个人缴纳金额",
render: (text, record) => {
return (
<WeaInputNumber
value={record[`${record.insuranceId}_per`]} min={0}
precision={2} onChange={(val) => this.handleChangeBaseItem(record, val, type, "per")}
/>
);
}
},
{
dataIndex: "com", title: "单位缴纳金额",
render: (text, record) => {
return (
<WeaInputNumber
value={record[`${record.insuranceId}_com`]} min={0}
precision={2} onChange={(val) => this.handleChangeBaseItem(record, val, type, "com")}
/>
);
}
}
];
return <WeaTable
rowKey="insuranceId"
dataSource={dataSource}
pagination={false}
columns={columns}
/>;
};
handleChangeBaseItem = (item, value, type, paymentType) => {
const { onChangeInputItem, socialPayment, fundPayment, otherPayment } = this.props;
_.map(this.props[type], it => {
const key = `${it.insuranceId}_${paymentType}`;
if (item.insuranceId === it.insuranceId) {
_.assign(it, { [key]: value });
}
});
onChangeInputItem(socialPayment, fundPayment, otherPayment);
};
render() {
const { socialPayment, fundPayment, otherPayment } = this.props;
return (
<div>
{
!_.isEmpty(socialPayment) &&
<WeaSearchGroup title="社保" showGroup
col={1}>{this.renderInputItem(socialPayment, "socialPayment")}</WeaSearchGroup>
}
{
!_.isEmpty(fundPayment) &&
<WeaSearchGroup title="公积金" showGroup
col={1}>{this.renderInputItem(fundPayment, "fundPayment")}</WeaSearchGroup>
}
{
!_.isEmpty(otherPayment) &&
<WeaSearchGroup title="企业年金及其他福利" showGroup
col={1}>{this.renderInputItem(otherPayment, "otherPayment")}</WeaSearchGroup>
}
</div>
);
}
}
export default InputPaymentAmount;

View File

@ -13,6 +13,8 @@ import { Picker, SelectWithAll } from "./regAddEmployee";
import { Browser } from "../../../dataAcquisition/addItems";
import { getPaymentGroup, getSupplementPaymentForm, siaccountSupplementarySave } from "../../../../apis/standingBook";
import "./index.less";
import BusinessAccounting from "./businessAccounting";
import InputPaymentAmount from "./inputPaymentAmount";
@inject("taxAgentStore")
@observer
@ -29,10 +31,88 @@ class SupplementarySlide extends Component {
projects: "",
billMonthList: "",
historyMonth: ""
},
businessAccounting: {
socialSecurityBase: [],
fundBase: [],
otherBase: []
},
inputPaymentAmount: {
socialPayment: [],
fundPayment: [],
otherPayment: []
}
};
}
/*
* Author: 黎永顺
* Description: 按补缴人员的历史月份核算基数和当前档案方案核算 数据转换
* Params: socialSecurityBase fundBase otherBase
* Date: 2023/1/3
*/
convertBusinessAccounting = () => {
let payload = { socialPaymentBaseString: {}, fundPaymentBaseString: {}, otherPaymentBaseString: {} };
const { businessAccounting } = this.state;
_.map(Object.keys(businessAccounting), item => {
_.map(businessAccounting[item], child => {
const key = child.insuranceId, value = child.insuranceBase;
_.assign(
payload[item === "socialSecurityBase" ? "socialPaymentBaseString" : item === "fundBase" ? "fundPaymentBaseString" : "otherPaymentBaseString"],
{ [key]: value ? value.toString() : "" }
);
});
});
for (let i in payload) {
_.assign(payload, { [i]: JSON.stringify(payload[i]) });
}
return payload;
};
/*
* Author: 黎永顺
* Description: 动输入补缴金额数据整改
* Params:
* Date: 2023/1/3
*/
convertInputPaymentAmount = () => {
let payload = {
socialPaymentPerString: {},
socialPaymentComString: {},
fundPaymentPerString: {},
fundPaymentComString: {},
otherPaymentPerString: {},
otherPaymentComString: {}
};
const { inputPaymentAmount } = this.state;
_.map(Object.keys(inputPaymentAmount), item => {
_.map(inputPaymentAmount[item], child => {
const key = child.insuranceId, valuePer = child[`${child.insuranceId}_per`],
valueCom = child[`${child.insuranceId}_com`];
_.assign(payload[`${item}PerString`], { [key]: valuePer ? valuePer.toString() : "" });
_.assign(payload[`${item}ComString`], { [key]: valueCom ? valueCom.toString() : "" });
});
});
for (let i in payload) {
_.assign(payload, { [i]: JSON.stringify(payload[i]) });
}
return payload;
};
convertData = (dataSource) => {
let endList = [];
_.values(_.groupBy(dataSource, "insuranceName")).forEach((itemList) => {
let data = {};
itemList.forEach(d => {
const perKey = `${d.insuranceId}_per`, comKey = `${d.insuranceId}_com`;
data = _.assign(data, {
...d,
[perKey]: "",
[comKey]: ""
});
});
return endList.push(data);
});
return endList;
};
handleSaveSupplementSalary = () => {
const { billMonth, paymentOrganization, onCancel } = this.props;
const { baseInfo } = this.state;
@ -50,7 +130,9 @@ class SupplementarySlide extends Component {
billMonth,
paymentOrganization,
billMonthList: billMonthList.split(","),
includes: includes.split(",")
includes: includes.split(","),
...this.convertBusinessAccounting(),
...this.convertInputPaymentAmount()
};
this.setState({ loading: true });
siaccountSupplementarySave(payload).then(({ status, errormsg }) => {
@ -72,6 +154,11 @@ class SupplementarySlide extends Component {
projectsAll: "",
projects: "",
billMonthList: ""
},
businessAccounting: {
socialSecurityBase: [],
fundBase: [],
otherBase: []
}
});
};
@ -89,7 +176,13 @@ class SupplementarySlide extends Component {
};
getSupplementPaymentForm(payload).then(({ status, data, errormsg }) => {
if (status) {
this.setState({
businessAccounting: {
socialSecurityBase: _.filter(data, it => it.title === "社保"),
fundBase: _.filter(data, it => it.title === "公积金"),
otherBase: _.filter(data, it => it.title === "企业年金及其它福利")
}
});
} else {
message.error(errormsg || "");
}
@ -102,16 +195,36 @@ class SupplementarySlide extends Component {
employeeId: Number(includes),
projects: projectsAll ? projectsAll.split(",").concat(projects.split(",")) : projects.split(",")
};
getPaymentGroup(payload).then((status, data) => {
console.log(data);
getPaymentGroup(payload).then(({ status, data, errormsg }) => {
if (status) {
this.setState({
inputPaymentAmount: {
socialPayment: this.convertData(_.filter(data, it => it.title === "社保")),
fundPayment: this.convertData(_.filter(data, it => it.title === "公积金")),
otherPayment: this.convertData(_.filter(data, it => it.title === "企业年金及其它福利"))
}
});
} else {
message.error(errormsg || "");
}
});
}
}
};
handleChangeBaseFieldItem = (socialSecurityBase, fundBase, otherBase) => {
this.setState({
businessAccounting: { socialSecurityBase, fundBase, otherBase }
});
};
handleChangeInputItem = (socialPayment, fundPayment, otherPayment) => {
this.setState({
inputPaymentAmount: { socialPayment, fundPayment, otherPayment }
});
};
render() {
const { title, visible, onCancel, taxAgentStore: { showOperateBtn } } = this.props;
const { baseInfo, loading } = this.state;
const { baseInfo, loading, businessAccounting, inputPaymentAmount } = this.state;
const baseItems = [
{
com: Browser({
@ -256,6 +369,16 @@ class SupplementarySlide extends Component {
items={baseInfo.supplementType === "2" ? [...baseItems, ...baseExtraItems] : baseItems}
showGroup col={1}
/>
{/* 按补缴人员的历史月份核算基数和当前档案方案核算 */}
{
baseInfo.supplementType === "2" &&
<BusinessAccounting {...businessAccounting} onChangeBaseItem={this.handleChangeBaseFieldItem}/>
}
{/* 动输入补缴金额 */}
{
baseInfo.supplementType === "3" &&
<InputPaymentAmount {...inputPaymentAmount} onChangeInputItem={this.handleChangeInputItem}/>
}
</div>
}
onClose={() => {