<div class="mobileTrainActivityDetailButton_css">
<mt-button v-if="path=='/mobileMyTrains'?true:false" @click.native="leave" size="large"> 请假 </mt-button>
</div>
//方法体里面
leave() {
MessageBox.prompt('请假理由', {
inputValidator: (val) => {
if (val === null) {
return true;//初始化的值为null,不做处理的话,刚打开MessageBox就会校验出错,影响用户体验
}
return !(val.length < 100)
}, inputErrorMessage: '不能小于100字'
}).then((val) => {
this.loading = true;
var leaveForm = {
trainId: this.trainInfo.trainId,
leaveFlow: this.trainInfo.leaveFlow,
leaveReason: val,
};
this.postRequest("/tmsproxy/trainLeave", leaveForm).then(resp => {
this.loading = false;
if(resp.data.status == "success") {
MessageBox.alert(resp.data.msg, "");
}
})
}, () => {
console.info('cancel')
})
}