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 (