其他免税扣除页面添加沿用上月的功能

This commit is contained in:
黎永顺 2022-11-16 17:29:01 +08:00
parent 79d1f42a12
commit ea9359c728
2 changed files with 39 additions and 2 deletions

View File

@ -127,3 +127,7 @@ export const deleteSelectData = (params) => {
export const deleteAllData = (params) => {
return postFetch('/api/bs/hrmsalary/otherDeduction/deleteAllData', params);
}
//沿用上月
export const extendToLastMonth = (params) => {
return postFetch('/api/bs/hrmsalary/otherDeduction/extendToLastMonth', params);
}

View File

@ -13,6 +13,7 @@ import EditSlideContent from "./editSlideContent";
import { optionAddAll } from "../../../util/options";
import * as API from "../../../apis/otherDeduct";
import "./index.less";
import { extendToLastMonth } from "../../../apis/otherDeduct";
@inject("otherDeductStore", "taxAgentStore")
@ -22,6 +23,7 @@ export default class OtherDeduct extends React.Component {
super(props);
this.state = {
saveLoading: false,
lastLoading: false,
addVisible: false,
editId: {},
value: "",
@ -383,6 +385,30 @@ export default class OtherDeduct extends React.Component {
});
};
//沿用上月
extendToLastMonth= ()=>{
const { monthValue: declareMonth, taxAgentId } = this.state;
const { otherDeductStore: { doSearch } } = this.props;
const payload= {
declareMonth,
taxAgentId: taxAgentId === "All" ? "" : taxAgentId,
}
this.setState({ lastLoading: true });
API.extendToLastMonth(payload).then(({ status, data, errormsg })=>{
this.setState({ lastLoading: false });
if (status) {
message.success(data || "操作成功");
doSearch({
declareMonth: [declareMonth],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
});
} else {
message.error(errormsg || "操作失败");
}
}).catch(() => this.setState({ lastLoading: false }));
}
render() {
const { otherDeductStore, taxAgentStore } = this.props;
const {
@ -416,7 +442,7 @@ export default class OtherDeduct extends React.Component {
setPageObj
} = otherDeductStore;
const selectedRowKeys = toJS(tableStore.selectedRowKeys) || [];
const { modalParam, monthValue, taxAgentId, slideSelectedKey, addVisible, editId, saveLoading } = this.state;
const { modalParam, monthValue, taxAgentId, slideSelectedKey, addVisible, editId, saveLoading, lastLoading } = this.state;
const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || [];
@ -529,9 +555,16 @@ export default class OtherDeduct extends React.Component {
}
type="ghost">
一键清空
</Dropdown.Button>
</Dropdown.Button>,
<Button
type="primary"
loading={lastLoading}
onClick={this.extendToLastMonth}>
沿用上月
</Button>
];
const handleExportAllDetailClick = () => {
const {
otherDeductStore: { currentRecord }