From 048f7b0855d05293e80c9bf5dbf0620f064f13f4 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期四, 11 五月 2023 10:51:19 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

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

diff --git a/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js
new file mode 100644
index 0000000..911a425
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js
@@ -0,0 +1,63 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+import init from '@salesforce/apex/rentalApplyEquipmentRentalPDFController.initJumptoPDFButton';
+export default class lexRentalApplyEquipmentRentalPDF extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		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() {
+		console.log('this.recordId' + this.recordId);
+		init({
+			recordId : this.recordId
+		}).then(result => {
+			if(result != null) {
+				if(result.shipmentRequestedCnt > 0){
+					this.IsLoading = false;
+					let num = result.pageLength;
+					window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num);
+					this.dispatchEvent(new CloseActionScreenEvent());
+				}else{
+					this.showToast('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��','error');
+				}
+			}
+		})
+		.catch( error =>{
+			console.log(error);
+		})
+	}
+
+	showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        if(type == 'success'){
+            this.updateRecordView();
+        }
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1