public with sharing class buttonQISSCReportCtl {
    public buttonQISSCReportCtl() {

    }

    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            QIS_SC_Report__c report =  [SELECT Status__c,Id FROM QIS_SC_Report__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.Id = report.Id;
            res.StatusC = report.Status__c;

            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }   

    // 根据ID修改QIS市场部
    @AuraEnabled
    public static String updateQISSCReport(String QId){
        String s='';
        try {
            QIS_SC_Report__c qis = new QIS_SC_Report__c();
            qis.Id = QId;
            qis.Status__c = '已提交';
            update qis;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            if (e.getMessage().contains(':')){
                String eMessage = e.getMessage();
                Integer left = eMessage .indexof(',')+1 ;
                Integer right = eMessage.indexof('[')-2;
                s =  eMessage.substring(left,right);
            }else {
                s  = e.getMessage();
            }
        }
        return s;
    }

    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String StatusC;
     }
}