({ doInit : function(component, event, helper) { helper.doinit(component, event, helper); }, createAopp : function(component, event, helper) { var addRecordEvent = $A.get('e.force:createRecord'); addRecordEvent.setParams({ entityApiName: 'Agency_Opportunity__c', recordTypeId: '012100000006KW7' }); addRecordEvent.fire(); }, new_report : function(component, event, helper) { component.find('save_button').set('v.label', '保存并新建'); helper.new_report(component, event, helper); }, copy_button : function(component, event, helper) { component.find('save_button').set('v.label', '保存并新建'); helper.copy_button(component, event, helper); }, delete_button : function(component, event, helper) { helper.delete_button(component, event, helper); }, change_report_radio : function(component, event, helper) { helper.change_report_radio(component, event, helper); }, edit_button : function(component, event, helper) { component.find('save_button').set('v.label', '保存'); helper.edit_button(component, event, helper); }, createCon : function(component, event, helper) { helper.createCon(component, event, helper); }, showRequiredFields: function(component, event, helper){ $A.util.removeClass(component.find("newOpportunityField"), "none"); $A.util.removeClass(component.find("newOpportunityField"), "none"); }, handleSuccess : function(component, event, helper) { helper.handleSuccess(component, event, helper); }, handleSubmit : function(component, event, helper) { event.preventDefault(); // stop form submission var showValidationError = false; var fields = component.find("newOpportunityField"); var vaildationFailReason = ''; let agencyReport = Object.create(null); fields.forEach(function (field) { if(field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))){ showValidationError = true; vaildationFailReason = "分类不能为空!"; }else if(field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))){ showValidationError = true; if(vaildationFailReason != ''){ vaildationFailReason += "医生区分(职务)不能为空!"; }else{ vaildationFailReason = "医生区分(职务)不能为空!"; } } //SWAG-CF58C3 fy start if(field.get("v.fieldName") === 'Name'){ agencyReport['name'] = field.get("v.value"); }else if(field.get("v.fieldName") === 'Type__c'){ agencyReport['type'] = field.get("v.value"); }else if(field.get("v.fieldName") === 'Doctor_Division1__c'){ agencyReport['doctorDivision1'] = field.get("v.value"); } //SWAG-CF58C3 fy end }); if (!showValidationError) { //SWAG-CF58C3 fy start var agencyHospitalid = component.get('v.hospitalLinkId'); //zhj MEBG新方案改造 2022-11-29 start debugger let hospitalName = ''; //调用后端searchAgencyDataId方法查询出医院下面所有客户人员dataid helper.CallBackAction(component,'searchAgencyDataId',{ hospitalId : agencyHospitalid },function(data){ if(data.getState() == "SUCCESS"){ var data = data.getReturnValue(); if(data.IsSuccess == true){ let agencyContactIds = '' if(data.Message == '' && data.Data && data.Data.length > 0){ hospitalName = data.Data[0].Agency_Hospital__r.Name; for(var i=0;i