public with sharing class HosipitalToDeptController { @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try { Account report = [SELECT Id, GI_Main__c, BF_owner__c, ET_owner__c, SP_Main__c, URO_owner_ID__c, GYN_owner__c, ENT_owner_ID__c, Tender_information__c, Is_upload_file__c, name, Attribute_Type__c FROM Account WHERE Id = :recordId]; res.giMain = report.GI_Main__c; res.bfowner = report.BF_owner__c; res.etowner = report.ET_owner__c; res.spmain = report.SP_Main__c; res.uroownerID = report.URO_owner_ID__c; res.gynowner = report.GYN_owner__c; res.entownerID = report.ENT_owner_ID__c; res.soakupHPDeptTeam = System.Label.Confirm_SoakupHPDeptTeam; res.tenderinformation = report.Tender_information__c; res.isuploadfile = report.Is_upload_file__c; res.name = report.name; res.attributeType = report.Attribute_Type__c; } catch (Exception e) { } return res; } @AuraEnabled public static string updataAccount(String recordId,Boolean HosipitalToDept){ Account a = new Account(); try { a.Id = recordId; a.HosipitalToDept__c = HosipitalToDept; update a; } catch (Exception e) { return e.getMessage(); } return 'ok'; } //提交审批 @AuraEnabled public static String submitApproval(String recordId){ Savepoint sp = Database.setSavepoint(); try { // Account_Delay_Apply__c report = [SELECT Id,name FROM Account_Delay_Apply__c WHERE Id = :recordId]; Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); psr.setObjectId(recordId); Approval.ProcessResult submitResult = Approval.process(psr); //chenjingwu 20231225 start return JSON.serialize(submitResult); //chenjingwu 20231225 end } catch (Exception e) { Database.rollback(sp); return e.getMessage(); } } @AuraEnabled public static string ReportId(String TypeName){ String reportId = [select Id from Report where DeveloperName = :TypeName].Id; return reportId; } public class InitData{ @AuraEnabled public string giMain; @AuraEnabled public string bfowner; @AuraEnabled public string etowner; @AuraEnabled public string spmain; @AuraEnabled public string uroownerID; @AuraEnabled public string gynowner; @AuraEnabled public string entownerID; @AuraEnabled public string soakupHPDeptTeam; @AuraEnabled public string tenderinformation; @AuraEnabled public Boolean isuploadfile; @AuraEnabled public string name; @AuraEnabled public string attributeType; } }