From 428f42fab44b654c69fbc461513203830743d7de Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期二, 18 七月 2023 10:55:50 +0800
Subject: [PATCH] hql20230718更新lightning按钮

---
 force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js |   85 +++++++++++++++++++++++-------------------
 1 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
index 044dee1..d556747 100644
--- a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
@@ -2,19 +2,26 @@
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
 import init  from '@salesforce/apex/QISReportController.initForlexRCRecievedButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCRecieved';
-
+/*
+ * @Description: OCSM鏈嶅姟鏈儴鏀跺埌瀹炵墿
+ * @Author: hql
+ * @Date: 2023-07-12 09:45:19
+ * @LastEditTime: 2023-07-12 15:44:33
+ * @LastEditors:  
+ */
 export default class lexRCRecieved extends LightningElement {
-	@api recordId;
-	err;
-	IsLoading = true;
-	qisReportId;
-	qisStatus;
-	isAEProfile;
-	isPAEProfile;
-	isCNBuy;
-	 @wire(CurrentPageReference)
+    @api recordId;
+    err;
+    IsLoading = true;
+    qisReportId;
+    qisStatus;
+    isAEProfile;
+    isPAEProfile;
+    isCNBuy;
+     @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
              console.log(currentPageReference);
@@ -41,29 +48,29 @@
             this.isPAEProfile = result.isPAEProfile;
             this.isCNBuy = result.isCNBuy;
             console.log('this.qisStatus='+this.qisStatus);   
-         	if (this.qisStatus!='RC妫�娴嬬敵璇�') {
+            if (this.qisStatus!='RC妫�娴嬬敵璇�') {
                 const evt = new ShowToastEvent({
-                        title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
-                        message: '',
+                        title : '',
+                        message: 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
                         variant: 'error'
                     });
                 this.dispatchEvent(evt);
                 this.dispatchEvent(new CloseActionScreenEvent());
                 return;
-         	}else{
-         		if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
-         			const evt = new ShowToastEvent({
-                        title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
-                        message: '',
+            }else{
+                if (this.isAEProfile == null ||(this.isPAEProfile == null && this.isCNBuy != 'true')) {
+                    const evt = new ShowToastEvent({
+                        title : '',
+                        message: '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
                         variant: 'error'
                     });
-	                this.dispatchEvent(evt);
-	                this.dispatchEvent(new CloseActionScreenEvent());
-	                return;
-         		}else{
-         			this.updateQisSubmit();
-         		}
-         	}
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+                }else{
+                    this.updateQisSubmit();
+                }
+            }
         }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
@@ -71,25 +78,27 @@
         }); 
     }
     updateQisSubmit(){
-        	updateQis({
-        		 recordId: this.recordId
-        		}).then(result =>{
+            updateQis({
+                 recordId: this.recordId
+                }).then(result =>{
                     
-        			console.log('result'+result);
-        			this.err = result;
-        			if (result!='鎴愬姛') {
+                    console.log('result'+result);
+                    this.err = result;
+                    if (result!='鎴愬姛') {
                         const evt = new ShowToastEvent({
-                            title : '鏇存柊澶辫触',
-                            message: this.err,
+                            title : '',
+                            message: '鏇存柊澶辫触'+this.err,
                             variant: 'error'
                         });
                         this.dispatchEvent(evt);
+                        updateRecord({fields: { Id: this.recordId }});
                     }
                 this.dispatchEvent(new CloseActionScreenEvent());
-        		}).catch(error => {
-           				 console.log('error='+error);
-		        }).finally(() => {
-		            
-		        });
+                updateRecord({fields: { Id: this.recordId }});
+                }).catch(error => {
+                         console.log('error='+error);
+                }).finally(() => {
+                    
+                });
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1