From 626f3c3bb25e204568019e8d568e2d7547d1037a Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 09 八月 2023 10:54:08 +0800
Subject: [PATCH] 20230809修改伟意按钮同步

---
 force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js |  119 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 64 insertions(+), 55 deletions(-)

diff --git a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
index 2f48924..d8e78dc 100644
--- a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
@@ -5,17 +5,24 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import init  from '@salesforce/apex/QISReportController.initForOCMSubmitButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQisWithOCM';
-
+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 lexOCMSubmit extends LightningElement {
-	@api recordId;
-	IsLoading = true;
-	qisReportId;
-	QISInstallDate;
-	qisStatus;
-	contractnumber;
-	isaohuiproduct;
+    @api recordId;
+    IsLoading = true;
+    qisReportId;
+    QISInstallDate;
+    qisStatus;
+    contractnumber;
+    isaohuiproduct;
     err;
-	@wire(CurrentPageReference)
+    @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
              console.log(currentPageReference);
@@ -41,49 +48,49 @@
             this.QISInstallDate = result.qISInstallDate;
             this.contractnumber = result.contractnumber;
             this.isaohuiproduct = result.isaohuiproduct;
-         	if (this.qisStatus!='鑽夋涓�' && this.qisStatus!='鍙栨秷') {
-         		const evt = new ShowToastEvent({
-                        title : '宸茬粡鎻愪氦',
-                        message: '',
+            if (this.qisStatus!='鑽夋涓�' && this.qisStatus!='鍙栨秷') {
+                const evt = new ShowToastEvent({
+                        title : '',
+                        message: '宸茬粡鎻愪氦',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
                 this.dispatchEvent(new CloseActionScreenEvent());
-         		return;
-         	}else{
-         		if (this.qisStatus == '鍙栨秷') {
-         			const evt = new ShowToastEvent({
-                        title : '鍙栨秷鍚庣殑QIS涓嶅厑璁稿啀鎻愪氦锛屽鏋滈渶瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓猀IS',
-                        message: '',
+                return;
+            }else{
+                if (this.qisStatus == '鍙栨秷') {
+                    const evt = new ShowToastEvent({
+                        title : '',
+                        message: '鍙栨秷鍚庣殑QIS涓嶅厑璁稿啀鎻愪氦锛屽鏋滈渶瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓猀IS',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
-					this.dispatchEvent(new CloseActionScreenEvent());
-					return;
-         		}
-         	}
-         	
-         	if (this.QISInstallDate == null) {
-         		const evt = new ShowToastEvent({
-                        title : '銆愯喘涔版棩鏈�/瀹夎鏃ユ湡銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
-                        message: '',
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+                }
+            }
+            
+            if (this.QISInstallDate == null) {
+                const evt = new ShowToastEvent({
+                        title : '',
+                        message: '銆愯喘涔版棩鏈�/瀹夎鏃ユ湡銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
                         variant: 'error'
                     });
                  this.dispatchEvent(evt);
-         		this.dispatchEvent(new CloseActionScreenEvent());
-				return;
-         	}
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+            }
 
-         	if (this.contractnumber == null) {
-         		const evt = new ShowToastEvent({
-                        title : '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
-                        message: '',
+            if (this.contractnumber == null) {
+                const evt = new ShowToastEvent({
+                        title : '',
+                        message: '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
                         variant: 'error'
                     });
                     this.dispatchEvent(evt);
-         		this.dispatchEvent(new CloseActionScreenEvent());
-				return;
-         	}
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+            }
                 LightningConfirm.open({
                 message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
                 variant: 'headerless',
@@ -106,24 +113,26 @@
         }); 
     }
     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,
-	                        variant: 'error'
-                    	});
-                    	this.dispatchEvent(evt);
-        			}
+                        const evt = new ShowToastEvent({
+                            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