diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index ceac9763..f6943db0 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -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); +}; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js b/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js index 5d03b906..cb9ce2fe 100644 --- a/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js +++ b/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js @@ -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: "" + } +]; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/components/tabEditDialog.js b/pc4mobx/hrmSalary/pages/declareDetail/components/tabEditDialog.js new file mode 100644 index 00000000..2a10d21e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/declareDetail/components/tabEditDialog.js @@ -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 ( + {getLabel(826, "确定")} + ]} + > +
{getSearchs(tabDecForm, conditions, 1, false)}
+
+ ); + } +} + +export default TabEditDialog; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/index.js b/pc4mobx/hrmSalary/pages/declareDetail/index.js index 1222d287..e1467cb2 100644 --- a/pc4mobx/hrmSalary/pages/declareDetail/index.js +++ b/pc4mobx/hrmSalary/pages/declareDetail/index.js @@ -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 { this[fun]()}/>
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())} /> {/*个税申报表-新增编辑框*/} this.taxDeclareRef = dom} onSuccess={this.declare} /> + {/*个税申报表-新增tab弹框*/} + this.setState({ editTabVisible: false }, () => isRefresh && this.init())}/>
diff --git a/pc4mobx/hrmSalary/stores/declare.js b/pc4mobx/hrmSalary/stores/declare.js index 60d12569..37fbfa1b 100644 --- a/pc4mobx/hrmSalary/stores/declare.js +++ b/pc4mobx/hrmSalary/stores/declare.js @@ -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