({ 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); }, 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 = ''; 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 = "医生区分(职务)不能为空!"; } } }); if (!showValidationError) { helper.newlyBuild(component, event, helper); }else{ component.find('OppMessage').setError(vaildationFailReason); } }, createCancel : function(component, event, helper) { helper.createCancel(component, event, helper); }, yes_button : function(component, event, helper) { component.set('v.confirm_status', 1); helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text')); }, no_button : function(component, event, helper) { component.set('v.confirm_status', 2); helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text')); }, toggle_report : function(component, event, helper) { helper.toggle_report(component, event, helper); }, save_report : function(component, event, helper) { helper.save_report(component, event, helper); }, select_date_change : function(component, event, helper) { helper.select_date_change(component, event, helper); }, select_agency_change : function(component, event, helper) { helper.select_agency_change(component, event, helper); }, hosChange : function(component, event, helper) { var hospital_name = event.getParam("value"); if (hospital_name.match(/(\S+\s)+/)) { helper.searchHos(component, event, helper); } else { helper.hideSearch(component, event, helper); } }, selectHos : function(component, event, helper) { helper.selectHos(component, event, helper); helper.setOpportunity_cfilter(component); }, //使用产品1 UseProduct1Change : function(component, event, helper) { var UseProduct1Name = event.getParam("value"); if (UseProduct1Name.match(/(\S+\s)+/)) { helper.searchUseProduct1(component, event, helper); } else { helper.hideSearchUseProduct1(component, event, helper); } }, seletUseProduct1Change : function(component, event, helper) { helper.seletUseProduct1Change(component, event, helper); }, //使用产品2 UseProduct2Change : function(component, event, helper) { var UseProduct2Name = event.getParam("value"); if (UseProduct2Name.match(/(\S+\s)+/)) { helper.searchUseProduct2(component, event, helper); } else { helper.hideSearchUseProduct2(component, event, helper); } }, seletUseProduct2Change : function(component, event, helper) { helper.seletUseProduct2Change(component, event, helper); }, productcategoryChange2 : function(component, event, helper) { helper.productcategoryChange2(component, event, helper); }, //使用产品3 UseProduct3Change : function(component, event, helper) { var UseProduct3Name = event.getParam("value"); if (UseProduct3Name.match(/(\S+\s)+/)) { helper.searchUseProduct3(component, event, helper); } else { helper.hideSearchUseProduct3(component, event, helper); } }, seletUseProduct3Change : function(component, event, helper) { helper.seletUseProduct3Change(component, event, helper); }, select_department : function(component, event, helper) { helper.setOpportunity_cfilter(component); }, doctor_change : function(component, event, helper) { helper.doctor_change(component, event, helper); }, stageNameChange : function(component, event, helper) { helper.stageNameChange(component, event, helper); }, onDragOver : function(component, event, helper) { event.preventDefault(); }, onDrop : function(component, event, helper) { event.stopPropagation(); event.preventDefault(); event.dataTransfer.dropEffect='copy'; var files=event.dataTransfer.files; helper.readFile(component,helper,files[0]); }, CreateRecord : function(component, event, helper){ var files = event.getSource().get("v.files"); helper.readFile(component,helper,files[0]); }, processFileContent : function(component,event,helper){ helper.saveRecords(component,event,helper); }, cancel : function(component,event,helper){ component.set("v.showMain",true); }, import : function(component,event,helper){ helper.showImport(component); }, exportDate : function(component,event,helper){ var stockData = component.get("v.reports_date"); console.log('导出数据'+stockData); var csv = helper.convertArrayOfObjectsToCSV(component,stockData); if (csv == null){return;} var universalBOM = "\uFEFF"; var hiddenElement = document.createElement('a'); hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM+csv); hiddenElement.target = '_self'; // hiddenElement.download = 'ExportData.csv'; // CSV file Name* you can change it.[only name not .csv] document.body.appendChild(hiddenElement); // Required for FireFox browser hiddenElement.click(); // using click() js function to download csv file }, export_condition : function(component,event,helper){ helper.showExport(component); }, select_repores_date : function(component,event,helper){ helper.select_repores_date(component,event,helper); }, export : function(component,event,helper){ console.log('进入export'); var stockData = component.get("v.reports_date"); console.log('查出的数据'+stockData); }, close_import : function(component,event,helper){ component.set("v.showMain",true); helper.close_import(component); }, close_export : function(component,event,helper){ component.set("v.showMain",true); helper.close_export(component); }, select_ConsumptionOfConsumables : function(component,event,helper){ helper.select_ConsumptionOfConsumables(component,event,helper); }, select_purpose_type : function(component,event,helper){ helper.selectPurposeType(component,event,helper); }, select_warlocksNumber : function(component,event,helper){ helper.select_warlocksNumber(component,event,helper); }, selectProductClassification : function(component,event,helper){ helper.selectProductClassification(component,event,helper); } })