hotfix/2.9.9.2312.02-个税

申报表-动态增删tab
This commit is contained in:
黎永顺 2023-12-29 17:45:59 +08:00
parent 8adcd121c6
commit 28d8ebe64d
5 changed files with 164 additions and 7 deletions

View File

@ -252,3 +252,11 @@ export const taxdeclarationImportData = (params) => {
export const employeedeclareImportData = (params) => {
return postFetch("/api/bs/hrmsalary/employeedeclare/importData", params);
};
//个税申报表-新增申报表Tab
export const addTaxDeclaration = (params) => {
return postFetch("/api/bs/hrmsalary/taxdeclaration/addTaxDeclaration", params);
};
//个税申报表-删除申报表Tab
export const deleteTaxDeclaration = (params) => {
return postFetch("/api/bs/hrmsalary/taxdeclaration/deleteTaxDeclaration", params);
};

View File

@ -136,3 +136,24 @@ export const incomeTaxDecConditions = [
defaultshow: true
}
];
//个税申报表-tab新增删除
export const taxTabConditions = [
{
items: [
{
colSpan: 1,
conditionType: "SELECT",
domkey: ["incomeCategory"],
fieldcol: 14,
label: "申报表类型",
lanId: 111,
labelcol: 6,
options: [],
rules: "required|string",
viewAttr: 3
}
],
defaultshow: true,
title: ""
}
];

View File

@ -0,0 +1,95 @@
/*
* Author: 黎永顺
* name: 个税申报表详情-tab动态添加
* Description:
* Date: 2023/12/29
*/
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/index";
import * as API from "../../../apis/declare";
import { commonEnumList } from "../../../apis/ruleconfig";
import { taxTabConditions } from "./constants";
import { getQueryString } from "../../../util/url";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@inject("declareStore")
@observer
class TabEditDialog extends Component {
constructor(props) {
super(props);
this.state = {
conditions: [], loading: false
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTabForm(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.declareStore.initTabDecForm();
}
getTabForm = (props) => {
const payload = {
enumClass: "com.engine.salary.enums.salarysob.IncomeCategoryEnum"
};
commonEnumList(payload).then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(taxTabConditions, item => ({
...item, items: _.map(item.items, o => {
if (getKey(o) === "incomeCategory") {
return {
...o, label: getLabel(o.lanId, o.label),
options: _.map(data, it => ({ key: it.enum, showname: it.defaultLabel }))
};
}
return { ...o };
})
}))
}, () => props.declareStore.tabDecForm.initFormFields(this.state.conditions));
}
});
};
save = () => {
const { declareStore: { tabDecForm } } = this.props;
tabDecForm.validateForm().then(f => {
if (f.isValid) {
const payload = tabDecForm.getFormParams();
this.setState({ loading: true });
API.addTaxDeclaration({ ...payload, taxDeclareRecordId: Number(getQueryString("id")) })
.then(({ status, data, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success(getLabel(30700, "操作成功"));
this.props.onCancel(true);
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
render() {
const { conditions, loading } = this.state;
const { declareStore: { tabDecForm } } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480 }} initLoadCss title={getLabel(1421, "新增")}
buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(826, "确定")}</Button>
]}
>
<div className="calculate-dialog-layout">{getSearchs(tabDecForm, conditions, 1, false)}</div>
</WeaDialog>
);
}
}
export default TabEditDialog;

View File

