From d77b6353ca9b59a6398df3eae9912f9fd766946d Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期六, 05 八月 2023 17:04:22 +0800
Subject: [PATCH] fix: lightning 页面确认

---
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js |   71 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
index 4a51737..49ebe4e 100644
--- a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
@@ -13,6 +13,7 @@
 	@api recordId;
 	transferApplyPermission;
 	IsLoading=true;
+	cancelResult;
 
 	@wire(CurrentPageReference)
 	getStateParameters(currentPageReference) {
@@ -34,17 +35,8 @@
 		console.log('this.transferApplyId:' + this.recordId);
 		applyPermission().then(result => {
 			console.log(result);
-			this.transferApplyPermission = result;			
-			this.cancelSubmit();	
-					
-		}).catch( error =>{
-			console.log(error);
-		});
-	}
-	
-	cancelSubmit(){
-		
-		if (this.transferApplyPermission == false) {
+			this.transferApplyPermission = result;
+			if (this.transferApplyPermission == false) {
 			this.showToast('','娌℃湁鎻愪氦鐢宠鐨勬潈闄�','warning');
 			this.IsLoading=false;
 			this.dispatchEvent(new CloseActionScreenEvent());
@@ -56,26 +48,59 @@
 	        }).then(cancel=>{
 	        	if(cancel) {
 	    			submitApply({taId:this.recordId}).then(submitRes=>{
-						if(submitRes == '1'){
-							this.showToast('','鎻愪氦鎴愬姛','success');
-							setTimeout(function(){
-								window.location.href = window.location;
-							}, 1500 );
-						}else{
-							this.showToast("",submitRes,"warning");
-						}
+	    				console.log(submitRes);
+	    				this.cancelResult = submitRes;
+						this.cancelSubmit().then(res=>{
+							this.IsLoading=false;
+							this.dispatchEvent(new CloseActionScreenEvent());
+						});	
 						
-					});	
-					this.IsLoading=false;
-					this.dispatchEvent(new CloseActionScreenEvent());
+					}).catch( error =>{
+						this.showToast("",submitRes,"error");
+					});
+					// this.IsLoading=false;
+					// this.dispatchEvent(new CloseActionScreenEvent());
 	        	} else{
 	        		this.IsLoading=false;
 					this.dispatchEvent(new CloseActionScreenEvent());
 	        	}
 	        	
+	        	
 	        });
 			
-		}		
+		}	
+
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	
+
+    async cancelSubmit(){
+    	console.log(this.cancelResult);
+		if(this.cancelResult == '1') {
+			console.log(this.cancelResult);
+			this.dispatchEvent( 
+				new ShowToastEvent({
+		            message:'鎻愪氦鎴愬姛',
+		            variant: "success"
+		        })
+			);
+			setTimeout(function(){
+				window.location.href = window.location;
+			}, 1500 )
+		} else {
+			this.dispatchEvent( 
+				new ShowToastEvent({
+		            message:this.cancelResult,
+		            variant: "warning"
+		        })
+			);
+			console.log("result:",this.cancelResult);
+			// await this.showToast("",this.cancelResult,"warning"); 	
+		}
+			
     }
     
     showToast(_title,_message,_variant) {

--
Gitblit v1.9.1