twysparks
2023-05-24 f0adfc7326311c6ba40281ffe48437d41a79bd32
force-app/main/default/classes/buttonAccountCtl.cls
@@ -7,14 +7,16 @@
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            Account report =  [SELECT Name,Department_Class_ID_18__c,Department_Class__c,Hospital_ID__c,Hospital__c,Id FROM Account WHERE Id =: recordId LIMIT 1];
            Account report =  [SELECT Department_Class__r.Id,Hospital__r.Id,Name,Department_Class__c,Hospital__c,Id FROM Account WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.Id = report.Id;
            res.HospitalC = report.Hospital__c;
            res.HospitalIdC = report.Hospital_ID__c;
            res.HospitalId = report.Hospital__r.Id;
            res.DepartmentClassC = report.Department_Class__c;
            res.DepartmentClassIdC = report.Department_Class_ID_18__c;
            res.DepartmentClassId = report.Department_Class__r.Id;
            res.Name = report.Name;
            res.userID = UserInfo.getUserId();
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
@@ -23,18 +25,42 @@
        return res;
    }   
       // 查找UserName
       @AuraEnabled
       public static List<User> initUserName(String userId){
           List<User> res = new List<User>();
           try{
               res = [SELECT Id,name,RepairSalesPoint_Province_China__c,Employee_No__c FROM User WHERE Id=: userId ];
           }catch(Exception e){
               System.debug(LoggingLevel.INFO, '*** e: ' + e);
           }
           return res;
       }
       @AuraEnabled
     public static List<Account> selecctAccountByAccountId(String AccountId){
         try {
           List<Account> accounts = [SELECT ParentId,Parent.RecordTypeId,Parent.RecordType_DeveloperName__c  ,Parent.Parent.FSE_GI_Main_Leader__c, Parent.Parent.FSE_GI_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__c,Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE ID=:AccountId];
           return accounts;
       } catch (Exception e) {
             throw new AuraHandledException(e.getMessage());
          }
      }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String HospitalC;
        @AuraEnabled
        public String HospitalIdC;
        public String HospitalId;
        @AuraEnabled
        public String DepartmentClassC;
        @AuraEnabled
        public String DepartmentClassIdC;
        public String DepartmentClassId;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String userID;
     }
}