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/lexOCMSubmit/lexOCMSubmit.js |  133 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
new file mode 100644
index 0000000..814dd7b
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
@@ -0,0 +1,133 @@
+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.initForOCMSubmitButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisWithOCM';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCMSubmit extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	QISInstallDate;
+	qisStatus;
+	contractnumber;
+	isaohuiproduct;
+    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.QISInstallDate = result.qISInstallDate;
+            this.contractnumber = result.contractnumber;
+            this.isaohuiproduct = result.isaohuiproduct;
+         	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: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+					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;
+         	}
+
+         	if (this.contractnumber == null) {
+         		const evt = new ShowToastEvent({
+                        title : '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+         		this.dispatchEvent(new CloseActionScreenEvent());
+				return;
+         	}
+
+         	if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+         		this.dispatchEvent(new CloseActionScreenEvent());
+				return;
+			}
+			this.updateQisSubmit();
+			if (this.isaohuiproduct == 'true') {
+				this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+			}
+			this.dispatchEvent(new CloseActionScreenEvent());
+            this.updateRecordView(this.recordId);
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	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);
+        			}
+                this.dispatchEvent(new CloseActionScreenEvent());
+        		}).catch(error => {
+            			console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1