From d439ad21da58ab911d2529f49eb9cf3e05042061 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期五, 12 五月 2023 15:17:08 +0800
Subject: [PATCH] 备品借出申请-配套清单(按钮)测试
---
force-app/main/default/classes/EquipmentRentalPicturePDFController.cls | 6 +++---
force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js | 29 ++++++++++++++++++++++++-----
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls
index d7ceca7..04ddbac 100644
--- a/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls
+++ b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls
@@ -11,7 +11,7 @@
res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : (setLength/10) +1 ;
res.raesList = raeSet;
}
- res.ShipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);
+ res.shipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);
}
catch (Exception e) {
System.debug(LoggingLevel.INFO, '****e:' + e);
@@ -21,11 +21,11 @@
public class InitData{
@AuraEnabled
- public String Id;
+ public String id;
@AuraEnabled
public Integer pagelength;
@AuraEnabled
- public Integer ShipmentRequestedCnt;
+ public Integer shipmentRequestedCnt;
@AuraEnabled
public List<Rental_Apply_Equipment_Set__c> raesList;
}
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
index bd82704..2d24bf8 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
@@ -1,6 +1,9 @@
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/EquipmentRentalPicturePDFController.init';
export default class lexEquipmentRentalPicturePDF extends LightningElement {
@api recordId;
@@ -22,20 +25,36 @@
init({
recordId: this.recordId
}).then(result=>{
- //console.log('result.ShipmentRequestedCnt===' + result.ShipmentRequestedCnt)
- if( result.ShipmentRequestedCnt > 0){
+ //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{
- 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