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/lexOSHInspect/lexOSHInspect.js |   62 ++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
index 60bb2c0..c927338 100644
--- a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
@@ -3,14 +3,22 @@
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import init  from '@salesforce/apex/QISReportController.initForlexOSHInspectButton';
+import { updateRecord } from 'lightning/uiRecordApi';
 import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOSHInspect';
 
+/*
+ * @Description: OSH妫�鏌ュ彈鐞�
+ * @Author: hql
+ * @Date: 2023-07-12 09:45:19
+ * @LastEditTime: 2023-07-12 15:44:33
+ * @LastEditors:  
+ */
 export default class lexOSHInspect extends LightningElement {
-	@api recordId;
-	IsLoading = true;
-	qisReportId;
-	qisStatus;
-	oSHInspectionDate;
+    @api recordId;
+    IsLoading = true;
+    qisReportId;
+    qisStatus;
+    oSHInspectionDate;
     err;
     @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
@@ -37,30 +45,30 @@
             this.qisReportId = result.Id;
             this.qisStatus = result.qIStatus;
             this.oSHInspectionDate = result.oSHInspectionDate;
-         	if (this.qisStatus!='OSH妫�娴嬩腑') {
-         		const evt = new ShowToastEvent({
-                            title : '闇�瑕佸厛鐐瑰嚮锛籓SH鐜板搧鏀跺埌锛�',
-                            message: '',
+            if (this.qisStatus!='OSH妫�娴嬩腑') {
+                const evt = new ShowToastEvent({
+                            title : '',
+                            message: '闇�瑕佸厛鐐瑰嚮锛籓SH鐜板搧鏀跺埌锛�',
                             variant: 'error'
                         });
                         this.dispatchEvent(evt);
                         this.dispatchEvent(new CloseActionScreenEvent());
                         return;
-         	}else if(this.oSHInspectionDate != null){
-         		const evt = new ShowToastEvent({
-                            title : 'OSH妫�娴嬪凡缁忓彈鐞�',
-                            message: '',
+            }else if(this.oSHInspectionDate != null){
+                const evt = new ShowToastEvent({
+                            title : '',
+                            message: 'OSH妫�娴嬪凡缁忓彈鐞�',
                             variant: 'error'
                         });
                         this.dispatchEvent(evt);
                         this.dispatchEvent(new CloseActionScreenEvent());
                         return;
-         	}else{
-         		this.updateQisSubmit();
-         	}
-         	
+            }else{
+                this.updateQisSubmit();
+            }
+            
     
-			
+            
         }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
@@ -68,21 +76,23 @@
         }); 
     }
     updateQisSubmit(){
-        	updateQis({
-        		 recordId: this.recordId
-        		}).then(result =>{
-        			console.log('result'+result);
-        			if (result!='鎴愬姛') {
+            updateQis({
+                 recordId: this.recordId
+                }).then(result =>{
+                    console.log('result'+result);
+                    if (result!='鎴愬姛') {
                         this.err = 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 => {
+                updateRecord({fields: { Id: this.recordId }});
+                }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
             

--
Gitblit v1.9.1