From 45031aed307e255ef5910599eef11132ce719f49 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 06 七月 2023 10:49:14 +0800
Subject: [PATCH] 发货确认单
---
force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.js | 35 ++++++++++++++++++++++++++++-------
force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.html | 3 ---
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.html b/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.html
index 3eff9e8..ba53413 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.html
+++ b/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.html
@@ -1,5 +1,2 @@
<template>
- <div class="EquipmentRentalPDF" 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/lexEquipmentRentalPDF/lexEquipmentRentalPDF.js b/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.js
index 12d6d76..a73f06f 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.js
+++ b/force-app/main/default/lwc/lexEquipmentRentalPDF/lexEquipmentRentalPDF.js
@@ -1,10 +1,12 @@
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 {
+export default class lexEquipmentRentalPDF extends LightningElement {
@api recordId;
IsLoading = true;
@@ -29,11 +31,14 @@
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);
+ console.log('shipmentRequestedCnt'+ result.shipmentRequestedCnt);
+ 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 +46,20 @@
})
}
+ 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