force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
@@ -1,23 +1,18 @@ public with sharing class SubmitExtensionApprovalProcessController { public SubmitExtensionApprovalProcessController() { } @AuraEnabled public static InitData init(String recordId) { InitData res = new InitData(); try { Rental_Apply__c rac = [SELECT Id, ExtensionStatus__c, demo_purpose2__c, AgreementBorrowingExtensionDate__c, Return_dadeline_final__c from Rental_Apply__c where Id = :recordId]; Rental_Apply__c rac = [SELECT Id, ExtensionStatus__c, Root_Rental_Apply__c, demo_purpose2__c, AgreementBorrowingExtensionDate__c, Return_dadeline_final__c from Rental_Apply__c where Id = :recordId]; res.Id = rac.Id; res.ExtensionStatus = rac.ExtensionStatus__c; res.RootRentalApply = rac.Root_Rental_Apply__c; res.id = rac.Id; res.extensionStatus = rac.ExtensionStatus__c; res.rootRentalApply = rac.Root_Rental_Apply__c; res.demoPurpose2 = rac.demo_purpose2__c; res.AgreementBorrowingExtensionDate = rac.AgreementBorrowingExtensionDate__c; res.ReturnDadelineFinal = rac.Return_dadeline_final__c; res.agreementBorrowingExtensionDate = rac.AgreementBorrowingExtensionDate__c; res.returnDadelineFinal = rac.Return_dadeline_final__c; } catch (Exception e) { System.debug(LoggingLevel.INFO, '****e:' + e); @@ -27,16 +22,16 @@ public class InitData { @AuraEnabled public String Id; public String id; @AuraEnabled public String ExtensionStatus; public String extensionStatus; @AuraEnabled public String RootRentalApply; public String rootRentalApply; @AuraEnabled public String demoPurpose2; @AuraEnabled public Date AgreementBorrowingExtensionDate; public Date agreementBorrowingExtensionDate; @AuraEnabled public Date ReturnDadelineFinal; public Date returnDadelineFinal; } } force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js
@@ -1,14 +1,11 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/BidAnnouncementController.BidAnnouncementController'; import ApplyFor from '@salesforce/apex/BidAnnouncementController.ApplyFor'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexBidAnnouncementApplyForButton extends LightningElement { @api recordId;//OwnerId ownerId;//所有人id id;//返回值的id IsLoading = true; arrMessage = []; @@ -23,26 +20,27 @@ } } connectedCallback(){ this.IsLoading = false; this.ApplyFor(); } //中标通知书 申请 ApplyFor(){ ApplyFor({recordId:this.recordId}).then(res=>{ console.log(res); if(res == '1'){ this.showToast('请求申请成功,申请中。。。','success'); this.updateRecordView(); this.dispatchEvent(new CloseActionScreenEvent()); }else{ var messageage = ""; messageage = res.split(',')[1]; if(res.split(',')[1].slice(-2) == '[]'){ messageage = res.split(',')[1].slice(0,-4); }else{ messageage = res; } this.showToast(messageage,'error'); } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); @@ -57,18 +55,3 @@ this.dispatchEvent(new CloseActionScreenEvent()); } } // var Bid_Announcement = new sforce.SObject("Bid_Announcement__c"); // Bid_Announcement.Id = "{!Bid_Announcement__c.Id}"; // Bid_Announcement.Status__c = "申请中"; // Bid_Announcement.Request_flag__c = "true"; // Bid_Announcement.Request_user__c = "{!$User.Id}"; // var serverTimestamp = sforce.connection.getServerTimestamp(); // Bid_Announcement.Request_date__c = serverTimestamp.timestamp; // var result = sforce.connection.update([Bid_Announcement]); // var messages = getConnectDMLErrorMessages(result); // if (messages.length > 0) { // alert(messages.join("\n")); // } // location.reload(); force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
@@ -6,11 +6,7 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexBidAnnouncementRejectButton extends LightningElement { @api recordId;//OwnerId ownerId;//所有人id id;//返回值的id IsLoading = true; arrMessage = []; BidCancel = null; @wire(CurrentPageReference) getStateParameters(currentPageReference) { @@ -23,61 +19,37 @@ } } connectedCallback(){ this.IsLoading = false; this.Consent(); } //中标通知书 同意 Consent(){ ConSent({recordId:this.recordId}).then(res=>{ console.log(res); if(res == '1'){ this.showToast("同意请求成功","success"); this.updateRecordView(); this.dispatchEvent(new CloseActionScreenEvent()); } if(res != "1"){ var messageage = ""; messageage = res.split(',')[1]; if(res.split(',')[1].slice(-2) == '[]'){ messageage = res.split(',')[1].slice(0,-4); }else{ messageage = res; } this.showToast(messageage,"error"); } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(new CloseActionScreenEvent()); } } // var Bid_Announcement = new sforce.SObject("Bid_Announcement__c"); // Bid_Announcement.Id = "{!Bid_Announcement__c.Id}"; // Bid_Announcement.Status__c = "处理完毕"; // Bid_Announcement.Complete__c = "true"; // Bid_Announcement.Agree_user__c = "{!$User.Id}"; // var serverTimestamp = sforce.connection.getServerTimestamp(); // Bid_Announcement.Complete_date__c = serverTimestamp.timestamp; // var result = sforce.connection.update([Bid_Announcement]); // var messages = getConnectDMLErrorMessages(result); // if (messages.length > 0) { // alert(messages.join("\n")); // } // location.reload(); force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js
@@ -7,10 +7,7 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexBidAnnouncementRejectButton extends LightningElement { @api recordId;//OwnerId ownerId;//所有人id id;//返回值的id IsLoading = true; arrMessage = []; BidCancel = null; @wire(CurrentPageReference) @@ -24,15 +21,13 @@ } } connectedCallback(){ this.IsLoading = false; this.Reject(); } //中标通知书 驳回 Reject(){ UserInfo_Owner().then(res=>{ console.log(res); this.BidCancel = res.BidCancel; if(this.BidCancel == false){ this.showToast('没有驳回的权限',"error"); @@ -41,7 +36,8 @@ recordId: this.recordId }).then(requst=>{ if(requst == '1'){ this.showToast("驳回请求成功","success"); this.updateRecordView(); this.dispatchEvent(new CloseActionScreenEvent()); } if(requst != "1"){ var messageage = ""; @@ -52,42 +48,15 @@ } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(new CloseActionScreenEvent()); } } // if ('{!$User.BidCancel__c}' == 'false') { // alert("没有驳回的权限"); // } else { // var Bid_Announcement = new sforce.SObject("Bid_Announcement__c"); // Bid_Announcement.Id = "{!Bid_Announcement__c.Id}"; // Bid_Announcement.Status__c = "草案中"; // Bid_Announcement.Complete__c = "false"; // Bid_Announcement.Agree_user__c = null; // Bid_Announcement.Complete_date__c = null; // Bid_Announcement.Request_flag__c = "false"; // Bid_Announcement.Request_user__c = null; // Bid_Announcement.Request_date__c = null; // var result = sforce.connection.update([Bid_Announcement]); // var messages = getConnectDMLErrorMessages(result); // if (messages.length > 0) { // alert(messages.join("\n")); // } // location.reload(); // } } force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
@@ -1,6 +1,8 @@ import { LightningElement, track, wire, api } from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { updateRecord } from 'lightning/uiRecordApi'; import init from '@salesforce/apex/SubmitExtensionApprovalProcessController.init'; import extension_approval_processCheck from '@salesforce/apex/RentalApplyWebService.extension_approval_processCheck' @@ -23,43 +25,46 @@ connectedCallback(){ init({ recordId:this.recordId }).then(result=>{ console.log(result); }).then(res=>{ console.log('res==='+JSON.stringify(res)); var today = new Date(); //追加备品申请状态确认,已经提交过的申请,不能重复提交Status__c if(result.ExtensionStatus == '填写完毕' || result.ExtensionStatus == '申请中') { alert('请确认延期申请状态,已经提交过的申请,不能重复提交'); if(res.extensionStatus == '填写完毕' || res.extensionStatus == '申请中') { this.showToast('请确认延期申请状态,已经提交过的申请,不能重复提交','error'); return; } extension_approval_processCheck({rentalApplyId:this.recordId}).then( result =>{ extension_approval_processCheck({rentalApplyId:this.recordId}).then(result =>{ console.log('result==='+result); if(result != '1'){ if(result == '2'){ //返回值为2,判断入口为从单还是主单,如果是从单,那么就需要跳原来的单个延期页面 if(result.RootRentalApply == '' || result.RootRentalApply == null){ 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()); this.showToast(result,'error'); return } }else{ if(result.demoPurpose2 == '协议借用'){ alert('请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批'); if(res.demoPurpose2 == '协议借用'){ this.showToast('请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批','error'); return; } if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){ alert('协议借用的延期申请的【协议借用延期日期】不能为空'); console.log('typeof'+typeof(res.agreementBorrowingExtensionDate)); if(res.agreementBorrowingExtensionDate =='' || res.agreementBorrowingExtensionDate == null){ this.showToast('协议借用的延期申请的【协议借用延期日期】不能为空','error'); return; } if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){ alert('协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日'); typeof(res.agreementBorrowingExtensionDate) == 'string' ? res.agreementBorrowingExtensionDate = new Date(res.agreementBorrowingExtensionDate) : ''; typeof(res.returnDadelineFinal) == 'string' ? res.returnDadelineFinal = new Date(res.returnDadelineFinal) : ''; if(res.agreementBorrowingExtensionDate <= res.returnDadelineFinal){ this.showToast('协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日','error'); return; } if(result.AgreementBorrowingExtensionDate <= today ){ alert('协议借用的延期申请的【协议借用延期日期】必须大于今天'); if(res.agreementBorrowingExtensionDate <= today ){ this.showToast('协议借用的延期申请的【协议借用延期日期】必须大于今天','error'); return; } } @@ -73,4 +78,20 @@ console.log('error====>'+err); }) } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } }