From ddb0231ef7c5cf2bad9d3f1afc2f733674ad38a5 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 24 八月 2023 14:50:51 +0800
Subject: [PATCH] 再修理按钮

---
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
index bd626db..4e09ac0 100644
--- a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -4,10 +4,10 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { updateRecord } from 'lightning/uiRecordApi';
 
-import init from '@salesforce/apex/loanerArrangedEmailController.init';
-import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet';
+import init from '@salesforce/apex/LexLoanerArrangedEmailController.init';
+import getRentalApplyEquipmentSet from '@salesforce/apex/LexLoanerArrangedEmailController.getRentalApplyEquipmentSet';
 import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck';
-import setShipment_request from '@salesforce/apex/RentalApplyWebService.approvalCheck';
+import setShipment_request from '@salesforce/apex/RentalApplyWebService.setShipment_request';
 export default class lexLoanerArrangedEmail extends LightningElement {
 	@api recordId;
 	IsLoading = true;
@@ -24,9 +24,11 @@
 	}
 
 	connectedCallback() {
+
 		init({
 			recordId: this.recordId
 		}).then(result => {
+			let id = result.id;
 			let statusArr = result.statusList;
 			console.log('result==='+JSON.stringify(result));
 			if(result != null) {
@@ -58,19 +60,24 @@
 							//bp2 alert(rs2);
 							//bp2 } else {
 							//var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"}); 
-							console.log('setShipment_request==');
 							setShipment_request({
 								raid: this.recordId
 							}).then(res=>{
 								console.log('res==',res);
-								if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
-									this.showToast("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�",'success');
+								if (res == '鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�') {
+									this.showToast('鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�','success');
 									print();
-									// setTimeout(function() {
-									// 	location.href = "/{!Rental_Apply__c.Id}"; 
-									// },100);
+									this.updateRecordView(this.recordId);
+									return;
 								}else {
-									this.showToast(res,'error');
+									console.log('else==',res);
+									 const evt = new ShowToastEvent({
+					                    title: 'Error',
+					                    message:res,
+					                    variant: 'error'
+					                });
+					                this.dispatchEvent(evt);
+					                this.dispatchEvent(new CloseActionScreenEvent());
 								}
 							}).catch(e=>{
 								console.log('approvalCheck==='+e);
@@ -80,7 +87,6 @@
 						console.log('setShipment_request==='+e);
 					})				
 				}
-				this.dispatchEvent(new CloseActionScreenEvent());
 			}
 		})
 	}
@@ -89,7 +95,7 @@
 		getRentalApplyEquipmentSet({
 			recordId: this.recordId
 		}).then(result => {
-			window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result);
+			window.open("/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result);
 		})
 	}
 
@@ -109,7 +115,7 @@
             variant: type
         });
         if(type == 'success'){
-            this.updateRecordView();
+            this.updateRecordView(this.recordId);
         }
         this.dispatchEvent(event);
         this.dispatchEvent(new CloseActionScreenEvent());

--
Gitblit v1.9.1