| | |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import updateSubmitSolutionSchemeForApprovalButton from '@salesforce/apex/lexSolutionProgrammeController.updateSubmitSolutionSchemeForApprovalButton'; |
| | | import submitApproval from '@salesforce/apex/lexSolutionProgrammeController.submitApproval'; |
| | | import init from '@salesforce/apex/lexSolutionProgrammeController.initSubmitSolutionSchemeForApprovalButton'; |
| | | import queryForAttachments from '@salesforce/apex/lexSolutionProgrammeController.queryForAttachments'; |
| | | import { updateRecord } from 'lightning/uiRecordApi'; |
| | |
| | | } |
| | | } |
| | | } |
| | | showToast(msg,type) { |
| | | const event = new ShowToastEvent({ |
| | | title: '', |
| | | message: msg, |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | |
| | | |
| | | updateRecordView(recordId) { |
| | | updateRecord({fields: { Id: recordId }}); |
| | |
| | | init({ |
| | | recordId: this.recordId |
| | | }).then(result=>{ |
| | | this.schemeType = result.schemeType == undefined ? result.schemeType : ''; |
| | | this.confirmationResult = result.confirmationResult == undefined ? result.confirmationResult : ''; |
| | | console.log(result); |
| | | this.schemeType = result.schemeType; |
| | | this.confirmationResult = result.confirmationResult == undefined ? '' : result.confirmationResult; |
| | | this.submitSolutionSchemeForApproval(); |
| | | }); |
| | | } |
| | |
| | | }); |
| | | console.log(result); |
| | | if(result){ |
| | | if(this.schemeType == '结案' && this.confirmationResult == ''){ |
| | | console.log(this.schemeType); |
| | | console.log(this.confirmationResult); |
| | | if(this.schemeType == '结案' && (this.confirmationResult == '' || this.confirmationResult == undefined)){ |
| | | this.showToast('结案方案提交前,方案采纳结果必填','error'); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | console.log('this.schemeType:'+this.schemeType); |
| | | if((this.records.length > 0 && this.schemeType == '结案') || (this.schemeType == '初次')){ |
| | | updateSubmitSolutionSchemeForApprovalButton({ |
| | | recordId: this.recordId |
| | | }).then(result=>{ |
| | | if(result){ |
| | | this.showToast(result,'error'); |
| | | submitApproval({recordId:this.recordId}).then(rep => { |
| | | console.log(rep); |
| | | if(rep==='OK'){ |
| | | console.log('1'); |
| | | this.showToast('提交审批成功','success'); |
| | | }else{ |
| | | this.updateRecordView(this.recordId); |
| | | console.log('2'); |
| | | this.showToast(rep,'error'); |
| | | } |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | }); |
| | | }).catch(err => { |
| | | console.log('3'); |
| | | console.log(err); |
| | | this.showToast(err,'error'); |
| | | }) |
| | | }else{ |
| | | this.showToast('结案的方案提交前,必须上传结案附件','error'); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | |
| | | return; |
| | | } |
| | | } |
| | | showToast(msg, type) { |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(event); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | if(type==='success'){ |
| | | window.location.href = '/lightning/r/Solution_Programme__c/'+this.recordId+'/view'; |
| | | } |
| | | } |
| | | } |