diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js
index 0551453c..57fbfa87 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js
@@ -1,5 +1,6 @@
import React from "react";
import { inject, observer } from "mobx-react";
+import { message } from "antd";
import { toJS } from "mobx";
import { WeaSearchGroup } from "ecCom";
import {
@@ -15,6 +16,12 @@ import "./index.less";
@inject("archivesStore")
@observer
export default class AccumulationFundForm extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ Welfare: ""
+ };
+ }
componentWillMount() {
const { archivesStore: { getBaseForm, getPaymentForm } } = this.props;
@@ -30,6 +37,7 @@ export default class AccumulationFundForm extends React.Component {
let form = { ...accumulationFundForm };
form.data = request;
setAccumulationFundForm(form);
+ key === "fundSchemeId" && this.setState({ Welfare: "" });
key === "fundSchemeId" && this.handleFetchPaymentForm(value);
key === "fundSchemeId" && onChangeRecordFundSchemeId(value);
};
@@ -37,7 +45,7 @@ export default class AccumulationFundForm extends React.Component {
// 获取基数表单
handleFetchPaymentForm = (fundName) => {
const { archivesStore: { getPaymentForm } } = this.props;
- getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization);
+ getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization, true);
};
handlePaymentChange = ({ key, value }) => {
const params = { [key]: !_.isNil(value) ? value.toString() : "" };
@@ -48,8 +56,36 @@ export default class AccumulationFundForm extends React.Component {
form.data = request;
setAccumulationFundPaymentForm(form);
};
+ handleChangeWelfare = (val) => {
+ const { archivesStore: { accumulationFundPaymentForm, setAccumulationFundPaymentForm } } = this.props;
+ let paymentData = toJS(accumulationFundPaymentForm.data);
+ const [paymentFormItems] = toJS(accumulationFundPaymentForm.items);
+ const { items } = paymentFormItems;
+ if (val) {
+ _.forEach(items, (it) => {
+ const { min, max, domkey } = it;
+ const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
+ if ((val < minNum || val > maxNum) && !_.isNil(min) && !_.isNil(max) && (!!maxNum || !!minNum)) {
+ message.warning("超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。");
+ paymentData = {
+ ...paymentData,
+ [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
+ };
+ } else {
+ paymentData = { ...paymentData, [domkey[0]]: val };
+ }
+ });
+ } else {
+ _.forEach(items, (it) => {
+ const { domkey } = it;
+ paymentData = { ...paymentData, [domkey[0]]: "" };
+ });
+ }
+ setAccumulationFundPaymentForm({ ...accumulationFundPaymentForm, data: { ...paymentData } });
+ };
render() {
+ const { Welfare } = this.state;
const { archivesStore: { accumulationFundForm, accumulationFundPaymentForm } } = this.props;
const { items, data: foundData } = accumulationFundForm;
const paymentData = accumulationFundPaymentForm.data;
@@ -124,7 +160,8 @@ export default class AccumulationFundForm extends React.Component {
max: child.max
})
}))}
- customComponent={}
+ customComponent={ this.setState({ Welfare })}
+ onBlurChange={this.handleChangeWelfare}/>}
title={title} col={2} showGroup
/>;
})
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js
index 4e4a3119..7944b3f7 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js
@@ -1,5 +1,6 @@
import React from "react";
import { inject, observer } from "mobx-react";
+import { message } from "antd";
import { WeaSearchGroup } from "ecCom";
import { toJS } from "mobx";
import {
@@ -17,7 +18,7 @@ export default class OtherForm extends React.Component {
constructor(props) {
super(props);
this.state = {
- inited: false
+ Welfare: ""
};
}
@@ -30,7 +31,7 @@ export default class OtherForm extends React.Component {
// 获取基数表单
handleFetchPaymentForm = (value) => {
const { archivesStore: { getPaymentForm } } = this.props;
- getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization);
+ getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization, true);
};
handleFormChange = ({ key, value }) => {
const params = { [key]: value };
@@ -40,6 +41,7 @@ export default class OtherForm extends React.Component {
let form = { ...otherForm };
form.data = request;
setOtherForm(form);
+ key === "otherSchemeId" && this.setState({ Welfare: "" });
key === "otherSchemeId" && this.handleFetchPaymentForm(value);
key === "otherSchemeId" && onChangeRecordOtherSchemeId(value);
};
@@ -53,7 +55,36 @@ export default class OtherForm extends React.Component {
setOtherPaymentForm(form);
};
+ handleChangeWelfare = (val) => {
+ const { archivesStore: { otherPaymentForm, setOtherPaymentForm } } = this.props;
+ let paymentData = toJS(otherPaymentForm.data);
+ const [paymentFormItems] = toJS(otherPaymentForm.items);
+ const { items } = paymentFormItems;
+ if (val) {
+ _.forEach(items, (it) => {
+ const { min, max, domkey } = it;
+ const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
+ if ((val < minNum || val > maxNum) && !_.isNil(min) && !_.isNil(max) && (!!maxNum || !!minNum)) {
+ message.warning("超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。");
+ paymentData = {
+ ...paymentData,
+ [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
+ };
+ } else {
+ paymentData = { ...paymentData, [domkey[0]]: val };
+ }
+ });
+ } else {
+ _.forEach(items, (it) => {
+ const { domkey } = it;
+ paymentData = { ...paymentData, [domkey[0]]: "" };
+ });
+ }
+ setOtherPaymentForm({ ...otherPaymentForm, data: { ...paymentData } });
+ };
+
render() {
+ const { Welfare } = this.state;
const { archivesStore: { otherForm, otherPaymentForm } } = this.props;
const { items, data: otherData } = otherForm;
let paymentData = otherPaymentForm.data;
@@ -109,7 +140,8 @@ export default class OtherForm extends React.Component {
max: child.max
})
}))}
- customComponent={}
+ customComponent={ this.setState({ Welfare })}
+ onBlurChange={this.handleChangeWelfare}/>}
title={title} col={2} showGroup
/>;
})
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js
index 2fdd8f4a..a378f168 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js
@@ -26,12 +26,7 @@ export default class SocialSecurityForm extends React.Component {
handleFormChange = ({ key, value }) => {
const params = { [key]: value };
const {
- archivesStore: {
- socialSecurityForm,
- setSocialSecurityForm,
- socialSecurityPaymentForm,
- setSocialSecurityPaymentForm
- },
+ archivesStore: { socialSecurityForm, setSocialSecurityForm },
onChangeRecordSchemeId
} = this.props;
const { data } = socialSecurityForm;
@@ -39,8 +34,6 @@ export default class SocialSecurityForm extends React.Component {
let form = { ...socialSecurityForm };
form.data = request;
setSocialSecurityForm(form);
- console.log(toJS(socialSecurityPaymentForm));
- key === "socialSchemeId" && setSocialSecurityPaymentForm({ ...toJS(socialSecurityPaymentForm) });
key === "socialSchemeId" && this.setState({ Welfare: "" });
key === "socialSchemeId" && this.handleFetchPaymentForm(value);
key === "socialSchemeId" && onChangeRecordSchemeId(value);
@@ -49,7 +42,7 @@ export default class SocialSecurityForm extends React.Component {
handleFetchPaymentForm = (value) => {
const { archivesStore: { getPaymentForm }, employeeId, record } = this.props;
const { paymentOrganization } = record;
- getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization);
+ getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization, true);
};
handlePaymentChange = ({ key, value }) => {
diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js
index db21b4e2..7ba4e492 100644
--- a/pc4mobx/hrmSalary/stores/archives.js
+++ b/pc4mobx/hrmSalary/stores/archives.js
@@ -166,7 +166,7 @@ export class ArchivesStore {
// 查询档案缴纳基数表单
@action
- getPaymentForm = (employeeId, welfareTypeEnum, schemeId, paymentOrganization = "") => {
+ getPaymentForm = (employeeId, welfareTypeEnum, schemeId, paymentOrganization = "", isChange = false) => {
API.getPaymentForm({ employeeId, welfareTypeEnum, schemeId, paymentOrganization }).then(res => {
if (res.status) {
let obj = {};
@@ -180,21 +180,63 @@ export class ArchivesStore {
};
});
}
- if (welfareTypeEnum == "SOCIAL_SECURITY") {
+ if (welfareTypeEnum === "SOCIAL_SECURITY") {
this.socialSecurityPaymentForm = res.data.data ? {
...res.data,
data: { ...obj, ...res.data.data }
} : { ...res.data, data: obj };
- } else if (welfareTypeEnum == "ACCUMULATION_FUND") {
+ if (isChange) {
+ const socialSecurityPaymentData = toJS(this.socialSecurityPaymentForm).data;
+ const socialSecurityPaymentItems = toJS(this.socialSecurityPaymentForm).items[0].items;
+ const tmpV = socialSecurityPaymentItems.reduce((pre, cur) => {
+ const { domkey, max, min } = cur;
+ const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
+ const val = socialSecurityPaymentData[domkey[0]];
+ return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
+ }, {});
+ this.setSocialSecurityPaymentForm({
+ ...toJS(this.socialSecurityPaymentForm),
+ data: { ...socialSecurityPaymentData, ...tmpV }
+ });
+ }
+ } else if (welfareTypeEnum === "ACCUMULATION_FUND") {
this.accumulationFundPaymentForm = res.data.data ? {
...res.data,
data: { ...obj, ...res.data.data }
} : { ...res.data, data: obj };
- } else if (welfareTypeEnum == "OTHER") {
+ if (isChange) {
+ const accumulationFundPaymentData = toJS(this.accumulationFundPaymentForm).data;
+ const accumulationFundPaymentItems = toJS(this.accumulationFundPaymentForm).items[0].items;
+ const tmpV = accumulationFundPaymentItems.reduce((pre, cur) => {
+ const { domkey, max, min } = cur;
+ const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
+ const val = accumulationFundPaymentData[domkey[0]];
+ return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
+ }, {});
+ this.setAccumulationFundPaymentForm({
+ ...toJS(this.accumulationFundPaymentForm),
+ data: { ...accumulationFundPaymentData, ...tmpV }
+ });
+ }
+ } else if (welfareTypeEnum === "OTHER") {
this.otherPaymentForm = res.data.data ? { ...res.data, data: { ...obj, ...res.data.data } } : {
...res.data,
data: obj
};
+ if (isChange) {
+ const otherPaymentData = toJS(this.otherPaymentForm).data;
+ const otherPaymentItems = toJS(this.otherPaymentForm).items[0].items;
+ const tmpV = otherPaymentItems.reduce((pre, cur) => {
+ const { domkey, max, min } = cur;
+ const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
+ const val = otherPaymentData[domkey[0]];
+ return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
+ }, {});
+ this.setOtherPaymentForm({
+ ...toJS(this.otherPaymentForm),
+ data: { ...otherPaymentData, ...tmpV }
+ });
+ }
}
}
});
@@ -229,7 +271,7 @@ export class ArchivesStore {
}
} else if (welfareType === "OTHER") {
baseForm = JSON.stringify(this.otherForm.data);
- if (this.otherForm.data.fundSchemeId) {
+ if (this.otherForm.data.otherSchemeId) {
const otherPaymentData = toJS(this.otherPaymentForm).data;
const otherPaymentItems = toJS(this.otherPaymentForm).items[0].items;
const payload = otherPaymentItems.reduce((pre, cur) => {