From 93d996c79f2e7095c01d1d47f5a25fdc7a51467b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 10 Oct 2023 17:49:45 +0800
Subject: [PATCH] =?UTF-8?q?feature/2.9.42310.01-=E8=96=AA=E8=B5=84?=
=?UTF-8?q?=E6=A0=B8=E7=AE=97=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hrmSalary/pages/calculate/calculate.js | 144 +++++++++++++++++-
.../components/calculateTablelist/index.js | 5 +-
2 files changed, 142 insertions(+), 7 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/calculate/calculate.js b/pc4mobx/hrmSalary/pages/calculate/calculate.js
index f289d080..ae98e007 100644
--- a/pc4mobx/hrmSalary/pages/calculate/calculate.js
+++ b/pc4mobx/hrmSalary/pages/calculate/calculate.js
@@ -7,12 +7,14 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTop } from "ecCom";
-import { Button } from "antd";
+import { Button, message, Modal } from "antd";
import moment from "moment";
import CalculateQuery from "./components/calculateQuery";
import CalculateTablelist from "./components/calculateTablelist";
import CalculateDialog from "./components/calculateDialog";
+import { backCalculate, deleteSalaryacct, fileSalaryAcct, reAccounting } from "../../apis/calculate";
import "./index.less";
+import ProgressModal from "../../components/progressModal";
const getLabel = WeaLocaleProvider.getLabel;
@@ -28,10 +30,12 @@ class Calculate extends Component {
moment(new Date()).startOf("year").format("YYYY-MM"),
moment(new Date()).startOf("month").format("YYYY-MM")
]
- },
- isRefresh: false,
+ }, isRefresh: false,
+ progressModule: { visible: false, progress: 0, title: getLabel(111, "正在归档中请稍后") },
calcDaialog: { visible: false, title: "" }
};
+ this.timer = null;
+ this.handleDebounce = null;
}
renderCalculateOpts = () => {
@@ -51,21 +55,151 @@ class Calculate extends Component {
];
return !showOperateBtn ? calculateOpts.slice(1) : calculateOpts;
};
+ handleCalcOpts = ({ key }, record) => {
+ const { isRefresh, progressModule } = this.state, { id } = record;
+ switch (key) {
+ case "0":
+ //核算
+ window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/calculate/${id}`);
+ break;
+ case "1":
+ //删除
+ Modal.confirm({
+ title: getLabel(131329, "信息确认"),
+ content: getLabel(543231, "确认删除本条数据吗?"),
+ onOk: () => {
+ deleteSalaryacct([id]).then(({ status, errormsg }) => {
+ if (status) {
+ message.success(getLabel(502230, "删除成功!"));
+ this.setState({ isRefresh: !isRefresh });
+ } else {
+ message.error(errormsg);
+ }
+ });
+ }
+ });
+ break;
+ case "2":
+ //归档
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ if (this.timer) clearInterval(this.timer);
+ this.setState({ progressModule: { ...progressModule, visible: true } });
+ this.timer = setInterval(() => {
+ if (progressModule.progress === 100 && this.timer) {
+ clearInterval(this.timer);
+ this.timer = null;
+ this.setState({
+ progressModule: { ...progressModule, visible: false, progress: 0 },
+ isRefresh: !isRefresh
+ });
+ }
+ this.setState({
+ progressModule: { ...progressModule, progress: progressModule.progress + 1 }
+ });
+ }, 800);
+ fileSalaryAcct({ id }).then(({ status, errormsg }) => {
+ if (status) {
+ clearInterval(this.timer);
+ this.timer = null;
+ this.setState({
+ progressModule: { ...progressModule, visible: false, progress: 0 },
+ isRefresh: !isRefresh
+ });
+ message.success(getLabel(503690, "归档成功"));
+ } else {
+ clearInterval(this.timer);
+ this.timer = null;
+ this.setState({
+ progressModule: { ...progressModule, visible: false, progress: 0 }
+ });
+ message.error(errormsg);
+ }
+ });
+ this.handleDebounce = null;
+ }, 500);
+ }
+ this.handleDebounce();
+ break;
+ case "3":
+ //查看详情
+ window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/placeOnFileDetail?id=${id}`);
+ break;
+ case "4":
+ //重新核算
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ reAccounting({ salaryAcctRecordId: id }).then(({ status, errormsg }) => {
+ if (status) {
+ message.success(getLabel(30700, "操作成功!"));
+ this.setState({ isRefresh: !isRefresh });
+ } else {
+ message.error(errormsg);
+ }
+ });
+ this.handleDebounce = null;
+ }, 500);
+ }
+ this.handleDebounce();
+ break;
+ case "5":
+ //回算
+ Modal.confirm({
+ title: getLabel(131329, "信息确认"),
+ content: getLabel(543538, "确定回算吗?回算后,正常核算的数据会被覆盖,正常核算的工资单不能继续发放或撤回!"),
+ onOk: () => {
+ if (!this.handleDebounce) {
+ this.handleDebounce = _.debounce(() => {
+ backCalculate({ salaryAcctRecordId: id }).then(({ status, errormsg }) => {
+ if (status) {
+ message.success(getLabel(544367, "回算成功!"));
+ this.setState({ isRefresh: !isRefresh });
+ } else {
+ message.error(errormsg);
+ }
+ });
+ this.handleDebounce = null;
+ }, 500);
+ }
+ this.handleDebounce();
+ }
+ });
+ break;
+ default:
+ break;
+ }
+ };
render() {
- const { queryParams, isRefresh, calcDaialog } = this.state;
+ const { queryParams, isRefresh, calcDaialog, progressModule } = this.state;
return (