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/lexRCSubmit/lexRCSubmit.js |  115 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
index 2a56a91..4da8f7c 100644
--- a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
@@ -5,22 +5,29 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import init  from '@salesforce/apex/QISReportController.initForRCSubmitButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQisWithRC';
-
+import { updateRecord } from 'lightning/uiRecordApi';
+/*
+ * @Description: 鎻愪氦寰呭鎵�
+ * @Author: hql
+ * @Date: 2023-07-12 09:45:19
+ * @LastEditTime: 2023-07-12 15:44:33
+ * @LastEditors:  
+ */
 export default class lexRCSubmit extends LightningElement {
-	@api recordId;
-	IsLoading = true;
-	qisReportId;
-	qisStatus;
-	OSHstaff;
-	OSHstaffEmail;
-	CancelQISReason;
-	Rcid;
-	RCinspectionDate;
-	QISReplyDay;
-	RCproblemnotfound;
-	type;
+    @api recordId;
+    IsLoading = true;
+    qisReportId;
+    qisStatus;
+    OSHstaff;
+    OSHstaffEmail;
+    CancelQISReason;
+    Rcid;
+    RCinspectionDate;
+    QISReplyDay;
+    RCproblemnotfound;
+    type;
     err;
-	@wire(CurrentPageReference)
+    @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
              console.log(currentPageReference);
@@ -50,7 +57,7 @@
             this.RCinspectionDate = result.rCinspectionDate;
             this.QISReplyDay = result.qISReplyDay;
             this.RCproblemnotfound = result.rCproblemnotfound;
-         	if (this.qisStatus!='RC妫�娴嬩腑') {
+            if (this.qisStatus!='RC妫�娴嬩腑') {
                 const evt = new ShowToastEvent({
                         title : '宸茬粡鎻愪氦瀹℃壒',
                         message: '',
@@ -58,51 +65,51 @@
                     });
                  this.dispatchEvent(evt);
                 this.dispatchEvent(new CloseActionScreenEvent());
-         		return;
-         	}
+                return;
+            }
             console.log('this.RCproblemnotfound='+(this.QISReplyDay!=null  && this.RCproblemnotfound));
-         	if (this.CancelQISReason!=null) {
-         		if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
+            if (this.CancelQISReason==null) {
+                if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
                     const evt = new ShowToastEvent({
-                        title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
-                        message: '',
+                        title : '',
+                        message: '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                     this.dispatchEvent(new CloseActionScreenEvent());
-					return;
-         		}
-         		if (this.Rcid ==null) {
+                    return;
+                }
+                if (this.Rcid ==null) {
                     const evt = new ShowToastEvent({
-                        title : '鍒ゅ畾鎷呭綋蹇呴』濉啓',
-                        message: '',
+                        title : '',
+                        message: '鍒ゅ畾鎷呭綋蹇呴』濉啓',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                     this.dispatchEvent(new CloseActionScreenEvent());
-					return;
-         		}
-         		if (this.RCinspectionDate == null) {
+                    return;
+                }
+                if (this.RCinspectionDate == null) {
                     const evt = new ShowToastEvent({
-                        title : 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
-                        message: '',
+                        title : '',
+                        message: 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                     this.dispatchEvent(new CloseActionScreenEvent());
-					return;
-         		}
+                    return;
+                }
 
-         		if (this.QISReplyDay!=null  && this.RCproblemnotfound) {
+                if (this.QISReplyDay!=null  && this.RCproblemnotfound) {
                     const evt = new ShowToastEvent({
-                        title : '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
-                        message: '',
+                        title : '',
+                        message: '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                     this.dispatchEvent(new CloseActionScreenEvent());
-					return;
-         		}
+                    return;
+                }
                 LightningConfirm.open({
                 message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
                 variant: 'headerless',
@@ -118,7 +125,7 @@
                     }
                     
                 });
-         	}else{
+            }else{
                 LightningConfirm.open({
                 message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
                 variant: 'headerless',
@@ -134,10 +141,10 @@
                     }
                     
                 });
-         	}
-         	
-         	// this.dispatchEvent(new CloseActionScreenEvent());
-         	
+            }
+            
+            // this.dispatchEvent(new CloseActionScreenEvent());
+            
         }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
@@ -145,23 +152,25 @@
         }); 
     }
     updateQisSubmit(){
-        	updateQis({
-        		 recordId: this.recordId,
-        		 type: this.type,
-        		 oldQIStatus: this.qisStatus
-        		}).then(result =>{
-        			console.log('result'+result);
+            updateQis({
+                 recordId: this.recordId,
+                 type: this.type,
+                 oldQIStatus: this.qisStatus
+                }).then(result =>{
+                    console.log('result'+result);
                      this.err = result;
-        			if (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 }});
                     }
+                    updateRecord({fields: { Id: this.recordId }});
                 this.dispatchEvent(new CloseActionScreenEvent());
-        		}).catch(error => {
+                }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
             

--
Gitblit v1.9.1