salary-management-front/pc4mobx/hrmSalary/stores/payroll.js

632 lines
20 KiB
JavaScript
Raw Normal View History

2022-12-07 14:15:46 +08:00
import { action, observable, toJS } from "mobx";
2022-06-22 17:14:53 +08:00
import { message } from "antd";
2023-03-15 14:36:09 +08:00
import { WeaLoadingGlobal } from "ecCom";
2022-06-22 17:14:53 +08:00
import { WeaForm, WeaTableNew } from "comsMobx";
2022-04-13 16:56:31 +08:00
2022-06-22 17:14:53 +08:00
import * as API from "../apis/payroll"; // 引入API接口文件
import { removePropertyCondition } from "../util/response";
2022-04-13 16:56:31 +08:00
const { TableStore } = WeaTableNew;
export class payrollStore {
@observable tableStore = new TableStore(); // new table
@observable form = new WeaForm(); // nrew 一个form
@observable condition = []; // 存储后台得到的form数据
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
@observable showSearchAd = false; // 高级搜索面板显示
@observable loading = true; // 数据加载状态
2023-03-15 14:36:09 +08:00
@observable btnLoading = false; // 数据加载状态
2022-04-13 16:56:31 +08:00
2022-06-22 17:14:53 +08:00
// **** 模板页面 ****
2022-04-13 16:56:31 +08:00
@observable templateStore = new TableStore(); // 模板设置列表
// 基础设置表单
2022-06-22 17:14:53 +08:00
@observable templateBaseData = {}; // 基础信息表单数据
@observable salarySobOptions = []; // 账套列表
2022-04-13 16:56:31 +08:00
// 显示设置表单
2022-06-22 17:14:53 +08:00
@observable salaryTemplateShowSet = {}; // 显示设置基础表单
2022-12-07 14:15:46 +08:00
@observable replenishSalaryTemplateSalaryItemSet = []; // 补发工资单模版基础表单
2022-06-22 17:14:53 +08:00
@observable salaryItemSet = []; // 显示设置薪资项
@observable salaryBillItemNameSetting = [
{
salaryTemplateId: "",
salaryBillType: 0,
itemShowNameSetting: []
},
{
salaryTemplateId: "",
salaryBillType: 1,
itemShowNameSetting: []
}
]; // 工资单模板薪资项目名称修改列表
@observable salaryBillItemNameSet = {}; // 工资单模板薪资项目名称修改列表
2022-04-16 13:13:41 +08:00
// **** 工资单页面 ****
@observable salarySendTableStore = new TableStore(); // 工资单列表
@observable salarySendDataSource = [];
2022-06-22 17:14:53 +08:00
@observable pageInfo = {};
2022-04-16 13:13:41 +08:00
// **** 工资单详情页 ****
@observable salarySendDetailBaseInfo = {}; // 工资单详情基础信息
@observable salarySendDetailDataSource = []; // 详情列表DataSource
@observable salarySendDetailTableStore = new TableStore(); // 详情列表store
@observable detailListConditionForm = new WeaForm(); // 详情页搜索条件
@observable detailListShowSearchAd = false; // 详情页是否展开搜索面板
@observable detailListCondition = []; // 详情页搜索条件
2022-06-22 17:14:53 +08:00
@observable salarySendDetailPageInfo = {};
2022-04-16 13:13:41 +08:00
// **** 工资单发放页 ****
@observable salaryGrantDataSource = [];
2022-06-22 17:14:53 +08:00
@observable salaryGrantPageInfo = {};
@observable salaryGrantTableStore = [];
2022-04-16 13:13:41 +08:00
@observable grantListConditionForm = new WeaForm(); // 详情页搜索条件
@observable grantListShowSearchAd = false; // 详情页是否展开搜索面板
@observable grantListCondition = []; // 详情页搜索条件
@observable canGrantDataSource = []; // 可以发送的列表
2022-06-22 17:14:53 +08:00
@observable canGrantColumns = []; // 可以发送的列名
2022-05-31 18:51:23 +08:00
@observable canGrantPageInfo = {}; // 可以发送列表分页对象
2022-04-16 13:13:41 +08:00
@observable canWithdrawDataSource = []; // 可以撤回的列表
@observable canWidthdrawColumns = []; // 可以撤回的列表列名
2022-05-31 18:51:23 +08:00
@observable canWithdrawPageInfo = {}; // 可以撤回列表分页对象
2022-04-16 13:13:41 +08:00
// **** 工资单模板 ****
@observable templateTableColumns = []; // 工资单模板columns
@observable templateTableDataSource = []; // 工资单模板dataSource
@observable templateTablePageInfo = {
current: 1, pageSize: 10, total: 0
}; // 工资单模板pageInfo
@observable templateTableSelectedRowKeys = []; // 工资单模板复选框
2022-12-07 14:15:46 +08:00
@action
setReplenishSalaryTemplateSalaryItemSet = replenishSalaryTemplateSalaryItemSet =>
(this.replenishSalaryTemplateSalaryItemSet = replenishSalaryTemplateSalaryItemSet);
2022-04-16 13:13:41 +08:00
@action
2022-06-22 17:14:53 +08:00
setGrantListShowSearchAd = grantListShowSearchAd =>
(this.grantListShowSearchAd = grantListShowSearchAd);
2022-04-16 13:13:41 +08:00
// 详情页是否展开搜索面板
@action
2022-06-22 17:14:53 +08:00
setDetailListShowSearchAd = detailListShowSearchAd =>
(this.detailListShowSearchAd = detailListShowSearchAd);
2022-04-16 13:13:41 +08:00
2022-04-13 16:56:31 +08:00
// 基础信息表单数据
@action
2022-12-06 15:04:57 +08:00
setTemplateBaseData = templateBaseData => (this.templateBaseData = templateBaseData);
2022-04-13 16:56:31 +08:00
// 显示设置基础表单
@action
2022-06-22 17:14:53 +08:00
setSalaryTemplateShowSet = salaryTemplateShowSet =>
(this.salaryTemplateShowSet = salaryTemplateShowSet);
2022-04-13 16:56:31 +08:00
2022-06-14 11:17:03 +08:00
@action
2022-06-22 17:14:53 +08:00
setSalaryItemSet = salaryItemSet => (this.salaryItemSet = salaryItemSet);
@action
setSalaryBillItemNameSet = salaryBillItemNameSet => (this.salaryBillItemNameSet = salaryBillItemNameSet);
@action
setSalaryBillItemNameSetting = salaryBillItemNameSetting => (this.salaryBillItemNameSetting = salaryBillItemNameSetting);
2022-06-14 11:17:03 +08:00
@action("工资单模板分页信息修改")
setTemplateTablePageInfo = (pageInfo, callback) => {
this.templateTablePageInfo = { ...this.templateTablePageInfo, ...pageInfo };
callback && callback();
};
@action("工资单模板复选框选择")
setTemplateTableSelectedRowKeys = (selectedRowKeys) => this.templateTableSelectedRowKeys = selectedRowKeys;
2022-04-13 16:56:31 +08:00
// 初始化操作
@action
doInit = () => {
// this.getCondition();
// this.getTableDatas();
2022-06-22 17:14:53 +08:00
};
2022-04-13 16:56:31 +08:00
// 获得高级搜索表单数据
@action
getCondition = () => {
2022-06-22 17:14:53 +08:00
API.getCondition().then(
action(res => {
if (res.api_status) {
// 接口请求成功/失败处理
let condition = removePropertyCondition(res.condition);
this.form.initFormFields(condition); // 渲染高级搜索form表单
} else {
message.error(res.msg || "接口调用失败!");
}
})
);
};
2022-04-13 16:56:31 +08:00
// 渲染table数据
@action
2022-06-22 17:14:53 +08:00
getTableDatas = params => {
2022-04-13 16:56:31 +08:00
this.loading = true;
const formParams = this.form.getFormParams() || {};
params = params || formParams;
2022-06-22 17:14:53 +08:00
API.getTableDatas(params).then(
action(res => {
if (res.api_status) {
// 接口请求成功/失败处理
this.tableStore.getDatas(res.datas); // table 请求数据
this.hasRight = res.hasRight;
} else {
message.error(res.msg || "接口调用失败!");
}
this.loading = false;
})
);
};
2022-04-13 16:56:31 +08:00
2022-06-22 17:14:53 +08:00
@action setShowSearchAd = bool => (this.showSearchAd = bool);
2022-04-13 16:56:31 +08:00
// 高级搜索 - 搜索
2022-06-22 17:14:53 +08:00
@action
doSearch = () => {
2022-04-13 16:56:31 +08:00
this.getTableDatas();
this.showSearchAd = false;
2022-06-22 17:14:53 +08:00
};
2022-04-13 16:56:31 +08:00
// 工资单模板-工资单模板列表
@action
2022-04-14 19:32:57 +08:00
getPayrollTemplateList = (params = {}) => {
2022-06-22 17:14:53 +08:00
this.loading = true;
API.getPayrollTemplateList({ ...this.templateTablePageInfo, ...params }).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.templateTableColumns = res.data.columns;
this.templateTableDataSource = res.data.list;
this.setTemplateTablePageInfo({
current: res.data.pageNum,
pageSize: res.data.pageSize,
total: res.data.total
});
2022-04-13 16:56:31 +08:00
} else {
message.error(res.errormsg || "获取失败");
}
2022-05-10 15:31:13 +08:00
this.loading = false;
2022-06-22 17:14:53 +08:00
});
};
2022-04-13 16:56:31 +08:00
// 工资单模板-获取工资单模板基础设置表单
@action
getPayrollBaseForm = (id = "") => {
let params = { id };
2022-04-13 16:56:31 +08:00
return new Promise((resolve, reject) => {
API.getPayrollBaseForm(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
let response = res.data.salaryTemplateBaseSet;
let templateBaseData = response.data;
templateBaseData.salarySob =
templateBaseData.salarySob != undefined
? templateBaseData.salarySob + ""
: null;
this.templateBaseData = templateBaseData; // 基础信息表单数据
this.salarySobOptions = response.salarySobOptions
? response.salarySobOptions.map(item => {
2022-12-06 15:04:57 +08:00
let result = {};
result.showname = item.name;
result.key = item.id + "";
result.selected = false;
return result;
})
2022-06-22 17:14:53 +08:00
: [];
2022-04-13 16:56:31 +08:00
resolve({
2022-12-07 14:15:46 +08:00
replenishRuleSetOption: res.data.replenishRuleSetOption,
2022-04-13 16:56:31 +08:00
templateBaseData: this.templateBaseData,
salarySobOptions: this.salarySobOptions
});
} else {
message.errro(res.errormsg || "获取失败");
2022-06-22 17:14:53 +08:00
reject();
2022-04-13 16:56:31 +08:00
}
2022-06-22 17:14:53 +08:00
});
});
};
2022-04-13 16:56:31 +08:00
// 工资单模板-获取工资单模板显示设置表单
@action
getPayrollShowForm = (id = "") => {
2022-12-07 14:15:46 +08:00
const params = { id };
2023-01-09 14:04:08 +08:00
const salaryTemplateShowSetStorage = window.localStorage.getItem("salary-showset") || "{}";
2022-04-13 16:56:31 +08:00
API.getPayrollShowForm(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
if (id !== "") {
this.salaryItemSet = res.data.salaryTemplateSalaryItemSet;
this.replenishSalaryTemplateSalaryItemSet = res.data.replenishSalaryTemplateSalaryItemSet;
2022-04-14 19:32:57 +08:00
}
this.salaryBillItemNameSet = res.data.salaryBillItemNameSet;
2022-12-07 14:15:46 +08:00
this.salaryTemplateShowSet = { ...res.data.salaryTemplateShowSet.data, ...JSON.parse(salaryTemplateShowSetStorage) };
2022-04-13 16:56:31 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-13 16:56:31 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-13 16:56:31 +08:00
// 工资单模板-获取薪资项目设置
@action
getPayrollItemList = (salarySobId = "") => {
let params = {
salarySobId
2022-06-22 17:14:53 +08:00
};
2022-04-13 16:56:31 +08:00
API.getPayrollItemList(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.salaryItemSet = res.data;
2022-04-13 16:56:31 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-13 16:56:31 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-13 16:56:31 +08:00
// 初始化显示设置表单
@action
initShowSettingForm = (id = "") => {
this.getPayrollShowForm(id);
2022-12-07 14:15:46 +08:00
if (id === "") {
2022-06-22 17:14:53 +08:00
this.getPayrollItemList(this.templateBaseData.salarySob);
2022-04-13 16:56:31 +08:00
}
2022-06-22 17:14:53 +08:00
};
2022-04-13 16:56:31 +08:00
// 拼装保存参数
convertParams = () => {
2022-06-22 17:14:53 +08:00
let params = { ...this.templateBaseData, ...this.salaryTemplateShowSet };
2022-12-07 14:15:46 +08:00
params.replenishRule = (!params.replenishRule || params.reissueRule === "0") ? "ALL" : params.replenishRule;
2022-06-22 17:14:53 +08:00
params.salarySobId = params.salarySob;
2022-04-13 16:56:31 +08:00
params.emailStatus = params.emailStatus ? params.emailStatus : false;
2022-06-22 17:14:53 +08:00
params.msgStatus = params.msgStatus ? params.msgStatus : false;
params.salaryItemNullStatus = params.salaryItemNullStatus
? params.salaryItemNullStatus
: false;
params.salaryItemZeroStatus = params.salaryItemZeroStatus
? params.salaryItemZeroStatus
: false;
2022-12-07 14:15:46 +08:00
params.salaryItemSetting = toJS(this.salaryItemSet);
params.replenishSalaryItemSetting = toJS(this.replenishSalaryTemplateSalaryItemSet);
params.salaryBillItemNameSetting = toJS(this.salaryBillItemNameSetting);
2022-06-22 17:14:53 +08:00
return params;
};
2022-04-13 16:56:31 +08:00
// 工资单模板-新建工资单模板
@action
fetchSavePayroll = () => {
return new Promise((resolve, reject) => {
2022-12-07 14:15:46 +08:00
const params = this.convertParams();
2022-04-13 16:56:31 +08:00
API.savePayroll(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-04-13 16:56:31 +08:00
message.success("保存成功");
2022-05-05 15:53:35 +08:00
this.getPayrollTemplateList();
this.setSalaryBillItemNameSetting(_.map(this.salaryBillItemNameSetting, it => {
return { ...it, salaryTemplateId: "", itemShowNameSetting: [] };
}));
2022-05-05 15:53:35 +08:00
resolve();
2022-06-22 17:14:53 +08:00
} else {
message.error(res.errormsg || "保存失败");
reject();
2022-05-05 15:53:35 +08:00
}
2022-12-07 14:15:46 +08:00
}).catch(() => reject());
2022-06-22 17:14:53 +08:00
});
};
2022-05-05 15:53:35 +08:00
// 工资单模板-更新工资单模板
@action
2022-06-22 17:14:53 +08:00
fetchUpdatePayroll = id => {
2022-05-05 15:53:35 +08:00
return new Promise((resolve, reject) => {
2022-12-07 14:15:46 +08:00
let params = this.convertParams();
params.id = id;
2022-05-05 15:53:35 +08:00
API.updatePayroll(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-05-05 15:53:35 +08:00
message.success("保存成功");
2022-04-13 16:56:31 +08:00
this.getPayrollTemplateList();
resolve();
2022-06-22 17:14:53 +08:00
} else {
message.error(res.errormsg || "保存失败");
reject();
2022-04-13 16:56:31 +08:00
}
2022-06-22 17:14:53 +08:00
});
});
};
2022-04-14 19:32:57 +08:00
//工资单-获取薪资账套下拉列表
@action
getPayrollTemplateLedgerList = () => {
return new Promise((resolve, reject) => {
API.getPayrollTemplateLedgerList().then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-04-14 19:32:57 +08:00
this.payrollTemplateLedgerList = res.data.map(item => {
2022-06-22 17:14:53 +08:00
let result = {};
2022-04-14 19:32:57 +08:00
result.showname = item.content;
result.selected = false;
2022-06-22 17:14:53 +08:00
result.key = item.id;
2022-04-14 19:32:57 +08:00
return result;
2022-06-22 17:14:53 +08:00
});
resolve(this.payrollTemplateLedgerList);
2022-04-14 19:32:57 +08:00
} else {
message.error(res.errormsg || "获取失败");
2022-06-22 17:14:53 +08:00
reject();
2022-04-14 19:32:57 +08:00
}
2022-06-22 17:14:53 +08:00
});
});
};
2022-04-14 19:32:57 +08:00
// 工资单模板-工资单模板默认使用
@action
changePayrollDefaultUse(id = "") {
2022-06-22 17:14:53 +08:00
if (id == "") {
2022-04-14 19:32:57 +08:00
message.warning("id必填");
2022-06-22 17:14:53 +08:00
return;
2022-04-14 19:32:57 +08:00
}
let params = {
id
2022-06-22 17:14:53 +08:00
};
2022-05-10 15:31:13 +08:00
return new Promise((resolve, reject) => {
API.changePayrollDefaultUse(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-05-10 15:31:13 +08:00
message.success("设置成功");
2022-06-22 17:14:53 +08:00
resolve();
2022-05-10 15:31:13 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.success(res.errormsg || "设置失败");
reject();
2022-05-10 15:31:13 +08:00
}
2022-06-22 17:14:53 +08:00
});
});
2022-04-14 19:32:57 +08:00
}
// 工资单模板-复制工资单模板
@action
duplicatePayroll = (id, name) => {
let params = {
2022-06-22 17:14:53 +08:00
id,
name
};
2022-04-14 19:32:57 +08:00
return new Promise((resolve, reject) => {
API.duplicatePayroll(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
message.success("复制成功");
this.getPayrollTemplateList();
resolve();
2022-04-14 19:32:57 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "复制失败");
2022-04-14 19:32:57 +08:00
reject();
}
2022-06-22 17:14:53 +08:00
});
});
};
2022-04-14 19:32:57 +08:00
// 工资单模板-删除工资单模板
@action
2022-06-22 17:14:53 +08:00
deletePayroll = ids => {
2022-04-14 19:32:57 +08:00
API.deletePayroll(ids).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-04-14 19:32:57 +08:00
message.success("删除成功");
this.setTemplateTableSelectedRowKeys([]);
2022-06-22 17:14:53 +08:00
this.getPayrollTemplateList();
2022-04-14 19:32:57 +08:00
} else {
message.error(res.errormsg || "删除失败");
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单-工资单发放列表
@action
2022-06-22 17:14:53 +08:00
getPayrollList = (parmas = { salaryYearMonth: [] }) => {
this.loading = true;
2022-04-16 13:13:41 +08:00
API.getPayrollList(parmas).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.salarySendDataSource = res.data.datas;
this.salarySendTableStore.getDatas(res.data.dataKey.datas);
this.pageInfo = res.data.pageInfo;
2022-04-16 13:13:41 +08:00
} else {
message.error(res.errormsg || "获取失败");
}
2022-06-22 17:14:53 +08:00
this.loading = false;
});
};
2022-04-16 13:13:41 +08:00
// 工资单发放-工资单发放基本信息
@action
2022-06-22 17:14:53 +08:00
getPayrollInfo = id => {
API.getPayrollInfo({ id }).then(res => {
if (res.status) {
this.salarySendDetailBaseInfo = res.data;
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-16 13:13:41 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单发放-工资单发放信息列表
@action
getInfoList = (params = {}) => {
2022-05-31 18:51:23 +08:00
let form = this.grantListConditionForm.getFormParams();
2022-06-22 17:14:53 +08:00
params = { ...form, ...params };
2022-04-16 13:13:41 +08:00
API.getInfoList(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.salaryGrantTableStore = res.data.columns;
this.salaryGrantDataSource = res.data.list;
this.salaryGrantPageInfo = {
total: res.data.total,
pageNum: res.data.pageNum
};
this.getPayrollInfo(params.salarySendId);
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-16 13:13:41 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单-工资单发放详情列表
@action
2022-06-22 17:14:53 +08:00
getPayrollDetailList = params => {
let form = this.detailListConditionForm.getFormParams() || {};
params = { ...form, ...params };
2022-04-16 13:13:41 +08:00
API.getPayrollDetailList(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.salarySendDetailTableStore.getDatas(res.data.dataKey.datas);
this.salarySendDetailDataSource = res.data.datas;
this.salarySendDetailPageInfo = res.data.pageInfo;
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-16 13:13:41 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单详情页 - 获得高级搜索表单数据
@action
getPayrollDetailSa = (params = {}) => {
API.getPayrollDetailSa(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
// 接口请求成功/失败处理
2022-06-02 13:51:45 +08:00
let condition = removePropertyCondition(res.data.condition);
2022-06-22 17:14:53 +08:00
this.detailListCondition = condition;
2022-06-02 13:51:45 +08:00
this.detailListConditionForm.initFormFields(condition); // 渲染高级搜索form表单
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "接口调用失败!");
2022-04-16 13:13:41 +08:00
}
});
2022-06-22 17:14:53 +08:00
};
2022-04-16 13:13:41 +08:00
// 工资单发放-导出-工资单发放详情列表
@action
exportDetailList = (params = {}) => {
2022-06-22 17:14:53 +08:00
API.exportDetailList(params);
};
2022-06-29 17:04:01 +08:00
// 工资单发放-导出-工资单发放列表
2022-12-06 15:04:57 +08:00
2022-06-29 17:04:01 +08:00
@action
exportPayroll = (params = {}) => {
API.exportPayroll(params);
};
2022-04-16 13:13:41 +08:00
// 工资单-获取工资单发放高级搜索
@action
getPaySa = (params = {}) => {
API.getPaySa(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
let condition = removePropertyCondition(res.data.condition);
2022-05-31 18:51:23 +08:00
this.grantListCondition = condition;
2022-06-22 17:14:53 +08:00
this.grantListConditionForm.initFormFields(condition);
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "接口调用失败");
2022-04-16 13:13:41 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单发放-工资单批量发放信息列表
@action
batchSendInfoList = (params = {}) => {
API.batchSendInfoList(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
this.canGrantDataSource = res.data.list;
2022-04-16 13:13:41 +08:00
this.canGrantColumns = res.data.columns;
2022-06-22 17:14:53 +08:00
this.canGrantPageInfo = {
total: res.data.total,
pageNum: res.data.pageNum
};
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "获取失败");
2022-04-16 13:13:41 +08:00
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
// 工资单发放-工资单批量撤回信息列表
@action
batchWithdrawInfoList = (params = {}) => {
API.batchWithdrawInfoList(params).then(res => {
2022-06-22 17:14:53 +08:00
if (res.status) {
let datas = res.data.list || [];
2022-05-31 18:51:23 +08:00
datas.map(item => {
2022-06-22 17:14:53 +08:00
item.key = item.id;
});
this.canWithdrawDataSource = datas;
this.canWidthdrawColumns = res.data.columns;
this.canWithdrawPageInfo = {
total: res.data.total,
pageNum: res.data.pageNum
};
2022-04-16 13:13:41 +08:00
} else {
message.error(res.errormsg || "获取失败");
}
2022-06-22 17:14:53 +08:00
});
};
2022-04-16 13:13:41 +08:00
//工资单-工资单发放
@action
grantPayroll = (params = {}) => {
return new Promise((resolve, reject) => {
// message.destroy();
// message.loading("正在发放中...", 0);
2023-03-15 14:36:09 +08:00
this.btnLoading = true;
// WeaLoadingGlobal.start();
2022-04-16 13:13:41 +08:00
API.grantPayroll(params).then(res => {
2023-03-15 14:36:09 +08:00
this.btnLoading = false;
// WeaLoadingGlobal.end();
// WeaLoadingGlobal.destroy();
// message.destroy();
2022-06-22 17:14:53 +08:00
if (res.status) {
// message.success("发送成功");
2022-04-16 13:13:41 +08:00
resolve();
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "发送失败");
2022-04-16 13:13:41 +08:00
reject();
}
2023-03-15 14:36:09 +08:00
}).catch(() => {
this.btnLoading = false;
// WeaLoadingGlobal.end();
// WeaLoadingGlobal.destroy();
2022-06-22 17:14:53 +08:00
});
});
};
2022-04-16 13:13:41 +08:00
// 工资单-工资单撤回
@action
withdrawPayroll = (params = {}) => {
return new Promise((resolve, reject) => {
2023-03-15 10:18:38 +08:00
message.destroy();
message.loading("正在撤回中...", 0);
2023-03-15 14:36:09 +08:00
this.btnLoading = true;
WeaLoadingGlobal.start();
2022-04-16 13:13:41 +08:00
API.withdrawPayroll(params).then(res => {
2023-03-15 14:36:09 +08:00
this.btnLoading = false;
WeaLoadingGlobal.end();
WeaLoadingGlobal.destroy();
2023-03-15 10:18:38 +08:00
message.destroy();
2022-06-22 17:14:53 +08:00
if (res.status) {
2022-04-16 13:13:41 +08:00
message.success("撤回成功");
2022-06-22 17:14:53 +08:00
resolve();
2022-04-16 13:13:41 +08:00
} else {
2022-06-22 17:14:53 +08:00
message.error(res.errormsg || "撤回失败");
2022-04-16 13:13:41 +08:00
reject();
}
2023-03-15 14:36:09 +08:00
}).catch(() => {
this.btnLoading = false;
2023-03-15 14:36:09 +08:00
WeaLoadingGlobal.end();
WeaLoadingGlobal.destroy();
2022-06-22 17:14:53 +08:00
});
});
};
2022-06-24 11:59:29 +08:00
// 工资单-工资单撤回
@action
getSendBtnStatus = (params = {}) => {
return new Promise((resolve, reject) => {
API.getSendBtnStatus(params).then(res => {
if (res.status) {
resolve(res.data);
} else {
reject();
}
});
});
};
// 工资单-流程发起
@action
grantProxy = (params = {}) => {
return new Promise((resolve, reject) => {
API.grantProxy(params).then(res => {
if (res.status) {
2022-06-27 18:01:30 +08:00
resolve(res.data);
2022-06-24 11:59:29 +08:00
} else {
reject();
}
});
});
};
2022-06-22 17:14:53 +08:00
}