From 5fd9369336fd2a5e12132691284250f8799ebe5b Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 10 五月 2023 15:37:12 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js |   53 +++++++++----
 force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls                       |   27 ++----
 force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js     |   44 ++---------
 force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js       |   39 +--------
 force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js   |   31 +------
 5 files changed, 67 insertions(+), 127 deletions(-)

diff --git a/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls b/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
index af0b518..76f0363 100644
--- a/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
+++ b/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;
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js
index 910869e..94315cd 100644
--- a/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js
+++ b/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();
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
index b8fc756..8e91256 100644
--- a/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
+++ b/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();
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js
index 98f7446..3392f9f 100644
--- a/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js
+++ b/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();
-//     }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
index eefc389..a78c32f 100644
--- a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
+++ b/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();
 			//杩藉姞澶囧搧鐢宠鐘舵�佺‘璁わ紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜tatus__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锛屽垽鏂叆鍙d负浠庡崟杩樻槸涓诲崟锛屽鏋滄槸浠庡崟锛岄偅涔堝氨闇�瑕佽烦鍘熸潵鐨勫崟涓欢鏈熼〉闈� 
-						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 }});
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1