From 56e71306a7829fd27f03db14b7741fac16e5256c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 18 Aug 2023 08:57:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E8=B5=84=E8=B4=A6?= =?UTF-8?q?=E5=A5=97=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ledgerPage/components/cumulativeFields.js | 12 +- .../ledgerPage/components/incomeTaxFields.js | 6 +- .../components/ledgerFieldsTable.js | 2 +- .../ledgerPage/components/ledgerSlide.js | 126 ++++++++++++++---- 4 files changed, 111 insertions(+), 35 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/cumulativeFields.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/cumulativeFields.js index 5c03a3dc..5f074220 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/cumulativeFields.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/cumulativeFields.js @@ -33,7 +33,7 @@ class CumulativeFields extends Component { tabs: _.map(data, it => ({ viewcondition: it.incomeCategoryId, title: it.incomeCategoryName })), selectedKey: _.take(data)[0].incomeCategoryId, addupruleFields: data - }); + }, () => this.props.onSetAdduprule(this.state.addupruleFields, this.state.selectedKey)); } }); }; @@ -44,7 +44,7 @@ class CumulativeFields extends Component { if (it.incomeCategoryId === selectedKey) { return { ...it, - taxReportRules: _.map(it.taxReportRules, child => { + addUpRules: _.map(it.addUpRules, child => { if (child.id === id) { return { ...child, visible }; } @@ -54,7 +54,7 @@ class CumulativeFields extends Component { } return { ...it }; }) - }); + }, () => this.props.onSetAdduprule(this.state.addupruleFields, this.state.selectedKey)); }; handleChangeAddupruleFieldsItem = (salaryItem, recordRuleId) => { const { addupruleFields, selectedKey } = this.state; @@ -63,7 +63,7 @@ class CumulativeFields extends Component { if (it.incomeCategoryId === selectedKey) { return { ...it, - taxReportRules: _.map(it.taxReportRules, child => { + addUpRules: _.map(it.addUpRules, child => { if (child.id === recordRuleId) { return { ...child, visible: false, salaryItem }; } @@ -73,7 +73,7 @@ class CumulativeFields extends Component { } return { ...it }; }) - }); + }, () => this.props.onSetAdduprule(this.state.addupruleFields, this.state.selectedKey)); }; render() { @@ -96,7 +96,7 @@ class CumulativeFields extends Component { { title: getLabel(111, "往期累计情况字段"), width: "50%", - dataIndex: "reportColumnName" + dataIndex: "addUpColumnName" }, { title: getLabel(111, "对应本账套薪资项目"), diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js index fc9f811e..84675ec9 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/incomeTaxFields.js @@ -33,7 +33,7 @@ class IncomeTaxFields extends Component { tabs: _.map(data, it => ({ viewcondition: it.incomeCategoryId, title: it.incomeCategoryName })), selectedKey: _.take(data)[0].incomeCategoryId, incomeTaxFields: data - }); + }, () => this.props.onSetTaxreportrule(this.state.incomeTaxFields, this.state.selectedKey)); } }); }; @@ -54,7 +54,7 @@ class IncomeTaxFields extends Component { } return { ...it }; }) - }); + }, () => this.props.onSetTaxreportrule(this.state.incomeTaxFields, this.state.selectedKey)); }; handleChangeIncomeFieldsItem = (salaryItem, recordRuleId) => { const { incomeTaxFields, selectedKey } = this.state; @@ -73,6 +73,8 @@ class IncomeTaxFields extends Component { } return { ...it }; }) + }, () => { + this.props.onSetTaxreportrule(this.state.incomeTaxFields, this.state.selectedKey); }); }; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsTable.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsTable.js index 13a03f01..b2a0a176 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsTable.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerFieldsTable.js @@ -18,7 +18,7 @@ class LedgerFieldsTable extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.dataSource !== this.props.dataSource && !_.isEmpty(nextProps.dataSource)) { this.setState({ - dataSource: _.take(nextProps.dataSource)[0].taxReportRules + dataSource: _.take(nextProps.dataSource)[0].taxReportRules || _.take(nextProps.dataSource)[0].addUpRules }); } } diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js index 15093c2f..179494da 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js @@ -16,7 +16,13 @@ import LedgerBackCalculatedSalaryItem from "./ledgerBackCalculatedSalaryItem"; import LedgerSalaryItem from "./ledgerSalaryItem"; import IncomeTaxFields from "./incomeTaxFields"; import CumulativeFields from "./cumulativeFields"; -import { saveAdjustmentRule, saveLedgerBasic, saveLedgerItem, taxreportruleSave } from "../../../apis/ledger"; +import { + addupruleSave, + saveAdjustmentRule, + saveLedgerBasic, + saveLedgerItem, + taxreportruleSave +} from "../../../apis/ledger"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @@ -33,6 +39,8 @@ class LedgerSlide extends Component { baseSettingInfo: {}, adjustRules: [], empFields: [], itemGroups: [], + incomeTaxFields: [], incomeTaxKeys: "", //个税申报字段对应 + addupruleFields: [], addupruleKeys: "", //累计字段对应 saveSalarySobId: "", taxableItems: "" //薪资类型 1||489 对应显示个税设置-累计字段对应 }; @@ -146,16 +154,15 @@ class LedgerSlide extends Component { * Date: 2023/8/16 */ taxreportruleSave = () => { - const { taxableItems } = this.state; - const { editId, saveSalarySobId } = this.props; + const { taxableItems, incomeTaxKeys, incomeTaxFields, saveSalarySobId } = this.state; + const { editId } = this.props; if ((!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489")) { this.saveLedgerAdjustRule(); } else { - const { incomeTaxFields, selectedKey } = this.incomeRef.state; const payload = { - salarySobId: saveSalarySobId || editId, + salarySobId: editId || saveSalarySobId, incomeCategoryParams: _.map(incomeTaxFields, it => { - if (it.incomeCategoryId === selectedKey) { + if (it.incomeCategoryId === incomeTaxKeys) { return { incomeCategory: it.incomeCategoryId, taxReportRuleParams: _.map(it.taxReportRules, child => { @@ -172,17 +179,20 @@ class LedgerSlide extends Component { }; }) }; - this.setState({ loading: true }); - taxreportruleSave(payload).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { - message.success(getLabel(22619, "保存成功!")); - } else { - message.error(errormsg || getLabel(22620, "保存失败!")); - } - }).catch(() => this.setState({ loading: false })); + this.saveTaxreportrule(payload); } }; + saveTaxreportrule = (payload) => { + this.setState({ loading: true }); + taxreportruleSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(22619, "保存成功!")); + } else { + message.error(errormsg || getLabel(22620, "保存失败!")); + } + }).catch(() => this.setState({ loading: false })); + }; /* * Author: 黎永顺 * Description:保存薪资账套下的累计字段对应关系 @@ -190,14 +200,60 @@ class LedgerSlide extends Component { * Date: 2023/8/17 */ addupruleSave = () => { - const { taxableItems } = this.state; - const { editId, saveSalarySobId } = this.props; + const { taxableItems, incomeTaxFields, incomeTaxKeys, addupruleFields, addupruleKeys, saveSalarySobId } = this.state; + const { editId } = this.props; if ((!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489")) { - console.log(this.cumulativeRef); - console.log(11111); + const payload = { + salarySobId: editId || saveSalarySobId, + incomeCategoryParams: _.map(incomeTaxFields, it => { + if (it.incomeCategoryId === incomeTaxKeys) { + return { + incomeCategory: it.incomeCategoryId, + taxReportRuleParams: _.map(it.taxReportRules, child => { + return { + reportColumnDataIndex: child.reportColumnDataIndex, + salaryItemId: _.map(child.salaryItem, o => o.id).join(",") + }; + }) + }; + } + return { + incomeCategory: it.incomeCategoryId, + taxReportRuleParams: [] + }; + }) + }; + this.saveTaxreportrule(payload); } else { - console.log(this.cumulativeRef); - console.log(2222); + const payload = { + salarySobId: editId || saveSalarySobId, + incomeCategoryParams: _.map(addupruleFields, it => { + if (it.incomeCategoryId === addupruleKeys) { + return { + incomeCategory: it.incomeCategoryId, + addUpRuleParams: _.map(it.addUpRules, child => { + return { + addUpColumnDataIndex: child.addUpColumnDataIndex, + salaryItemId: _.map(child.salaryItem, o => o.id).join(",") + }; + }) + }; + } + return { + incomeCategory: it.incomeCategoryId, + taxReportRuleParams: [] + }; + }) + }; + this.setState({ loading: true }); + addupruleSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(22619, "保存成功!")); + } else { + message.error(errormsg || getLabel(22620, "保存失败!")); + } + }).catch(() => this.setState({ loading: false })); } }; handleChangeSlideTab = (current) => { @@ -247,14 +303,26 @@ class LedgerSlide extends Component { break; case 4: CurrentDom = (!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489") ? - this.incomeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/> : - this.cumulativeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/>; + this.setState({ + incomeTaxFields, + incomeTaxKeys: selectedKey + })}/> : + this.setState({ + addupruleFields, + addupruleKeys: selectedKey + })}/>; break; case 5: CurrentDom = (!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489") ? this.setState({ adjustRules })}/> : - this.incomeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/>; + this.setState({ + incomeTaxFields, + incomeTaxKeys: selectedKey + })}/>; break; case 6: CurrentDom = @@ -269,7 +337,7 @@ class LedgerSlide extends Component { }; renderCustomOperate = () => { const { taxAgentStore: { showOperateBtn }, editId } = this.props; - const { current, loading } = this.state; + const { current, loading, taxableItems } = this.state; let CurrentDom = []; //管理员操作权限 if (showOperateBtn) { @@ -342,7 +410,13 @@ class LedgerSlide extends Component { onClick={() => { this.setState({ current: current + 1 }, () => this.taxreportruleSave()); }} - >保存并进入下一步 + > + { + (!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489") ? + getLabel(555, "完成") : + getLabel(33199, "保存并进入下一步") + } + ] : [ ];