工资单页面定制

This commit is contained in:
MustangDeng 2022-06-13 16:31:08 +08:00
parent 6fda61cf83
commit 5decf617a6
3 changed files with 80 additions and 3 deletions

View File

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

View File

@ -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 (
<div style={{display: "inline-block"}}>
<Button type="primary" style={{marginRight: "10px"}} onClick={() => {this.handleGrantAll()}}>全部发放</Button>
<Button type="primary" style={{marginRight: "10px"}} onClick={() => {this.handleGrantAll()}} disabled={!this.state.btnStatus.can_send}>全部发放</Button>
{
this.state.btnStatus.show_workflow_status && <Button type="primary" style={{marginRight: "10px"}} onClick={() => {this.handleGrantProxy()}}>发起流程</Button>
}
<Button type="default" style={{marginRight: "10px"}} onClick={() => {this.handleWithdrawAll()}}>全部撤回</Button>
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu}>更多</Dropdown.Button>
</div>
@ -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;

View File

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