From 7986d6aaf7e235f2f5a7dac7345f97a76ac00b97 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期五, 26 五月 2023 12:23:09 +0800
Subject: [PATCH] 清理多余引用,去除多余update操作(跳转带默认值未完成)

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

diff --git a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
index 002e02a..2a56a91 100644
--- a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
@@ -1,12 +1,10 @@
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
-import { NavigationMixin } from 'lightning/navigation';
+import LightningConfirm from 'lightning/confirm';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import init  from '@salesforce/apex/QISReportController.initForRCSubmitButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQisWithRC';
-import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
-import { updateRecord } from 'lightning/uiRecordApi';
 
 export default class lexRCSubmit extends LightningElement {
 	@api recordId;
@@ -21,6 +19,7 @@
 	QISReplyDay;
 	RCproblemnotfound;
 	type;
+    err;
 	@wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
@@ -43,19 +42,14 @@
         }).then(result => {
             this.IsLoading = false;
             this.qisReportId = result.Id;
-            this.qisStatus = result.QIStatus;
-            this.OSHstaff = result.OSHstaff;
-            this.OSHstaffEmail = result.OSHstaffEmail;
-            this.CancelQISReason = result.CancelQISReason;
-            this.Rcid = result.RCid;
-            this.RCinspectionDate = result.RCinspectionDate;
-            this.QISReplyDay = result.QISReplyDay;
-            this.RCproblemnotfound = result.RCproblemnotfound;
-            console.log('this.qisStatus='+this.qisStatus);
-            console.log('this.CancelQISReason='+this.CancelQISReason);
-            console.log('this.Rcid='+this.Rcid);
-            console.log('this.RCproblemnotfound='+this.RCproblemnotfound);
-            console.log('this.RCinspectionDate='+this.RCinspectionDate);
+            this.qisStatus = result.qIStatus;
+            this.OSHstaff = result.oSHstaff;
+            this.OSHstaffEmail = result.oSHstaffEmail;
+            this.CancelQISReason = result.cancelQISReason;
+            this.Rcid = result.rCid;
+            this.RCinspectionDate = result.rCinspectionDate;
+            this.QISReplyDay = result.qISReplyDay;
+            this.RCproblemnotfound = result.rCproblemnotfound;
          	if (this.qisStatus!='RC妫�娴嬩腑') {
                 const evt = new ShowToastEvent({
                         title : '宸茬粡鎻愪氦瀹℃壒',
@@ -66,6 +60,7 @@
                 this.dispatchEvent(new CloseActionScreenEvent());
          		return;
          	}
+            console.log('this.RCproblemnotfound='+(this.QISReplyDay!=null  && this.RCproblemnotfound));
          	if (this.CancelQISReason!=null) {
          		if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
                     const evt = new ShowToastEvent({
@@ -97,7 +92,8 @@
                     this.dispatchEvent(new CloseActionScreenEvent());
 					return;
          		}
-         		if (this.QISReplyDay!=null  && this.RCproblemnotfound == 'true') {
+
+         		if (this.QISReplyDay!=null  && this.RCproblemnotfound) {
                     const evt = new ShowToastEvent({
                         title : '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
                         message: '',
@@ -107,34 +103,47 @@
                     this.dispatchEvent(new CloseActionScreenEvent());
 					return;
          		}
-         		if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
-         			this.type = '1';
-				}else{
-                    this.dispatchEvent(new CloseActionScreenEvent());
-                    return;
-                }
+                LightningConfirm.open({
+                message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+                variant: 'headerless',
+                label: 'this is the aria-label value',
+                }).then(res=>{
+                    if(res) {
+                        this.type = '1';
+                        console.log('this.type='+this.type);
+                        this.updateQisSubmit();
+                    }else{
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+                    }
+                    
+                });
          	}else{
-         		if (confirm("涓�鏃︽彁浜ゅ叧闂璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
-					this.type = '2';
-				}else{
-                    this.dispatchEvent(new CloseActionScreenEvent());
-                    return;
-                }
+                LightningConfirm.open({
+                message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+                variant: 'headerless',
+                label: 'this is the aria-label value',
+                }).then(res=>{
+                    if(res) {
+                        this.type = '2';
+                        console.log('this.type='+this.type);
+                        this.updateQisSubmit();
+                    }else{
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+                    }
+                    
+                });
          	}
-         	console.log('this.type='+this.type);
+         	
          	// this.dispatchEvent(new CloseActionScreenEvent());
-         	this.updateQisSubmit();
+         	
         }).catch(error => {
             console.log('error='+error);
         }).finally(() => {
             
         }); 
     }
-
-    updateRecordView(recordId) {
-        updateRecord({fields: { Id: recordId }});
-    }
-
     updateQisSubmit(){
         	updateQis({
         		 recordId: this.recordId,
@@ -142,16 +151,16 @@
         		 oldQIStatus: this.qisStatus
         		}).then(result =>{
         			console.log('result'+result);
+                     this.err = result;
         			if (result!='鎴愬姛') {
                         const evt = new ShowToastEvent({
                             title : '鏇存柊澶辫触',
-                            message: result,
+                            message: this.err,
                             variant: 'error'
                         });
                         this.dispatchEvent(evt);
                     }
                 this.dispatchEvent(new CloseActionScreenEvent());
-                this.updateRecordView(this.recordId);
         		}).catch(error => {
             console.log('error='+error);
         }).finally(() => {

--
Gitblit v1.9.1