| | |
| | | var action = component.get('c.getalldata'); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.set('v.alldata', res.reports); |
| | | component.set('v.fieldsmap', res.fieldsMap); |
| | |
| | | component.set('v.doclist', res.doclist); |
| | | //fy |
| | | debugger |
| | | var xx=res.UserProType; |
| | | var xx = res.UserProType; |
| | | component.set('v.UserProType', res.UserProType); |
| | | var gg=component.get('v.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.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); |
| | | } |
| | |
| | | $A.enqueueAction(action); |
| | | }, |
| | | //其他品牌产品类别 下拉框赋值 |
| | | selectProductCcategory : function(component){ |
| | | 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', []); |
| | | } |
| | | 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) { |
| | | return false; |
| | | } |
| | | |
| | | if(person_str){ |
| | | var person_str2= person_str.split(';'); |
| | | if(person_str2.length>1){ |
| | | person_str=person_str2[0]; |
| | | |
| | | if (person_str) { |
| | | var person_str2 = person_str.split(';'); |
| | | if (person_str2.length > 1) { |
| | | person_str = person_str2[0]; |
| | | } |
| | | } |
| | | date_str = this.get_date_string(date_str); |
| | |
| | | } |
| | | if (res.reports.length > 0) { |
| | | component.set('v.list_message', ''); |
| | | var flag2=res.reports.length; |
| | | var flag2 = res.reports.length; |
| | | //fy 20220414 start |
| | | var report1 =[]; |
| | | var report2 =[]; |
| | | var report1 = []; |
| | | var report2 = []; |
| | | res.reports.forEach(item => { |
| | | if((item.WorkRecord__c == '科室会'&&item.doctor3__c != undefined)|| |
| | | ((item.doctor3__c == undefined||item.doctor3__c == ''||item.doctor3__c=="") |
| | | && (item.doctor2__r== undefined||item.doctor2__r==''||item.doctor2__r==""))){ |
| | | if ((item.WorkRecord__c == '科室会' && item.doctor3__c != undefined) || |
| | | ((item.doctor3__c == undefined || item.doctor3__c == '' || item.doctor3__c == "") |
| | | && (item.doctor2__r == undefined || item.doctor2__r == '' || item.doctor2__r == ""))) { |
| | | report1.push(item); |
| | | }else{ |
| | | report2.push(item); |
| | | } else { |
| | | report2.push(item); |
| | | } |
| | | }); |
| | | res.reports=report2; |
| | | res.reports = report2; |
| | | //fy 20220414 end |
| | | // 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]; |
| | | } |
| | | 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]; |
| | | } |
| | | debugger |
| | | 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]; |
| | | } |
| | | } |
| | | debugger |
| | | 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); |
| | | } |
| | | //fy 20220414 start |
| | | var reports3=component.get('v.reports'); |
| | | if(reports3.length<flag2){ |
| | | res.reports = [...report1, ...reports3]; |
| | | component.set('v.reports', res.reports); |
| | | component.set('v.report_count', res.reports.length); |
| | | } |
| | | //fy 20220414 end |
| | | component.set('v.login', false); |
| | | }, staticResourceAgencyContact.token); |
| | | }else{ |
| | | component.set('v.reports', res.reports); |
| | | component.set('v.report_count', res.reports.length); |
| | | } |
| | | //fy 20220414 start |
| | | var reports3 = component.get('v.reports'); |
| | | if (reports3.length < flag2) { |
| | | res.reports = [...report1, ...reports3]; |
| | | component.set('v.reports', res.reports); |
| | | component.set('v.report_count', res.reports.length); |
| | | } |
| | | //fy 20220414 end |
| | | 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.'); |
| | |
| | | //使用产品2 |
| | | var UseProduct2Text = ''; |
| | | var UseProduct2Id = ''; |
| | | if (select_data['UseProduct2__c'] != ''&&select_data['UseProduct2__c'] != undefined) { |
| | | 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']['Asset_Model_No__c']; |
| | |
| | | //使用产品3 |
| | | var UseProduct3Text = ''; |
| | | var UseProduct3Id = ''; |
| | | if (select_data['UseProduct3__c'] != ''&&select_data['UseProduct3__c'] != undefined) { |
| | | 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']['Asset_Model_No__c']; |
| | |
| | | // } |
| | | //fy Department_Cateogy_text__c |
| | | if (select_data['Department_Cateogy_text__c'] != '') { |
| | | component.find('select_department').set('v.value',select_data['Department_Cateogy_text__c']); |
| | | component.find('select_department').set('v.value', select_data['Department_Cateogy_text__c']); |
| | | } |
| | | //经销商人员 |
| | | if (select_data['DealerPersonnel__c'] != '') { |
| | |
| | | this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']); |
| | | this.selectPurposeType(component); |
| | | } |
| | | // 拜访人 |
| | | if(select_data['WorkRecord__c'] == '科室会'){ |
| | | // 拜访人 |
| | | if (select_data['WorkRecord__c'] == '科室会') { |
| | | component.set('v.default_select_doctor_id2', select_data['doctor3__c']); |
| | | var a =component.get('v.default_select_doctor_id2'); |
| | | var a = component.get('v.default_select_doctor_id2'); |
| | | this.set_doctor_list(component); |
| | | }else{ |
| | | } else { |
| | | component.set('v.default_select_doctor_id', select_data['doctor2__c']); |
| | | this.set_doctor_list(component); |
| | | } |
| | | } |
| | | //产品分类(第三分类) |
| | | if (select_data['ProductClassification__c'] != null) { |
| | | if (select_data['ProductClassification__c'] != null) { |
| | | this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']); |
| | | this.selectProductClassification(component); |
| | | } |
| | | // 产品1同类耗材科室月使用量 |
| | | // 产品1同类耗材科室月使用量 |
| | | if (select_data['ConsumptionOfConsumables__c'] != '') { |
| | | component.find('select_ConsumptionOfConsumables').set('v.value',select_data['ConsumptionOfConsumables__c']); |
| | | component.find('select_ConsumptionOfConsumables').set('v.value', select_data['ConsumptionOfConsumables__c']); |
| | | } |
| | | // 产品用量 |
| | | if (select_data['warlocksNumber__c'] != '') { |
| | | component.find('select_warlocksNumber').set('v.value',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']); |
| | | component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']); |
| | | } |
| | | debugger; |
| | | |
| | |
| | | WarlockClassification = reports[i]["WarlockClassification__c"]; |
| | | ProductCcategory = reports[i]["ProductCcategory__c"]; |
| | | productCategories = reports[i]["productCategories__c"]; |
| | | break; |
| | | break; |
| | | } |
| | | } |
| | | //效果/进度 |
| | |
| | | !productCategories__c && |
| | | !warlocksNumber__c && |
| | | !WorkMark__c && |
| | | !WorkRecord__c |
| | | !WorkRecord__c |
| | | ) { |
| | | this.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | |
| | | 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['Agency_Hospital__c'] == Agency_Hospital__c && |
| | | select_report_data['UseProduct1__c'] == UseProduct1__c && |
| | | select_report_data['UseProduct2__c'] == UseProduct2__c && |
| | | select_report_data['UseProduct3__c'] == UseProduct3__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['WarlockClassification__c'] == WarlockClassification__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['WorkRecord__c'] == WorkRecord__c) { |
| | | this.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | |
| | | select_report_data['DealerPersonnel__c'] == DealerPersonnel__c && |
| | | select_report_data['doctor2__c'] == doctor2__c && |
| | | select_report_data['EffectProgress__c'] == EffectProgress__c && |
| | | select_report_data['WarlockClassification__c'] == WarlockClassification__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['WorkRecord__c'] == WorkRecord__c) { |
| | | this.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | |
| | | // 担当 |
| | | var select_agency = component.find('select_agency_person').get('v.value'); |
| | | var cm = 0; |
| | | if(select_agency.indexOf(";") != -1){ |
| | | if (select_agency.indexOf(";") != -1) { |
| | | select_agency = select_agency.split(";")[0]; |
| | | } |
| | | component.set('v.selected_date', select_date); |
| | |
| | | component.set('v.default_select_doctor_id2', ''); |
| | | |
| | | // SWAG-CF58C3 fy start |
| | | this.set_aws_url(component,'Agency_Contact__c') |
| | | this.set_aws_url(component, 'Agency_Contact__c') |
| | | // SWAG-CF58C3 fy end |
| | | }, |
| | | // 复制按钮 |
| | |
| | | |
| | | var ret = this.create_report_header(component, event, helper, name, select_agency, select_date); |
| | | // SWAG-CF58C3 fy start |
| | | this.set_aws_url(component,'Agency_Contact__c') |
| | | this.set_aws_url(component, 'Agency_Contact__c') |
| | | // SWAG-CF58C3 fy end |
| | | |
| | | }, |
| | |
| | | delete_button: function (component, event, helper) { |
| | | debugger |
| | | var select_report_data = component.get('v.select_report_data_radio'); |
| | | if(confirm('是否删除该数据?')){ |
| | | if (confirm('是否删除该数据?')) { |
| | | debugger |
| | | component.set('v.login', true); |
| | | var action = component.get('c.deleteAgencyReport'); |
| | |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var result = response.getReturnValue(); |
| | | if(result=='success'){ |
| | | if (result == 'success') { |
| | | this.select_agency_change(component, event, helper); |
| | | } |
| | | component.set('v.login', false); |
| | | }else { |
| | | } else { |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | |
| | | 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); |
| | | // SWAG-CF58C3 fy start |
| | | this.set_aws_url(component,'Agency_Contact__c') |
| | | this.set_aws_url(component, 'Agency_Contact__c') |
| | | // SWAG-CF58C3 fy end |
| | | }, |
| | | //保存 |
| | |
| | | var doctor2__c = component.find('select_doctor').get('v.value'); |
| | | // 活动区分会 WorkRecord__c |
| | | var WorkRecord__c = component.find('select_purpose_type').get('v.value'); |
| | | // 效果/进度 EffectProgress__c |
| | | // 效果/进度 EffectProgress__c |
| | | var EffectProgress__c = component.find('select_EffectProgress').get('v.value'); |
| | | // alert(EffectProgress__c); |
| | | // 科室同来耗材月使用量 ConsumptionOfConsumables__c |
| | | // 科室同来耗材月使用量 ConsumptionOfConsumables__c |
| | | var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value'); |
| | | // 术士分类 WarlockClassification__c |
| | | // 术士分类 WarlockClassification__c |
| | | var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value'); |
| | | // 已采用其他品牌 ProductCcategory__c |
| | | // 已采用其他品牌 ProductCcategory__c |
| | | var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value'); |
| | | // 其他品牌产品类别 productCategories__c |
| | | // 其他品牌产品类别 productCategories__c |
| | | var productCategories__c = component.find('select_productCategories').get('v.value'); |
| | | // 产品用量 warlocksNumber__c |
| | | // 产品用量 warlocksNumber__c |
| | | var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value'); |
| | | // 支援需求 WorkMark__c |
| | | // 支援需求 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 error = []; |
| | | //fy start |
| | | // if(WorkRecord__c != 'SIS'&&WorkRecord__c != '科室会'){ |
| | | if(WorkRecord__c == '临床信息(使用量)收集'){ |
| | | if (warlocksNumber__c==''||warlocksNumber__c==""||warlocksNumber__c==undefined) { error.push("产品用量 不能为空"); } |
| | | if (WorkRecord__c == '临床信息(使用量)收集') { |
| | | if (warlocksNumber__c == '' || warlocksNumber__c == "" || warlocksNumber__c == undefined) { error.push("产品用量 不能为空"); } |
| | | } |
| | | //fy end |
| | | if(WorkRecord__c == '临床信息(使用量)收集'&&UserProType=='ENG'){ |
| | | if (productCategories__c==''||productCategories__c==""||productCategories__c==undefined) { error.push("其他品牌产品类别 不存在"); } |
| | | if (WorkRecord__c == '临床信息(使用量)收集' && UserProType == 'ENG') { |
| | | if (productCategories__c == '' || productCategories__c == "" || productCategories__c == undefined) { error.push("其他品牌产品类别 不存在"); } |
| | | } |
| | | if(WorkRecord__c == '临床信息(使用量)收集'){ |
| | | if (ProductCcategory__c==''||ProductCcategory__c==""||ProductCcategory__c==undefined) { error.push("已采用其他品牌 不存在"); } |
| | | if (WorkRecord__c == '临床信息(使用量)收集') { |
| | | if (ProductCcategory__c == '' || ProductCcategory__c == "" || ProductCcategory__c == undefined) { error.push("已采用其他品牌 不存在"); } |
| | | } |
| | | if(WorkRecord__c == '临床信息(使用量)收集'){ |
| | | if (WarlockClassification__c==''||WarlockClassification__c==""||WarlockClassification__c==undefined) { error.push("产品1对应OLY产品线 不存在"); } |
| | | if (WorkRecord__c == '临床信息(使用量)收集') { |
| | | if (WarlockClassification__c == '' || WarlockClassification__c == "" || WarlockClassification__c == undefined) { error.push("产品1对应OLY产品线 不存在"); } |
| | | } |
| | | if(WorkRecord__c == '临床信息(使用量)收集'){ |
| | | if (ConsumptionOfConsumables__c==''||ConsumptionOfConsumables__c==""||ConsumptionOfConsumables__c==undefined) { error.push("产品1同类耗材科室月使用量 不能为空"); } |
| | | if (WorkRecord__c == '临床信息(使用量)收集') { |
| | | if (ConsumptionOfConsumables__c == '' || ConsumptionOfConsumables__c == "" || ConsumptionOfConsumables__c == undefined) { error.push("产品1同类耗材科室月使用量 不能为空"); } |
| | | } |
| | | if(WorkRecord__c != '临床信息(使用量)收集'&&WorkRecord__c != '市场推广类活动'){ |
| | | if (EffectProgress__c==''||EffectProgress__c==""||EffectProgress__c==undefined) { error.push("效果/进度 不存在"); } |
| | | if (WorkRecord__c != '临床信息(使用量)收集' && WorkRecord__c != '市场推广类活动') { |
| | | if (EffectProgress__c == '' || EffectProgress__c == "" || EffectProgress__c == undefined) { error.push("效果/进度 不存在"); } |
| | | } |
| | | // if(WorkRecord__c != '临床信息(使用量)收集'&&WorkRecord__c != 'QIS处理'){ |
| | | if(WorkRecord__c != '临床信息(使用量)收集'){ |
| | | if (UseProduct1__c==''||UseProduct1__c==""||UseProduct1__c==undefined) { error.push("使用产品1(产品型号) 不存在"); } |
| | | if (WorkRecord__c != '临床信息(使用量)收集') { |
| | | if (UseProduct1__c == '' || UseProduct1__c == "" || UseProduct1__c == undefined) { error.push("使用产品1(产品型号) 不存在"); } |
| | | } |
| | | if (ProductClassification__c==''||ProductClassification__c==""||ProductClassification__c==undefined) { error.push("产品分类(第三分类) 不存在"); } |
| | | if(WorkRecord__c == 'SIS'||WorkRecord__c == '科室会'||WorkRecord__c == '院内入院申请'||WorkRecord__c == '收费项目申请'){ |
| | | if (doctor2__c==''||doctor2__c==""||doctor2__c==undefined) { error.push("拜访人 不存在"); } |
| | | if (ProductClassification__c == '' || ProductClassification__c == "" || ProductClassification__c == undefined) { error.push("产品分类(第三分类) 不存在"); } |
| | | if (WorkRecord__c == 'SIS' || WorkRecord__c == '科室会' || WorkRecord__c == '院内入院申请' || WorkRecord__c == '收费项目申请') { |
| | | if (doctor2__c == '' || doctor2__c == "" || doctor2__c == undefined) { error.push("拜访人 不存在"); } |
| | | } |
| | | if (WorkRecord__c==''||WorkRecord__c==""||WorkRecord__c==undefined) { error.push("活动区分 不存在"); } |
| | | if (DealerPersonnel__c==''||DealerPersonnel__c==""||DealerPersonnel__c==undefined) { error.push("经销商人员 不存在"); } |
| | | if (Department_Cateogy__c==''||Department_Cateogy__c==""||Department_Cateogy__c==undefined) { error.push("科室 不存在"); } |
| | | if (Agency_Hospital__c==''||Agency_Hospital__c==""||Agency_Hospital__c==undefined) { error.push("医院 不存在"); } |
| | | if (WorkRecord__c == '' || WorkRecord__c == "" || WorkRecord__c == undefined) { error.push("活动区分 不存在"); } |
| | | if (DealerPersonnel__c == '' || DealerPersonnel__c == "" || DealerPersonnel__c == undefined) { error.push("经销商人员 不存在"); } |
| | | if (Department_Cateogy__c == '' || Department_Cateogy__c == "" || Department_Cateogy__c == undefined) { error.push("科室 不存在"); } |
| | | if (Agency_Hospital__c == '' || Agency_Hospital__c == "" || Agency_Hospital__c == undefined) { error.push("医院 不存在"); } |
| | | |
| | | |
| | | |
| | | |
| | | if (Report_Date__c==''||Report_Date__c==""||Report_Date__c==undefined) { error.push("活动日 不存在"); } |
| | | if (Submit_date__c==''||Submit_date__c==""||Submit_date__c==undefined) { error.push("周 不存在"); } |
| | | if (Report_Date__c == '' || Report_Date__c == "" || Report_Date__c == undefined) { error.push("活动日 不存在"); } |
| | | if (Submit_date__c == '' || Submit_date__c == "" || Submit_date__c == undefined) { error.push("周 不存在"); } |
| | | var rDate = new Date(Report_Date__c); |
| | | var sDate = new Date(Submit_date__c); |
| | | sDate.setDate(sDate.getDate() - 1); |
| | | if (rDate < sDate) { error.push('活动日必须是本周!'); } |
| | | sDate.setDate(sDate.getDate() + 7); |
| | | if (rDate >= sDate) { error.push('活动日必须是本周!'); } |
| | | if (Person_In_Charge2__c==''||Person_In_Charge2__c==""||Person_In_Charge2__c==undefined) { error.push("担当 不存在"); } |
| | | if (Agency_Report_Header__c==''||Agency_Report_Header__c==""||Agency_Report_Header__c==undefined) { this.error("Report Header Id 不存在"); } |
| | | |
| | | |
| | | if (Person_In_Charge2__c == '' || Person_In_Charge2__c == "" || Person_In_Charge2__c == undefined) { error.push("担当 不存在"); } |
| | | if (Agency_Report_Header__c == '' || Agency_Report_Header__c == "" || Agency_Report_Header__c == undefined) { this.error("Report Header Id 不存在"); } |
| | | |
| | | |
| | | // if (!UseProduct2__c) { error.push("使用产品2 不存在"); } |
| | | // if (!UseProduct3__c) { error.push("使用产品3 不存在"); } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // if (!productCategories__c) { error.push("其他品牌产品类别 不存在"); } |
| | | |
| | | |
| | | 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, |
| | | "WarlockClassification" : WarlockClassification__c, |
| | | "ProductCcategory" : ProductCcategory__c, |
| | | "productCategories" : productCategories__c, |
| | | "warlocksNumber" : warlocksNumber__c, |
| | | "WorkMark" : WorkMark__c, |
| | | "WarlockClassification": WarlockClassification__c, |
| | | "ProductCcategory": ProductCcategory__c, |
| | | "productCategories": productCategories__c, |
| | | "warlocksNumber": warlocksNumber__c, |
| | | "WorkMark": WorkMark__c, |
| | | "ProductClassification": ProductClassification__c, |
| | | "DealerPersonnel": DealerPersonnel__c, |
| | | "Agency_Report_Header": Agency_Report_Header__c, |
| | |
| | | action.setParams({ |
| | | "Department_Cateogy": Department_Cateogy__c, |
| | | "ConsumptionOfConsumables": ConsumptionOfConsumables__c, |
| | | "WorkMark" : WorkMark__c, |
| | | "warlocksNumber" : warlocksNumber__c, |
| | | "WorkMark": WorkMark__c, |
| | | "warlocksNumber": warlocksNumber__c, |
| | | "DealerPersonnel": DealerPersonnel__c, |
| | | "ProductCcategory" : ProductCcategory__c, |
| | | "productCategories" : productCategories__c, |
| | | "WarlockClassification" : WarlockClassification__c, |
| | | "ProductCcategory": ProductCcategory__c, |
| | | "productCategories": productCategories__c, |
| | | "WarlockClassification": WarlockClassification__c, |
| | | "ProductClassification": ProductClassification__c, |
| | | "WorkRecord": WorkRecord__c, |
| | | "EffectProgress": EffectProgress__c, |
| | |
| | | if (hospital_data[i].Hospital__c == accid) { |
| | | component.set('v.hospitalLinkId', hospital_data[i].Id); |
| | | component.set('v.data.Agency_Hospital__c', hospital_data[i].Id); |
| | | if(select_purpose_type!='科室会'&&hospital_data[i].Hospital__c){ |
| | | component.find('new_con').set('v.disabled', false); |
| | | }else{ |
| | | component.find('new_con').set('v.disabled', true); |
| | | if (select_purpose_type != '科室会' && hospital_data[i].Hospital__c) { |
| | | component.find('new_con').set('v.disabled', false); |
| | | } else { |
| | | component.find('new_con').set('v.disabled', true); |
| | | } |
| | | } |
| | | } |
| | |
| | | component.set('v.setdoctorlisthos', true); |
| | | this.set_doctor_list(component, event, helper); |
| | | }, |
| | | |
| | | |
| | | |
| | | //模糊查询使用产品1(产品型号) |
| | | searchUseProduct1: function (component, event, helper) { |
| | |
| | | var action = component.get("c.getUseProduct1"); |
| | | action.setParams({ |
| | | "UseProduct1Name": UseProduct1Name, |
| | | "select_ProductClassification" : select_ProductClassification |
| | | "select_ProductClassification": select_ProductClassification |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | |
| | | } |
| | | var UseProduct2_TEXT = component.find('UseProduct2_TEXT').get('v.value'); |
| | | var UseProduct3_TEXT = component.find('UseProduct3_TEXT').get('v.value'); |
| | | if(UseProduct2_TEXT != accname && UseProduct3_TEXT != accname){ |
| | | if (UseProduct2_TEXT != accname && UseProduct3_TEXT != accname) { |
| | | component.set("v.UseProduct1s", accname); |
| | | component.set("v.UseProduct1", accname); |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } |
| | | }, |
| | | //模糊查询使用产品2 |
| | | //模糊查询使用产品2 |
| | | searchUseProduct2: function (component, event, helper) { |
| | | var UseProduct2Name = event.getParam("value"); |
| | | var select_ProductClassification = component.find('select_ProductClassification').get('v.value'); |
| | | var action = component.get("c.getUseProduct1"); |
| | | action.setParams({ |
| | | "UseProduct1Name": UseProduct2Name, |
| | | "select_ProductClassification" : select_ProductClassification |
| | | "select_ProductClassification": select_ProductClassification |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | |
| | | } |
| | | var UseProduct1_TEXT = component.find('UseProduct1_TEXT').get('v.value'); |
| | | var UseProduct3_TEXT = component.find('UseProduct3_TEXT').get('v.value'); |
| | | if(UseProduct1_TEXT != accname && UseProduct3_TEXT != accname){ |
| | | if (UseProduct1_TEXT != accname && UseProduct3_TEXT != accname) { |
| | | component.set("v.UseProduct2s", accname); |
| | | component.set("v.UseProduct2", accname); |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } |
| | | |
| | | |
| | | }, |
| | | //模糊查询使用产品3 |
| | | //模糊查询使用产品3 |
| | | searchUseProduct3: function (component, event, helper) { |
| | | var UseProduct3Name = event.getParam("value"); |
| | | var select_ProductClassification = component.find('select_ProductClassification').get('v.value'); |
| | | var action = component.get("c.getUseProduct1"); |
| | | action.setParams({ |
| | | "UseProduct1Name": UseProduct3Name, |
| | | "select_ProductClassification" :select_ProductClassification |
| | | "select_ProductClassification": select_ProductClassification |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | |
| | | } |
| | | var UseProduct1_TEXT = component.find('UseProduct1_TEXT').get('v.value'); |
| | | var UseProduct2_TEXT = component.find('UseProduct2_TEXT').get('v.value'); |
| | | if(UseProduct1_TEXT != accname && UseProduct2_TEXT != accname ){ |
| | | if (UseProduct1_TEXT != accname && UseProduct2_TEXT != accname) { |
| | | component.set("v.UseProduct3s", accname); |
| | | component.set("v.UseProduct3", accname); |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } |
| | | |
| | | |
| | | }, |
| | | //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'); |
| | | var flg = false; |
| | | if(doctor_list){ |
| | | if (doctor_list) { |
| | | for (var i = 0; i < doctor_list.length; i++) { |
| | | if (doctor_list[i].value == doctor_value) { |
| | | if(doctorurpose == '科室会'){ |
| | | if (doctorurpose == '科室会') { |
| | | // component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c); |
| | | }else{ |
| | | } else { |
| | | component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c); |
| | | } |
| | | flg = true; |
| | |
| | | component.set('v.doctor_title', ''); |
| | | } |
| | | }, |
| | | //SWAG-CF58C3 fy start 调用pi |
| | | set_aws_url : function(component,sobject) { |
| | | //SWAG-CF58C3 fy start 调用pi |
| | | set_aws_url: function (component, sobject) { |
| | | var action = component.get('c.getAwsurl'); |
| | | action.setParams({ |
| | | "sobj" : sobject, |
| | | "sobj": sobject, |
| | | }); |
| | | action.setCallback(this,function(response){ |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if(state == 'SUCCESS'){ |
| | | if (state == 'SUCCESS') { |
| | | var awsmap = this.conv_selected(response.getReturnValue()); |
| | | component.set('v.AWStoken',awsmap.token); |
| | | component.set('v.AWSinsert',awsmap.newUrl); |
| | | component.set('v.AWSsearch',awsmap.searchUrl); |
| | | component.set('v.AWStransactionURL',awsmap.transactionURL); |
| | | component.set('v.AWStoken', awsmap.token); |
| | | component.set('v.AWSinsert', awsmap.newUrl); |
| | | component.set('v.AWSsearch', awsmap.searchUrl); |
| | | component.set('v.AWStransactionURL', awsmap.transactionURL); |
| | | } |
| | | else{ |
| | | else { |
| | | component.set('v.errorMessage', 'AWS url/token error.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | insert_agencycontact : function(component,token,newUrl,payload,agencyHospitalid,helper,hospitalName) { |
| | | insert_agencycontact: function (component, token, newUrl, payload, agencyHospitalid, helper, hospitalName) { |
| | | debugger |
| | | console.log('newUrl = ' + newUrl); |
| | | console.log('payload = ' + payload); |
| | |
| | | return data.json(); |
| | | }).then((result) => { |
| | | console.log('result = ' + JSON.stringify(result)); |
| | | if(result.status == '0'){ |
| | | $A.getCallback(function(){ |
| | | helper.to_agencycontact(component,result,agencyHospitalid); |
| | | if (result.status == '0') { |
| | | $A.getCallback(function () { |
| | | helper.to_agencycontact(component, result, agencyHospitalid); |
| | | })(); |
| | | }else{ |
| | | } else { |
| | | console.log('AWS status error:' + result) |
| | | component.set('v.login',false); |
| | | if(result.status == '129'){ |
| | | component.find('OppMessage').setError('该客户人员名字已存在,在'+hospitalName+'医院,请修改'); |
| | | }else{ |
| | | component.set('v.login', false); |
| | | if (result.status == '129') { |
| | | component.find('OppMessage').setError('该客户人员名字已存在,在' + hospitalName + '医院,请修改'); |
| | | } else { |
| | | component.find('OppMessage').setError('AWS insert error.'); |
| | | } |
| | | } |
| | | }).catch(error => { |
| | | console.log('AWS insert error:' + error) |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | component.find('OppMessage').setError('AWS insert error.'); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | to_agencycontact : function(component,result,agencyHospitalid) { |
| | | to_agencycontact: function (component, result, agencyHospitalid) { |
| | | var action = component.get('c.saveAgencyContact'); |
| | | action.setParams({ |
| | | "name" : result.object[0].name, |
| | | "name": result.object[0].name, |
| | | //"nameEncrypt" : result.object[0].nameEncrypt, //zhj 新方案改造 2023-12-21 |
| | | "type" : result.object[0].type, |
| | | "type": result.object[0].type, |
| | | //"typeEncrypt" : result.object[0].typeEncrypt, //zhj 新方案改造 2023-12-21 |
| | | "doctorDivision1" : result.object[0].doctorDivision1, |
| | | "doctorDivision1": result.object[0].doctorDivision1, |
| | | //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt, //zhj 新方案改造 2023-12-21 |
| | | "agencyHospitalid" : agencyHospitalid, |
| | | "awsid" : result.object[0].dataId, |
| | | "agencyHospitalid": agencyHospitalid, |
| | | "awsid": result.object[0].dataId, |
| | | }); |
| | | action.setCallback(this,function(response){ |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if(state == 'SUCCESS'){ |
| | | if (state == 'SUCCESS') { |
| | | var acMap = this.conv_selected(response.getReturnValue()); |
| | | console.log(acMap); |
| | | if(acMap.AgencyContactId != ''){ |
| | | if (acMap.AgencyContactId != '') { |
| | | //确认事务 |
| | | var token = component.get('v.AWStoken'); |
| | | var confirmUrl = component.get('v.AWStransactionURL'); |
| | |
| | | data['sfRecordId'] = ''; |
| | | data['txId'] = result.txId; |
| | | |
| | | this.to_confirm(component,token,confirmUrl,JSON.stringify(data)); |
| | | }else if(acMap.errormsg != ''){ |
| | | this.to_confirm(component, token, confirmUrl, JSON.stringify(data)); |
| | | } else if (acMap.errormsg != '') { |
| | | component.set('v.errorMessage', acMap.errormsg); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | }else { |
| | | component.set('v.login', false); |
| | | } else { |
| | | component.set('v.errorMessage', 'agency contact insert id error.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | } |
| | | else{ |
| | | else { |
| | | component.set('v.errorMessage', 'agency contact insert error.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | to_confirm : function(component,token,confirmUrl,payload,event) { |
| | | to_confirm: function (component, token, confirmUrl, payload, event) { |
| | | fetch(confirmUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((result) => { |
| | | if(result.status == '0' && result.hasOwnProperty('success') && result.success){ |
| | | if (result.status == '0' && result.hasOwnProperty('success') && result.success) { |
| | | // component.set('v.truthy', false); |
| | | // var modal_newAC = component.find('modal_newAC') |
| | | // $A.util.addClass(modal_newAC, 'disp_none'); |
| | |
| | | component.set('v.successMessage', '.拜访人已创建。'); |
| | | this.showSuccessToast(component); |
| | | this.set_doctor_list(component); |
| | | }else { |
| | | } else { |
| | | component.set('v.errorMessage', 'AWS confirm error.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | }).catch(error => { |
| | | component.set('v.errorMessage', 'AWS confirm error.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | }); |
| | | }, |
| | | //SWAG-CF58C3 fy end 调用pi |
| | | |
| | | set_doctor_list: function (component) { |
| | | console.log('set_doctor_list') |
| | | var doctor_value = component.find('select_purpose_type').get('v.value'); |
| | | var hospital_id = component.get('v.hospitalLinkId'); |
| | | console.log('hospital_id = ' + hospital_id); |
| | | if (hospital_id) { |
| | | if(doctor_value == '科室会'){ |
| | | if (doctor_value == '科室会') { |
| | | component.set('v.login', true); |
| | | this.set_doctor_list2(component); |
| | | }else{ |
| | | } else { |
| | | component.set('v.login', true); |
| | | var action = component.get('c.getDoctorList'); |
| | | action.setParams({ |
| | |
| | | var res = this.conv_selected(response.getReturnValue()); |
| | | //fy |
| | | var setdoctorlisthos = component.get('v.setdoctorlisthos'); |
| | | if(setdoctorlisthos){ |
| | | if (setdoctorlisthos) { |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.setdoctorlisthos', false); |
| | | } |
| | |
| | | } else { |
| | | res[i].selected = false; |
| | | } |
| | | if(res[i].AWS_Data_Id__c){ |
| | | 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){ |
| | | console.log('awsids = ' + JSON.stringify(awsids)) |
| | | 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){ |
| | | AWSService.search(staticResourceAgencyContact.searchUrl, { |
| | | dataIds: awsids |
| | | }, function (data) { |
| | | console.log('data = ' + JSON.stringify(data)) |
| | | if (data && data.object && data.object.length) { |
| | | let m = {}; |
| | | for(let di in data.object){ |
| | | if(data.object[di] && data.object[di].dataId){ |
| | | 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)){ |
| | | |
| | | 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 { |
| | | let awsids = []; |
| | | for (var i = 0; i < res.length; i++) { |
| | | if(res[i].AWS_Data_Id__c){ |
| | | if (res[i].AWS_Data_Id__c) { |
| | | awsids.push(res[i].AWS_Data_Id__c); |
| | | } |
| | | } |
| | | component.find('select_doctor').set('v.options', res); |
| | | if(awsids.length > 0){ |
| | | 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){ |
| | | 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){ |
| | | 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)){ |
| | | |
| | | 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); |
| | | } |
| | |
| | | }); |
| | | $A.enqueueAction(action); |
| | | } |
| | | |
| | | }else{ |
| | | if(doctor_value == '科室会'){ |
| | | |
| | | } else { |
| | | if (doctor_value == '科室会') { |
| | | this.set_doctor_list2(component); |
| | | }else{ |
| | | } else { |
| | | component.find('select_doctor').set('v.options', ''); |
| | | } |
| | | } |
| | | },//fy 20220414 |
| | | set_doctor_list2:function (component) { |
| | | var action1 = component.get('c.selectdoctor3c'); |
| | | action1.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | debugger |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].selected == 'true') { |
| | | res[i].selected = true; |
| | | } else { |
| | | res[i].selected = false; |
| | | } |
| | | set_doctor_list2: function (component) { |
| | | var action1 = component.get('c.selectdoctor3c'); |
| | | action1.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | debugger |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].selected == 'true') { |
| | | res[i].selected = true; |
| | | } else { |
| | | res[i].selected = false; |
| | | } |
| | | debugger |
| | | component.find('select_doctor').set('v.options', res); |
| | | var doctor3value = component.get('v.default_select_doctor_id2'); |
| | | this.set_selected(component, 'select_doctor', doctor3value); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action1); |
| | | debugger |
| | | component.find('select_doctor').set('v.options', res); |
| | | var doctor3value = component.get('v.default_select_doctor_id2'); |
| | | this.set_selected(component, 'select_doctor', doctor3value); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action1); |
| | | }, |
| | | productcategoryChange1: function (component, event, helper) { |
| | | var product_category_id = component.find('select_Product1').get('v.value'); |
| | |
| | | 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'); |
| | | var p1bool = pcId1 != '' && pcId1 != null ; |
| | | var p2bool = pcId2 != '' && pcId2 != null ; |
| | | var p1bool = pcId1 != '' && pcId1 != null; |
| | | var p2bool = pcId2 != '' && pcId2 != null; |
| | | var p0bool = product_category_id != '' && product_category_id != null; |
| | | if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) { |
| | | component.set('v.errorMessage', '不能选择同样的产品区分'); |
| | | this.showErrorToast(component); |
| | | component.set('v.UseProduct2_TEXT',''); |
| | | component.set('v.UseProduct2_TEXT', ''); |
| | | } |
| | | }, |
| | | productcategoryChange3: function (component, event, helper) { |
| | |
| | | reader.onload = function (e) { |
| | | debugger; |
| | | var data = e.target.result; |
| | | |
| | | |
| | | component.set("v.fileContentData", data); |
| | | console.log("file data" + JSON.stringify(data)); |
| | | var allTextLines = data.split(/\r\n|\n/); |
| | |
| | | reader.readAsDataURL(file); |
| | | }, |
| | | // fy 调用pi改造的 获取url 和 token的方法 |
| | | search_contact_url : function(component, sobject, callback) { |
| | | search_contact_url: function (component, sobject, callback) { |
| | | var action = component.get("c.getAwsurl"); |
| | | action.setParams({ |
| | | sobj : sobject |
| | | }); |
| | | action.setCallback(this,function(response){ |
| | | action.setParams({ |
| | | sobj: sobject |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if(state == 'SUCCESS'){ |
| | | if (state == 'SUCCESS') { |
| | | var result = response.getReturnValue(); |
| | | if(callback)callback(result); |
| | | if (callback) callback(result); |
| | | } |
| | | else{ |
| | | else { |
| | | component.set('v.errorMessage', 'AWS url/token error.'); |
| | | this.showErrorToast01(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((result) => { |
| | | component.set('v.login',false); |
| | | if(callback)callback(result); |
| | | component.set('v.login', false); |
| | | if (callback) callback(result); |
| | | }).catch(error => { |
| | | console.log('AWS search error = ' + JSON.stringify(error)); |
| | | component.set('v.errorMessage', 'AWS search error.'); |
| | | this.showErrorToast01(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | }); |
| | | }, |
| | | saveRecords: function (component, event, helper) { |
| | | component.set('v.login', true); |
| | | //fy 导入 202200506 start |
| | | var action1 = component.get("c.processDataAWSId"); |
| | | action1.setParams({ |
| | | fileData : component.get("v.fileContentData"), |
| | | }); |
| | | action1.setCallback(this, function(response) { |
| | | action1.setParams({ |
| | | fileData: component.get("v.fileContentData"), |
| | | }); |
| | | action1.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state === "SUCCESS") { |
| | | debugger |
| | | var ress = response.getReturnValue(); |
| | | if(ress){ |
| | | var valur =ress.split('error1'); |
| | | if(valur.length<=1){ |
| | | if (ress) { |
| | | var valur = ress.split('error1'); |
| | | if (valur.length <= 1) { |
| | | var res = JSON.parse(response.getReturnValue()); |
| | | debugger |
| | | var dataArr = new Array(); |
| | | var dataMap = new Map(); |
| | | res.forEach(item => { |
| | | if(item.AWS_Data_Id__c){ |
| | | if (item.AWS_Data_Id__c) { |
| | | dataArr.push(item.AWS_Data_Id__c); |
| | | //dataMap.set(item.AWS_Data_Id__c,item.Name_Encrypted__c); //zhj 新方案改造 2022-12-21 |
| | | dataMap.set(item.AWS_Data_Id__c,item.AWS_Data_Id__c); |
| | | dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c); |
| | | } |
| | | }); |
| | | debugger |
| | | let obj= Object.create(null); |
| | | let obj = Object.create(null); |
| | | obj['dataIds'] = dataArr; |
| | | var payload = JSON.stringify(obj); |
| | | this.search_contact_url(component, 'Agency_Contact__c', (result)=>{ |
| | | this.search_contact_url(component, 'Agency_Contact__c', (result) => { |
| | | var token = result.token; |
| | | var searchUrl = result.searchUrl; |
| | | console.log('token = ' + token); |
| | | console.log('searchUrl = ' + searchUrl); |
| | | console.log('payload = ' + payload); |
| | | this.search_core(token,searchUrl,payload,(result)=>{ |
| | | this.search_core(token, searchUrl, payload, (result) => { |
| | | console.log('result = ' + JSON.stringify(result)); |
| | | if(result.status == '0'){ |
| | | if(result.object != null&&result.object.length != 0){ |
| | | component.set('v.login',true); |
| | | this.saveRecordsEditFile(component,dataMap,result.object,helper); |
| | | }else{ |
| | | if (result.status == '0') { |
| | | if (result.object != null && result.object.length != 0) { |
| | | component.set('v.login', true); |
| | | this.saveRecordsEditFile(component, dataMap, result.object, helper); |
| | | } else { |
| | | component.set('v.errorMessage', 'AWS search status '); |
| | | this.showErrorToast01(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', 'AWS search status : ' + result.status); |
| | | this.showErrorToast01(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | },component); |
| | | }, component); |
| | | }); |
| | | }else{ |
| | | component.set('v.errorMessage', valur[1]+'\n'+"请修改后重新上传"); |
| | | } else { |
| | | component.set('v.errorMessage', valur[1] + '\n' + "请修改后重新上传"); |
| | | this.showErrorToast01(component); |
| | | component.set('v.login',false); |
| | | component.set('v.login', false); |
| | | } |
| | | } |
| | | } |
| | |
| | | // $A.enqueueAction(action); |
| | | |
| | | }, |
| | | saveRecordsEditFile : function(component,dataMap,searchData,helper){ |
| | | saveRecordsEditFile: function (component, dataMap, searchData, helper) { |
| | | var searchDataMap = new Map(); |
| | | for (var i = 0; i < searchData.length; i++) { |
| | | var sd = searchData[i]; |
| | | searchDataMap.set(sd.name.replace(' ',''),sd.dataId); |
| | | } |
| | | console.log('searchDataMap='+searchDataMap); |
| | | var error = ''; |
| | | var fileData = component.get("v.fileContentData"); |
| | | fileData=this.ToCDB(fileData);//全角转半角 |
| | | var files = fileData.split('\n'); |
| | | for (var i = 0; i < searchData.length; i++) { |
| | | var sd = searchData[i]; |
| | | searchDataMap.set(sd.name.replace(' ', ''), sd.dataId); |
| | | } |
| | | console.log('searchDataMap=' + searchDataMap); |
| | | var error = ''; |
| | | var fileData = component.get("v.fileContentData"); |
| | | fileData = this.ToCDB(fileData);//全角转半角 |
| | | var files = fileData.split('\n'); |
| | | |
| | | var fileStr = files[0]; |
| | | fileStr += '\n'; |
| | | var fileStr = files[0]; |
| | | fileStr += '\n'; |
| | | |
| | | for (var i = 1; i < files.length-1; i++) { |
| | | if(files[i]){ |
| | | var filelist = files[i].split(','); |
| | | var fileName = filelist[5]; |
| | | var WorkRecord = filelist[4]; |
| | | if(WorkRecord == 'SIS'||WorkRecord == '院内入院申请'||WorkRecord == '收费项目申请'||WorkRecord == '科室会'){ |
| | | if(fileName){ |
| | | if(WorkRecord != '科室会'){ |
| | | if (searchDataMap.get(fileName.replace(' ',''))) { |
| | | var nameDataId = searchDataMap.get(fileName.replace(' ','')); |
| | | if (dataMap.get(nameDataId)) { |
| | | filelist[5] = dataMap.get(nameDataId); //zhj 新方案改造 filelist[5]不再存的nameEncrpt 2022-12-21 |
| | | }else { |
| | | error += 'error1 第'+i+'行数据拜访人SF不存在'; |
| | | for (var i = 1; i < files.length - 1; i++) { |
| | | if (files[i]) { |
| | | var filelist = files[i].split(','); |
| | | var fileName = filelist[5]; |
| | | var WorkRecord = filelist[4]; |
| | | if (WorkRecord == 'SIS' || WorkRecord == '院内入院申请' || WorkRecord == '收费项目申请' || WorkRecord == '科室会') { |
| | | if (fileName) { |
| | | if (WorkRecord != '科室会') { |
| | | if (searchDataMap.get(fileName.replace(' ', ''))) { |
| | | var nameDataId = searchDataMap.get(fileName.replace(' ', '')); |
| | | if (dataMap.get(nameDataId)) { |
| | | filelist[5] = dataMap.get(nameDataId); //zhj 新方案改造 filelist[5]不再存的nameEncrpt 2022-12-21 |
| | | } else { |
| | | error += 'error1 第' + i + '行数据拜访人SF不存在'; |
| | | } |
| | | } else { |
| | | error += 'error1 第' + i + '行数据拜访人AWS不存在'; |
| | | } |
| | | }else { |
| | | error += 'error1 第'+i+'行数据拜访人AWS不存在'; |
| | | } else { |
| | | if (filelist[5] != '医生' && filelist[5] != '医生+护士') {//&&filelist[5]!='医生+护士' |
| | | error += 'error1 第' + i + '行数据拜访人不存在'; |
| | | } |
| | | } |
| | | }else{ |
| | | if(filelist[5]!='医生'&&filelist[5]!='医生+护士'){//&&filelist[5]!='医生+护士' |
| | | error += 'error1 第'+i+'行数据拜访人不存在'; |
| | | } |
| | | } else { |
| | | error += 'error1 第' + i + '行数据拜访人不能为空'; |
| | | } |
| | | }else{ |
| | | error += 'error1 第'+i+'行数据拜访人不能为空'; |
| | | } |
| | | }else{ |
| | | if(fileName){ |
| | | if(WorkRecord != '科室会'){ |
| | | if (searchDataMap.get(fileName.replace(' ',''))) { |
| | | var nameDataId = searchDataMap.get(fileName.replace(' ','')); |
| | | if (dataMap.get(nameDataId)) { |
| | | filelist[5] = dataMap.get(nameDataId); |
| | | }else { |
| | | error += 'error1 第'+i+'行数据拜访人SF不存在'; |
| | | } else { |
| | | if (fileName) { |
| | | if (WorkRecord != '科室会') { |
| | | if (searchDataMap.get(fileName.replace(' ', ''))) { |
| | | var nameDataId = searchDataMap.get(fileName.replace(' ', '')); |
| | | if (dataMap.get(nameDataId)) { |
| | | filelist[5] = dataMap.get(nameDataId); |
| | | } else { |
| | | error += 'error1 第' + i + '行数据拜访人SF不存在'; |
| | | } |
| | | } else { |
| | | error += 'error1 第' + i + '行数据拜访人AWS不存在'; |
| | | } |
| | | }else { |
| | | error += 'error1 第'+i+'行数据拜访人AWS不存在'; |
| | | } |
| | | }else{ |
| | | if(filelist[5]!='医生'&&filelist[5]!='医生+护士'){//&&filelist[5]!='医生+护士' |
| | | error += 'error1 第'+i+'行数据拜访人不存在'; |
| | | } else { |
| | | if (filelist[5] != '医生' && filelist[5] != '医生+护士') {//&&filelist[5]!='医生+护士' |
| | | error += 'error1 第' + i + '行数据拜访人不存在'; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | fileStr += filelist.toString(); |
| | | fileStr += '\n'; |
| | | } |
| | | fileStr += filelist.toString(); |
| | | fileStr += '\n'; |
| | | } |
| | | } |
| | | |
| | | if (error != '') { |
| | |
| | | console.log('error=' + error); |
| | | component.set('v.login', false); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | console.log('fileStr='+fileStr); |
| | | $A.getCallback(function(){ |
| | | debugger |
| | | helper.ImportMethod(component,fileStr,helper); |
| | | })(); |
| | | console.log('fileStr=' + fileStr); |
| | | $A.getCallback(function () { |
| | | debugger |
| | | helper.ImportMethod(component, fileStr, helper); |
| | | })(); |
| | | |
| | | },ImportMethod : function(component,fileStr,helper){ |
| | | }, ImportMethod: function (component, fileStr, helper) { |
| | | var action = component.get("c.processData"); |
| | | var fieldsList = ['Name', 'Phone', 'AccountNumber']; //Please write your code dynamic fields |
| | | // var filedata =component.get("v.fileContentData"); |
| | |
| | | } |
| | | columnDivider = ','; |
| | | lineDivider = '\n'; |
| | | keys = [ 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy_text__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','效果/进度','产品1同类耗材科室月使用量','产品1对应术式分类','已采用其他品牌','其他品牌产品类别','产品用量','支援需求'] |
| | | keys = ['Report_Date__c', 'Agency_Hospital__c', 'Department_Cateogy_text__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', '效果/进度', '产品1同类耗材科室月使用量', '产品1对应术式分类', '已采用其他品牌', '其他品牌产品类别', '产品用量', '支援需求'] |
| | | csvStringResult = ''; |
| | | csvStringResult += thkeys.join(columnDivider); |
| | | csvStringResult += lineDivider; |
| | |
| | | csvStringResult += objectRecords[i].Person_In_Charge2__r.Name; |
| | | } else if (skey == 'Agency_Hospital__c') { |
| | | csvStringResult += objectRecords[i].Agency_Hospital__r.Name; |
| | | } else if (skey == 'DealerPersonnel__c') { |
| | | csvStringResult += objectRecords[i].DealerPersonnel__r.Name; |
| | | } else if (skey == 'DealerPersonnel__c') { |
| | | csvStringResult += objectRecords[i].DealerPersonnel__r.Name; |
| | | } else if (skey == 'doctor2__c') { |
| | | csvStringResult += objectRecords[i].doctor2__r.Name; |
| | | csvStringResult += objectRecords[i].doctor2__r.Name; |
| | | } else if (skey == 'UseProduct1__c') { |
| | | csvStringResult += objectRecords[i].UseProduct1__r.Asset_Model_No__c; |
| | | csvStringResult += objectRecords[i].UseProduct1__r.Asset_Model_No__c; |
| | | } else if (skey == 'UseProduct2__c') { |
| | | csvStringResult += objectRecords[i].UseProduct2__r.Asset_Model_No__c; |
| | | csvStringResult += objectRecords[i].UseProduct2__r.Asset_Model_No__c; |
| | | } else if (skey == 'UseProduct3__c') { |
| | | csvStringResult += objectRecords[i].UseProduct3__r.Asset_Model_No__c; |
| | | }else{ |
| | | csvStringResult += objectRecords[i][skey] ; |
| | | csvStringResult += objectRecords[i].UseProduct3__r.Asset_Model_No__c; |
| | | } else { |
| | | csvStringResult += objectRecords[i][skey]; |
| | | } |
| | | counter++; |
| | | } |
| | |
| | | // 导出页面显示的模板 |
| | | showExportDate: function (component, objectRecords) { |
| | | console.log('进入showexceportdate' + objectRecords); |
| | | var keys = ['Report_Date__c', 'Agency_Hospital__c','Department_Cateogy_text__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','效果/进度','产品1同类耗材科室月使用量','产品1对应术式分类','已采用其他品牌','其他品牌产品类别','产品用量','支援需求'] |
| | | var keys = ['Report_Date__c', 'Agency_Hospital__c', 'Department_Cateogy_text__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', '效果/进度', '产品1同类耗材科室月使用量', '产品1对应术式分类', '已采用其他品牌', '其他品牌产品类别', '产品用量', '支援需求'] |
| | | 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++) { |
| | |
| | | var skey = keys[sTempkey]; |
| | | if (typeof objectRecords[i][skey] === "undefined") { |
| | | content += '<td>' + '' + '</td>'; |
| | | continue; |
| | | continue; |
| | | } |
| | | console.log('for2' + objectRecords[i].Person_In_Charge2__r.Name); |
| | | if (skey == 'Person_In_Charge2__c') { |
| | |
| | | content += '<td>' + objectRecords[i].UseProduct2__r.Asset_Model_No__c + '</td>'; |
| | | } else if (skey == 'UseProduct3__c') { |
| | | content += '<td>' + objectRecords[i].UseProduct3__r.Asset_Model_No__c + '</td>'; |
| | | }else{ |
| | | } else { |
| | | content += '<td>' + objectRecords[i][skey] + '</td>'; |
| | | } |
| | | } |
| | |
| | | var res = response.getReturnValue(); |
| | | console.log('输入的开始日期3' + res); |
| | | component.set('v.login', false); |
| | | |
| | | |
| | | // PI 改造 By Bright 20220328 |
| | | if(true){ |
| | | if (true) { |
| | | let awsids = []; |
| | | for (let ri in res) { |
| | | if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c){ |
| | | 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){ |
| | | } |
| | | 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){ |
| | | 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){ |
| | | 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)){ |
| | | |
| | | 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{ |
| | | } else { |
| | | helper.showExportDate(component, res); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | component.set('v.reports_date', res); |
| | | } else { |
| | | alert('导出失败,请检查活动日'); |
| | |
| | | } |
| | | }, |
| | | //科室同类耗材验证必须输入数字 |
| | | select_ConsumptionOfConsumables : function(component, event, helper) { |
| | | select_ConsumptionOfConsumables: function (component, event, helper) { |
| | | var sc = event.getSource().get('v.value'); |
| | | if(sc != null){ |
| | | if(sc.length <= 14){ |
| | | if(sc.replace(/\D/gi,"")){ |
| | | component.set("v.select_ConsumptionOfConsumables",sc); |
| | | }else{ |
| | | if (sc != null) { |
| | | if (sc.length <= 14) { |
| | | if (sc.replace(/\D/gi, "")) { |
| | | component.set("v.select_ConsumptionOfConsumables", sc); |
| | | } else { |
| | | component.set('v.errorMessage', '产品1同类耗材科室月使用量必须输入数字!'); |
| | | this.showErrorToast(component); |
| | | } |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', '产品1同类耗材科室月使用量最多输入14位数字!'); |
| | | this.showErrorToast(component); |
| | | } |
| | | } |
| | | }, |
| | | //产品用量验证必须输入数字 |
| | | select_warlocksNumber : function(component, event, helper) { |
| | | select_warlocksNumber: function (component, event, helper) { |
| | | var sc = event.getSource().get('v.value'); |
| | | if(sc != null){ |
| | | if(sc.length <= 14){ |
| | | if(sc.replace(/\D/gi,"")){ |
| | | component.set("v.select_warlocksNumber",sc); |
| | | }else{ |
| | | if (sc != null) { |
| | | if (sc.length <= 14) { |
| | | if (sc.replace(/\D/gi, "")) { |
| | | component.set("v.select_warlocksNumber", sc); |
| | | } else { |
| | | component.set('v.errorMessage', '产品用量必须输入数字!'); |
| | | this.showErrorToast(component); |
| | | } |
| | | }else{ |
| | | } else { |
| | | component.set('v.errorMessage', '产品用量最多输入14位数字!'); |
| | | this.showErrorToast(component); |
| | | } |
| | | } |
| | | }, |
| | | //工作会记录 |
| | | selectPurposeType: function (component,event,helper) { |
| | | selectPurposeType: function (component, event, helper) { |
| | | debugger |
| | | var doctor_value = component.find('select_purpose_type').get('v.value'); |
| | | // alert(doctor_value); |
| | | if(doctor_value!='科室会'){ |
| | | component.find('new_con').set('v.disabled', false); |
| | | }else{ |
| | | component.find('new_con').set('v.disabled', true); |
| | | if (doctor_value != '科室会') { |
| | | component.find('new_con').set('v.disabled', false); |
| | | } else { |
| | | component.find('new_con').set('v.disabled', true); |
| | | } |
| | | if(doctor_value != ''){ |
| | | if (doctor_value != '') { |
| | | this.set_doctor_list(component); |
| | | var action = component.get('c.selectPurposeTypes'); |
| | | action.setParams({ |
| | |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | } else { |
| | | component.find('select_EffectProgress').set('v.options', []); |
| | | } |
| | | }, |
| | | |
| | | selectProductClassification: function (component,event,helper) { |
| | | selectProductClassification: function (component, event, helper) { |
| | | debugger |
| | | 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 |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_OtherBrandConsumables').set("v.options", JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }else{ |
| | | component.find('select_OtherBrandConsumables').set('v.options', []); |
| | | } |
| | | this.selectProductCcategory(component); |
| | | if (select_ProductClassification != '') { |
| | | var action = component.get('c.selectProductClassificationc'); |
| | | action.setParams({ |
| | | "select_ProductClassification": select_ProductClassification |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_OtherBrandConsumables').set("v.options", JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | } else { |
| | | component.find('select_OtherBrandConsumables').set('v.options', []); |
| | | } |
| | | this.selectProductCcategory(component); |
| | | }, |
| | | select_ProductCcategory: function (component,event,helper) { |
| | | select_ProductCcategory: function (component, event, helper) { |
| | | var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value'); |
| | | debugger |
| | | if(select_ProductCcategory != ''){ |
| | | if (select_ProductCcategory != '') { |
| | | var result = component.find('result'); |
| | | var UserProType = component.get('v.UserProType'); |
| | | //fy |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | if(UserProType=='ENG'){ |
| | | //fy |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | }else{ |
| | | 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'); |
| | | } |
| | | 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){ |
| | | selectpurposetype: function (component, event, helper) { |
| | | var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value'); |
| | | if (select_ProductCcategory == null && select_ProductCcategory == undefined && select_ProductCcategory == '') { |
| | | if (select_ProductCcategory == null && select_ProductCcategory == undefined && select_ProductCcategory == '') { |
| | | var result = component.find('result'); |
| | | // $A.util.removeClass(result, 'disp_none'); |
| | | if(UserProType=='ENG'){ |
| | | if (UserProType == 'ENG') { |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | }else{ |
| | | } else { |
| | | $A.util.addClass(result, 'disp_none'); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | }, |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | CallBackAction : function(component,action_name,para,callback) { |
| | | var action = component.get("c." + action_name.trimStart().replace("c.","")); |
| | | if(para){ |
| | | CallBackAction: function (component, action_name, para, callback) { |
| | | var action = component.get("c." + action_name.trimStart().replace("c.", "")); |
| | | if (para) { |
| | | action.setParams(para); |
| | | } |
| | | if(callback){ |
| | | action.setCallback(this,function(data){ |
| | | if (callback) { |
| | | action.setCallback(this, function (data) { |
| | | callback(data); |
| | | }); |
| | | } |
| | | |
| | | |
| | | $A.enqueueAction(action); |
| | | }, |
| | | }, |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | |
| | | //zhj 导出错误信息 2023-05-16 start |
| | |
| | | } |
| | | |
| | | console.log('datas = ' + JSON.stringify(datas)); |
| | | var csv = this.convertToCSV(component,datas); |
| | | var csv = this.convertToCSV(component, datas); |
| | | console.log('csv = ' + JSON.stringify(csv)) |
| | | this.downloadCSV(component,csv); |
| | | this.downloadCSV(component, csv); |
| | | }, |
| | | |
| | | convertToCSV: function (component,data) { |
| | | convertToCSV: function (component, data) { |
| | | console.log('enter convertToCSV') |
| | | console.log('data = ' + data); |
| | | var csv = ''; |
| | |
| | | return csv; |
| | | }, |
| | | |
| | | downloadCSV: function (component,csv) { |
| | | downloadCSV: function (component, csv) { |
| | | var link = document.createElement('a'); |
| | | link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv); |
| | | link.download = 'data.csv'; |