From 2975df582adffdcc8cd7a5a179ff844d029655dd Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期一, 08 五月 2023 17:46:10 +0800
Subject: [PATCH] 20230508补充QIS按钮相关

---
 force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js                                  |   84 +++++++++++++++++++++
 force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js                                      |    2 
 force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.css         |   10 ++
 force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.html        |    5 +
 force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.html                                |    5 +
 force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js-meta.xml |   11 ++
 force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js            |    6 
 force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js          |   63 +++++++++++++++
 force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js-meta.xml                         |   11 ++
 force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.css                                 |   10 ++
 10 files changed, 203 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.css b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.css
new file mode 100644
index 0000000..a612ca7
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.css
@@ -0,0 +1,10 @@
+.VOCSubmitHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.html b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.html
new file mode 100644
index 0000000..1d3b62c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="VOCSubmitHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
new file mode 100644
index 0000000..9d05937
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js
@@ -0,0 +1,84 @@
+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 { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForOSHRecievedButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQis';
+
+export default class lexOSHRecieved extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	 @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;
+            console.log('this.qisStatus='+this.qisStatus);
+         	if (this.qisStatus!='OSH妫�娴嬬敵璇�' && this.qisStatus!='瀹屾瘯') {
+                const evt = new ShowToastEvent({
+                        title : 'OSH宸茬粡鏀跺埌瀹炵墿',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else{
+         		this.updateQisSubmit();
+         	}
+        }).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!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: result,
+                            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
diff --git a/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js-meta.xml b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js-meta.xml
new file mode 100644
index 0000000..5712416
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHRecieved/lexOSHRecieved.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOSHRecieved">
+      <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
index 515ea3e..42da614 100644
--- a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
@@ -44,7 +44,7 @@
             console.log('this.qisStatus='+this.qisStatus);
             console.log('this.OSHstaff='+this.OSHstaff);
             console.log('this.OSHstaffEmail='+this.OSHstaffEmail);
-         	if (this.qisStatus=='OSH妫�娴嬬敵璇�' && this.qisStatus=='瀹屾瘯') {
+         	if (this.qisStatus=='OSH妫�娴嬬敵璇�' || this.qisStatus=='瀹屾瘯') {
                 const evt = new ShowToastEvent({
                             title : '闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀',
                             message: '',
diff --git a/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
index 94c87ab..f3236b0 100644
--- a/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
+++ b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
@@ -41,11 +41,11 @@
                 	qisReportId: this.qisReportId
            		 }).then(result => {
 	            	if (result!=null) {
-	            		this.paeId = result.PAEid;
-	            		console.log('result='+this.paeId);
+	            		this.paeId = result.pAEid;
+	            		console.log('result2='+this.paeId);           
 	            	}   
 	            	var url = '';
-					if (result!=null&&result.length>0){
+					if (result!=null){
 						url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ;
 					} else {
 						url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId;
diff --git a/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.css b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.css
new file mode 100644
index 0000000..66b51b5
--- /dev/null
+++ b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.css
@@ -0,0 +1,10 @@
+.exampleHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.html b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.html
new file mode 100644
index 0000000..33549d5
--- /dev/null
+++ b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js
new file mode 100644
index 0000000..cbf87b9
--- /dev/null
+++ b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js
@@ -0,0 +1,63 @@
+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.initForQisUniversalFailureCodeButton';
+import sqlForPAE  from '@salesforce/apex/QISReportController.sqlForPAE';
+
+export default class lexQisUniversalFailureCode extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	paeId;
+	 @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 => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.qisReportId = result.Id;
+                var RecordTypeId = "ASACDecision";
+                sqlForPAE({
+                	qisReportId: this.qisReportId
+           		 }).then(result => {
+	            	if (result!=null) {
+	            		this.paeId = result.pAEid;
+	            		console.log('result='+this.paeId);
+	            	}   
+	            	var url = '';
+					if (result!=null){
+						url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ;
+					} else {
+						url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId;
+					} 
+					console.log('url='+url);
+					// window.open(url,'_self');
+                    window.location.replace(url);
+		        }); 
+            }
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });   
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js-meta.xml b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js-meta.xml
new file mode 100644
index 0000000..51bdb04
--- /dev/null
+++ b/force-app/main/default/lwc/lexQisUniversalFailureCode/lexQisUniversalFailureCode.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQisUniversalFailureCode">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file

--
Gitblit v1.9.1