产品-薪资账套个税申报字段对应

This commit is contained in:
黎永顺 2023-08-18 08:57:20 +08:00
parent abdc35e134
commit 56e71306a7
4 changed files with 111 additions and 35 deletions

View File

@ -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, "对应本账套薪资项目"),

View File

@ -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);
});
};

View File

@ -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
});
}
}

View File

@ -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") ?
<IncomeTaxFields ref={dom => this.incomeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/> :
<CumulativeFields ref={dom => this.cumulativeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/>;
<IncomeTaxFields {...this.props} saveSalarySobId={saveSalarySobId}
onSetTaxreportrule={(incomeTaxFields, selectedKey) => this.setState({
incomeTaxFields,
incomeTaxKeys: selectedKey
})}/> :
<CumulativeFields {...this.props} saveSalarySobId={saveSalarySobId}
onSetAdduprule={(addupruleFields, selectedKey) => this.setState({
addupruleFields,
addupruleKeys: selectedKey
})}/>;
break;
case 5:
CurrentDom = (!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489") ?
<LedgerSalaryAdjustmentRules {...this.props} saveSalarySobId={saveSalarySobId}
onSaveParams={(adjustRules) => this.setState({ adjustRules })}/> :
<IncomeTaxFields ref={dom => this.incomeRef = dom} {...this.props} saveSalarySobId={saveSalarySobId}/>;
<IncomeTaxFields {...this.props} saveSalarySobId={saveSalarySobId}
onSetTaxreportrule={(incomeTaxFields, selectedKey) => 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());
}}
>保存并进入下一步</Button>
>
{
(!editId && taxableItems && taxableItems.toString() !== "1" && taxableItems.toString() !== "489") ?
getLabel(555, "完成") :
getLabel(33199, "保存并进入下一步")
}
</Button>
] : [
<Button type="primary" loading={loading} onClick={this.taxreportruleSave}>保存</Button>
];