100 lines
3.4 KiB
JavaScript
100 lines
3.4 KiB
JavaScript
/*
|
|
* Author: ydh
|
|
* name: 个税申报重构- 撤回申报
|
|
* Description:
|
|
* Date: 2026/01/21
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { inject, observer } from "mobx-react";
|
|
import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom";
|
|
import { Button, message } from "antd";
|
|
import { getSearchs } from "../../../../util";
|
|
import {batchDeleteTaxDeclaration, saveDeclare, withDrawTaxDeclaration} from "../../../../apis/declare";
|
|
import { declareConditions } from "./condition";
|
|
import { postFetch } from "../../../../util/request";
|
|
import * as API from "../../../../apis/ruleconfig";
|
|
|
|
const getKey = WeaTools.getKey;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
@inject("declareStore")
|
|
@observer
|
|
class Index extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
conditions: [], loading: false
|
|
};
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxAgentSelectListAsAdmin(nextProps);
|
|
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.declareStore.initDeclareForm();
|
|
}
|
|
|
|
getTaxAgentSelectListAsAdmin = async (props) => {
|
|
const { data: sysinfo } = await API.sysinfo();
|
|
const { declareStore: { declareForm } } = props;
|
|
postFetch("/api/bs/hrmsalary/taxAgent/listAuth", { filterType: "ADMIN_DATA" })
|
|
.then(({ status, data }) => {
|
|
if (status) {
|
|
this.setState({
|
|
conditions: _.map(declareConditions, item => ({
|
|
...item,
|
|
items: _.map(item.items, o => {
|
|
if (getKey(o) === "taxAgentId") {
|
|
return {
|
|
...o, label: getLabel(o.lanId, o.label),
|
|
options: _.map(data, g => ({ key: String(g.id), showname: g.name }))
|
|
};
|
|
} else if (getKey(o) === "salaryMonthStr") {
|
|
return {
|
|
...o,
|
|
label: sysinfo["TAX_DECLARATION_DATE_TYPE"] === "1" ? getLabel(111, "税款所属期") : getLabel(111, "薪资所属月")
|
|
};
|
|
}
|
|
return { ...o, label: getLabel(o.lanId, o.label) };
|
|
})
|
|
}))
|
|
}, () => declareForm.initFormFields(this.state.conditions));
|
|
}
|
|
});
|
|
};
|
|
// 撤回申报
|
|
taxdeclarationDelete = () => {
|
|
const { declareStore: { declareForm } } = this.props;
|
|
declareForm.validateForm().then(f => {
|
|
if (f.isValid) {
|
|
const payload = declareForm.getFormParams();
|
|
this.setState({ loading: true });
|
|
batchDeleteTaxDeclaration({...payload}).then(({ status, errormsg }) => {
|
|
if (status) {
|
|
message.success(getLabel(505793, "撤回成功"));
|
|
this.props.onCancel("refresh");
|
|
} else {
|
|
message.error(errormsg);
|
|
}
|
|
});
|
|
} else {
|
|
f.showErrors();
|
|
}
|
|
});
|
|
};
|
|
render() {
|
|
const { conditions, loading } = this.state;
|
|
const { declareStore: { declareForm } } = this.props;
|
|
return (
|
|
<WeaDialog
|
|
{...this.props} style={{ width: 500, height: 174 }} initLoadCss
|
|
buttons={[
|
|
<Button type="primary" onClick={this.taxdeclarationDelete} loading={loading}>撤回申报</Button>
|
|
]}
|
|
>
|
|
<div className="declare-dialog-layout">{getSearchs(declareForm, conditions, 1, false)}</div>
|
|
</WeaDialog>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Index;
|