From 1be637e168653611f8a94a9476235881c3ef3eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 28 Dec 2023 09:46:25 +0800 Subject: [PATCH] =?UTF-8?q?hotfix/2.9.9.2312.02-=E4=B8=AA=E7=A8=8E=20?= =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/declare.js | 17 +- .../declareDetail/components/constants.js | 45 ++++ .../incomeTaxDeclarationPersonnelSlide.js | 193 ++++++++++++++++++ .../hrmSalary/pages/declareDetail/index.js | 106 +++++++--- .../hrmSalary/pages/declareDetail/index.less | 39 ++++ pc4mobx/hrmSalary/stores/declare.js | 3 + 6 files changed, 373 insertions(+), 30 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/declareDetail/components/incomeTaxDeclarationPersonnelSlide.js diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index 23760cbe..76709840 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -213,8 +213,23 @@ export const taxPaymentVoucherPrintFeedback = (params) => { export const taxdeclarationUpdateIcon = (params) => { return postFetch("/api/bs/hrmsalary/taxdeclaration/updateIcon", params); }; - export const employeedeclareExport = params => { return postExportFetch("/api/bs/hrmsalary/employeedeclare/export", params); }; +//个税申报表申报数据-获取表单 +export const getTaxDecForm = (params) => { + return postFetch("/api/bs/hrmsalary/taxdeclaration/getAddForm", params); +}; +//个税申报表申报数据-新增 +export const taxdeclarationAdd = (params) => { + return postFetch("/api/bs/hrmsalary/taxdeclaration/add", params); +}; +//个税申报表申报数据-编辑 +export const taxdeclarationEdit = (params) => { + return postFetch("/api/bs/hrmsalary/taxdeclaration/edit", params); +}; +//个税申报表申报数据-详情 +export const getTaxdeclarationDetailInfo = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/detailInfo", "GET", params); +}; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js b/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js index 483d987c..5d03b906 100644 --- a/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js +++ b/pc4mobx/hrmSalary/pages/declareDetail/components/constants.js @@ -91,3 +91,48 @@ export const paymentBankConditions = [ defaultshow: true } ]; +export const incomeTaxDecConditions = [ + { + items: [ + { + conditionType: "SELECT", + domkey: ["employeeId"], + fieldcol: 16, + label: "姓名", + lanId: 25034, + labelcol: 8, + value: "", + rules: "required|string", + viewAttr: 3, + options: [] + }, + { + conditionType: "INPUT", + domkey: ["jobNum"], + fieldcol: 16, + label: "工号", + lanId: 1933, + labelcol: 8, + value: "", + viewAttr: 1 + }, + { + conditionType: "INPUT", + domkey: ["cardNum"], + fieldcol: 16, + label: "证件号码", + lanId: 1839, + labelcol: 8, + value: "", + viewAttr: 1 + } + ], + title: "baseInfo", + defaultshow: true + }, + { + items: [], + title: "salaryItems", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/components/incomeTaxDeclarationPersonnelSlide.js b/pc4mobx/hrmSalary/pages/declareDetail/components/incomeTaxDeclarationPersonnelSlide.js new file mode 100644 index 00000000..54fd02b1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/declareDetail/components/incomeTaxDeclarationPersonnelSlide.js @@ -0,0 +1,193 @@ +/* + * Author: 黎永顺 + * name: 个税申报人员-新增与编辑 + * Description: + * Date: 2023/12/27 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { incomeTaxDecConditions } from "./constants"; +import { WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom"; +import { Button, Col, message, Row } from "antd"; +import { getConditionDomkeys, getSearchs, toDecimal_n } from "../../../util"; +import * as API from "../../../apis/declare"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; +const APIFOX = { + add: API.taxdeclarationAdd, + edit: API.taxdeclarationEdit +}; + +@inject("declareStore") +@observer +class IncomeTaxDeclarationPersonnelSlide extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], employeeDeclares: [], taxReportColumns: [], + loading: false, detailInfo: {} + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + const { declareStore: { initTaxDecForm } } = nextProps; + if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxDecForm(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ + conditions: [], employeeDeclares: [], taxReportColumns: [], + loading: false, detailInfo: {} + }, () => initTaxDecForm()); + } + } + + getTaxDecForm = (props) => { + const { taxDeclarationId, id } = props; + API.getTaxDecForm({ taxDeclarationId }).then(({ status, data }) => { + if (status) { + const { employeeDeclares, taxReportColumns } = data; + this.setState({ + employeeDeclares, taxReportColumns, + conditions: _.map(incomeTaxDecConditions, item => { + if (item.title === "baseInfo") { + return { + ...item, title: getLabel(1361, "基本信息"), + items: _.map(item.items, o => { + if (getKey(o) === "employeeId") { + if (!id) { + return { + ...o, otherParams: { showSearch: true, optionFilterProp: "children" }, + label: getLabel(o.lanId, o.label), + options: _.map(employeeDeclares, g => ({ + key: g.employeeId.toString(), + showname: g.employeeName + })) + }; + } else { + return { + conditionType: "INPUT", + domkey: ["username"], + fieldcol: 16, + label: getLabel(25034, "姓名"), + labelcol: 8, + value: "", + viewAttr: 1 + }; + } + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + }; + } else if (item.title === "salaryItems") { + return { + ...item, title: getLabel(111, "薪资项"), + items: _.map(taxReportColumns, o => ({ + conditionType: o.dataType === "number" ? "INPUTNUMBER" : "INPUT", + domkey: [o.reportColumnDataIndex], + fieldcol: 16, + label: o.reportColumnName, + labelcol: 8, + value: o.dataType === "number" ? 0 : "", + rules: o.dataType === "number" ? "required" : "", + otherParams: { precision: 2 }, + viewAttr: o.dataType === "number" ? 3 : 2 + })) + }; + } + }) + }, () => { + const { declareStore: { taxDecForm } } = props; + taxDecForm.initFormFields(this.state.conditions); + id && this.getTaxdeclarationDetailInfo(id); + }); + } + }); + }; + getTaxdeclarationDetailInfo = (id) => { + API.getTaxdeclarationDetailInfo({ id }).then(({ status, data }) => { + if (status) { + const { conditions } = this.state; + const { declareStore: { taxDecForm } } = this.props; + const detailInfo = { ...data, ...data["resultValue"] }; + this.setState({ + detailInfo: detailInfo + }, () => { + _.forEach(getConditionDomkeys(conditions), o => { + taxDecForm.updateFields({ + [o]: this.state.detailInfo[o] || "" + }); + }); + }); + } + }); + }; + handleFormChange = (params) => { + const { declareStore: { taxDecForm } } = this.props; + const { employeeDeclares } = this.state; + const key = Object.keys(params)[0]; + const value = params[key].value; + if (key === "employeeId") { + taxDecForm.updateFields({ + jobNum: _.find(employeeDeclares, o => o.employeeId == value).jobNum, + cardNum: _.find(employeeDeclares, o => o.employeeId == value).cardNum + }); + } + }; + save = () => { + const { declareStore: { taxDecForm }, taxDeclarationId, id } = this.props; + const { employeeDeclares, detailInfo } = this.state; + const type = id ? "edit" : "add"; + taxDecForm.validateForm().then(f => { + if (f.isValid) { + const { cardNum, jobNum, employeeId, ...taxReportColumnValues } = taxDecForm.getFormParams(); + const payload = { + taxDeclarationId, employeeId: employeeId || detailInfo.employeeId, + employeeType: employeeId ? _.find(employeeDeclares, o => o.employeeId == employeeId).employeeType : detailInfo.employeeType, + taxReportColumnValues: _.reduce(_.keys(taxReportColumnValues), (pre, cur) => { + if (Object.prototype.toString.call(taxReportColumnValues[cur]) === "[object Number]") { + return { ...pre, [cur]: toDecimal_n(taxReportColumnValues[cur], 2) }; + } else { + return { ...pre, [cur]: taxReportColumnValues[cur] }; + } + }, {}) + }; + this.setState({ loading: true }); + APIFOX[type](type === "add" ? payload : { ...payload, id }).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功!")); + this.props.onClose(true); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + renderTitle = () => { + return + +
+ {this.props.title} + + + + +
; + }; + + render() { + const { declareStore: { taxDecForm } } = this.props; + const { conditions } = this.state; + return ( + this.props.onClose()} + top={0} width={60} height={100} measure="%" direction="right" title={this.renderTitle()} + content={getSearchs(taxDecForm, conditions, 2, false, this.handleFormChange)} + /> + ); + } +} + +export default IncomeTaxDeclarationPersonnelSlide; diff --git a/pc4mobx/hrmSalary/pages/declareDetail/index.js b/pc4mobx/hrmSalary/pages/declareDetail/index.js index 156d8a6b..86906901 100644 --- a/pc4mobx/hrmSalary/pages/declareDetail/index.js +++ b/pc4mobx/hrmSalary/pages/declareDetail/index.js @@ -5,8 +5,8 @@ * Date: 2023/8/18 */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaTab, WeaTable } from "ecCom"; -import { Button, message } from "antd"; +import { WeaLocaleProvider, WeaTab } from "ecCom"; +import { Button, message, Spin } from "antd"; import TaxDeclarationInfo from "./components/taxDeclarationInfo"; import { apiflowBillingConfigStatus } from "../../apis/intelligentCalculateSalarySettings"; import PaymentBtn from "./components/paymentBtn"; @@ -26,6 +26,7 @@ import { taxPaymentWithheldVoucherGet } from "../../apis/declare"; import { convertToUrlString, getQueryString } from "../../util/url"; +import IncomeTaxDeclarationPersonnelSlide from "./components/incomeTaxDeclarationPersonnelSlide"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @@ -49,6 +50,9 @@ class Index extends Component { correct: false, cancel: false, cancelFeedback: false, refreshingPay: false, issuance: false }, + taxDecPersonSlide: { + visible: false, title: getLabel(1421, "新增"), taxDeclarationId: "", id: "" + }, intelCalcSalaryStatus: false, //智能算薪 总开关是否开启 declareInfo: {}, pageInfo: { current: 0, pageSize: 10, total: 0 } }; @@ -56,7 +60,11 @@ class Index extends Component { } componentDidMount() { - const promise = this.init(); + window.addEventListener("message", this.handleReceive, false); + } + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); } init = async () => { @@ -95,6 +103,32 @@ class Index extends Component { taxdeclarationGetRate = (index) => { return taxdeclarationGetRate({ index }); }; + handleReceive = ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + const promise = this.init(); + } else if (type === "turn") { + if (id === "PAGEINFO") { + this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.getDetailList()); + } else if (id === "EDIT") { + this.handleTaxDescPerSlide({ + visible: true, id: params.id, + title: getLabel(501169, "编辑") + }); + } + } + }; + postMessageToChild = (payload = {}) => { + const { declareInfo, intelCalcSalaryStatus } = this.state; + const i18n = { + "总计": getLabel(523, "总计"), "编辑": getLabel(501169, "编辑"), + "操作": getLabel(30585, "操作"), "共": getLabel(83698, "共"), + "条": getLabel(18256, "条") + }; + const declareStatus = intelCalcSalaryStatus ? declareInfo.declareStatus : ""; + const childFrameObj = document.getElementById("atdTable"); + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n, declareStatus }), "*"); + }; getDetailList = () => { const { loading, pageInfo, selectedKey } = this.state; const [incomeCategory, taxDeclarationId] = selectedKey.split("%%"); @@ -111,10 +145,16 @@ class Index extends Component { dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, columns: _.map(columns, (it, idx) => { if (idx <= 1) { - return { ...it, width: 150, fixed: "left" }; + return { ...it, width: 150, fixed: "left", ellipsis: true }; } - return { ...it, width: 150 }; + return { ...it, width: 150, ellipsis: true }; }) + }, () => { + const payload = { + dataSource, pageInfo: this.state.pageInfo, + columns: this.state.columns + }; + this.postMessageToChild(payload); }); } }).catch(() => this.setState({ loading: { ...loading, query: false } })); @@ -221,11 +261,18 @@ class Index extends Component { }; window.open(`${window.ecologyContentPath || ""}/api/bs/hrmsalary/taxdeclaration/detail/export?${convertToUrlString(payload)}`, "_blank"); }; + handleTaxDescPerSlide = (params) => { + const { callback, ...module } = params; + const { taxDecPersonSlide, selectedKey } = this.state; + const [__, taxDeclarationId] = selectedKey.split("%%"); + this.setState({ + taxDecPersonSlide: { ...taxDecPersonSlide, ...module, taxDeclarationId } + }, () => callback && this.getDetailList()); + }; render() { const { - tabs, selectedKey, columns, pageInfo, - dataSource, loading, declareInfo, intelCalcSalaryStatus + tabs, selectedKey, loading, declareInfo, intelCalcSalaryStatus, taxDecPersonSlide } = this.state; let btns = [ , @@ -234,23 +281,6 @@ class Index extends Component { ]; - const pagination = { - ...pageInfo, - showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, - showQuickJumper: true, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: (current, pageSize) => { - this.setState({ - pageInfo: { ...pageInfo, current, pageSize } - }, () => this.getDetailList()); - }, - onChange: current => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => this.getDetailList()); - } - }; //申报状态:作废中 declareInfo.declareStatus === "DECLARE_CANCELLING" && (btns.splice(1, 2, + ); + } + } if (intelCalcSalaryStatus && (declareInfo.declareStatus === "DECLARE_SUCCESS_UNPAID")) { btns.push( , @@ -309,13 +349,21 @@ class Index extends Component { datas={tabs} keyParam="viewcondition" selectedKey={selectedKey} buttons={btns} onChange={(v) => this.setState({ selectedKey: v }, () => this.getDetailList())} /> - this.handleTaxDescPerSlide({ visible: false, id: "", callback })} /> +
+ +