From 420104e13177bcaf3a159f764d0a9c10b666fd51 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Tue, 24 Dec 2024 18:09:15 +0800 Subject: [PATCH] =?UTF-8?q?release/2.18.2.2412.02-release/2.18.2.2412.02-?= =?UTF-8?q?=E4=B8=AA=E7=A8=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/otherDeduct.js | 4 ++ .../hrmSalary/components/FormInfo/index.js | 9 ++-- .../dataAcquisition/otherDeduct/columns.js | 40 ++++++++++++++ .../otherDeduct/detailSettingsDialog.js | 52 +++++++++++++++++-- .../otherDeduct/taxSetDialog.js | 8 +-- pc4mobx/hrmSalary/stores/otherDeduct.js | 1 + 6 files changed, 102 insertions(+), 12 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/otherDeduct.js b/pc4mobx/hrmSalary/apis/otherDeduct.js index 4797a844..517046cf 100644 --- a/pc4mobx/hrmSalary/apis/otherDeduct.js +++ b/pc4mobx/hrmSalary/apis/otherDeduct.js @@ -85,3 +85,7 @@ export const deleteAllData = (params) => { export const extendToLastMonth = (params) => { return postFetch("/api/bs/hrmsalary/otherDeduction/extendToLastMonth", params); }; +//免税收入保存 +export const saveFreeIncome = (params) => { + return postFetch("/api/bs/hrmsalary/otherDeduction/saveFreeIncome", params); +}; diff --git a/pc4mobx/hrmSalary/components/FormInfo/index.js b/pc4mobx/hrmSalary/components/FormInfo/index.js index 5c14f828..8d7847c0 100644 --- a/pc4mobx/hrmSalary/components/FormInfo/index.js +++ b/pc4mobx/hrmSalary/components/FormInfo/index.js @@ -7,17 +7,17 @@ import { WeaSwitch } from "comsMobx"; export default class FormInfo extends Component { renderForm = () => { const { - formFields, form, colCount, itemRender, onSelectedChangeHandle, - showLabel, multiColumn, custLabelCol, childrenComponents + formFields, form, colCount, itemRender, onSelectedChangeHandle, showLabel, multiColumn, custLabelCol, + childrenComponents } = this.props; let groupArr = []; const formParams = form.getFormParams(); const labelVisible = showLabel == null || showLabel == true; const col = colCount ? colCount : 1; - const labelCol = labelVisible ? (custLabelCol || `${window.HrmEngineLabelCol}`) : 0; + const labelCol = labelVisible ? (custLabelCol || 6) : 0; const itemProps = { - ratio1to2: labelVisible && custLabelCol == null, + // ratio1to2: labelVisible && custLabelCol == null, style: { marginLeft: 0 }, tipPosition: "bottom", labelCol: { span: labelCol }, @@ -61,7 +61,6 @@ export default class FormInfo extends Component { }); } } - coms != null && formItems.push({ com: ({coms}), col diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js index c94c8d56..682a7047 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js @@ -139,6 +139,46 @@ export const dataCollectCondition = [ col: 2 } ]; +export const taxDetailSettingsConditions = { + freeIncome: [{ + items: [ + { + conditionType: "INPUT", + domkey: ["freeItem"], + fieldcol: 14, + label: "免税事项", + labelcol: 8, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["freeProperty"], + fieldcol: 14, + label: "免税性质", + labelcol: 4, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUTNUMBER", + domkey: ["freeAmount"], + fieldcol: 14, + label: "免税金额", + labelcol: 8, + value: "", + rules: "required", + precision: 2, + viewAttr: 3 + } + ], + title: "", + defaultshow: true, + col: 1 + }] +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/detailSettingsDialog.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/detailSettingsDialog.js index 882a02b4..82f72dcb 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/detailSettingsDialog.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/detailSettingsDialog.js @@ -8,22 +8,66 @@ * @description: */ import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; -import { Button } from "antd"; +import FormInfo from "../../../components/FormInfo"; +import { taxDetailSettingsConditions } from "./columns"; +import * as API from "../../../apis/otherDeduct"; +import { Button, message } from "antd"; const getLabel = WeaLocaleProvider.getLabel; +@inject("otherDeductStore") +@observer class DetailSettingsDialog extends Component { + constructor(props) { + super(props); + this.state = { + loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.props.otherDeductStore.settingsForm.initFormFields(taxDetailSettingsConditions[nextProps.dataType]); + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.props.otherDeductStore.settingsForm.resetForm(); + } + } + + save = () => { + const { otherDeductStore: { settingsForm }, mainId } = this.props; + settingsForm.validateForm().then(f => { + if (f.isValid) { + const payload = settingsForm.getFormParams(); + this.setState({ loading: true }); + API.saveFreeIncome({ ...payload, mainId }).then(({ status, errormsg }) => { + this.setState({ loading: true }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.props.onCancel(this.props.onSuccess()); + } else { + message.error(errormsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + render() { + const { otherDeductStore: { settingsForm }, dataType } = this.props, { loading } = this.state; return ( {getLabel(111, "确定")}, + , ]} > -
+
); } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/taxSetDialog.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/taxSetDialog.js index d6a51576..9d3fc831 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/taxSetDialog.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/taxSetDialog.js @@ -20,13 +20,15 @@ class TaxSetDialog extends Component { super(props); this.state = { dataSource: [], columns: [], loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, - selectedRowKeys: [], detailSettingsDialog: { visible: false } + selectedRowKeys: [], detailSettingsDialog: { visible: false, dataType: "", mainId: "", id: "" } }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { - this.getList(nextProps); + this.setState({ + detailSettingsDialog: { ...this.state.detailSettingsDialog, dataType: nextProps.dataType, mainId: nextProps.id } + }, () => this.getList(nextProps)); } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { this.setState({ dataSource: [], columns: [], loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, @@ -94,7 +96,7 @@ class TaxSetDialog extends Component { scroll={{ y: this.taxSetRef ? this.taxSetRef.state.height - 112 : 600 }}/> this.setState({ detailSettingsDialog: { ...detailSettingsDialog, visible: false } - })}/> + })} onSuccess={this.getList}/> diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index 18ce76d6..67e23409 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -13,6 +13,7 @@ export class OtherDeductStore { @observable form = new WeaForm(); // new 一个form @observable addForm = new WeaForm(); // 新增form @action initAddForm = () => this.addForm = new WeaForm(); + @observable settingsForm = new WeaForm(); // 其他个税申报明细form @observable condition = []; // 存储后台得到的form数据 @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示