| | |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | |
| | | import init from '@salesforce/apex/SubmitExtensionApprovalProcessController.init'; |
| | | import extension_approval_processCheck from '@salesforce/apex/RentalApplyWebService.extension_approval_processCheck' |
| | | export default class lexSubmitExtensionApprovalProcess extends LightningElement { |
| | | @api |
| | | recordId; |
| | |
| | | init({ |
| | | recordId:this.recordId |
| | | }).then(result=>{ |
| | | console.log(result); |
| | | var today = new Date(); |
| | | //追加备品申请状态确认,已经提交过的申请,不能重复提交Status__c |
| | | if(result.ExtensionStatus == '填写完毕' || result.ExtensionStatus == '申请中') { |
| | | alert('请确认延期申请状态,已经提交过的申请,不能重复提交'); |
| | | return; |
| | | } |
| | | |
| | | var rs1 = sforce.apex.execute("RentalApplyWebService", "extension_approval_processCheck", {rentalApplyId: this.recordId}); |
| | | if(rs1 != '1'){ |
| | | if(rs1 == '2'){ |
| | | //返回值为2,判断入口为从单还是主单,如果是从单,那么就需要跳原来的单个延期页面 |
| | | if(result.RootRentalApply == '' || result.RootRentalApply == null){ |
| | | window.open("/apex/RentalApplyMultiPostpone?parentId=" + this.recordId); |
| | | }else { |
| | | window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); |
| | | extension_approval_processCheck({rentalApplyId:this.recordId}).then( result =>{ |
| | | if(result != '1'){ |
| | | if(result == '2'){ |
| | | //返回值为2,判断入口为从单还是主单,如果是从单,那么就需要跳原来的单个延期页面 |
| | | if(result.RootRentalApply == '' || result.RootRentalApply == null){ |
| | | window.open("/apex/RentalApplyMultiPostpone?parentId=" + this.recordId); |
| | | }else { |
| | | window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); |
| | | } |
| | | }else{ |
| | | alert(result); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return |
| | | } |
| | | }else{ |
| | | alert(rs1); |
| | | return |
| | | if(result.demoPurpose2 == '协议借用'){ |
| | | alert('请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】不能为空'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate <= today ){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】必须大于今天'); |
| | | return; |
| | | } |
| | | } |
| | | }else{ |
| | | if(result.demoPurpose2 == '协议借用'){ |
| | | alert('请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】不能为空'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日'); |
| | | return; |
| | | } |
| | | if(result.AgreementBorrowingExtensionDate <= today ){ |
| | | alert('协议借用的延期申请的【协议借用延期日期】必须大于今天'); |
| | | return; |
| | | } |
| | | } |
| | | window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); |
| | | window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | }).catch(err=>{ |
| | | console.log('extension_approval_processCheckerr==='+err); |
| | | }) |
| | | }) |
| | | .catch(err=>{ |
| | | console.log('error====>'+err); |
| | | }) |
| | | } |
| | | } |