From 6ac2e9df968bfdc5ded01fa183994bd7f622d7ee Mon Sep 17 00:00:00 2001
From: zhangchunxu <1842059105@qq.com>
Date: 星期五, 04 八月 2023 13:54:16 +0800
Subject: [PATCH] 提交 经销商管理 侧边栏

---
 force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js |   42 +++++++++++++++++++++++++++++++++---------
 1 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
index bd82704..30c6e36 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
@@ -1,7 +1,10 @@
 import { LightningElement, track, wire, api } from 'lwc';
 import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
 import { CloseActionScreenEvent } from 'lightning/actions';
-import init from '@salesforce/apex/EquipmentRentalPicturePDFController.init';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+import init from '@salesforce/apex/LexEquipmentRentalPicturePDFController.init';
 export default class lexEquipmentRentalPicturePDF extends LightningElement {
 	@api recordId;
 		IsLoading = true;
@@ -22,20 +25,41 @@
 		init({
 			recordId: this.recordId
 		}).then(result=>{
-			//console.log('result.ShipmentRequestedCnt===' + result.ShipmentRequestedCnt)
-			if( result.ShipmentRequestedCnt > 0){
-				console.log(result.pagelength);
-				for(var i =0; i<result.pagelength; i++){
-					window.open('/apex/FixtureRentalPicturePDF?raid='+ this.recordId +'&page=' + i); 
+			console.log('result==='+JSON.stringify(result));
+			if(result){
+				//console.log('result.shipmentRequestedCnt===' + result.shipmentRequestedCnt)
+				if( result.shipmentRequestedCnt > 0){
+					console.log(result.pagelength);
+					for(var i =0; i<result.pagelength; i++){
+						this.dispatchEvent(new CloseActionScreenEvent());
+						window.open('/apex/FixtureRentalPicturePDF?raid='+ this.recordId +'&page=' + i); 
+					}
+				}else{
+					this.showToast('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��','error');
 				}
 			}else{
-				alert('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��');
+				this.showToast("鏈煡鍒版暟鎹�", 'error');
 			}
-			this.dispatchEvent(new CloseActionScreenEvent());
 		}).catch(err=>{
 			this.dispatchEvent(new CloseActionScreenEvent());
-			console.log(err);
+			console.log('initerr===='+err);
 		})
 	}
 
+	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