diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/addCompensationPersonnelDialog.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/addCompensationPersonnelDialog.js index 34b7edb4..33ee9267 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/addCompensationPersonnelDialog.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/addCompensationPersonnelDialog.js @@ -101,7 +101,8 @@ class AddCompensationPersonnelDialog extends Component { type: "custom", key: "custom", render: (text, record, index, onEdit) => ( - onEdit({ record: { ...record, [`${record.insuranceId}_per`]: v }, index, key: "per", value: v @@ -122,7 +123,8 @@ class AddCompensationPersonnelDialog extends Component { type: "custom", key: "custom", render: (text, record, index, onEdit) => ( - onEdit({ record: { ...record, [`${record.insuranceId}_com`]: v }, index, key: "com", value: v @@ -166,10 +168,10 @@ class AddCompensationPersonnelDialog extends Component { let perJson = {}, comJson = {}; _.forEach(list, o => { if (!_.isNil(o.per)) { - perJson = _.assign(perJson, { [o.insuranceId]: toDecimal_n(o.per, 2) }); + perJson = _.assign(perJson, { [o.insuranceId]: toDecimal_n(o.per, o.perValidNum || 2) }); } if (!_.isNil(o.com)) { - comJson = _.assign(comJson, { [o.insuranceId]: toDecimal_n(o.com, 2) }); + comJson = _.assign(comJson, { [o.insuranceId]: toDecimal_n(o.com, o.comValidNum ||2) }); } }); return { [`${type}PerJson`]: JSON.stringify(perJson), [`${type}ComJson`]: JSON.stringify(comJson) }; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/inputPaymentAmount.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/inputPaymentAmount.js index 44eddfe0..d9a91166 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/inputPaymentAmount.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/inputPaymentAmount.js @@ -20,7 +20,8 @@ class InputPaymentAmount extends Component { return ( this.handleChangeBaseItem(record, val, type, "per")} + precision={parseFloat(record.perValidNum || 2)} + onChange={(val) => this.handleChangeBaseItem(record, val, type, "per")} /> ); } @@ -31,7 +32,8 @@ class InputPaymentAmount extends Component { return ( this.handleChangeBaseItem(record, val, type, "com")} + precision={parseFloat(record.comValidNum || 2)} + onChange={(val) => this.handleChangeBaseItem(record, val, type, "com")} /> ); } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regEditDetial.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regEditDetial.js index ef41880a..b1271972 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regEditDetial.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regEditDetial.js @@ -24,70 +24,19 @@ class RegEditDetial extends Component { key: "social", label: "社保", dataSource: [], - columns: _.map(regColumns, item => { - if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { - return { - ...item, - render: (text, record) => { - return ( - this.handleChange("social", item.dataIndex, v, record)} - /> - ); - } - }; - } - return { ...item }; - }) + columns: [] }, { key: "fund", label: "公积金", dataSource: [], - columns: _.map(regColumns, item => { - if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { - return { - ...item, - render: (text, record) => { - return ( - this.handleChange("fund", item.dataIndex, v, record)} - /> - ); - } - }; - } - return { ...item }; - }) + columns: [] }, { key: "other", label: "企业年金及其他福利", dataSource: [], - columns: _.map(regColumns, item => { - if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { - return { - ...item, - render: (text, record) => { - return ( - this.handleChange("other", item.dataIndex, v, record)} - /> - ); - } - }; - } - return { ...item }; - }) + columns: [] } ] }; @@ -113,27 +62,28 @@ class RegEditDetial extends Component { otherComJson: {} }; _.forEach(socialData.dataSource, item => { + console.log(item) if (item.personalPaymentAmount) { - payload["socialPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, 2); + payload["socialPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, item.personalPaymentAmountValidNum || 2); } if (item.companyPaymentAmount) { - payload["socialComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, 2); + payload["socialComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, item.companyPaymentAmountValidNum || 2); } }); _.forEach(foundData.dataSource, item => { if (item.personalPaymentAmount) { - payload["fundPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, 2); + payload["fundPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, item.personalPaymentAmountValidNum || 2); } if (item.companyPaymentAmount) { - payload["fundComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, 2); + payload["fundComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, item.companyPaymentAmountValidNum || 2); } }); _.forEach(otherData.dataSource, item => { if (item.personalPaymentAmount) { - payload["otherPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, 2); + payload["otherPerJson"][item["insuranceId"]] = toDecimal_n(item.personalPaymentAmount, item.personalPaymentAmountValidNum || 2); } if (item.companyPaymentAmount) { - payload["otherComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, 2); + payload["otherComJson"][item["insuranceId"]] = toDecimal_n(item.companyPaymentAmount, item.companyPaymentAmountValidNum || 2); } }); _.forEach(Object.keys(payload), item => { @@ -214,11 +164,70 @@ class RegEditDetial extends Component { const social = this.combinedData(socialSecurity, result); const fund = this.combinedData(accumulationFund, result); const other = this.combinedData(otherBenefits, result); + console.log(social) this.setState({ - listMap: [{ ...socialData, dataSource: social }, { ...foundData, dataSource: fund }, { - ...otherData, - dataSource: other - }] + listMap: [ + { + ...socialData, dataSource: social, columns: _.map(regColumns, item => { + if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { + return { + ...item, + render: (text, record) => { + return ( + this.handleChange("social", item.dataIndex, v, record)} + /> + ); + } + }; + } + return { ...item }; + }) + }, + { + ...foundData, dataSource: fund, columns: _.map(regColumns, item => { + if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { + return { + ...item, + render: (text, record) => { + return ( + this.handleChange("fund", item.dataIndex, v, record)} + /> + ); + } + }; + } + return { ...item }; + }) + }, + { + ...otherData, dataSource: other, columns: _.map(regColumns, item => { + if (item.dataIndex === "personalPaymentAmount" || item.dataIndex === "companyPaymentAmount") { + return { + ...item, + render: (text, record) => { + return ( + this.handleChange("other", item.dataIndex, v, record)} + /> + ); + } + }; + } + return { ...item }; + }) + } + ] }); } }); @@ -230,9 +239,15 @@ class RegEditDetial extends Component { let obj = { benefits: item }; _.forEach(data, it => { if (item === it.insuranceName && it.paymentScopeSign === "per") { - obj = _.assign(obj, { ...it, personalPaymentAmount: it.insuranceValue }); + obj = _.assign(obj, { + ...it, personalPaymentAmount: it.insuranceValue, + personalPaymentAmountValidNum: it.validNum + }); } else if (item === it.insuranceName && it.paymentScopeSign === "com") { - obj = _.assign(obj, { ...it, companyPaymentAmount: it.insuranceValue }); + obj = _.assign(obj, { + ...it, companyPaymentAmount: it.insuranceValue, + companyPaymentAmountValidNum: it.validNum + }); } }); return obj; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/supplementarySlide.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/supplementarySlide.js index 8881cc39..3719461f 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/supplementarySlide.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/supplementarySlide.js @@ -92,10 +92,10 @@ class SupplementarySlide extends Component { const key = child.insuranceId, valuePer = child[`${child.insuranceId}_per`], valueCom = child[`${child.insuranceId}_com`]; if (!child.perDisabled) { - _.assign(payload[`${item}PerString`], { [key]: toDecimal_n(valuePer, 2) || "0" }); + _.assign(payload[`${item}PerString`], { [key]: toDecimal_n(valuePer, parseFloat(child.perValidNum || 2)) || "0" }); } if (!child.comDisabled) { - _.assign(payload[`${item}ComString`], { [key]: toDecimal_n(valueCom, 2) || "0" }); + _.assign(payload[`${item}ComString`], { [key]: toDecimal_n(valueCom, parseFloat(child.comValidNum || 2)) || "0" }); } }); }); @@ -444,7 +444,9 @@ export const convertData = (dataSource) => { [perKey]: "", [comKey]: "", perDisabled: !_.includes(_.map(itemList, o => o.paymentScopeSign), "per"), - comDisabled: !_.includes(_.map(itemList, o => o.paymentScopeSign), "com") + perValidNum: !_.isEmpty(_.filter(itemList, i => i.paymentScopeSign === "per")) ? _.filter(itemList, i => i.paymentScopeSign === "per")[0].validNum : 2, + comDisabled: !_.includes(_.map(itemList, o => o.paymentScopeSign), "com"), + comValidNum: !_.isEmpty(_.filter(itemList, i => i.paymentScopeSign === "com")) ? _.filter(itemList, i => i.paymentScopeSign === "com")[0].validNum : 2, }); }); return endList.push(data);