From 79ea27233f5eef2083761396f76c67224881409f 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, 15 Mar 2023 14:36:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E5=8F=91=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/payroll/payrollGrant/index.js | 4 +++- pc4mobx/hrmSalary/stores/payroll.js | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index a90c108b..71327ee1 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -250,7 +250,7 @@ export default class PayrollGrant extends React.Component { getSearchsAdQuick() { const { payrollStore } = this.props; - const { salarySendDetailBaseInfo } = payrollStore; + const { salarySendDetailBaseInfo, btnLoading } = payrollStore; const notShowGrantOrWithdraw = salarySendDetailBaseInfo.haveBackCalc === 1 && salarySendDetailBaseInfo.salaryAcctType === "0"; const { selectedKey } = this.state; const handleMenuClick = e => { @@ -284,6 +284,7 @@ export default class PayrollGrant extends React.Component { { key: "SELECT", show: "发放所选", selected: false }, { key: "PART", show: "部分发放", selected: false } ]} + btnProps={{loading: btnLoading}} btnOnClick={this.sendPayroll} menuOnClick={(key) => this.sendPayroll(key)} />, @@ -297,6 +298,7 @@ export default class PayrollGrant extends React.Component { { key: "recallSelected", show: "撤回所选", selected: false }, { key: "partialWithdrawal", show: "部分撤回", selected: false } ]} + btnProps={{loading: btnLoading}} btnOnClick={this.withdrawalPayroll} menuOnClick={(key) => this.withdrawalPayroll(key)} />, diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index a68f0ae8..7a31dbd4 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -1,5 +1,6 @@ import { action, observable, toJS } from "mobx"; import { message } from "antd"; +import { WeaLoadingGlobal } from "ecCom"; import { WeaForm, WeaTableNew } from "comsMobx"; import * as API from "../apis/payroll"; // 引入API接口文件 @@ -14,6 +15,7 @@ export class payrollStore { @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 + @observable btnLoading = false; // 数据加载状态 // **** 模板页面 **** @observable templateStore = new TableStore(); // 模板设置列表 @@ -508,7 +510,12 @@ export class payrollStore { return new Promise((resolve, reject) => { message.destroy(); message.loading("正在发放中...", 0); + this.btnLoading = true; + WeaLoadingGlobal.start(); API.grantPayroll(params).then(res => { + this.btnLoading = false; + WeaLoadingGlobal.end(); + WeaLoadingGlobal.destroy(); message.destroy(); if (res.status) { message.success("发送成功"); @@ -517,6 +524,10 @@ export class payrollStore { message.error(res.errormsg || "发送失败"); reject(); } + }).catch(() => { + this.btnLoading = false + WeaLoadingGlobal.end(); + WeaLoadingGlobal.destroy(); }); }); }; @@ -527,7 +538,12 @@ export class payrollStore { return new Promise((resolve, reject) => { message.destroy(); message.loading("正在撤回中...", 0); + this.btnLoading = true; + WeaLoadingGlobal.start(); API.withdrawPayroll(params).then(res => { + this.btnLoading = false; + WeaLoadingGlobal.end(); + WeaLoadingGlobal.destroy(); message.destroy(); if (res.status) { message.success("撤回成功"); @@ -536,6 +552,10 @@ export class payrollStore { message.error(res.errormsg || "撤回失败"); reject(); } + }).catch(() => { + this.btnLoading = false + WeaLoadingGlobal.end(); + WeaLoadingGlobal.destroy(); }); }); };