1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public with sharing class LexOpdCommitApprovalController {
    @AuraEnabled
    public static CancelPostponePlan__c init(String recordId){
        CancelPostponePlan__c res = new CancelPostponePlan__c();
        try{
            res = [Select Id,Status__c,CancelOPDPlan__c
                FROM CancelPostponePlan__c
                    WHERE  Id = : recordId];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
    @AuraEnabled
    public static String  newUpdateCancelPostponePlan(String Id,String Status){
        CancelPostponePlan__c res = new CancelPostponePlan__c();
        try{
            res.Id=Id;
            if(Status == '取消'){
                res.Status__c ='提交';
            }
            else if (Status == '延期报告'){
                res.Status__c ='延期提交';
            }
            update res;
            return 'success';
        }
        catch (Exception e) {
            String messageText='';
            if(e.getMessage().contains(':')){
                String eMessage =e.getMessage();
                Integer left = eMessage.indexOf(',')+1;
                Integer right= eMessage.lastIndexOf(':')+1;
                if(right>eMessage.length()||right<=left){
                    right=eMessage.length();
                }
                String mes=eMessage.substring(left,right);
                messageText = mes;
                return messageText;
            }else{
                messageText=e.getMessage();
                return messageText;
            }  
        }
 
    } 
}