From 492f744d9d84289e27b2ddac9a9b4a2137fd11d6 Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期一, 07 八月 2023 11:25:24 +0800
Subject: [PATCH] slefreview

---
 force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js |   71 ++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
index 21c94ae..fb2e2d7 100644
--- a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
+++ b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
@@ -10,16 +10,15 @@
 import { CloseActionScreenEvent } from 'lightning/actions';
 
  const event = new ShowToastEvent({
-            title: '妫�鏌ョ姸鎬�',
             message:
                 '鍙湁鐘舵�佷负寰呮彁浜ゆ姤鍛婄殑OPD璁″垝鎵嶈兘杩涜鏃犳姤鍛婄敵璇�',
+            variant: 'error'
         });
 export default class lexNoReportApplication extends LightningElement {
 
 
 	@api recordId;
-
-
+    IsLoading=true;
 	OPDPlan__c;
     currentUserProfileId;
     error;
@@ -29,13 +28,29 @@
 
 
     @wire(getRecord, { recordId: USER_ID, fields: [USERPROFILE_ID]}) 
-         userDetails({error, data}) {
+        userDetails({error, data}) {
             if (data) {
                 this.currentUserProfileId = data.fields.ProfileId.value;
                
             } else if (error) {
                 this.error = error ;
             }
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.OPDPlan__c=result;
+            this.NoReportApplication().then(result=>{
+                this.IsLoading=false;
+                this.dispatchEvent(new CloseActionScreenEvent());
+            });
+        }).catch(error=>{
+            const eventError = new ShowToastEvent({
+                title: '椤甸潰鍒濆鍖栭敊璇�',
+                message:
+                error.message,
+            });
+            this.dispatchEvent(eventError);
+        });
     }
 
     @wire(CurrentPageReference)
@@ -52,40 +67,28 @@
 
     
 
-    async connectedCallback(){
-       await init({
-            recordId: this.recordId
-        }).then(result=>{
-            this.OPDPlan__c=result;
-            this.NoReportApplication();
-        }).catch(error=>{
-            console.log("error");
-            console.log(error);
-        });
+    connectedCallback(){
+
     }
 
 
 
     async NoReportApplication() {
-
-	
-	//OPD璁″垝鐘舵��
-	var status = this.OPDPlan__c.Status__c;
-	this.NotSupportProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"});
-	//褰撳墠鐢ㄦ埛绠�妗d
-	var ProfileId = this.currentUserProfileId;
-	//璺宠繃绯荤粺绠$悊鍛�
-	if(status !='寰呮彁浜ゆ姤鍛�'&& ProfileId != this.NotSupportProfileId){
-		this.dispatchEvent(new CloseActionScreenEvent());
-		this.dispatchEvent(event);		 
-		return;
-	}
-	else{
-		this.dispatchEvent(new CloseActionScreenEvent());
-		window.open ('/apex/OPDNoReportApplication?id='+this.OPDPlan__c.Id+'&name='+this.OPDPlan__c.Name, '鏃犳姤鍛婄敵璇�',
-		'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
-	
-	}
-	}
+    	//OPD璁″垝鐘舵��
+    	var status = this.OPDPlan__c.Status__c;
+    	this.NotSupportProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"});
+    	//褰撳墠鐢ㄦ埛绠�妗d
+    	var ProfileId = this.currentUserProfileId;
+    	//璺宠繃绯荤粺绠$悊鍛�
+    	if(status !='寰呮彁浜ゆ姤鍛�'&& ProfileId != this.NotSupportProfileId){
+    		this.dispatchEvent(event);	
+    		return;
+    	}
+    	else{
+    		window.open ('/apex/OPDNoReportApplication?id='+this.OPDPlan__c.Id+'&name='+this.OPDPlan__c.Name, '鏃犳姤鍛婄敵璇�',
+    		'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
+    	
+    	}
+    }
 
 }
\ No newline at end of file

--
Gitblit v1.9.1