zhangqian
2023-07-10 a4b8019d414735754babdefa9c339414981a91fe
耗材备品配套一览 分单  选择明细 取消选择明细

1
12个文件已添加
261 ■■■■■ 已修改文件
force-app/main/default/classes/LexCancelConsumDetailsCtl.cls 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelConsumDetailsCtl.cls
New file
@@ -0,0 +1,43 @@
public with sharing class LexCancelConsumDetailsCtl {
    public LexCancelConsumDetailsCtl() {
    }
    @AuraEnabled
    public static List<Consum_Apply_Equipment_Set__c> splitApplyButton(String recordId){
        try{
            List<Consum_Apply_Equipment_Set__c> report=[select RAES_Status__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: recordId];
            return report;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO,'Consum_Apply_Equipment_Set__c Cancel Error : ' + e);
        }
        return null;
    }
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try {
            Consum_Apply__c rep = [select Id,Yi_loaner_arranged__c from Consum_Apply__c where Id =: recordId];
            res.consumApplyId = rep.Id;
            res.yiLoaner = rep.Yi_loaner_arranged__c;
            Consum_Apply_Equipment_Set__c repSet = [select Id,Yi_loaner_arranged__c from Consum_Apply_Equipment_Set__c where Id =: recordId];
            res.equipmentyiLoaner = repSet.Yi_loaner_arranged__c;
            return res;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String consumApplyId;
        @AuraEnabled
        public Decimal yiLoaner;
        @AuraEnabled
        public Decimal equipmentyiLoaner;
    }
}
force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
            <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js
New file
@@ -0,0 +1,55 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/LexCancelConsumDetailsCtl.init';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
// 20230705 耗材备品配套一览 自定义按钮或链接:取消明细申请
export default class LexCancelConsumDetails extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(111);
            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);
        init({
            recordId: this.recordId
        }).then(res=>{
            this.IsLoading = false;
            if(res){
                if(res.consumApplyId > 0 && res.equipmentyiLoaner == 0){
                    this.showToast('出库之后 而且 没有未分配明细, 不能点击取消明细申请按钮','error');
                }else{
                    window.open("/apex/ConsumAssignCancel?pt_recid="+this.recordId);
                }
            }
            this.dispatchEvent(new CloseActionScreenEvent());
        })
        .catch(err=>{console.log(err)})
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: 'Error',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml
New file
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
        <target>lightning__FlowScreen</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <property name="recordId" type="String" label="recordId"/>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
            <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js
New file
@@ -0,0 +1,18 @@
import { LightningElement,api, track, wire } from 'lwc';
import {CurrentPageReference} from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
// 耗材备品配套一览 自定义按钮或链接:选择明细
export default class LexConsumFixtureSetSelect extends LightningElement {
    @api recordId;
    IsLoading=true;
    connectedCallback(){
        if (this.recordId) {
            window.open("/apex/ConsumFixtureSetSelect?pt_recid="+this.recordId, "_top");
        }
    }
}
force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml
New file
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
        <target>lightning__FlowScreen</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <property name="recordId" type="String" label="recordId"/>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>
force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css
New file
@@ -0,0 +1,22 @@
.holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
.toast{
    border: 1px solid #c9c9c9;
    border-radius: 10px;
    width: 50%;
    margin: 0 auto;
    font-size: 18px;
    font-weight: bold;
    padding: 10px 20px;
    background: #feb75d;
    display: flex;
}
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html
New file
@@ -0,0 +1,13 @@
<template>
    <div class="holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
    <div if:false={IsLoading} class="toast">
        <span style="padding: 10px;">{msg}</span>
        <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;">
                <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small"
                    title="Close"  style="color: black;"></lightning-icon>
              <span class="slds-assistive-text">Close</span>
        </button>
    </div>
</template>
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js
New file
@@ -0,0 +1,43 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  splitApplyButton  from '@salesforce/apex/LexCancelConsumDetailsCtl.splitApplyButton';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
// 耗材备品配套一览 自定义按钮或链接:分单
export default class LexSplit_Apply extends NavigationMixin(LightningElement) {
    @api recordId;
    //只获取当前list选中的一览Id
    @api rentalApplyIds;
    IsLoading=true;
    //提示信息
    msg;
    connectedCallback(){
        console.log(this.recordId);
        console.log(JSON.stringify(this.rentalApplyIds));
        if (this.recordId && JSON.stringify(this.rentalApplyIds)) {
            splitApplyButton({
                recordId: this.recordId
            }).then(res=>{
                this.IsLoading = false;
                if(res && res.length == 1){
                    this.msg = '这个申请单只有一条耗材备品一览,不能分单';
                }else if(res.length == this.rentalApplyIds.length){
                    this.msg = '不能全选耗材备品一览分单';
                }else{
                    window.open("/apex/ConsumApplySplit?objId="+this.recordId+"&raesIds="+this.rentalApplyIds, 'ConsumApplySplit', 'width=800,height=300');
                }
            })
            this.closeAction();
        }else{
            this.msg = '请选择借出备品一览记录';
            this.IsLoading = false;
        }
    }
    closeAction() {
        //返回当前的备品申请
        window.open("/"+this.recordId,'_self');
    }
}
force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml
New file
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
        <target>lightning__FlowScreen</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <property name="recordId" type="String" label="recordId"/>
            <property name="rentalApplyIds" type="String[]" label="rentalApplyIds"/>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>