| | |
| | | ({ |
| | | doinit: function (component, event, helper) { |
| | | debugger |
| | | this.report_date_list(component, event, helper, 5); |
| | | component.set('v.login', true); |
| | | var action = component.get('c.getalldata'); |
| | |
| | | component.set('v.fieldsmap', res.fieldsMap); |
| | | component.set('v.allselectlist', res.allselectlist); |
| | | component.set('v.doclist', res.doclist); |
| | | //fy |
| | | debugger |
| | | var xx=res.UserProType; |
| | | component.set('v.UserProType', res.UserProType); |
| | | var gg=component.get('v.UserProType'); |
| | | //fy |
| | | component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c)); |
| | | component.find('select_DealerPersonnel').set('v.options', this.conv_selected(res.allselectlist.DealerPersonnel__c)); |
| | | component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.WorkRecord__c)); |
| | | component.find('select_ProductClassification').set('v.options', this.conv_selected(res.allselectlist.ProductClassification__c)); |
| | | // component.find('select_OtherBrandConsumables').set('v.options', this.conv_selected(res.allselectlist.OtherBrandConsumables__c)); |
| | | component.find('select_ProductCcategory').set('v.options', this.conv_selected(res.allselectlist.ProductCcategory__c)); |
| | | // component.set('v.select_WorkMark',true); |
| | | component.find('select_stageName').set('v.options', this.conv_selected(res.allselectlist.StageName__c)); |
| | | component.set('v.selected_agency_person', res.allselectlist.AgencyPerson__c[0].label); |
| | | component.set('v.dialog_type', '新建'); |
| | | |
| | | this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value')); |
| | | |
| | | component.set('v.PIConfig', res.PIConfig);// 20220222 PI改造 by Bright |
| | | component.set('v.login', false); |
| | | } |
| | | else { |
| | |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | //其他品牌产品类别 下拉框赋值 |
| | | selectProductCcategory : function(component){ |
| | | var select_ProductClassification = component.find('select_ProductClassification').get('v.value'); |
| | | if(select_ProductClassification != ''){ |
| | | var action = component.get('c.selectProductCcategory'); |
| | | action.setCallback(this,function( response){ |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_ProductCcategory').set('v.options', JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | component.find('select_ProductCcategory').set('v.options', []); |
| | | } |
| | | }, |
| | | //根据周和担当查询数据给初始页面赋数据 |
| | | get_reports: function (component, event, helper, date_str, person_str) { |
| | | if (!date_str) { |
| | |
| | | "date_str": date_str, |
| | | "person_str": person_str, |
| | | }); |
| | | |
| | | component.set('v.login', true); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | |
| | | var res = response.getReturnValue(); |
| | | component.set('v.reports', res.reports); |
| | | component.set('v.report_count', res.reports.length); |
| | | |
| | | // 更新保存後のselect_data用 |
| | | var report_id = component.get('v.update_select_report_data_id'); |
| | | if (report_id != "") { |
| | |
| | | } |
| | | if (res.reports.length > 0) { |
| | | component.set('v.list_message', ''); |
| | | |
| | | // PI 改造 By Bright 20220328 |
| | | if(true){ |
| | | let doctor_awsids = res.reports.map(function(d){return d.doctor2__r.AWS_Data_Id__c;}); |
| | | let PIConfig = component.get('v.PIConfig'); |
| | | let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact); |
| | | if(doctor_awsids.length > 0){ |
| | | AWSService.search(staticResourceAgencyContact.searchUrl,{ |
| | | dataIds:doctor_awsids |
| | | }, function(data){ |
| | | if(data && data.object && data.object.length){ |
| | | let m = {}; |
| | | for(let di in data.object){ |
| | | if(data.object[di] && data.object[di].dataId){ |
| | | m[data.object[di].dataId] = data.object[di]; |
| | | } |
| | | } |
| | | |
| | | for(let ri in res.reports){ |
| | | if(res.reports[ri] && res.reports[ri].doctor2__r && res.reports[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res.reports[ri].doctor2__r.AWS_Data_Id__c)){ |
| | | res.reports[ri].doctor2__r.awsdata = m[res.reports[ri].doctor2__r.AWS_Data_Id__c]; |
| | | } |
| | | } |
| | | component.set('v.reports', res.reports); |
| | | component.set('v.report_count', res.reports.length); |
| | | } |
| | | |
| | | component.set('v.login', false); |
| | | }, staticResourceAgencyContact.token); |
| | | }else{ |
| | | component.set('v.login', false); |
| | | } |
| | | |
| | | } |
| | | |
| | | } else { |
| | | component.set('v.list_message', 'no_data'); |
| | | component.set('v.login', false); |
| | | } |
| | | component.set('v.login', false); |
| | | |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'get_reports failed.'); |
| | | this.showErrorToast(component); |
| | | // this.error('get_reports failed.'); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | |
| | | } |
| | | return new_label; |
| | | }, |
| | | |
| | | |
| | | toggle_report: function (component, event, helper) { |
| | | //复制和编辑回显的位置 |
| | | toggle_report: function (component) { |
| | | var modal_window = component.find('modal_window'); |
| | | var modal_bg = component.find('modal_bg'); |
| | | if ($A.util.hasClass(modal_window, 'disp_none')) { |
| | |
| | | component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']); |
| | | component.find('new_con').set('v.disabled', false); |
| | | } |
| | | //使用产品1 |
| | | //使用产品1(产品型号) |
| | | var UseProduct1Text = ''; |
| | | var UseProduct1Id = ''; |
| | | if (select_data['UseProduct1__c'] != '') { |
| | | if (select_data['UseProduct1__c'] != '' || select_data['UseProduct1__c'] != 'undefined') { |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i]['UseProduct1__c'] == select_data['UseProduct1__c']) { |
| | | UseProduct1Text = reports[i]['UseProduct1__r']['Name']; |
| | |
| | | //使用产品2 |
| | | var UseProduct2Text = ''; |
| | | var UseProduct2Id = ''; |
| | | if (select_data['UseProduct2__c'] != '') { |
| | | if (select_data['UseProduct2__c'] != ''&&select_data['UseProduct2__c'] != undefined) { |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i]['UseProduct2__c'] == select_data['UseProduct2__c']) { |
| | | UseProduct2Text = reports[i]['UseProduct2__r']['Name']; |
| | |
| | | //使用产品3 |
| | | var UseProduct3Text = ''; |
| | | var UseProduct3Id = ''; |
| | | if (select_data['UseProduct3__c'] != '') { |
| | | if (select_data['UseProduct3__c'] != ''&&select_data['UseProduct3__c'] != undefined) { |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i]['UseProduct3__c'] == select_data['UseProduct3__c']) { |
| | | UseProduct3Text = reports[i]['UseProduct3__r']['Name']; |
| | |
| | | component.set('v.UseProduct3', UseProduct3Text); |
| | | component.set('v.UseProduct3Id', select_data['UseProduct3__c']); |
| | | } |
| | | |
| | | //活动日 |
| | | var reportDate; |
| | | if (select_data['Report_Date__c'] != '') { |
| | |
| | | if (select_data['DealerPersonnel__c'] != '') { |
| | | this.set_selected(component, 'select_DealerPersonnel', select_data['DealerPersonnel__c']); |
| | | } |
| | | // 拜访人 |
| | | // 医院人员 |
| | | component.set('v.default_select_doctor_id', select_data['doctor2__c']); |
| | | this.set_doctor_list(component, event, helper); |
| | | // 工作记录会 |
| | | this.set_doctor_list(component); |
| | | |
| | | // 工作记录 |
| | | if (select_data['WorkRecord__c'] != '') { |
| | | this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']); |
| | | this.selectPurposeType(component); |
| | | |
| | | } |
| | | //产品分类 |
| | | //产品分类(第三分类) |
| | | if (select_data['ProductClassification__c'] != null) { |
| | | this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']); |
| | | this.selectProductClassification(component); |
| | | } |
| | | alert(component.find('select_EffectProgress').get('v.value')); |
| | | |
| | | // 科室同类耗材月使用量 |
| | | if (select_data['ConsumptionOfConsumables__c'] != '') { |
| | | component.find('select_ConsumptionOfConsumables').set('v.value',select_data['ConsumptionOfConsumables__c']); |
| | | } |
| | | |
| | | // 其他品牌耗材使用 |
| | | if (select_data['ProductCcategory__c'] != '') { |
| | | this.set_selected(component, 'select_ProductCcategory', select_data['ProductCcategory__c']); |
| | | } |
| | | // 术士使用产品对应数量 |
| | | // 产品用量 |
| | | if (select_data['warlocksNumber__c'] != '') { |
| | | component.find('select_warlocksNumber').set('v.value',select_data['warlocksNumber__c']); |
| | | } |
| | |
| | | if (select_data['WorkMark__c'] != false) { |
| | | component.find('select_WorkMark').set('v.checked',select_data['WorkMark__c']); |
| | | } |
| | | // 其他品牌耗材使用 |
| | | // if (select_data['OtherBrandConsumables__c'] != '') { |
| | | // this.set_selected(component, 'select_OtherBrandConsumables', select_data['OtherBrandConsumables__c']); |
| | | // } |
| | | // var OtherBrandConsumables = ''; |
| | | // var i = 0; |
| | | // for (i = 0; i < reports.length; i++) { |
| | | // OtherBrandConsumables = reports[i]["OtherBrandConsumables__c"]; |
| | | // break; |
| | | // } |
| | | // alert('22222'+OtherBrandConsumables); |
| | | // if (OtherBrandConsumables != null && OtherBrandConsumables != '') { |
| | | |
| | | // component.find('select_OtherBrandConsumables').set('v.value', OtherBrandConsumables); |
| | | // alert('3333333'+component.find('select_OtherBrandConsumables').get('v.value')); |
| | | // } |
| | | debugger; |
| | | |
| | | var report_id = component.get('v.edit_copy_select_report_id'); |
| | | if (report_id != "") { |
| | | var select_EffectProgress1 = ''; |
| | | var OtherBrandConsumables = ''; |
| | | var WarlockClassification = ''; |
| | | var ProductCcategory = ''; |
| | | var productCategories = ''; |
| | | var i = 0; |
| | | for (i = 0; i < reports.length; i++) { |
| | | select_EffectProgress1 = reports[i]["EffectProgress__c"]; |
| | | OtherBrandConsumables = reports[i]["OtherBrandConsumables__c"]; |
| | | break; |
| | | if (report_id == reports[i]["Id"]) { |
| | | select_EffectProgress1 = reports[i]["EffectProgress__c"]; |
| | | WarlockClassification = reports[i]["WarlockClassification__c"]; |
| | | ProductCcategory = reports[i]["ProductCcategory__c"]; |
| | | productCategories = reports[i]["productCategories__c"]; |
| | | break; |
| | | } |
| | | } |
| | | //效果/进度 |
| | | if (select_EffectProgress1 != null && select_EffectProgress1 != '') { |
| | | component.find('select_EffectProgress').set('v.value', select_EffectProgress1); |
| | | } |
| | | if (OtherBrandConsumables != null && OtherBrandConsumables != '') { |
| | | component.find('select_OtherBrandConsumables').set('v.value', OtherBrandConsumables); |
| | | //术士分类 |
| | | if (WarlockClassification != null && WarlockClassification != '') { |
| | | component.find('select_OtherBrandConsumables').set('v.value', WarlockClassification); |
| | | } |
| | | //已采用其他品牌 |
| | | if (ProductCcategory != null && ProductCcategory != '') { |
| | | component.find('select_ProductCcategory').set('v.value', ProductCcategory); |
| | | this.selectpurposetype(component); |
| | | } |
| | | //其他品牌产品类别 |
| | | if (productCategories != null && productCategories != '') { |
| | | component.find('select_productCategories').set('v.value', productCategories); |
| | | } |
| | | component.set('v.edit_copy_select_report_id', ""); |
| | | } |
| | | alert(component.find('select_EffectProgress').get('v.value')); |
| | | } |
| | | } else { |
| | | // CLOSE agency_report_header_id |
| | | var select_report_data = component.get('v.select_report_data'); |
| | | var Report_Date__c = component.get('v.data.Report_Date__c'); |
| | | var Agency_Hospital__c = component.get('v.hospitalLinkId'); |
| | |
| | | var doctor2__c = component.find('select_doctor').get('v.value'); |
| | | var WorkRecord__c = component.find('select_purpose_type').get('v.value'); |
| | | var EffectProgress__c = component.find('select_EffectProgress').get('v.value'); |
| | | var OtherBrandConsumables__c = component.find('select_OtherBrandConsumables').get('v.value'); |
| | | var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value'); |
| | | var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value'); |
| | | var productCategories__c = component.find('select_productCategories').get('v.value'); |
| | | var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value'); |
| | | var WorkMark__c = component.find('select_WorkMark').get('v.checked'); |
| | | if (component.get('v.mode') == 'new') { |
| | |
| | | !DealerPersonnel__c && |
| | | !doctor2__c && |
| | | !EffectProgress__c && |
| | | !OtherBrandConsumables__c && |
| | | !WarlockClassification__c && |
| | | !ProductCcategory__c && |
| | | !productCategories__c && |
| | | !warlocksNumber__c && |
| | | !WorkMark__c && |
| | | !WorkRecord__c |
| | |
| | | } else if (component.get('v.mode') == 'copy') { |
| | | var confirm_title = '警告!' |
| | | var confirm_text = '放弃新建周报?'; |
| | | |
| | | if (select_report_data['Report_Date__c'] == Report_Date__c && |
| | | select_report_data['Agency_Hospital__c'] == Agency_Hospital__c && |
| | | select_report_data['UseProduct1__c'] == UseProduct1__c && |
| | |
| | | select_report_data['DealerPersonnel__c'] == DealerPersonnel__c && |
| | | select_report_data['doctor2__c'] == doctor2__c && |
| | | select_report_data['EffectProgress__c'] == EffectProgress__c && |
| | | select_report_data['OtherBrandConsumables__c'] == OtherBrandConsumables__c && |
| | | select_report_data['WarlockClassification__c'] == WarlockClassification__c && |
| | | select_report_data['ProductCcategory__c'] == ProductCcategory__c && |
| | | select_report_data['productCategories__c'] == productCategories__c && |
| | | select_report_data['warlocksNumber__c'] == warlocksNumber__c && |
| | | select_report_data['WorkMark__c'] == WorkMark__c && |
| | | select_report_data['WorkRecord__c'] == WorkRecord__c ) { |
| | |
| | | select_report_data['DealerPersonnel__c'] == DealerPersonnel__c && |
| | | select_report_data['doctor2__c'] == doctor2__c && |
| | | select_report_data['EffectProgress__c'] == EffectProgress__c && |
| | | select_report_data['OtherBrandConsumables__c'] == OtherBrandConsumables__c && |
| | | select_report_data['WarlockClassification__c'] == WarlockClassification__c && |
| | | select_report_data['ProductCcategory__c'] == ProductCcategory__c && |
| | | select_report_data['productCategories__c'] == productCategories__c && |
| | | select_report_data['warlocksNumber__c'] == warlocksNumber__c && |
| | | select_report_data['WorkMark__c'] == WorkMark__c && |
| | | select_report_data['WorkRecord__c'] == WorkRecord__c ) { |
| | |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }, |
| | | //关闭页面是 小的提示框是否放弃新建周报 |
| | |
| | | var modal_bg = component.find('modal_bg'); |
| | | var modal_confirm = component.find('modal_confirm'); |
| | | var modal_confirm_bg = component.find('modal_confirm_bg'); |
| | | |
| | | if (confirm_status == 0) { |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | |
| | | var select_date = component.find('select_date').get('v.value'); |
| | | // 担当 |
| | | var select_agency = component.find('select_agency_person').get('v.value'); |
| | | var cm = 0; |
| | | if(select_agency.indexOf(";") != -1){ |
| | | select_agency = select_agency.split(";")[0]; |
| | | } |
| | | component.set('v.selected_date', select_date); |
| | | // 担当 |
| | | var name = component.get('v.selected_agency_person'); |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //编辑按钮 |
| | | edit_button: function (component, event, helper) { |
| | | this.allclear(component); |
| | | debugger |
| | | component.set('v.loadOpp', true); |
| | | var index = event.getSource().get('v.value'); |
| | | component.set('v.select_report_data', component.get('v.reports')[index]); |
| | |
| | | component.set('v.edit_copy_select_report_id', component.get('v.reports')[index].Id); |
| | | var ret = this.create_report_header(component, event, helper, name, select_agency, select_date); |
| | | }, |
| | | |
| | | //保存 |
| | | save_report: function (component, event, helper) { |
| | | component.find('save_button').set('v.disabled', true); |
| | | var etEng = component.get('v.etEng'); |
| | |
| | | if (component.get('v.mode') == 'edit') { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = component.get('v.select_report_data').Submit_date__c; |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | | Person_In_Charge2__c = component.get('v.select_report_data').Person_In_Charge2__c; |
| | | } else { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = this.get_date_string(component.find('select_date').get('v.value')); |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | | Person_In_Charge2__c = component.find('select_agency_person').get('v.value'); |
| | | } |
| | | debugger |
| | | // Agency_Report_Header__c |
| | | var Agency_Report_Header__c = component.get('v.agency_report_header_id'); |
| | | |
| | | |
| | | // 医院 Agency_Hospital__c (Agency_Hospital_Link__c) |
| | | // 医院 |
| | | var Agency_Hospital__c = component.get('v.hospitalLinkId'); |
| | | |
| | | // 产品分类 |
| | | // 产品分类(第三分类) |
| | | var ProductClassification__c = component.find('select_ProductClassification').get('v.value'); |
| | | |
| | | // 使用产品1 UseProduct1__c |
| | | // 使用产品1(产品型号) UseProduct1__c |
| | | var UseProduct1__c = component.get('v.UseProduct1Id'); |
| | | |
| | | // 使用产品2 UseProduct2__c |
| | | var UseProduct2__c = component.get('v.UseProduct2Id'); |
| | | |
| | | |
| | | // 使用产品3 UseProduct3__c |
| | | var UseProduct3__c = component.get('v.UseProduct3Id'); |
| | | |
| | | |
| | | // 科室 Department_Cateogy__c 未找到 |
| | | // 科室 Department_Cateogy__c |
| | | var Department_Cateogy__c = component.find('select_department').get('v.value'); |
| | | |
| | | // 经销商人员 DealerPersonnel__c |
| | | var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value'); |
| | | |
| | | // 拜访人 doctor2__c |
| | | // 医院人员 doctor2__c |
| | | var doctor2__c = component.find('select_doctor').get('v.value'); |
| | | |
| | | // 工作记录会 WorkRecord__c |
| | | // 工作记录会 WorkRecord__c |
| | | var WorkRecord__c = component.find('select_purpose_type').get('v.value'); |
| | | |
| | | // 效果/进度 EffectProgress__c |
| | | var EffectProgress__c = component.find('select_EffectProgress').get('v.value'); |
| | | |
| | | // 科室同来耗材月使用量 ConsumptionOfConsumables__c 未找到 |
| | | var EffectProgress__c = component.find('select_EffectProgress').get('v.value'); |
| | | // alert(EffectProgress__c); |
| | | // 科室同来耗材月使用量 ConsumptionOfConsumables__c |
| | | var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value'); |
| | | |
| | | // 其他品牌耗材使用 OtherBrandConsumables__c |
| | | var OtherBrandConsumables__c = component.find('select_OtherBrandConsumables').get('v.value'); |
| | | |
| | | // 产品类别 ProductCcategory__c |
| | | // 术士分类 WarlockClassification__c |
| | | var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value'); |
| | | // 已采用其他品牌 ProductCcategory__c |
| | | var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value'); |
| | | |
| | | // 术士使用产品对应数量 warlocksNumber__c |
| | | var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value'); |
| | | |
| | | // 其他品牌产品类别 productCategories__c |
| | | var productCategories__c = component.find('select_productCategories').get('v.value'); |
| | | // 产品用量 warlocksNumber__c |
| | | var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value'); |
| | | // 工作标记 WorkMark__c |
| | | var WorkMark__c = component.find('select_WorkMark').get('v.checked'); |
| | | |
| | | var StageName__c = component.find('select_stageName').get('v.value'); |
| | | var Amount__c = component.get('v.oppdata.Amount__c') != null ? component.get('v.oppdata.Amount__c').toString() : ''; |
| | | var OCMSale_Price__c = component.get('v.oppdata.OCMSale_Price__c') != null ? component.get('v.oppdata.OCMSale_Price__c').toString() : ''; |
| | |
| | | if (!Person_In_Charge2__c) { error.push("担当 不存在"); } |
| | | if (!Agency_Report_Header__c) { this.error("Report Header Id 不存在"); } |
| | | if (!Agency_Hospital__c) { error.push("医院 不存在"); } |
| | | if (!UseProduct1__c) { error.push("使用产品1 不存在"); } |
| | | if (!UseProduct2__c) { error.push("使用产品2 不存在"); } |
| | | if (!UseProduct3__c) { error.push("使用产品3 不存在"); } |
| | | if (!UseProduct1__c) { error.push("使用产品1(产品型号) 不存在"); } |
| | | // if (!UseProduct2__c) { error.push("使用产品2 不存在"); } |
| | | // if (!UseProduct3__c) { error.push("使用产品3 不存在"); } |
| | | if (!Department_Cateogy__c) { error.push("科室 不存在"); } |
| | | if (!DealerPersonnel__c) { error.push("经销商人员 不存在"); } |
| | | if (!doctor2__c) { error.push("拜访人 不存在"); } |
| | | if (!WorkRecord__c) { error.push("工作记录会 不存在"); } |
| | | if (!doctor2__c) { error.push("医院人员 不存在"); } |
| | | if (!WorkRecord__c) { error.push("工作记录 不存在"); } |
| | | if (!EffectProgress__c) { error.push("效果/进度 不存在"); } |
| | | if (!OtherBrandConsumables__c) { error.push("其他品牌耗材使用 不存在"); } |
| | | if (!ProductCcategory__c) { error.push("产品类别 不存在"); } |
| | | // if (!OtherBrandConsumables__c) { error.push("术士分类 不存在"); } |
| | | if (ProductCcategory__c==''||ProductCcategory__c==""||ProductCcategory__c==undefined) { error.push("已采用其他品牌 不存在"); } |
| | | // if (!productCategories__c) { error.push("其他品牌产品类别 不存在"); } |
| | | if (!ConsumptionOfConsumables__c) { error.push("科室同类耗材月使用量 不能为空"); } |
| | | if (!warlocksNumber__c) { error.push("术士使用产品对应数量 不能为空"); } |
| | | //fy start |
| | | if(WorkRecord__c != 'SIS'){ |
| | | if (!warlocksNumber__c) { error.push("产品用量 不能为空"); } |
| | | } |
| | | //fy end |
| | | for (var i = 0; i < error.length; i++) { |
| | | component.set('v.errorMessage', error[i]); |
| | | this.showErrorToast(component); |
| | |
| | | "ConsumptionOfConsumables": ConsumptionOfConsumables__c, |
| | | "WorkRecord": WorkRecord__c, |
| | | "EffectProgress": EffectProgress__c, |
| | | "OtherBrandConsumables" : OtherBrandConsumables__c, |
| | | "WarlockClassification" : WarlockClassification__c, |
| | | "ProductCcategory" : ProductCcategory__c, |
| | | "productCategories" : productCategories__c, |
| | | "warlocksNumber" : warlocksNumber__c, |
| | | "WorkMark" : WorkMark__c, |
| | | "ProductClassification": ProductClassification__c, |
| | |
| | | "Close_Forecasted_Date": Close_Forecasted_Date__c, |
| | | "Report_Date": Report_Date__c |
| | | }); |
| | | |
| | | |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | |
| | | var report_id = response.getReturnValue(); |
| | | component.set('v.create_agency_report_id', report_id); |
| | | var select_agency_list = component.get('v.allselectlist').AgencyPerson__c; |
| | | |
| | | for (var i = 0; i < select_agency_list.length; i++) { |
| | | if (select_agency_list[i].value == component.get('v.select_report_data').Person_In_Charge2__c) { |
| | | select_agency_list[i].selected = true; |
| | |
| | | } |
| | | } |
| | | component.find('select_agency_person').set('v.options', select_agency_list); |
| | | |
| | | component.set('v.update_select_report_data_id', report_id); |
| | | this.get_reports(component, event, helper, component.get('v.select_report_data').Submit_date__c, component.get('v.select_report_data').Person_In_Charge2__c); |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | } |
| | | else { |
| | | |
| | | component.set('v.errorMessage', 'save_report failed.'); |
| | | this.showErrorToast(component); |
| | | component.find('save_button').set('v.disabled', false); |
| | |
| | | "warlocksNumber" : warlocksNumber__c, |
| | | "DealerPersonnel": DealerPersonnel__c, |
| | | "ProductCcategory" : ProductCcategory__c, |
| | | "OtherBrandConsumables" : OtherBrandConsumables__c, |
| | | "productCategories" : productCategories__c, |
| | | "WarlockClassification" : WarlockClassification__c, |
| | | "ProductClassification": ProductClassification__c, |
| | | "WorkRecord": WorkRecord__c, |
| | | "EffectProgress": EffectProgress__c, |
| | |
| | | if (reports_now.length > 0 && reports_now != "") { |
| | | reports_now_count = reports_now.length; |
| | | } |
| | | |
| | | // Save&New時のウィンドウ内データ一覧 |
| | | if (res.length > 0) { |
| | | reports_now[reports_now_count] = res[0]; |
| | | |
| | | reports_now.sort(function (a, b) { |
| | | if (a.Name > b.Name) return -1; |
| | | if (a.Name < b.Name) return 1; |
| | | return 0; |
| | | }); |
| | | |
| | | component.set('v.reports_now', reports_now); |
| | | component.set('v.reports_now_count', reports_now.length); |
| | | var data_list = component.find('modal_data_list_tr'); |
| | |
| | | else { |
| | | component.set('v.errorMessage', 'get_reports_now failed.'); |
| | | this.showErrorToast(component); |
| | | // this.error('get_reports_now failed.'); |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action2); |
| | | |
| | | this.allclear(component); |
| | | component.find('select_WorkMark').set('v.value', false); |
| | | |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | this.doinit(component, event, helper); |
| | |
| | | component.set('v.UseProduct2Id', ''); |
| | | component.set('v.UseProduct3', ''); |
| | | component.set('v.UseProduct3Id', ''); |
| | | component.set('v.select_ProductClassification', ''); |
| | | component.find('select_ProductClassification').set('v.value', ''); |
| | | component.find('select_warlocksNumber').set('v.value', null); |
| | | component.find('select_department').set('v.value', ''); |
| | | component.find('select_ConsumptionOfConsumables').set('v.value', null); |
| | |
| | | component.find('select_doctor').set('v.options', clear); |
| | | component.find('select_DealerPersonnel').set('v.options', this.conv_selected(component.get('v.allselectlist.DealerPersonnel__c'))); |
| | | component.find('select_purpose_type').set('v.options', this.conv_selected(component.get('v.allselectlist.WorkRecord__c'))); |
| | | component.find('select_ProductCcategory').set('v.options', this.conv_selected(component.get('v.allselectlist.ProductCcategory__c'))); |
| | | // component.find('select_ProductCcategory').set('v.options', this.conv_selected(component.get('v.allselectlist.ProductCcategory__c'))); |
| | | component.find('select_EffectProgress').set('v.value', ''); |
| | | component.find('select_OtherBrandConsumables').set('v.value', ''); |
| | | component.find('select_ProductCcategory').set('v.value', ''); |
| | | component.find('select_productCategories').set('v.value', ''); |
| | | // ToDo需要测试手机上能运行不 |
| | | component.set('v.data.Report_Date__c', ''); |
| | | component.set('v.oppdata.Close_Forecasted_Date__c', ''); |
| | |
| | | $A.util.addClass(component.find('input-opportunity-amount1'), 'disp_none'); |
| | | $A.util.addClass(component.find('input-opportunity-amount2'), 'disp_none'); |
| | | $A.util.addClass(component.find('input-opportunity-date'), 'disp_none'); |
| | | // $A.util.removeClass(component.find('input-opportunity-blank'), 'disp_none'); |
| | | // this.selectPurposeType(component); |
| | | // this.selectProductClassification(component); |
| | | |
| | | |
| | | |
| | | this.selectPurposeType(component); |
| | | this.selectProductClassification(component); |
| | | this.selectpurposetype(component); |
| | | }, |
| | | |
| | | report_date_list: function (component, event, helper, count) { |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | component.find('select_date').set('v.options', ret_obj); |
| | | component.set('v.report_date_list', ret_obj); |
| | | }, |
| | | |
| | | create_report_header: function (component, event, helper, name, s_agency, s_date) { |
| | | s_date = this.get_date_string(s_date); |
| | | if (s_date == false) { |
| | |
| | | this.showErrorToast(component); |
| | | return false; |
| | | } |
| | | |
| | | var head_key = this.create_header_input_key(s_agency, s_date); |
| | | component.set('v.agency_report_header', head_key); |
| | | if (head_key == false) { |
| | |
| | | this.showErrorToast(component); |
| | | return false; |
| | | } |
| | | |
| | | var key2 = s_date.replace(/-/g, ''); |
| | | var action = component.get('c.createReportHeader'); |
| | | action.setParams({ |
| | |
| | | else { |
| | | component.set('v.errorMessage', 'createReportHeader callback failed.'); |
| | | this.showErrorToast(component); |
| | | // this.error('createReportHeader callback failed.'); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | create_header_input_key: function (agency_id, s_date) { |
| | | if (typeof (s_date) != 'string') { |
| | | s_date = this.get_date_string(s_date); |
| | | if (s_date == false) { |
| | | component.set('v.errorMessage', 'get_date_string in create_header_input_key.'); |
| | | this.showErrorToast(component); |
| | | // this.error('get_date_string in create_header_input_key.'); |
| | | return false; |
| | | } |
| | | } |
| | | if (!agency_id || !s_date) { |
| | | return false; |
| | | } |
| | | |
| | | s_date = s_date.replace(/-/g, ''); |
| | | var headkey = agency_id + ":" + s_date; |
| | | |
| | | return headkey; |
| | | }, |
| | | |
| | |
| | | var obj_type = Object.prototype.toString.call(obj).slice(8, -1); |
| | | return obj_type; |
| | | }, |
| | | |
| | | // create yyyy-mm-dd string |
| | | get_date_string: function (val) { |
| | | if (typeof (val) == 'string') { |
| | |
| | | if (String(mm).length == 1) { |
| | | mm = '0' + mm; |
| | | } |
| | | |
| | | var dd = ''; |
| | | if (String(val.getDate()).length == 1) { |
| | | dd = '0' + val.getDate(); |
| | | } else { |
| | | dd = val.getDate(); |
| | | } |
| | | |
| | | val = val.getFullYear() + '-' + mm + '-' + dd; |
| | | } else { |
| | | return false; |
| | |
| | | component.set('v.hospitalLinkId', hospital_data[i].Id); |
| | | component.set('v.data.Agency_Hospital__c', hospital_data[i].Id); |
| | | component.find('new_con').set('v.disabled', false); |
| | | //break; |
| | | } |
| | | } |
| | | component.set("v.hospital", accname); |
| | |
| | | }, |
| | | |
| | | |
| | | //模糊查询使用产品1 |
| | | //模糊查询使用产品1(产品型号) |
| | | searchUseProduct1: function (component, event, helper) { |
| | | var UseProduct1Name = event.getParam("value"); |
| | | var select_ProductClassification = component.find('select_ProductClassification').get('v.value'); |
| | |
| | | } |
| | | |
| | | }, |
| | | |
| | | |
| | | //hospitalLinkId 经销商医院的ID 医院人员复制的地方 |
| | | doctor_change: function (component, event, helper) { |
| | | var doctor_value = component.find('select_doctor').get('v.value'); |
| | | var doctor_list = component.get('v.doctor_list'); |
| | |
| | | component.set('v.doctor_title', ''); |
| | | } |
| | | }, |
| | | |
| | | set_doctor_list: function (component, event, helper) { |
| | | set_doctor_list: function (component) { |
| | | var hospital_id = component.get('v.hospitalLinkId'); |
| | | if (hospital_id) { |
| | | component.set('v.login', true); |
| | |
| | | var default_doctor = component.get('v.default_select_doctor_id'); |
| | | if (default_doctor != '' && res.length > 0) { |
| | | var doctor_title = ''; |
| | | let awsids = []; |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].value == default_doctor) { |
| | | res[i].selected = true; |
| | |
| | | } else { |
| | | res[i].selected = false; |
| | | } |
| | | if(res[i].AWS_Data_Id__c){ |
| | | awsids.push(res[i].AWS_Data_Id__c); |
| | | } |
| | | } |
| | | |
| | | component.find('select_doctor').set('v.options', res); |
| | | component.set('v.doctor_title', doctor_title); |
| | | |
| | | if(awsids.length > 0){ |
| | | let PIConfig = component.get('v.PIConfig'); |
| | | let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact); |
| | | AWSService.search(staticResourceAgencyContact.searchUrl,{ |
| | | dataIds:awsids |
| | | }, function(data){ |
| | | if(data && data.object && data.object.length){ |
| | | let m = {}; |
| | | for(let di in data.object){ |
| | | if(data.object[di] && data.object[di].dataId){ |
| | | m[data.object[di].dataId] = data.object[di]; |
| | | } |
| | | } |
| | | |
| | | for(let ri in res){ |
| | | if(res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)){ |
| | | res[ri].label = m[res[ri].AWS_Data_Id__c].name; |
| | | } |
| | | } |
| | | component.find('select_doctor').set('v.options', res); |
| | | } |
| | | |
| | | component.set('v.login', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } |
| | | } else { |
| | | component.find('select_doctor').set('v.options', res); |
| | | if (res.length > 0) { |
| | | component.set('v.doctor_title', res[0].Doctor_Division1__c); |
| | | } |
| | | } |
| | | |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.doctor_list', res); |
| | | component.set('v.login', false); |
| | |
| | | $A.enqueueAction(action); |
| | | } |
| | | }, |
| | | |
| | | productcategoryChange1: function (component, event, helper) { |
| | | var product_category_id = component.find('select_Product1').get('v.value'); |
| | | var pcId1 = component.find('select_Product2').get('v.value'); |
| | |
| | | } |
| | | }, |
| | | productcategoryChange2: function (component, event, helper) { |
| | | |
| | | var product_category_id = component.find('UseProduct2_TEXT').get('v.value'); |
| | | var pcId1 = component.find('UseProduct1_TEXT').get('v.value'); |
| | | var pcId2 = component.find('UseProduct3_TEXT').get('v.value'); |
| | |
| | | component.find('select_Product3').set('v.value', ''); |
| | | } |
| | | }, |
| | | |
| | | conv_selected: function (obj) { |
| | | for (var i = 0; i < obj.length; i++) { |
| | | if (obj[i].selected) { |
| | |
| | | } |
| | | return obj; |
| | | }, |
| | | |
| | | set_selected: function (component, aura_id_name, value) { |
| | | var select_tmp = component.find(aura_id_name).get('v.options'); |
| | | if (select_tmp) { |
| | |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | |
| | | //弹出 成功提示 |
| | | showSuccessToast: function (component) { |
| | | debugger |
| | | $A.util.removeClass(component.find('successDiv'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('successDiv'), 'slds-hide'); |
| | |
| | | }, |
| | | //弹出 成功提示 |
| | | showSuccessToast01: function (component) { |
| | | debugger |
| | | $A.util.removeClass(component.find('successDiv01'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('successDiv01'), 'slds-hide'); |
| | |
| | | }, |
| | | //弹出 错误提示 |
| | | showErrorToast: function (component) { |
| | | debugger |
| | | $A.util.removeClass(component.find('errorDiv'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('errorDiv'), 'slds-hide'); |
| | |
| | | 3000 |
| | | ); |
| | | }, |
| | | |
| | | error: function (message) { |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | | toastEvent.setParams({ |
| | |
| | | }); |
| | | toastEvent.fire(); |
| | | }, |
| | | |
| | | createCon: function (component, event, helper) { |
| | | var modal_newAC = component.find('modal_newAC'); |
| | | $A.util.removeClass(modal_newAC, 'disp_none'); |
| | | component.set('v.truthy', true); |
| | | }, |
| | | |
| | | |
| | | hideCmp: function (component, event, helper) { |
| | | var div1 = component.find('report') |
| | | var div2 = component.find('report_list') |
| | | $A.util.addClass(div1, 'disp_none'); |
| | | $A.util.addClass(div2, 'disp_none'); |
| | | }, |
| | | |
| | | handleSuccess: function (component, event, helper) { |
| | | var insertId = event.getParams().response.Id; |
| | | var displayValue = event.getParams().response.fields.Name.value; |
| | |
| | | component.set('v.truthy', false); |
| | | var modal_newAC = component.find('modal_newAC') |
| | | $A.util.addClass(modal_newAC, 'disp_none'); |
| | | component.set('v.successMessage', '.客户人员已创建。'); |
| | | component.set('v.successMessage', '.医院人员已创建。'); |
| | | this.showSuccessToast(component); |
| | | this.set_doctor_list(component, event, helper); |
| | | }, |
| | | |
| | | createCancel: function (component, event, helper) { |
| | | component.set('v.truthy', false); |
| | | var modal_newAC = component.find('modal_newAC') |
| | |
| | | alert('File read cancelled'); |
| | | }; |
| | | reader.onloadstart = function (e) { |
| | | |
| | | var output = '<ui type=\"disc\"><li><strong>' + file.name + '</strong> (' + file.type + ')- ' + file.size + 'bytes, last modified: ' + file.lastModifiedDate.toLocaleDateString() + '</li></ui>'; |
| | | component.set("v.filename", file.name); |
| | | component.set("v.TargetFileName", output); |
| | | |
| | | }; |
| | | reader.onload = function (e) { |
| | | debugger; |
| | | var data = e.target.result; |
| | | |
| | | component.set("v.fileContentData", data); |
| | | console.log("file data" + JSON.stringify(data)); |
| | | // console.log("file data"+encodeURI(JSON.stringify(data),"utf-8")); |
| | | var allTextLines = data.split(/\r\n|\n/); |
| | | console.log("qqqqqqqqqqqqqqqqqqq" + allTextLines); |
| | | var dataRows = allTextLines.length - 1; |
| | | var headers = allTextLines[0].split(','); |
| | | |
| | | // console.log("Rows length::"+dataRows); |
| | | |
| | | |
| | | var numOfRows = component.get("v.NumOfRecords"); |
| | | if (dataRows > numOfRows + 1 || dataRows == 1 || dataRows == 0) { |
| | | |
| | | alert("File Rows between 1 to " + numOfRows + " ."); |
| | | component.set("v.showMain", true); |
| | | |
| | | } |
| | | else { |
| | | var lines = []; |
| | |
| | | } |
| | | var reader = new FileReader(); |
| | | reader.onloadend = function () { |
| | | |
| | | }; |
| | | reader.readAsDataURL(file); |
| | | }, |
| | |
| | | for (var i = 0; i < ress.length; i++) { |
| | | res1 += ress[i].substr(7) + '\n'; |
| | | } |
| | | |
| | | console.log("==" + res1); |
| | | // String logerror = res1 + "请修改后重新上传"; |
| | | component.set('v.errorMessage', res1 + "请修改后重新上传"); |
| | | this.showErrorToast(component); |
| | | // this.error(res1 + "请修改后重新上传"); |
| | | component.set('v.login', false); |
| | | } else { |
| | | component.set('v.successMessage', '导入成功'); |
| | | this.showSuccessToast01(component); |
| | | component.set("v.showMain", true); |
| | | |
| | | component.set('v.login', false); |
| | | this.doinit(component, event, helper); |
| | | } |
| | |
| | | } |
| | | columnDivider = ','; |
| | | lineDivider = '\n'; |
| | | keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c', 'OtherBrandConsumables__c', 'ProductCcategory__c', 'warlocksNumber__c','WorkMark__c']; |
| | | thkeys = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录', '客户人员','产品分类', '使用产品1', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','其他品牌耗材使用','产品类别','术士使用产品对应数量','工作标记'] |
| | | keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c', 'WarlockClassification__c', 'ProductCcategory__c', 'productCategories__c','warlocksNumber__c','WorkMark__c']; |
| | | thkeys = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录', '医院人员','产品分类(第三分类)', '使用产品1(产品型号)', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','术士分类','已采用其他品牌','其他品牌产品类别','产品用量','工作标记'] |
| | | csvStringResult = ''; |
| | | csvStringResult += thkeys.join(columnDivider); |
| | | csvStringResult += lineDivider; |
| | |
| | | csvStringResult += objectRecords[i].UseProduct2__r.Name; |
| | | } else if (skey == 'UseProduct3__c') { |
| | | csvStringResult += objectRecords[i].UseProduct3__r.Name; |
| | | } else if (skey == 'EffectProgress__c'){ |
| | | csvStringResult += objectRecords[i].EffectProgress__r.Name; |
| | | }else if (skey == 'OtherBrandConsumables__c'){ |
| | | csvStringResult += objectRecords[i].OtherBrandConsumables__r.Name; |
| | | }else{ |
| | | csvStringResult += objectRecords[i][skey] ; |
| | | } |
| | | counter++; |
| | | |
| | | } |
| | | console.log("导出循环结束"); |
| | | csvStringResult += lineDivider; |
| | |
| | | // 导出页面显示的模板 |
| | | showExportDate: function (component, objectRecords) { |
| | | console.log('进入showexceportdate' + objectRecords); |
| | | var keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c', 'OtherBrandConsumables__c', 'ProductCcategory__c', 'warlocksNumber__c','WorkMark__c']; |
| | | var headers = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录', '客户人员','产品分类', '使用产品1', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','其他品牌耗材使用','产品类别','术士使用产品对应数量','工作标记'] |
| | | var keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c', 'WarlockClassification__c', 'ProductCcategory__c','productCategories__c', 'warlocksNumber__c','WorkMark__c']; |
| | | var headers = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录', '医院人员','产品分类(第三分类)', '使用产品1(产品型号)', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','术士分类','已采用其他品牌','其他品牌产品类别','产品用量','工作标记'] |
| | | var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">"; |
| | | content += "<thead><tr class=\"slds-text-title--caps\">"; |
| | | for (i = 0; i < headers.length; i++) { |
| | |
| | | content += '<td>' + objectRecords[i].UseProduct2__r.Name + '</td>'; |
| | | } else if (skey == 'UseProduct3__c') { |
| | | content += '<td>' + objectRecords[i].UseProduct3__r.Name + '</td>'; |
| | | } else if (skey == 'EffectProgress__c'){ |
| | | content += '<td>' + objectRecords[i].EffectProgress__r.Name + '</td>'; |
| | | }else if (skey == 'OtherBrandConsumables__c'){ |
| | | content += '<td>' + objectRecords[i].OtherBrandConsumables__r.Name + '</td>'; |
| | | }else{ |
| | | content += '<td>' + objectRecords[i][skey] + '</td>'; |
| | | } |
| | |
| | | var res = response.getReturnValue(); |
| | | console.log('输入的开始日期3' + res); |
| | | component.set('v.login', false); |
| | | this.showExportDate(component, res); |
| | | |
| | | // PI 改造 By Bright 20220328 |
| | | if(true){ |
| | | let awsids = []; |
| | | for (let ri in res) { |
| | | if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c){ |
| | | awsids.push(res[ri].doctor2__r.AWS_Data_Id__c); |
| | | } |
| | | } |
| | | if(awsids.length > 0){ |
| | | let PIConfig = component.get('v.PIConfig'); |
| | | let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact); |
| | | AWSService.search(staticResourceAgencyContact.searchUrl,{ |
| | | dataIds:awsids |
| | | }, function(data){ |
| | | if(data && data.object && data.object.length){ |
| | | let m = {}; |
| | | for(let di in data.object){ |
| | | if(data.object[di] && data.object[di].dataId){ |
| | | m[data.object[di].dataId] = data.object[di]; |
| | | } |
| | | } |
| | | |
| | | for(let ri in res){ |
| | | if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)){ |
| | | res[ri].doctor2__r.Name = m[res[ri].doctor2__r.AWS_Data_Id__c].name; |
| | | } |
| | | } |
| | | } |
| | | helper.showExportDate(component, res); |
| | | |
| | | component.set('v.login', false); |
| | | }, staticResourceAgencyContact.token); |
| | | }else{ |
| | | helper.showExportDate(component, res); |
| | | } |
| | | } |
| | | |
| | | |
| | | component.set('v.reports_date', res); |
| | | |
| | | } else { |
| | | alert('导出失败,请检查活动日'); |
| | | component.set('v.login', false); |
| | |
| | | res[i].selected = false; |
| | | } |
| | | } |
| | | |
| | | component.find('select_doctor').set('v.options', res); |
| | | component.set('v.doctor_title', doctor_title); |
| | | } else { |
| | |
| | | component.set('v.doctor_title', res[0].Doctor_Division1__c); |
| | | } |
| | | } |
| | | |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.doctor_list', res); |
| | | component.set('v.login', false); |
| | |
| | | } |
| | | } |
| | | }, |
| | | //术士使用产品对应数量验证必须输入数字 |
| | | //产品用量验证必须输入数字 |
| | | select_warlocksNumber : function(component, event, helper) { |
| | | var sc = event.getSource().get('v.value'); |
| | | if(sc != null){ |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 产品分区根据当前登录人的用户产品区分字段来做限制 是ET产品分区字段 或者ENG产品分区字段 |
| | | // select_ProductClassification : function(component, event, helper) { |
| | | // var action = component.get("c.getProductClassification"); |
| | | // action.setParams({ |
| | | // 'ok':'ok' |
| | | // }); |
| | | // action.setCallback(this, function (response) { |
| | | // var state = response.getState(); |
| | | // if (state === "SUCCESS") { |
| | | // var ProductClassificationValue = response.getReturnValue(); |
| | | // console.log('ProductClassificationValue================>'+ProductClassificationValue); |
| | | // // component.set("v.select_ProductClassification", response.getReturnValue()); |
| | | // component.find('select_ProductClassification').set('v.options', ProductClassificationValue); |
| | | // } |
| | | // }); |
| | | // $A.enqueueAction(action); |
| | | // }, |
| | | |
| | | //工作会记录 |
| | | selectPurposeType: function (component,event,helper) { |
| | | var doctor_value = component.find('select_purpose_type').get('v.value'); |
| | | var select_EffectProgress = component.find('select_EffectProgress').get('v.value'); |
| | | // alert(doctor_value); |
| | | if(doctor_value != ''){ |
| | | var action = component.get('c.selectPurposeTypes'); |
| | | action.setParams({ |
| | | 'doctor_value': doctor_value |
| | |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | component.find('select_EffectProgress').set('v.options', []); |
| | | } |
| | | }, |
| | | |
| | | selectProductClassification: function (component,event,helper) { |
| | | var select_ProductClassification = component.find('select_ProductClassification').get('v.value'); |
| | | if(select_ProductClassification != ''){ |
| | | var action = component.get('c.selectProductClassificationc'); |
| | | action.setParams({ |
| | | 'select_ProductClassification': select_ProductClassification |
| | | "select_ProductClassification": select_ProductClassification |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | component.find('select_OtherBrandConsumables').set('v.options', []); |
| | | } |
| | | this.selectProductCcategory(component); |
| | | }, |
| | | select_ProductCcategory: function (component,event,helper) { |
| | | var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value'); |
| | | if(select_ProductCcategory != ''){ |
| | | var result = component.find('result'); |
| | | var UserProType = component.get('v.UserProType'); |
| | | //fy |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | if(UserProType=='ENG'){ |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | }else{ |
| | | $A.util.addClass(result, 'disp_none'); |
| | | } |
| | | var action = component.get('c.selectProductCcategory01'); |
| | | action.setParams({ |
| | | "select_ProductCcategory": select_ProductCcategory |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_productCategories').set("v.options", JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | component.find('select_productCategories').set('v.options', []); |
| | | var result = component.find('result'); |
| | | $A.util.addClass(result, 'disp_none'); |
| | | } |
| | | }, |
| | | selectpurposetype : function(component,event,helper){ |
| | | var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value'); |
| | | if (select_ProductCcategory == null && select_ProductCcategory == undefined && select_ProductCcategory == '') { |
| | | var result = component.find('result'); |
| | | // $A.util.removeClass(result, 'disp_none'); |
| | | if(UserProType=='ENG'){ |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | }else{ |
| | | $A.util.addClass(result, 'disp_none'); |
| | | } |
| | | } else { |
| | | debugger |
| | | component.find('select_productCategories').set('v.value', ''); |
| | | var result = component.find('result'); |
| | | $A.util.addClass(result, 'disp_none'); |
| | | this.select_ProductCcategory(component); |
| | | } |
| | | }, |
| | | }) |