From c58472ad8f511816cabdf63ff8582ea7b5321106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 16 Aug 2023 10:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E5=AF=B9=E6=8E=A5-=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF=E6=8A=A5=E9=80=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/declare.js | 150 +++++-- .../hrmSalary/pages/employeedeclare/index.js | 46 +- .../pages/employeedeclare/index.less | 3 + .../components/baseInfo.js | 35 +- .../employeeDeclareDetailCalcDialog.js | 56 ++- .../employeeDeclareDetailSchemaEditDialog.js | 190 ++++++++- .../pages/employeedeclareDetail/constants.js | 244 +++++++++-- .../pages/employeedeclareDetail/index.js | 398 +++++++++++++++--- .../pages/employeedeclareDetail/index.less | 8 +- .../pages/salary/components/taxAgentSlide.js | 2 +- 10 files changed, 970 insertions(+), 162 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/employeedeclare/index.less diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index 360c8b62..89c47341 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -1,68 +1,128 @@ -import { WeaTools } from 'ecCom'; -import { postFetch } from '../util/request'; +import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; //个税申报表-个税申报表列表 export const getDeclareList = params => { - return fetch('/api/bs/hrmsalary/taxdeclaration/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/taxdeclaration/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //个税申报表-个税申报表表单 export const getDeclareForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxdeclaration/getForm', 'get', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getForm", "get", params); +}; //个税申报表-个税申报表生成 export const saveDeclare = params => { - return fetch('/api/bs/hrmsalary/taxdeclaration/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/taxdeclaration/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //个税申报表-个税申报表相关信息 export const getDeclareInfo = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationInfo', 'get', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationInfo", "get", params); +}; // 个税申报表详情列表 export const getDetailList = params => { - return fetch('/api/bs/hrmsalary/taxdeclaration/detail/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/taxdeclaration/detail/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 个税申报表导出 export const exportSalaryArchive = (id = "") => { - fetch('/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=' + id).then(res => res.blob().then(blob => { - var filename=`个税申报表.xlsx` - var a = document.createElement('a'); - var url = window.URL.createObjectURL(blob); - a.href = url; - a.download = filename; - a.click(); - window.URL.revokeObjectURL(url); - })) -} + fetch("/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=" + id).then(res => res.blob().then(blob => { + var filename = `个税申报表.xlsx`; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + })); +}; //个税申报表-撤回申报 export const withDrawTaxDeclaration = (params) => { - return postFetch('/api/bs/hrmsalary/taxdeclaration/withDrawTaxDeclaration', params); -} + return postFetch("/api/bs/hrmsalary/taxdeclaration/withDrawTaxDeclaration", params); +}; +//人员信息报送-个税扣缴义务人列表 +export const taxAgentDeclareList = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/taxAgentDeclareList", params); +}; +//人员信息报送-全部人员列表 +export const employeedeclareList = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/list", params); +}; +//人员信息报送-本月新增人员列表 +export const employeedeclareList4Add = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/list4Add", params); +}; +//人员信息报送-本月信息变动列表 +export const employeedeclareList4Update = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/list4Update", params); +}; +//人员信息报送-本月报送失败人员列表 +export const employeedeclareList4Fail = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/list4Fail", params); +}; + +//人员报送-刷新数据 +export const employeedeclareRefresh = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/refresh", params); +}; + +//人员报送-获取报送结果反馈 +export const getDeclareFeedback = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/getDeclareFeedback", params); +}; + +//人员报送-获取整体的报送情况 +export const getEmployeeDeclareInfo = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/getDeclareInfo", params); +}; + +//人员报送-后端业务逻辑是否已经完成 +export const employeedeclareGetRate = params => { + return WeaTools.callApi("/api/bs/hrmsalary/employeedeclare/getRate", "GET", params); +}; + +//人员报送-获取新建或编辑的表单 +export const employeedeclareGetForm = params => { + return WeaTools.callApi("/api/bs/hrmsalary/employeedeclare/getForm", "GET", params); +}; + +//人员报送-新增人员/编辑人员保存 +export const getEmployeeSave = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/save", params); +}; + +//人员报送-删除 +export const employeeDelete = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/delete", params); +}; + +//人员报送-全部报送 +export const employeedeclareDeclare = (params) => { + return postFetch("/api/bs/hrmsalary/employeedeclare/declare", params); +}; diff --git a/pc4mobx/hrmSalary/pages/employeedeclare/index.js b/pc4mobx/hrmSalary/pages/employeedeclare/index.js index 028f5961..deb90613 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclare/index.js +++ b/pc4mobx/hrmSalary/pages/employeedeclare/index.js @@ -6,8 +6,11 @@ */ import React, { Component } from "react"; import { WeaInputSearch, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; -import { Col, Row } from "antd"; +import { Col, message, Row } from "antd"; +import { taxAgentDeclareList } from "../../apis/declare"; import TipLabel from "../../components/TipLabel"; +import "./index.less"; + const { getLabel } = WeaLocaleProvider; @@ -15,13 +18,35 @@ class Index extends Component { constructor(props) { super(props); this.state = { - pageInfo: { current: 1, pageSize: 10, total: 0 }, - loading: false + dataSource: [], loading: false, taxAgentName: "", + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } + componentDidMount() { + this.taxAgentDeclareList(); + } + + taxAgentDeclareList = () => { + const { pageInfo, taxAgentName } = this.state; + const payload = { ...pageInfo, taxAgentName }; + this.setState({ loading: true }); + taxAgentDeclareList(payload).then(({ status, data, errormsg }) => { + this.setState({ loading: false }); + if (status) { + const { pageNum: current, pageSize, total, list: dataSource } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource + }); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + }; + render() { - const { pageInfo } = this.state; + const { pageInfo, taxAgentName, dataSource } = this.state; const tipList = [ getLabel(544290, "1、点击查看详情,管理各个个税扣缴义务人的人员报送信息,如购买了在线报送服务,可在线报送,如未购买在线报送服务,也可导出数据线下报送。") ]; @@ -31,6 +56,8 @@ class Index extends Component { icon={} buttons={[ this.setState({ taxAgentName: val })} + onSearch={this.taxAgentDeclareList} /> ]} > @@ -38,6 +65,7 @@ class Index extends Component { ({getLabel(83110, "查看详情")}) + render: (_, record) => ({getLabel(83110, "查看详情")}) } ]} - dataSource={[]} + dataSource={dataSource} pagination={{ ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, @@ -60,12 +90,12 @@ class Index extends Component { onShowSizeChange: (current, pageSize) => { this.setState({ pageInfo: { ...pageInfo, current, pageSize } - }); + }, () => this.taxAgentDeclareList()); }, onChange: current => { this.setState({ pageInfo: { ...pageInfo, current } - }); + }, () => this.taxAgentDeclareList()); } }} /> diff --git a/pc4mobx/hrmSalary/pages/employeedeclare/index.less b/pc4mobx/hrmSalary/pages/employeedeclare/index.less new file mode 100644 index 00000000..fb271337 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/employeedeclare/index.less @@ -0,0 +1,3 @@ +.declareTable { + background: #FFF; +} diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/baseInfo.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/baseInfo.js index 549a0dba..4496e505 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/baseInfo.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/baseInfo.js @@ -8,6 +8,7 @@ import React, { Component } from "react"; import { WeaLocaleProvider } from "ecCom"; import { getQueryString } from "../../../util/url"; import EmployeeDeclareDetailCalcDialog from "./employeeDeclareDetailCalcDialog"; +import { getEmployeeDeclareInfo } from "../../../apis/declare"; const { getLabel } = WeaLocaleProvider; @@ -16,29 +17,47 @@ class BaseInfo extends Component { super(props); this.state = { declareCalcDialog: { - visible: false - } + visible: false, taxCycle: "" + }, + declareInfo: {} }; } + /* + * Author: 黎永顺 + * Description: 人员报送-获取整体的报送情况 + * Params: + * Date: 2023/8/14 + */ + getEmployeeDeclareInfo = () => { + const payload = { + taxAgentId: getQueryString("id"), + taxCycle: this.props.taxCycle + }; + getEmployeeDeclareInfo(payload).then(({ status, data }) => { + if (status) this.setState({ declareInfo: data }); + }); + }; handleOpenFailDialog = () => { this.setState({ declareCalcDialog: { - visible: true + visible: true, taxCycle: this.props.taxCycle } }); }; render() { - const { declareCalcDialog } = this.state; + const { declareCalcDialog, declareInfo } = this.state; + const { declareFailSize, notDeclareSize } = declareInfo; return (
-
{getLabel(537996, "个税扣缴义务人")}:{getQueryString("taxName")}
+
+ {getLabel(537996, "个税扣缴义务人")}:{decodeURIComponent(getQueryString("taxName") || "")}
{getLabel(111, "报送失败")}:  0 - {getLabel(111, "未报送")}:  0 + onClick={this.handleOpenFailDialog}>{getLabel(111, "报送失败")}:  {declareFailSize || 0} + {getLabel(111, "未报送")}:  {notDeclareSize || 0}
{/*报送失败数据查看*/} @@ -47,7 +66,7 @@ class BaseInfo extends Component { onCancel={() => { this.setState({ declareCalcDialog: { - visible: false + visible: false, taxCycle: "" } }); }} diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailCalcDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailCalcDialog.js index 83e88345..f4fa0756 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailCalcDialog.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailCalcDialog.js @@ -6,13 +6,64 @@ */ import React, { Component } from "react"; import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom"; +import { employeedeclareList4Fail } from "../../../apis/declare"; import { Button, Col, Row } from "antd"; +import { getQueryString } from "../../../util/url"; const { getLabel } = WeaLocaleProvider; class EmployeeDeclareDetailCalcDialog extends Component { + constructor(props) { + super(props); + this.state = { + pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false, columns: [], dataSource: [] + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.employeedeclareList4Fail(nextProps); + } + + employeedeclareList4Fail = (props) => { + const { pageInfo } = this.state; + const payload = { + ...pageInfo, + taxAgentId: getQueryString("id"), + taxCycle: props.taxCycle + }; + this.setState({ loading: true }); + employeedeclareList4Fail(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + columns, dataSource, + pageInfo: { ...pageInfo, current, pageSize, total } + }); + } + }).catch(() => this.setState({ loading: false })); + }; render() { + const { loading, columns, dataSource, pageInfo } = this.state; + 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.employeedeclareList4Fail(this.props)); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.employeedeclareList4Fail(this.props)); + } + }; return (
diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js index dc483a65..c65d2ef0 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js @@ -6,30 +6,199 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; -import { Button, Col, Row } from "antd"; +import { Button, Col, message, Modal, Row } from "antd"; import { inject, observer } from "mobx-react"; import { declareConditions } from "../constants"; import { getSearchs } from "../../../util"; +import { getQueryString } from "../../../util/url"; +import { employeedeclareGetForm, getEmployeeSave } from "../../../apis/declare"; const { getLabel } = WeaLocaleProvider; @inject("employeeDeclareStore") @observer class EmployeeDeclareDetailSchemaEditDialog extends Component { - componentDidMount() { - const { employeeDeclareStore: { declareForm } } = this.props; - declareForm.initFormFields(declareConditions); + constructor(props) { + super(props); + this.state = { + loading: false, + eConditions: [] + }; } componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.employeedeclareGetForm(nextProps); } + employeedeclareGetForm = (props) => { + employeedeclareGetForm(_.pick(props, ["id"])).then(({ status, data }) => { + if (status) { + this.setState({ + eConditions: _.map(declareConditions, it => { + return { + ...it, + items: _.map(it.items, child => { + if (child.domkey[0] === "employmentStatus") { + return { + ...child, + value: _.take(props.employmentStatusList)[0].enum, + options: _.map(props.employmentStatusList, it => ({ + key: it.enum, + showname: getLabel(it.labelId, it.defaultLabel) + })) + }; + } else if (child.domkey[0] === "employmentType") { + return { + ...child, + value: _.take(props.employmentTypeList)[0].enum, + options: _.map(props.employmentTypeList, it => ({ + key: it.enum, + showname: getLabel(it.labelId, it.defaultLabel) + })) + }; + } else if (child.domkey[0] === "gender") { + return { + ...child, + value: "MALE", + options: [ + { key: "MALE", showname: getLabel(111, "男") }, + { key: "FEMALE", showname: getLabel(111, "女") } + ] + }; + } else if (child.domkey[0] === "employeeType") { + return { + ...child, + viewAttr: props.id ? 1 : 3, + options: [ + { key: "ORGANIZATION", showname: getLabel(30042, "人员") } + ] + }; + } + if (child.conditionType === "SELECT" && child.domkey[0] !== "gender" && child.domkey[0] !== "employmentStatus" && child.domkey[0] !== "employmentType") { + return { + ...child, + options: [ + { key: "ON", showname: getLabel(538048, "是") }, + { key: "OFF", showname: getLabel(111, "否") } + ] + }; + } + return { ...child }; + }) + }; + }) + }, () => { + const { data: result, columns } = data; + const { employeeDeclareStore: { declareForm } } = this.props; + declareForm.initFormFields(this.state.eConditions); + const filedKes = _.map(columns, it => it.dataIndex); + _.map(filedKes, item => { + if (item === "disability" || item === "lonelyOld" || item === "martyrDependents") { + declareForm.updateFields({ [item]: result[item] || "OFF" }); + } else if (item === "deductExpenses") { + declareForm.updateFields({ [item]: result[item] || "ON" }); + } else if (item === "gender") { + declareForm.updateFields({ [item]: result[item] || "MALE" }); + } else if (item === "employmentStatus") { + declareForm.updateFields({ [item]: result[item] || _.take(props.employmentStatusList)[0].enum }); + } else if (item === "employmentType") { + declareForm.updateFields({ [item]: result[item] || _.take(props.employmentTypeList)[0].enum }); + } else if (item === "cardType") { + declareForm.updateFields({ [item]: "居民身份证" }); + } else if (item === "employee") { + declareForm.updateFields({ + // employeeType: { + // value: ["ORGANIZATION", ["13", "郑世珍", [{ id: "13", lastname: "郑世珍" }]]], + // valueSpan: ["employeeId"] + // } + }); + } else { + declareForm.updateFields({ [item]: result[item] || "" }); + } + }); + }); + } + }); + }; + onChange = (res) => { + const { eConditions } = this.state; + const { employeeDeclareStore: { declareForm } } = this.props; + const key = Object.keys(res)[0]; + const value = res[key].value; + switch (key) { + case "employmentStatus": + this.setState({ + eConditions: _.map(eConditions, it => { + return { + ...it, + items: _.map(it.items, child => { + if (child.domkey[0] === "dismissDate") { + return { + ...child, + viewAttr: value === "ABNORMAL" ? 3 : 2 + }; + } + return { ...child }; + }) + }; + }) + }, () => { + declareForm.initFormFields(this.state.eConditions); + }); + break; + case "employmentType": + this.setState({ + eConditions: _.map(eConditions, it => { + return { + ...it, + items: _.map(it.items, child => { + if (child.domkey[0] === "employmentDate") { + return { + ...child, + viewAttr: value !== "OTHER" ? 3 : 2 + }; + } + return { ...child }; + }) + }; + }) + }, () => { + declareForm.initFormFields(this.state.eConditions); + }); + break; + default: + break; + } + }; + handleSubmit = () => { const { employeeDeclareStore: { declareForm: form } } = this.props; form.validateForm().then(f => { if (f.isValid) { - const payload = form.getFormParams(); - console.log(payload); + const { employmentType, employmentDate, employmentStatus, dismissDate, ...params } = form.getFormParams(); + if ((employmentType !== "OTHER" && !employmentDate) || (employmentStatus === "ABNORMAL" && !dismissDate)) { + Modal.warning({ + title: getLabel(131329, "信息确认"), + content: getLabel(518702, "必要信息不完整,红色*为必填项!") + }); + return; + } + const payload = { + ...form.getFormParams(), id: this.props.id, + cardType: "RESIDENT_IDENTITY_CARDS", //暂时写死身份证类型 + taxAgentId: getQueryString("id"), + taxCycle: this.props.taxCycle + }; + this.setState({ loading: true }); + getEmployeeSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(22619, "保存成功!")); + this.props.onClose("true"); + } else { + message.error(errormsg || getLabel(22620, "保存失败!")); + } + }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); } @@ -37,7 +206,8 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { }; render() { - const { employeeDeclareStore: { declareForm: form } } = this.props; + const { eConditions, loading } = this.state; + const { employeeDeclareStore: { declareForm: form }, title = "" } = this.props; return (
- {getLabel(111, "本月新增数据")} + {title || getLabel(111, "本月新增数据")} - + )} - content={(
{getSearchs(form, declareConditions, 1)}
)} + content={(
{getSearchs(form, eConditions, 1, false, this.onChange)}
)} /> ); } diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/constants.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/constants.js index 9134619a..9b3ff734 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/constants.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/constants.js @@ -2,26 +2,6 @@ export const submitStatus = [ { key: "ALL", showname: "全部(报送状态)", - lanId: 332 - }, - { - key: "NOT_DECLARE", - showname: "待报送", - lanId: 111 - }, - { - key: "DECLARING", - showname: "报送中", - lanId: 111 - }, - { - key: "DECLARE_FAIL", - showname: "报送失败", - lanId: 111 - }, - { - key: "DECLARE_SUCCESS", - showname: "报送成功", lanId: 111 } ]; @@ -197,7 +177,7 @@ export const declareConditions = [ rules: "selectLinkageRequired", conditionType: "SELECT_LINKAGE", selectLinkageDatas: { - "1": { + "ORGANIZATION": { browserConditionParam: { completeParams: {}, conditionDataParams: {}, @@ -218,18 +198,15 @@ export const declareConditions = [ type: "1" }, conditionType: "BROWSER", - domkey: ["INPUT"] + domkey: ["employeeId"] }, - "2": { - conditionType: "CHECKBOX", - domkey: ["CHECKBOX"] + "EXT_EMPLOYEE": { + conditionType: "BROWSER", + domkey: ["INPUT2"] } }, - options: [ - { key: "1", showname: "今天" }, - { key: "2", showname: "本周" } - ], - domkey: ["secleve"], + options: [], + domkey: ["employeeType"], label: "系统名称", lanId: 111, viewAttr: 3 @@ -237,7 +214,7 @@ export const declareConditions = [ { colSpan: 1, conditionType: "INPUT", - domkey: ["keyword"], + domkey: ["employeeName"], fieldcol: 12, label: "证件姓名", lanId: 111, @@ -245,6 +222,211 @@ export const declareConditions = [ value: "", rules: "required", viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["jobNum"], + fieldcol: 12, + label: "工号", + lanId: 1933, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["nationality"], + fieldcol: 12, + label: "国籍", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 1 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["cardType"], + fieldcol: 12, + label: "证件类型", + lanId: 111, + labelcol: 6, + value: "居民身份证", + viewAttr: 1 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["cardNum"], + fieldcol: 12, + label: "证件号码", + lanId: 1839, + labelcol: 6, + value: "", + rules: "required", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["gender"], + fieldcol: 12, + label: "性别", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 3, + rules: "required", + options: [] + }, + { + colSpan: 1, + conditionType: "DATEPICKER", + domkey: ["birthday"], + fieldcol: 12, + label: "出生日期", + lanId: 111, + labelcol: 6, + rules: "required", + value: "", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["employmentStatus"], + fieldcol: 12, + label: "状态", + lanId: 535101, + labelcol: 6, + value: "", + viewAttr: 3, + rules: "required", + detailtype: 3, + options: [] + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["mobile"], + fieldcol: 12, + label: "手机号码", + lanId: 111, + labelcol: 6, + value: "", + rules: "required", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["employmentType"], + fieldcol: 12, + label: "任职受雇从业类型", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 3, + rules: "required", + options: [] + }, + { + colSpan: 1, + conditionType: "DATEPICKER", + domkey: ["employmentDate"], + fieldcol: 12, + label: "任职受雇从业日期", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "DATEPICKER", + domkey: ["dismissDate"], + fieldcol: 12, + label: "离职日期", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["disability"], + fieldcol: 12, + label: "是否残疾", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2, + detailtype: 3, + options: [] + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["disabilityCardNo"], + fieldcol: 12, + label: "残疾证号", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["lonelyOld"], + fieldcol: 12, + label: "是否孤老", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2, + detailtype: 3, + options: [] + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["martyrDependents"], + fieldcol: 12, + label: "是否是烈属", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2, + detailtype: 3, + options: [] + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["martyrDependentsCardNo"], + fieldcol: 12, + label: "烈属证号", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["deductExpenses"], + fieldcol: 12, + label: "是否扣除减除费用", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2, + detailtype: 3, + options: [] } ], defaultshow: true diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/index.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/index.js index 022bbf27..74b8d9d2 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/index.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/index.js @@ -6,16 +6,34 @@ */ import React, { Component } from "react"; import { WeaDatePicker, WeaLocaleProvider, WeaSelect, WeaTab, WeaTop } from "ecCom"; -import { Button, Dropdown, Menu, Spin } from "antd"; +import { Button, Dropdown, Menu, message, Modal, Spin } from "antd"; import BaseInfo from "./components/baseInfo"; import EmployeeDeclareDetailSchemaEditDialog from "./components/employeeDeclareDetailSchemaEditDialog"; +import { commonEnumList } from "../../apis/payrollFiles"; +import { + employeedeclareDeclare, + employeedeclareGetRate, + employeedeclareList, + employeedeclareList4Add, + employeedeclareList4Update, + employeedeclareRefresh, + employeeDelete, + getDeclareFeedback +} from "../../apis/declare"; import { advanceConditions, submitStatus } from "./constants"; +import moment from "moment"; import { getSearchs } from "../../util"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; +import { getQueryString } from "../../util/url"; import "./index.less"; const { getLabel } = WeaLocaleProvider; +const API = { + list: employeedeclareList, + list4Add: employeedeclareList4Add, + list4Update: employeedeclareList4Update +}; @inject("taxAgentStore", "employeeDeclareStore") @observer @@ -23,60 +41,288 @@ class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "0", - showSearchAd: false, - declareStatus: "ALL", - taxCycle: new Date(), - declareEditDialog: { - visible: false - } + selectedKey: "list", showSearchAd: false, declareStatus: "ALL", + taxCycle: new Date(), loading: { query: false, refresh: false, feedback: false, declare: false }, + pageInfo: { current: 1, pageSize: 10, total: 0 }, + declareEditDialog: { visible: false, id: "", title: "" }, + declareStatusList: [], employmentStatusList: [], + employmentTypeList: [], adConditons: [], + selectedRowKeys: [] }; + this.baseInfoRef = null; } componentDidMount() { - const { employeeDeclareStore: { advanceForm } } = this.props; document.title = getLabel(544289, "人员信息报送"); - advanceForm.initFormFields(advanceConditions); window.addEventListener("message", this.handleReceive, false); - this.setCss(); + this.initEmployeeDeclare().then(r => { + }); } + initEmployeeDeclare = async () => { + const { employeeDeclareStore: { advanceForm } } = this.props; + const [declareStatusList, employmentStatusList, employmentTypeList] = await Promise.all([this.commonEnumList("DeclareStatusEnum"), this.commonEnumList("EmploymentStatusEnum"), this.commonEnumList("EmploymentTypeEnum")]); + if (declareStatusList.status && employmentStatusList.status && employmentTypeList.status) { + this.setState({ + declareStatusList: declareStatusList.data, + employmentStatusList: employmentStatusList.data, + employmentTypeList: employmentTypeList.data, + adConditons: _.map(advanceConditions, it => { + return { + ...it, + items: _.map(it.items, child => { + if (child.domkey[0] === "employmentStatus") { + return { + ...child, + options: _.map(employmentStatusList.data, it => ({ + key: it.enum, + showname: getLabel(it.labelId, it.defaultLabel) + })) + }; + } else if (child.domkey[0] === "employmentType") { + return { + ...child, + options: _.map(employmentTypeList.data, it => ({ + key: it.enum, + showname: getLabel(it.labelId, it.defaultLabel) + })) + }; + } + if (child.conditionType === "SELECT" && child.domkey[0] !== "employmentStatus" && child.domkey[0] !== "employmentType") { + return { + ...child, + options: [ + { key: "ON", showname: getLabel(538048, "是") }, + { key: "OFF", showname: getLabel(111, "否") } + ] + }; + } + return { ...child }; + }) + }; + }) + }, () => { + advanceForm.initFormFields(this.state.adConditons); + }); + } + }; + componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); } - setCss = () => { - $($("head")[0]).append(""); - }; - handleReceive = ({ data }) => { const { type, payload: { id, params } = {} } = data; if (type === "init") { - this.postMessageToChild({}); + this.queryEmployeeList(); } else if (type === "turn") { if (id === "PAGEINFO") { const { pageNum: current, size: pageSize } = params; this.setState({ pageInfo: { ...pageInfo, current, pageSize } }); + } else if (id === "EDIT") { + this.setState({ + declareEditDialog: { + ...this.state.declareEditDialog, + visible: true, id: params.id, title: params.employeeName + } + }); + } else if (id === "DELETE") { + this.handleDeleteDeclare([params.id]); + } else if (id === "ROWSELECT") { + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); } } }; - postMessageToChild = (payload) => { + postMessageToChild = (payload = {}) => { + const i18n = { + "总计": getLabel(523, "总计"), "编辑": getLabel(501169, "编辑"), + "操作": getLabel(30585, "操作"), "删除": getLabel(535052, "删除"), + "共": getLabel(83698, "共"), "条": getLabel(18256, "条"), + "加载中": getLabel(83698, "加载中") + }; const childFrameObj = document.getElementById("atdTable"); - childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({}), "*"); + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; + commonEnumList = (key) => { + const payload = { enumClass: `com.engine.salary.enums.employeedeclare.${key}` }; + return commonEnumList(payload); + }; + /* + * Author: 黎永顺 + * Description: 报送列表查询 + * Params: + * Date: 2023/8/14 + */ + queryEmployeeList = () => { + const { employeeDeclareStore: { advanceForm: form } } = this.props; + const { pageInfo, declareStatus, taxCycle, selectedKey, selectedRowKeys } = this.state; + const { departmentIds, positionIds, ...formParams } = form.getFormParams(); + const payload = { + ...formParams, ...pageInfo, + declareStatus, + taxAgentId: getQueryString("id"), + taxCycle: moment(taxCycle).startOf("month").format("YYYY-MM-DD"), + departmentIds: departmentIds ? departmentIds.split(",") : [], + positionIds: positionIds ? positionIds.split(",") : [] + }; + this.setState({ loading: { ...this.state.loading, query: true } }); + API[selectedKey](payload).then(({ status, data }) => { + this.setState({ loading: { ...this.state.loading, query: false } }); + if (status) { + const { pageInfo: result } = data; + const { columns, list: dataSource, pageNum: current, pageSize, total } = result; + this.baseInfoRef.getEmployeeDeclareInfo(); + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total } + }, () => { + const payload = { + dataSource, selectedRowKeys, + pageInfo: this.state.pageInfo, + columns: _.map(columns, it => { + if (it.dataIndex === "employeeName" || it.dataIndex === "subCompanyName") { + return { ...it, width: 150, fixed: "left" }; + } + if (it.dataIndex === "declareStatusDesc") { + return { ...it, width: 150, fixed: "right" }; + } + return { ...it, width: 150 }; + }) + }; + this.postMessageToChild(payload); + }); + } + }).then(() => this.setState({ loading: { ...this.state.loading, query: false } })); + }; + /* + * Author: 黎永顺 + * Description: 刷新数据 + * Params: + * Date: 2023/8/14 + */ + employeedeclareRefresh = () => { + const payload = { + taxAgentId: getQueryString("id"), + taxCycle: moment(this.state.taxCycle).startOf("month").format("YYYY-MM-DD") + }; + this.setState({ loading: { ...this.state.loading, refresh: true } }); + employeedeclareRefresh(payload).then(async ({ status, data, errormsg }) => { + this.setState({ loading: { ...this.state.loading, refresh: false } }); + if (status) { + const { status, data: result } = await employeedeclareGetRate({ index: data }); + const { msg } = result || {}; + (status && !msg) ? message.success(getLabel(111, "刷新成功!")) : message.warning(msg || getLabel(111, "刷新失败!")); + this.queryEmployeeList(); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: { ...this.state.loading, refresh: false } })); + }; + /* + * Author: 黎永顺 + * Description:获取报送结果反馈 + * Params: + * Date: 2023/8/15 + */ + getDeclareFeedback = () => { + const payload = { + taxAgentId: getQueryString("id"), + taxCycle: moment(this.state.taxCycle).startOf("month").format("YYYY-MM-DD") + }; + this.setState({ loading: { ...this.state.loading, feedback: true } }); + getDeclareFeedback(payload).then(async ({ status, data, errormsg }) => { + this.setState({ loading: { ...this.state.loading, feedback: false } }); + if (status) { + const { status, data: result } = await employeedeclareGetRate({ index: data }); + const { msg } = result || {}; + (status && !msg) ? message.success(getLabel(111, "获取报送结果成功!")) : message.warning(msg || ""); + this.queryEmployeeList(); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: { ...this.state.loading, feedback: false } })); + }; + /* + * Author: 黎永顺 + * Description: 删除个税申报人员信息 + * Params: + * Date: 2023/8/15 + */ + handleDeleteDeclare = (paylaod) => { + const { selectedRowKeys } = this.state; + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(543548, "确认删除吗?"), + onOk: () => { + employeeDelete(paylaod).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(502230, "删除成功!")); + this.setState({ + selectedRowKeys: _.xorWith(selectedRowKeys, paylaod, _.isEqual) + }); + this.queryEmployeeList(); + } else { + message.error(errormsg || getLabel(20462, "删除失败!")); + } + }); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 全部报送 + * Params: + * Date: 2023/8/15 + */ + employeedeclareDeclare = () => { + const payload = { + taxAgentId: getQueryString("id"), + taxCycle: moment(this.state.taxCycle).startOf("month").format("YYYY-MM-DD") + }; + this.setState({ loading: { ...this.state.loading, declare: true } }); + employeedeclareDeclare(payload).then(async ({ status, data, errormsg }) => { + this.setState({ loading: { ...this.state.loading, declare: false } }); + if (status) { + const { status, data: result } = await employeedeclareGetRate({ index: data }); + const { msg } = result || {}; + (status && !msg) ? message.success(getLabel(111, "全部报送成功!")) : message.warning(msg || ""); + this.queryEmployeeList(); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: { ...this.state.loading, declare: false } })); }; handleAdd = () => { this.setState({ declareEditDialog: { + ...this.state.declareEditDialog, visible: true } }); }; + handleMenuClick = ({ key }) => { + const { selectedRowKeys } = this.state; + switch (key) { + case "1": + if (_.isEmpty(selectedRowKeys)) { + message.warning(getLabel(111, "请先选择需要删除的人员!")); + return; + } + this.handleDeleteDeclare(selectedRowKeys); + break; + default: + break; + } + }; render() { - const { selectedKey, showSearchAd, declareStatus, taxCycle, declareEditDialog } = this.state; - const { taxAgentStore: { showOperateBtn }, employeeDeclareStore: { advanceForm: form } } = this.props; + const { + selectedKey, showSearchAd, declareStatus, declareStatusList, taxCycle, declareEditDialog, loading, + pageInfo, adConditons, employmentTypeList, employmentStatusList + } = this.state; + const { taxAgentStore: { showOperateBtn }, employeeDeclareStore: { advanceForm: form, declareForm } } = this.props; const menu = ( - + {getLabel(32136, "批量删除")} {getLabel(111, "批量编辑")} {getLabel(81272, "导出全部")} @@ -84,73 +330,119 @@ class Index extends Component { ); const buttons = [ - , - , - , console.log(val)}/>, + onChange={val => this.setState({ + taxCycle: val, + pageInfo: { + ...pageInfo, + current: 1 + } + }, () => this.queryEmployeeList())}/>, + , + , + , + } + type="primary">{getLabel(1421, "新增")}, + ({ ...it, showname: getLabel(it.lanId, it.showname) })), + ..._.map(declareStatusList, it => ({ + key: it.enum, + showname: getLabel(it.labelId, it.defaultLabel) + })) + ]} + onChange={declareStatus => this.setState({ + declareStatus, + pageInfo: { + ...pageInfo, + current: 1 + } + }, () => this.queryEmployeeList())} + /> + ]; + // !showOperateBtn && tabBtns.shift(); return ( } className="declareWrapper" - buttons={showOperateBtn ? buttons : []} + buttons={buttons} + // buttons={showOperateBtn ? buttons : []} >
{/*基础信息*/} - + this.baseInfoRef = dom} + taxCycle={moment(taxCycle).startOf("month").format("YYYY-MM-DD")} + /> {/*列表数据*/}
this.setState({ showSearchAd: bool })} - advanceHeight={300} searchsAd={getSearchs(form, toJS(advanceConditions), 2)} - buttons={[ - - {getLabel(32935, "导入")} - - } - type="primary">{getLabel(1421, "新增")}, - ({ ...it, showname: getLabel(it.lanId, it.showname) }))} - onChange={declareStatus => this.setState({ declareStatus })} - /> - ]} searchsBaseValue={form.getFormParams().keyword} + advanceHeight={300} searchsAd={getSearchs(form, toJS(adConditons), 2)} + buttons={tabBtns} searchsBaseValue={form.getFormParams().keyword} onSearchChange={(v) => form.updateFields({ keyword: v })} - onChange={key => this.setState({ selectedKey: key })} + onChange={key => this.setState({ + selectedKey: key, + pageInfo: { ...pageInfo, current: 1 } + }, () => this.queryEmployeeList())} onAdReset={() => form.resetForm()} + onSearch={() => this.setState({ + pageInfo: { ...pageInfo, current: 1 } + }, () => this.queryEmployeeList())} + onAdSearch={() => this.setState({ + pageInfo: { + ...pageInfo, + current: 1 + } + }, () => this.queryEmployeeList())} />
- +