zhangqian
2023-05-15 628ffa98fa49282347008b94f4db58ad08a77673
耗材备品申请 取消

1
5个文件已添加
123 ■■■■■ 已修改文件
force-app/main/default/classes/lexConsumablesLostController.cls 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexConsumablesLostController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexConsumablesLostController.cls
New file
@@ -0,0 +1,29 @@
public with sharing class lexConsumablesLostController {
    // 耗材备品申请 取消
    @AuraEnabled
    public static InitData lexConsumablesLostController(String recordId) {
        InitData res = new initData();
        try{
            Consum_Apply__c report = [SELECT Id,Status__c,RA_Status__c,Yi_loaner_arranged__c FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.statusTf = report.Status__c;
            res.raStatusTf = report.RA_Status__c;
            res.yiLoanerArr = report.Yi_loaner_arranged__c;
            System.debug(LoggingLevel.INFO, '*** zq: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** zq: ' + e);
        }
        return res;
    }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String statusTf;
        @AuraEnabled
        public String raStatusTf;
        @AuraEnabled
        public Decimal yiLoanerArr;
    }
}
force-app/main/default/classes/lexConsumablesLostController.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>56.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="exampleHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js
New file
@@ -0,0 +1,73 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import updateForSubmitButton  from '@salesforce/apex/ReportController.updateForSubmitButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/lexConsumablesLostController.lexConsumablesLostController';
export default class LexConsumablesLost extends 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(){
        this.IsLoading = false;
        // this.submit();
        init({recordId:this.recordId})
        .then(result=>{
            console.log("LexConsumablesLost------>>>",result)
            if (result.statusTf == "取消" ) {
              this.showToast('已经取消!','error')
              return;
            }
            if (result.statusTf == "删除" ) {
                this.showToast('已经删除!','error')
                return;
              }
            //状态为终止的不能提交审批
            if(result.raStatusTf  == "已出库" || result.yiLoanerArr > 0){
              this.showToast('备品已经出库,不能取消!','error')
              return;
            }
            window.open("/apex/ConsumApplyCancel?objId="+this.recordId, 'ConsumApplyCancel', 'width=500,height=250');
            // window.open("/apex/ConsumApplyCancel?objId={!URLENCODE(Consum_Apply__c.Id)}", 'ConsumApplyCancel', 'width=500,height=250');
        })
        .catch(e=>{console.log(e)})
        .finally(()=>{
            this.dispatchEvent(new CloseActionScreenEvent());
        })
     }
     showToast(msg,type) {
      const event = new ShowToastEvent({
          title: '',
          message: msg,
          variant: type
      });
      this.dispatchEvent(event);
      this.dispatchEvent(new CloseActionScreenEvent());
    }
     updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
}
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.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>