@ -6,12 +6,13 @@
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTab } from "ecCom";
import { Button, message, Spin } from "antd";
import { Button, message, Modal, Spin } from "antd";
import TaxDeclarationInfo from "./components/taxDeclarationInfo";
import { apiflowBillingConfigStatus } from "../../apis/intelligentCalculateSalarySettings";
import PaymentBtn from "./components/paymentBtn";
import PaymentFeedbackBtn from "./components/paymentFeedbackBtn";
import {
deleteTaxDeclaration,
exportGetDeclareTaxResultFeedback,
getDeclareInfo,
getDetailList,
@ -29,6 +30,7 @@ import {
import { convertToUrlString, getQueryString } from "../../util/url";
import IncomeTaxDeclarationPersonnelSlide from "./components/incomeTaxDeclarationPersonnelSlide";
import TaxDeclareDetailImportDialog from "./components/taxDeclareDetailImportDialog";
import TabEditDialog from "./components/tabEditDialog";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
@ -46,7 +48,7 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
tabs: [], selectedKey: "", columns: [], dataSource: [],
tabs: [], selectedKey: "", columns: [], dataSource: [], editTabVisible: false,
loading: {
query: false, refresh: false, declare: false, feedback: false,
correct: false, cancel: false, cancelFeedback: false, refreshingPay: false,
@ -78,7 +80,7 @@ class Index extends Component {
this.setState({
tabs: tabStatus ? _.map(tabDataSource, it => ({
viewcondition: `${it.incomeCategory}%%${it.taxDeclarationId}`,
title: it.tabName
title: it.tabName, editable: true
})) : this.state.tabs,
selectedKey: tabStatus ? `${_.take(tabDataSource)[0].incomeCategory}%%${_.take(tabDataSource)[0].taxDeclarationId}` : this.state.selectedKey,
declareInfo: infoStatus ? infoDataSource : this.state.declareInfo,
@ -290,10 +292,36 @@ class Index extends Component {
message.error(getLabel(111, "下载失败!"));
});
};
handleTabEdit = (tabKey, type) => {
if (type === "remove") {
const [__, taxDeclarationId] = tabKey.split("%%");
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(111, "确认删除吗?"),
onOk: () => {
message.destroy();
message.loading("正在删除中...", 0);
deleteTaxDeclaration({ taxDeclarationId })
.then(({ status, errormsg }) => {
message.destroy();
if (status) {
message.success(getLabel(502230, "删除成功"));
const promise = this.init();
} else {
message.error(errormsg);
}
}).catch(() => message.destroy());
}
});
} else if (type === "add") {
this.setState({ editTabVisible: true });
}
};
render() {
const {
tabs, selectedKey, loading, declareInfo, intelCalcSalaryStatus, taxDecPersonSlide
tabs, selectedKey, loading, declareInfo, intelCalcSalaryStatus, taxDecPersonSlide,
editTabVisible
} = this.state;
const [__, taxDeclarationId] = selectedKey.split("%%");
let btns = [
@ -372,8 +400,9 @@ class Index extends Component {
<TaxDeclarationInfo declareInfo={declareInfo} onOperate={fun => this[fun]()}/>
<div className="declareDetail-layout-content">
<WeaTab
datas={tabs} keyParam="viewcondition" selectedKey={selectedKey}
buttons={btns} onChange={(v) => this.setState({ selectedKey: v }, () => this.getDetailList())}
datas={tabs} keyParam="viewcondition" selectedKey={selectedKey} showAddBtn buttons={btns}
type="editable-inline" onEdit={this.handleTabEdit}
onChange={(v) => this.setState({ selectedKey: v }, () => this.getDetailList())}
/>
{/*个税申报表-新增编辑框*/}
<IncomeTaxDeclarationPersonnelSlide
@ -384,6 +413,9 @@ class Index extends Component {
<TaxDeclareDetailImportDialog ref={dom => this.taxDeclareRef = dom}
onSuccess={this.declare}
/>
{/*个税申报表-新增tab弹框*/}
<TabEditDialog visible={editTabVisible}
onCancel={(isRefresh) => this.setState({ editTabVisible: false }, () => isRefresh && this.init())}/>
</div>
<div className="declareDetail-layout-table-content">
<Spin spinning={loading.query}>

View File

@ -10,11 +10,12 @@ export class DeclareStore {
@observable paymentForm = new WeaForm(); // declareDetail----在线申报-缴款Form
@observable declareForm = new WeaForm(); //薪资核算重构-核算form
@observable taxDecForm = new WeaForm(); //个税申报人员-新增编辑form
@observable tabDecForm = new WeaForm(); //个税申报表-tab新增删除form
// ** 薪资核算重构-初始化核算form **
@action
initDeclareForm = () => this.declareForm = new WeaForm();
@action
initTaxDecForm = () => this.taxDecForm = new WeaForm();
initTabDecForm = () => this.tabDecForm = new WeaForm();
@observable tableStore = new TableStore(); // new table