From 87861ae5f1ed5456685f97f8a8e7625e47b9576d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期四, 13 四月 2023 11:12:26 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

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

diff --git a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
new file mode 100644
index 0000000..a65405b
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
@@ -0,0 +1,160 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+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;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	OSHstaff;
+	OSHstaffEmail;
+	CancelQISReason;
+	Rcid;
+	RCinspectionDate;
+	QISReplyDay;
+	RCproblemnotfound;
+	type;
+    err;
+	@wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).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;
+         	if (this.qisStatus!='RC妫�娴嬩腑') {
+                const evt = new ShowToastEvent({
+                        title : '宸茬粡鎻愪氦瀹℃壒',
+                        message: '',
+                        variant: 'error'
+                    });
+                 this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+         		return;
+         	}
+         	if (this.CancelQISReason!=null) {
+         		if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
+                    const evt = new ShowToastEvent({
+                        title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+					return;
+         		}
+         		if (this.Rcid ==null) {
+                    const evt = new ShowToastEvent({
+                        title : '鍒ゅ畾鎷呭綋蹇呴』濉啓',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+					return;
+         		}
+         		if (this.RCinspectionDate == null) {
+                    const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+					return;
+         		}
+         		if (this.QISReplyDay!=null  && this.RCproblemnotfound == 'true') {
+                    const evt = new ShowToastEvent({
+                        title : '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+					return;
+         		}
+         		if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+         			this.type = '1';
+				}else{
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+                }
+         	}else{
+         		if (confirm("涓�鏃︽彁浜ゅ叧闂璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+					this.type = '2';
+				}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,
+        		 type: this.type,
+        		 oldQIStatus: this.qisStatus
+        		}).then(result =>{
+        			console.log('result'+result);
+                     this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+
+ 
+}
\ No newline at end of file

--
Gitblit v1.9.1