| | |
| | | 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; |
| | |
| | | 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 }}); |
| | | } |
| | | |
| | | } |