From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523
---
force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
index 12d6d76..42d53f0 100644
--- a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
+++ b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
@@ -1,8 +1,10 @@
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';
+import init from '@salesforce/apex/RentalApplyEquipmentRentalPDFController.initJumptoPDFButton';
export default class rentalApplyEquipmentRentalPDF extends LightningElement {
@api recordId;
@@ -29,11 +31,13 @@
recordId : this.recordId
}).then(result => {
if(result != null) {
- this.IsLoading = false;
- let num = result.pageLength;
- console.log("======"+this.recordId + ' ' +num);
- console.log("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num)
- window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num);
+ 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);
+ }else{
+ this.showToast('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��','error');
+ }
}
})
.catch( error =>{
@@ -41,4 +45,19 @@
})
}
+ 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