19626
2023-04-23 2c4649009ce262ecbd5f299ba6fb407621a7962c
修改按钮以及页面所需controller
1个文件已修改
46 ■■■■■ 已修改文件
force-app/main/default/classes/OpportunityLightingButtonController.cls 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -362,6 +362,31 @@
        return res;
    }
    @AuraEnabled
    public static InitData initForOpporSpliteButton(String recordId){
        InitData res = new InitData();
        try {
            Opportunity oppo = [
                select
                Authorized_DB_No__c,
                Estimation_Decision__c,
                SI_Decide_ID__c,
                Name,
                Opportunity_No__c,
                IsAuthorized__c
                from Opportunity where Id =: recordId
            ];
            res.authorizedDBNo = oppo.Authorized_DB_No__c;
            res.estimationDecision = oppo.Estimation_Decision__c;
            res.siDecideID = oppo.SI_Decide_ID__c;
            res.name = oppo.Name;
            res.opportunityNo = oppo.Opportunity_No__c;
            res.isAuthorized = oppo.IsAuthorized__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static string updateForAgencyAuthorizeButton(String recordId){
        try {
            Opportunity opp = new Opportunity();
@@ -547,6 +572,21 @@
        }
        return fields;
    }
    @AuraEnabled
    public static Object submitProcess(String opportunityId) {
        try {
            Approval.ProcessSubmitRequest request = new Approval.ProcessSubmitRequest();
            request.setObjectId(opportunityId);
            Approval.ProcessResult[] processResults = new Approval.ProcessResult[] {};
            processResults.add(Approval.process(request));
            return processResults[0].errors;
        } catch (Exception e) {
            String eMessage = e.getMessage();
            Integer left = eMessage.indexOf(',') + 1;
            Integer right = eMessage.length();
            return eMessage.substring(left,right);
        }
    }
    public class InitData{
        @AuraEnabled
        public Boolean directLossFLG;
@@ -642,5 +682,11 @@
        public String opportunityCategory;
        @AuraEnabled
        public String agency1Name;
        @AuraEnabled
        public String authorizedDBNo;
        @AuraEnabled
        public String siDecideID;
        @AuraEnabled
        public String opportunityNo;
    }
}