| | |
| | | import updateRaesc from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaesc'; |
| | | import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById'; |
| | | import postponeCheck from '@salesforce/apex/SelectSubstituteControllerLWT.postponeCheck'; |
| | | import submitApprovalRequest from '@salesforce/apex/SelectSubstituteControllerLWT.submitApprovalRequest'; |
| | | |
| | | import { loadScript } from 'lightning/platformResourceLoader'; |
| | | import { submitForApproval } from 'lightning/uiRecordApi'; |
| | |
| | | } |
| | | console.log("hhh2"); |
| | | let rtn; |
| | | let d=-5; |
| | | await postponeCheck({ |
| | | endDate:this.Rental_Apply_Equipment_Set__c.Rental_End_Date__c, |
| | | d:-5 |
| | | i:d |
| | | }).then(res=>{ |
| | | console.log(res); |
| | | rtn=res; |
| | | }).catch(err=>{ |
| | | console.log("err:",err.message); |
| | | }) |
| | | }); |
| | | |
| | | console.log(rtn); |
| | | if (rtn != "OK") { |
| | |
| | | message:result.errors[0].split(",")[1] |
| | | }); |
| | | this.dispatchEvent(event); |
| | | return; |
| | | } |
| | | console.log("hhh7"); |
| | | |
| | | // let request = new sforce.ProcessSubmitRequest(); |
| | | // request.objectId = this.recordId; |
| | | // let processResults = sforce.connection.process([request]); |
| | | console.log("hhh8"); |
| | | // submitForApproval(this.Rental_Apply_Equipment_Set__c.Id).then(result => { |
| | | // console.log(result); |
| | | // if (processResults[0].errors != null) { |
| | | // alert(processResults[0].errors.message); |
| | | // return; |
| | | // } |
| | | // console.log("hhh9"); |
| | | // window.location.reload(); |
| | | // }) |
| | | // .catch(error => { |
| | | // console.error('Error submitting record for approval:', error.message); |
| | | // }); |
| | | |
| | | // await submitForApproval(this.recordId); |
| | | const fields = {} |
| | | const recordInput = { fields }; |
| | | updateRecord({ fields: recordInput, recordId: this.recordId }) |
| | | .then(() => { |
| | | console.log("更新成功"); |
| | | }) |
| | | .catch(error => { |
| | | console.log(error.message); |
| | | console.log(error); |
| | | // alert(error.body.message); |
| | | await submitApprovalRequest({recordId:this.recordId}).then(res=>{ |
| | | console.log(res); |
| | | if(res!=null&&res!=''){ |
| | | const event = new ShowToastEvent({ |
| | | title: '提示信息', |
| | | message:error.body.message |
| | | message:res |
| | | }); |
| | | this.dispatchEvent(event); |
| | | return; |
| | | // 处理异常情况 |
| | | }else{ |
| | | const event = new ShowToastEvent({ |
| | | title: '提示信息', |
| | | message:"更新成功" |
| | | }); |
| | | this.dispatchEvent(event); |
| | | return; |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |