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/lexOSHRecieved/lexOSHRecieved.js |   49 +++++++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
index cf64145..97f655d 100644
--- a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
+++ b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
@@ -4,13 +4,20 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import init  from '@salesforce/apex/QISReportController.initForOSHRecievedButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQis';
-
+import { updateRecord } from 'lightning/uiRecordApi';
+/*
+ * @Description: OSH鐜板搧鏀跺埌
+ * @Author: hql
+ * @Date: 2023-07-12 09:45:19
+ * @LastEditTime: 2023-07-12 15:44:33
+ * @LastEditors:  
+ */
 export default class lexOSHRecieved extends LightningElement {
-	@api recordId;
-	IsLoading = true;
-	qisReportId;
-	qisStatus;
-	 @wire(CurrentPageReference)
+    @api recordId;
+    IsLoading = true;
+    qisReportId;
+    qisStatus;
+     @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
              console.log(currentPageReference);
@@ -34,18 +41,18 @@
             this.qisReportId = result.Id;
             this.qisStatus = result.qIStatus;
             console.log('this.qisStatus='+this.qisStatus);
-         	if (this.qisStatus!='OSH妫�娴嬬敵璇�' && this.qisStatus!='瀹屾瘯') {
+            if (this.qisStatus!='OSH妫�娴嬬敵璇�' && this.qisStatus!='瀹屾瘯') {
                 const evt = new ShowToastEvent({
-                        title : 'OSH宸茬粡鏀跺埌瀹炵墿',
-                        message: '',
+                        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(() => {
@@ -53,21 +60,23 @@
         }); 
     }
     updateQisSubmit(){
-        	updateQis({
-        		 recordId: this.recordId
-        		}).then(result =>{
+            updateQis({
+                 recordId: this.recordId
+                }).then(result =>{
                     
-        			console.log('result'+result);
-        			if (result!='鎴愬姛') {
+                    console.log('result'+result);
+                    if (result!='鎴愬姛') {
                         const evt = new ShowToastEvent({
-                            title : '鏇存柊澶辫触',
-                            message: result,
+                            title : '',
+                            message: '鏇存柊澶辫触'+result,
                             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