工资单发放页面接口优化

This commit is contained in:
黎永顺 2023-03-15 14:36:09 +08:00
parent 39d526d59e
commit 79ea27233f
2 changed files with 23 additions and 1 deletions

View File

@ -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)}
/>,

View File

@ -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();
});
});
};