From 5f8c97f8716088019ad9a0302c5dea461bc668b1 Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期一, 07 八月 2023 15:35:56 +0800
Subject: [PATCH] CIC相关按钮

---
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js |   75 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
index 2a9ab34..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,11 @@
 		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());
 		} else{
 			LightningConfirm.open({
 	            message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
@@ -53,19 +48,59 @@
 	        }).then(cancel=>{
 	        	if(cancel) {
 	    			submitApply({taId:this.recordId}).then(submitRes=>{
-						if(submitRes == '1'){
-							this.showToast('','鎻愪氦鎴愬姛','success');
-							window.location.href = window.location;
-						}else{
-							this.showToast("",submitRes,"warning");
-						}
-						this.IsLoading=false;
-						this.dispatchEvent(new CloseActionScreenEvent());
-					});	
+	    				console.log(submitRes);
+	    				this.cancelResult = submitRes;
+						this.cancelSubmit().then(res=>{
+							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