From 5decf617a6778178593c2c53a226e43e9f6bbb4b Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Mon, 13 Jun 2022 16:31:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AE=9A=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/payroll.js | 16 ++++++++ .../pages/payroll/payrollGrant/index.js | 37 +++++++++++++++++-- pc4mobx/hrmSalary/stores/payroll.js | 30 +++++++++++++++ 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index 8d6e72fe..22e7db7d 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -244,6 +244,22 @@ export const batchWithdrawInfoList = params => { }).then(res => res.json()) } +// 工资单发放-按钮状态 +export const getSendBtnStatus = params => { + return WeaTools.callApi('/api/bs/hrmsalary/salaryBill/send/getSendBtnStatus', 'get', params); +} + +// 工资单发放-扩展按钮点击 +export const grantProxy = params => { + return fetch('/api/bs/hrmsalary/salaryBill/grantProxy', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 725ce143..75fc6b7d 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -20,7 +20,11 @@ export default class PayrollGrant extends React.Component { this.state = { payrollGrantVisible: false, payrollWithdrawVisible: false, - currentId: "" + currentId: "", + btnStatus: { + can_send: true, + show_workflow_status: false + } } this.pageInfo = {current : 1, pageSize: 10} } @@ -28,7 +32,8 @@ export default class PayrollGrant extends React.Component { componentWillMount() { let id = getQueryString("id") this.setState({currentId: id}) - const { payrollStore: {getPayrollInfo, getInfoList, getPaySa} } = this.props; + const { payrollStore: {getPayrollInfo, getInfoList, getPaySa, } } = this.props; + this.getSendBtnStatus(id) getPayrollInfo(id) getInfoList({ salarySendId:id @@ -36,6 +41,19 @@ export default class PayrollGrant extends React.Component { getPaySa() } + getSendBtnStatus(id) { + const { payrollStore : {getSendBtnStatus}} = this.props; + getSendBtnStatus({id}).then((data) => { + this.setState({ + btnStatus: { + can_send: data.can_send, + show_workflow_status: data.show_workflow_status + } + }) + }).catch(() => { + }) + } + // 撤回 handleWithdraw(record) { @@ -144,7 +162,11 @@ export default class PayrollGrant extends React.Component { ); return (
- + + + { + this.state.btnStatus.show_workflow_status && + } 更多
@@ -176,6 +198,15 @@ export default class PayrollGrant extends React.Component { }) } + handleGrantProxy() { + const { payrollStore: {grantProxy} } = this.props; + grantProxy({ + salarySendId: this.state.currentId + }).then(() => { + this.getSendBtnStatus(this.state.currentId) + }) + } + render() { const {payrollStore} = this.props; const { salarySendDetailBaseInfo, salaryGrantDataSource, getInfoList, grantListShowSearchAd, grantListConditionForm, grantListCondition, setGrantListShowSearchAd, salaryGrantPageInfo } = payrollStore; diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index ed987caf..df2ae15d 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -513,5 +513,35 @@ export class payrollStore { }) } + // 工资单-按钮状态 + @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) { + message.success("发起流程") + resolve(res.data) + } else { + message.error(res.errormsg || "发起失败") + reject() + } + }) + }) + } + } \ No newline at end of file