unknown
2023-05-10 8c441a07b9392dc90b1d83123a7a2d85a404e54a
备品借出申请-发货确认单

备品借出申请-发货确认单(按钮)修改
1个文件已修改
4个文件已添加
102 ■■■■■ 已修改文件
force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
@@ -1,12 +1,12 @@
public with sharing class rentalApplyEquipmentRentalPDFController {
    public rentalApplyEquipmentRentalPDFController() {
    }
public with sharing class RentalApplyEquipmentRentalPDFController {
    @AuraEnabled
    public static InitData initJumptoPDFButton(String recordId) {
        InitData res = new InitData();
        try {
            Rental_Apply__c ra = [SELECT Id,Shipment_requested_cnt__c from Rental_Apply__c where Id = :recordId];
            List<Rental_Apply_Equipment_Set__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '取消'];
            res.shipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);
            Integer setLength = raeSet.size();
            res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : Math.round(setLength) +1 ;
        }catch(Exception e){
@@ -17,9 +17,11 @@
    public class InitData{
        @AuraEnabled
        public String Id;
        public String id;
        @AuraEnabled
        public Integer pageLength;
        @AuraEnabled
        public Integer shipmentRequestedCnt;
    }
    
}
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css
New file
@@ -0,0 +1,11 @@
.rentalApplyCanleButtonHolder{
 position: relative;
 display: inline-block;
 width: 80px;
 height: 80px;
 text-align: center;
}
.container .uiContainerManager{
 display : none !important;
}
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html
New file
@@ -0,0 +1,4 @@
<template>
<div class="rentalApplyCanleButtonHolder" if:true={IsLoding}>
<lightning-spinner alternative-text="Loading" size="medium">  </lightning-spinner> </div>
</template>
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js
New file
@@ -0,0 +1,64 @@
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';
export default class lexRentalApplyEquipmentRentalPDF extends LightningElement {
    @api recordId;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        console.log(currentPageReference);
        if(currentPageReference) {
            const urlValue = currentPageReference.state.recordId;
            if(urlValue) {
                let str = `${urlValue}`;
                console.log("str");
                console.log(str);
                this.recordId = str;
            }
        }
    }
    connectedCallback() {
        console.log('this.recordId' + this.recordId);
        init({
            recordId : this.recordId
        }).then(result => {
            if(result != null) {
                result.shipmentRequestedCnt = 1;
                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);
                    this.dispatchEvent(new CloseActionScreenEvent());
                }else{
                    this.showToast('当前的申请单中没有已出库指示的配套。','error');
                }
            }
        })
        .catch( error =>{
            console.log(error);
        })
    }
    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 }});
    }
}
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>