unknown
2023-08-24 ddb0231ef7c5cf2bad9d3f1afc2f733674ad38a5
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());