public with sharing class LexLostSubmitApprovalController { // 遗失报告 提交待审核 @AuraEnabled public static InitData LexLostSubmitApprovalController(String recordId) { InitData res = new initData(); try{ List reportDetail = new List(); List reportList = [SELECT Id,Status__c FROM LostReport__c WHERE Id = :recordId LIMIT 1]; if(reportList.size() > 0){ LostReport__c report = reportList[0]; res.Id = report.Id; res.statusTf = report.Status__c; reportDetail = [SELECT Rental_Apply_Equipment_Set_Detail__r.Lost_item_check_day__c FROM LostReport_Detail__c WHERE LostReport__c = :recordId AND Rental_Apply_Equipment_Set_Detail__r.Lost_item_check_day__c != null]; res.reportDetailList = reportDetail; System.debug(LoggingLevel.INFO, '*** zq: ' + res); } }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** zq: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String statusTf; @AuraEnabled public List reportDetailList; } //提交按钮 @AuraEnabled public static String submit(String recordId) { System.debug(recordId); try { LostReport__c rac = [SELECT Id,Status__c FROM LostReport__c WHERE Id = :recordId LIMIT 1]; rac.Id = rac.Id; rac.Status__c = '填写完毕'; update rac; return '1'; } catch (Exception e) { // return e.getMessage(); System.debug('exception----'+e); if (e.getMessage().contains(':')) { String eMessage = e.getMessage(); Integer left = e.getMessage().indexOf(',')+1; Integer right = e.getMessage().lastIndexOf(':'); return eMessage.substring(left,right); }else{ return e.getMessage(); } } } }