| | |
| | | ({ |
| | | doinit: function (component, event, helper) { |
| | | document.title = "追溯日报"; |
| | | |
| | | this.report_date_list(component, event, helper, 5); |
| | | component.set('v.login', true); |
| | | 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.allselectlist', res.allselectlist); |
| | | component.set('v.doclist', res.doclist); |
| | | //fy |
| | | |
| | | 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.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 { |
| | | component.set('v.errorMessage', 'doinit failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'doinit failed.'); |
| | | this.error('doinit failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | doinitSave: function (component, event, helper) { |
| | | document.title = "追溯日报"; |
| | | component.set('v.loginEdit', true); |
| | | this.report_date_list(component, event, helper, 5); |
| | | var action = component.get('c.getalldata'); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.set('v.alldata', res.reports); |
| | | component.set('v.fieldsmap', res.fieldsMap); |
| | | component.set('v.allselectlist', res.allselectlist); |
| | | component.set('v.doclist', res.doclist); |
| | | //fy |
| | | |
| | | 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_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.loginEdit', false); |
| | | } |
| | | else { |
| | | //component.set('v.errorMessage', 'doinit failed.'); |
| | | this.error('doinit failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.loginEdit', 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]; |
| | | } |
| | | } |
| | | date_str = this.get_date_string(date_str); |
| | | var action = component.get('c.getReports'); |
| | |
| | | "date_str": date_str, |
| | | "person_str": person_str, |
| | | }); |
| | | component.set('v.login', true); |
| | | component.set('v.loginEdit', true); |
| | | action.setCallback(this, function (response) { |
| | | |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | |
| | | } |
| | | if (res.reports.length > 0) { |
| | | component.set('v.list_message', ''); |
| | | var flag2 = res.reports.length; |
| | | //fy 20220414 start |
| | | 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 == ""))) { |
| | | report1.push(item); |
| | | } else { |
| | | report2.push(item); |
| | | } |
| | | }); |
| | | 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]; |
| | | } |
| | | } |
| | | |
| | | 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.loginEdit', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } else { |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | } |
| | | } else { |
| | | component.set('v.list_message', 'no_data'); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | component.set('v.login', false); |
| | | |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'get_reports failed.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | //component.set('v.errorMessage', 'get_reports failed.'); |
| | | this.error('get_reports failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value')); |
| | | component.set('v.select_report_data_radio', ''); |
| | | component.find('copy_button').set('v.disabled', true); |
| | | component.find('delete_button').set('v.disabled', true); |
| | | }, |
| | | |
| | | select_agency_change: function (component, event, helper) { |
| | |
| | | this.get_reports(component, event, helper, component.find('select_date').get('v.value'), select_value); |
| | | component.set('v.select_report_data_radio', ''); |
| | | component.find('copy_button').set('v.disabled', true); |
| | | component.find('delete_button').set('v.disabled', true); |
| | | }, |
| | | |
| | | get_agency_person_name: function (component, agency_person_value) { |
| | |
| | | }, |
| | | //复制和编辑回显的位置 |
| | | 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')) { |
| | |
| | | //使用产品1(产品型号) |
| | | var UseProduct1Text = ''; |
| | | var UseProduct1Id = ''; |
| | | if (select_data['UseProduct1__c'] != '' || select_data['UseProduct1__c'] != 'undefined') { |
| | | 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']; |
| | | UseProduct1Text = reports[i]['UseProduct1__r']['Asset_Model_No__c']; |
| | | UseProduct1Id = reports[i]['UseProduct1__c']; |
| | | } |
| | | } |
| | |
| | | //使用产品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']; |
| | | UseProduct2Text = reports[i]['UseProduct2__r']['Asset_Model_No__c']; |
| | | UseProduct2Id = reports[i]['UseProduct2__c']; |
| | | } |
| | | } |
| | |
| | | //使用产品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']; |
| | | UseProduct3Text = reports[i]['UseProduct3__r']['Asset_Model_No__c']; |
| | | UseProduct3Id = reports[i]['UseProduct3__c']; |
| | | } |
| | | } |
| | |
| | | component.set('v.data.Report_Date__c', reportDate); |
| | | } |
| | | // 科室 |
| | | if (select_data['Department_Cateogy__c'] != '') { |
| | | component.find('select_department').set('v.value',select_data['Department_Cateogy__c']); |
| | | // if (select_data['Department_Cateogy__c'] != '') { |
| | | // component.find('select_department').set('v.value',select_data['Department_Cateogy__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']); |
| | | } |
| | | //经销商人员 |
| | | 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); |
| | | |
| | | // 工作记录 |
| | | // 活动区分 |
| | | if (select_data['WorkRecord__c'] != '') { |
| | | this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']); |
| | | this.selectPurposeType(component); |
| | | } |
| | | // 拜访人 |
| | | 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'); |
| | | this.set_doctor_list(component); |
| | | } 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同类耗材科室月使用量 |
| | | 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; |
| | | ; |
| | | |
| | | var report_id = component.get('v.edit_copy_select_report_id'); |
| | | if (report_id != "") { |
| | |
| | | WarlockClassification = reports[i]["WarlockClassification__c"]; |
| | | ProductCcategory = reports[i]["ProductCcategory__c"]; |
| | | productCategories = reports[i]["productCategories__c"]; |
| | | break; |
| | | break; |
| | | } |
| | | } |
| | | //效果/进度 |
| | |
| | | var WorkMark__c = component.find('select_WorkMark').get('v.checked'); |
| | | if (component.get('v.mode') == 'new') { |
| | | var confirm_title = '警告!' |
| | | var confirm_text = '放弃新建周报?'; |
| | | var confirm_text = '放弃新建日报?'; |
| | | if (!Report_Date__c && |
| | | !Agency_Hospital__c && |
| | | !UseProduct1__c && |
| | |
| | | !productCategories__c && |
| | | !warlocksNumber__c && |
| | | !WorkMark__c && |
| | | !WorkRecord__c |
| | | !WorkRecord__c |
| | | ) { |
| | | this.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } 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['UseProduct2__c'] == UseProduct2__c && |
| | | select_report_data['UseProduct3__c'] == UseProduct3__c && |
| | | select_report_data['Department_Cateogy__c'] == Department_Cateogy__c && |
| | | select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__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['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.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } else if (component.get('v.mode') == 'edit') { |
| | | var confirm_title = '警告!' |
| | | var confirm_text = '放弃编辑周报?'; |
| | | 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['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'); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } else if (component.get('v.mode') == 'edit') { |
| | | 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['UseProduct2__c'] == UseProduct2__c && |
| | | select_report_data['UseProduct3__c'] == UseProduct3__c && |
| | | select_report_data['Department_Cateogy__c'] == Department_Cateogy__c && |
| | | select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__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['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.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | |
| | | } |
| | | } |
| | | }, |
| | | //关闭页面是 小的提示框是否放弃新建周报 |
| | | toggle_report_edit: function (component) { |
| | | var modal_window = component.find('modal_window'); |
| | | var modal_bg = component.find('modal_bg'); |
| | | if ($A.util.hasClass(modal_window, 'disp_none')) { |
| | | // OPEN |
| | | $A.util.removeClass(modal_window, 'disp_none'); |
| | | $A.util.removeClass(modal_bg, 'disp_none'); |
| | | component.set('v.loginEdit',true); |
| | | //复制 和编辑 回显问题在这里面 |
| | | if (component.get('v.mode') == 'edit' || component.get('v.mode') == 'copy') { |
| | | var select_data = ''; |
| | | if (component.get('v.mode') == 'edit') { |
| | | select_data = component.get('v.select_report_data'); |
| | | } else if (component.get('v.mode') == 'copy') { |
| | | select_data = component.get('v.select_report_data_radio'); |
| | | } |
| | | var reports = component.get('v.reports'); |
| | | var Agency_Hospital_text = ''; |
| | | var Agency_Hospital_parent_id = ''; |
| | | // 医院名 |
| | | if (select_data['Agency_Hospital__c'] != '') { |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i]['Agency_Hospital__c'] == select_data['Agency_Hospital__c']) { |
| | | Agency_Hospital_text = reports[i]['Agency_Hospital__r']['Name']; |
| | | Agency_Hospital_parent_id = reports[i]['Agency_Hospital__r']['Hospital__c']; |
| | | } |
| | | } |
| | | component.set('v.hospital', Agency_Hospital_text); |
| | | component.set('v.hospitalId', Agency_Hospital_parent_id); |
| | | component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']); |
| | | component.find('new_con').set('v.disabled', false); |
| | | } |
| | | //使用产品1(产品型号) |
| | | var UseProduct1Text = ''; |
| | | var UseProduct1Id = ''; |
| | | 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']['Asset_Model_No__c']; |
| | | UseProduct1Id = reports[i]['UseProduct1__c']; |
| | | } |
| | | } |
| | | component.set('v.UseProduct1', UseProduct1Text); |
| | | component.set('v.UseProduct1Id', select_data['UseProduct1__c']); |
| | | } |
| | | //使用产品2 |
| | | var UseProduct2Text = ''; |
| | | var UseProduct2Id = ''; |
| | | 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']; |
| | | UseProduct2Id = reports[i]['UseProduct2__c']; |
| | | } |
| | | } |
| | | component.set('v.UseProduct2', UseProduct2Text); |
| | | component.set('v.UseProduct2Id', select_data['UseProduct2__c']); |
| | | } |
| | | //使用产品3 |
| | | var UseProduct3Text = ''; |
| | | var UseProduct3Id = ''; |
| | | 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']; |
| | | UseProduct3Id = reports[i]['UseProduct3__c']; |
| | | } |
| | | } |
| | | component.set('v.UseProduct3', UseProduct3Text); |
| | | component.set('v.UseProduct3Id', select_data['UseProduct3__c']); |
| | | } |
| | | //活动日 |
| | | var reportDate; |
| | | if (select_data['Report_Date__c'] != '') { |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i]['Report_Date__c'] == select_data['Report_Date__c']) { |
| | | reportDate = reports[i]["Report_Date__c"]; |
| | | } |
| | | } |
| | | component.set('v.data.Report_Date__c', reportDate); |
| | | } |
| | | // 科室 |
| | | // if (select_data['Department_Cateogy__c'] != '') { |
| | | // component.find('select_department').set('v.value',select_data['Department_Cateogy__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']); |
| | | } |
| | | //经销商人员 |
| | | if (select_data['DealerPersonnel__c'] != '') { |
| | | this.set_selected(component, 'select_DealerPersonnel', select_data['DealerPersonnel__c']); |
| | | } |
| | | // 活动区分 |
| | | if (select_data['WorkRecord__c'] != '') { |
| | | this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']); |
| | | this.selectPurposeType(component); |
| | | } |
| | | // 拜访人 |
| | | 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'); |
| | | this.set_doctor_list_edit(component); |
| | | } else { |
| | | component.set('v.default_select_doctor_id', select_data['doctor2__c']); |
| | | this.set_doctor_list_edit(component); |
| | | } |
| | | //产品分类(第三分类) |
| | | if (select_data['ProductClassification__c'] != null) { |
| | | this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']); |
| | | this.selectProductClassification(component); |
| | | } |
| | | // 产品1同类耗材科室月使用量 |
| | | if (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']); |
| | | } |
| | | // 支援需求 |
| | | if (select_data['WorkMark__c'] != false) { |
| | | component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']); |
| | | } |
| | | ; |
| | | |
| | | var report_id = component.get('v.edit_copy_select_report_id'); |
| | | if (report_id != "") { |
| | | var select_EffectProgress1 = ''; |
| | | var WarlockClassification = ''; |
| | | var ProductCcategory = ''; |
| | | var productCategories = ''; |
| | | var i = 0; |
| | | for (i = 0; i < reports.length; i++) { |
| | | 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 (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', ""); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | 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 UseProduct1__c = component.get('v.UseProduct1Id'); |
| | | var UseProduct2__c = component.get('v.UseProduct2Id'); |
| | | var UseProduct3__c = component.get('v.UseProduct3Id'); |
| | | var Department_Cateogy__c = component.find('select_department').get('v.value'); |
| | | var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value'); |
| | | var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value'); |
| | | 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 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') { |
| | | var confirm_title = '警告!' |
| | | var confirm_text = '放弃新建日报?'; |
| | | if (!Report_Date__c && |
| | | !Agency_Hospital__c && |
| | | !UseProduct1__c && |
| | | !UseProduct2__c && |
| | | !UseProduct3__c && |
| | | !Department_Cateogy__c && |
| | | !ConsumptionOfConsumables__c && |
| | | !DealerPersonnel__c && |
| | | !doctor2__c && |
| | | !EffectProgress__c && |
| | | !WarlockClassification__c && |
| | | !ProductCcategory__c && |
| | | !productCategories__c && |
| | | !warlocksNumber__c && |
| | | !WorkMark__c && |
| | | !WorkRecord__c |
| | | ) { |
| | | this.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } 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['UseProduct2__c'] == UseProduct2__c && |
| | | select_report_data['UseProduct3__c'] == UseProduct3__c && |
| | | select_report_data['Department_Cateogy__c'] == Department_Cateogy__c && |
| | | select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__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['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.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } else if (component.get('v.mode') == 'edit') { |
| | | 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['UseProduct2__c'] == UseProduct2__c && |
| | | select_report_data['UseProduct3__c'] == UseProduct3__c && |
| | | select_report_data['Department_Cateogy__c'] == Department_Cateogy__c && |
| | | select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__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['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.allclear(component); |
| | | $A.util.addClass(modal_window, 'disp_none'); |
| | | $A.util.addClass(modal_bg, 'disp_none'); |
| | | } else { |
| | | this.close_confirm(component, confirm_title, confirm_text); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //component.set('v.loginEdit',false); |
| | | }, |
| | | //关闭页面是 小的提示框是否放弃新建日报 |
| | | close_confirm: function (component, title, text) { |
| | | var confirm_status = component.get('v.confirm_status'); |
| | | component.set('v.modal_confirm_title', title); |
| | |
| | | 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'); |
| | |
| | | }, |
| | | //新建按钮 |
| | | new_report: function (component, event, helper) { |
| | | |
| | | component.set('v.mode', 'new'); |
| | | component.set('v.dialog_type', '新建'); |
| | | // 周 |
| | |
| | | // 担当 |
| | | 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); |
| | | // 担当 |
| | | var name = component.get('v.selected_agency_person'); |
| | | var ret = this.create_report_header(component, event, helper, name, select_agency, select_date); |
| | | component.set('v.default_select_doctor_id2', ''); |
| | | |
| | | // SWAG-CF58C3 fy start |
| | | this.set_aws_url(component, 'Agency_Contact__c') |
| | | // SWAG-CF58C3 fy end |
| | | }, |
| | | // 复制按钮 |
| | | copy_button: function (component, event, helper) { |
| | | |
| | | this.allclear(component); |
| | | component.set('v.mode', 'copy'); |
| | | component.set('v.dialog_type', '新建'); |
| | |
| | | var name = component.get('v.selected_agency_person'); |
| | | component.set('v.edit_copy_select_report_id', select_report_data['Id']); |
| | | component.set('v.select_report_data', select_report_data); |
| | | |
| | | 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') |
| | | // SWAG-CF58C3 fy end |
| | | |
| | | }, |
| | | //删除按钮 |
| | | delete_button: function (component, event, helper) { |
| | | |
| | | var select_report_data = component.get('v.select_report_data_radio'); |
| | | if (confirm('是否删除该数据?')) { |
| | | |
| | | component.set('v.login', true); |
| | | var action = component.get('c.deleteAgencyReport'); |
| | | action.setParams({ |
| | | "agencyReport_id": select_report_data.Id, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var result = response.getReturnValue(); |
| | | if (result == 'success') { |
| | | this.select_agency_change(component, event, helper); |
| | | } |
| | | component.set('v.login', false); |
| | | } else { |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | } |
| | | }, |
| | | //复制按钮可用 |
| | | change_report_radio: function (component, event, helper) { |
| | | |
| | | var reports = component.get('v.reports'); |
| | | for (var i = 0; i < reports.length; i++) { |
| | | if (reports[i].Name == event.getSource().get('v.label')) { |
| | | component.set('v.select_report_data_radio', reports[i]); |
| | | component.find('copy_button').set('v.disabled', false); |
| | | component.find('delete_button').set('v.disabled', false); |
| | | break; |
| | | } |
| | | } |
| | | }, |
| | | //编辑按钮 |
| | | edit_button: function (component, event, helper) { |
| | | component.set('v.login', true); |
| | | debugger |
| | | //component.set('v.loginEdit', true); |
| | | this.allclear(component); |
| | | component.set('v.loadOpp', true); |
| | | //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.mode', 'edit'); |
| | |
| | | var new_label = this.get_agency_person_name(component, select_agency); |
| | | component.set('v.selected_agency_person', new_label); |
| | | 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); |
| | | var ret = this.create_report_header_edit(component, event, helper, name, select_agency, select_date); |
| | | // SWAG-CF58C3 fy start |
| | | this.set_aws_url(component, 'Agency_Contact__c') |
| | | //component.set('v.login', false); |
| | | // SWAG-CF58C3 fy end |
| | | }, |
| | | //保存 |
| | | save_report: function (component, event, helper) { |
| | | var UserProType = component.get('v.UserProType'); |
| | | component.find('save_button').set('v.disabled', true); |
| | | var etEng = component.get('v.etEng'); |
| | | var Report_Date__c = component.get('v.data.Report_Date__c'); |
| | |
| | | // 担当 Person_In_Charge2__c |
| | | Person_In_Charge2__c = component.find('select_agency_person').get('v.value'); |
| | | } |
| | | |
| | | // Agency_Report_Header__c |
| | | var Agency_Report_Header__c = component.get('v.agency_report_header_id'); |
| | | // 医院 |
| | |
| | | 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 |
| | | // 效果/进度 EffectProgress__c |
| | | var EffectProgress__c = component.find('select_EffectProgress').get('v.value'); |
| | | // 科室同来耗材月使用量 ConsumptionOfConsumables__c |
| | | // alert(EffectProgress__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 = []; |
| | | if (!Report_Date__c) { error.push("活动日 不存在"); } |
| | | if (!Submit_date__c) { error.push("周 不存在"); } |
| | | //fy start |
| | | // if(WorkRecord__c != 'SIS'&&WorkRecord__c != '科室会'){ |
| | | 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 == '临床信息(使用量)收集') { |
| | | 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 (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 != 'QIS处理'){ |
| | | 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 (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("周 不存在"); } |
| | | 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) { 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 (!Department_Cateogy__c) { error.push("科室 不存在"); } |
| | | if (!DealerPersonnel__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 (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("其他品牌产品类别 不存在"); } |
| | | if (!ConsumptionOfConsumables__c) { error.push("科室同类耗材月使用量 不能为空"); } |
| | | if (!warlocksNumber__c) { error.push("产品用量 不能为空"); } |
| | | |
| | | //let errorMsg = ''; |
| | | for (var i = 0; i < error.length; i++) { |
| | | component.set('v.errorMessage', error[i]); |
| | | this.showErrorToast(component); |
| | | //errorMsg += '; ' + error[i] |
| | | //this.error(error[i]); |
| | | } |
| | | // if(errorMsg != '') |
| | | // this.error(errorMsg.substring(1)); |
| | | if (error.length > 0) { |
| | | component.find('save_button').set('v.disabled', false); |
| | | return false; |
| | | } |
| | | // 保存処理 |
| | | component.set('v.login', true); |
| | | component.set('v.loginEdit', true); |
| | | if (component.get('v.mode') == 'edit') { |
| | | var Agency_Report__c = component.get('v.select_report_data').Id; |
| | | var action = component.get('c.editAgencyReport'); |
| | |
| | | "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.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | debugger |
| | | component.set('v.successMessage', '编辑保存成功'); |
| | | this.showSuccessToast(component); |
| | | var report_id = response.getReturnValue(); |
| | |
| | | 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); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'save_report failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'save_report failed.'); |
| | | this.error('保存日报失败'); |
| | | //this.showErrorToast(component); |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | 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, |
| | |
| | | } |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'get_reports_now failed.'); |
| | | this.showErrorToast(component); |
| | | // component.set('v.errorMessage', 'get_reports_now failed.'); |
| | | this.error('get_reports_now failed.'); |
| | | //this.showErrorToast(component); |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | component.set('v.loginEdit', 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.loginEdit', false); |
| | | debugger |
| | | this.doinitSave(component, event, helper); |
| | | } |
| | | else { |
| | | var error = response.getError(); |
| | | component.set('v.errorMessage', 'saveAgencyReport failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', '保存日报失败'); |
| | | this.error('保存日报失败'); |
| | | //this.showErrorToast(component); |
| | | component.find('save_button').set('v.disabled', false); |
| | | component.set('v.login', false); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | |
| | | create_report_header: function (component, event, helper, name, s_agency, s_date) { |
| | | s_date = this.get_date_string(s_date); |
| | | if (s_date == false) { |
| | | component.set('v.errorMessage', 'get_date_string failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'get_date_string failed.'); |
| | | this.error('get_date_string failed.'); |
| | | //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) { |
| | | component.set('v.errorMessage', 'create_header_input_key failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'create_header_input_key failed.'); |
| | | this.error('create_header_input_key failed.'); |
| | | //this.showErrorToast(component); |
| | | return false; |
| | | } |
| | | var key2 = s_date.replace(/-/g, ''); |
| | |
| | | this.toggle_report(component, event, helper); |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'createReportHeader callback failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'createReportHeader callback failed.'); |
| | | this.error('createReportHeader callback failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | create_report_header_edit: function (component, event, helper, name, s_agency, s_date) { |
| | | |
| | | s_date = this.get_date_string(s_date); |
| | | if (s_date == false) { |
| | | //component.set('v.errorMessage', 'get_date_string failed.'); |
| | | this.error('get_date_string failed.'); |
| | | //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) { |
| | | //component.set('v.errorMessage', 'create_header_input_key failed.'); |
| | | this.error('create_header_input_key failed.'); |
| | | //this.showErrorToast(component); |
| | | return false; |
| | | } |
| | | var key2 = s_date.replace(/-/g, ''); |
| | | var action = component.get('c.createReportHeader'); |
| | | |
| | | action.setParams({ |
| | | "name": name, |
| | | "s_date": s_date, |
| | | "s_agency": s_agency, |
| | | "head_key": head_key, |
| | | }); |
| | | component.set('v.login',true); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.set('v.agency_report_header_id', res); |
| | | component.set('v.login', false); |
| | | this.toggle_report_edit(component, event, helper); |
| | | } |
| | | else { |
| | | //component.set('v.errorMessage', 'createReportHeader callback failed.'); |
| | | this.error('createReportHeader callback failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | |
| | | 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); |
| | | //component.set('v.errorMessage', 'get_date_string in create_header_input_key.'); |
| | | this.error('get_date_string in create_header_input_key.'); |
| | | //this.showErrorToast(component); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | var hospital_list = component.find('hospital_list'); |
| | | $A.util.removeClass(hospital_list, 'slds-is-open'); |
| | | }, |
| | | hideSearchs: function (component, event, helper) { |
| | | var hospital_list = component.find('hospital_list'); |
| | | $A.util.removeClass(hospital_list, 'slds-is-open'); |
| | | component.set("v.hospital", ''); |
| | | component.set("v.hospitals", ''); |
| | | component.set('v.hospitalLinkId', ''); |
| | | component.set('v.data.Agency_Hospital__c', ''); |
| | | component.set("v.hospitalId", ''); |
| | | }, |
| | | selectHos: function (component, event, helper) { |
| | | |
| | | var hospital_list = component.find('hospital_list'); |
| | | $A.util.removeClass(hospital_list, 'slds-is-open'); |
| | | var accname = event.currentTarget.dataset.accname; |
| | | var accid = event.currentTarget.dataset.accid; |
| | | var hospital_data = component.get('v.hospitalList'); |
| | | var select_purpose_type = component.find('select_purpose_type').get('v.value'); |
| | | for (var i = 0; i < hospital_data.length; i++) { |
| | | 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); |
| | | component.find('new_con').set('v.disabled', false); |
| | | 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.hospitals", accname); |
| | | component.set("v.hospital", accname); |
| | | component.set("v.hospitalId", accid); |
| | | this.set_doctor_list(component, event, helper); |
| | | |
| | | component.set('v.setdoctorlisthos', true); |
| | | this.set_doctor_list_edit(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 UseProduct1_List = component.find('UseProduct1_List'); |
| | | $A.util.removeClass(UseProduct1_List, 'slds-is-open'); |
| | | }, |
| | | hideSearchUseProduct1s: function (component, event, helper) { |
| | | var UseProduct1_List = component.find('UseProduct1_List'); |
| | | $A.util.removeClass(UseProduct1_List, 'slds-is-open'); |
| | | component.set("v.UseProduct1", ''); |
| | | component.set("v.UseProduct1s", ''); |
| | | component.set('v.UseProduct1Id', ''); |
| | | component.set('v.data.UseProduct1__c', ''); |
| | | }, |
| | | seletUseProduct1Change: function (component, event, helper) { |
| | | |
| | | var UseProduct1_List = component.find('UseProduct1_List'); |
| | | $A.util.removeClass(UseProduct1_List, 'slds-is-open'); |
| | | var accname = event.currentTarget.dataset.accname; |
| | |
| | | component.set('v.data.UseProduct1__c', UseProduct1ListDate[i].Id); |
| | | } |
| | | } |
| | | var UseProduct2_TEXT = component.find('UseProduct1_TEXT').get('v.value'); |
| | | 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{ |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } else { |
| | | //component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.error('不能选择同样的产品'); |
| | | //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 UseProduct2_List = component.find('UseProduct2_List'); |
| | | $A.util.removeClass(UseProduct2_List, 'slds-is-open'); |
| | | }, |
| | | hideSearchUseProduct2s: function (component, event, helper) { |
| | | var UseProduct2_List = component.find('UseProduct2_List'); |
| | | $A.util.removeClass(UseProduct2_List, 'slds-is-open'); |
| | | component.set("v.UseProduct2", ''); |
| | | component.set("v.UseProduct2s", ''); |
| | | component.set('v.UseProduct2Id', ''); |
| | | component.set('v.data.UseProduct2__c', ''); |
| | | }, |
| | | seletUseProduct2Change: function (component, event, helper) { |
| | | var UseProduct2_List = component.find('UseProduct2_List'); |
| | | $A.util.removeClass(UseProduct2_List, 'slds-is-open'); |
| | |
| | | } |
| | | 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{ |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } else { |
| | | //component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.error('不能选择同样的产品'); |
| | | //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 UseProduct3_List = component.find('UseProduct3_List'); |
| | | $A.util.removeClass(UseProduct3_List, 'slds-is-open'); |
| | | }, |
| | | hideSearchUseProduct3s: function (component, event, helper) { |
| | | var UseProduct3_List = component.find('UseProduct3_List'); |
| | | $A.util.removeClass(UseProduct3_List, 'slds-is-open'); |
| | | component.set("v.UseProduct3", ''); |
| | | component.set("v.UseProduct3s", ''); |
| | | component.set('v.UseProduct3Id', ''); |
| | | component.set('v.data.UseProduct3__c', ''); |
| | | }, |
| | | seletUseProduct3Change: function (component, event, helper) { |
| | | var UseProduct3_List = component.find('UseProduct3_List'); |
| | | $A.util.removeClass(UseProduct3_List, 'slds-is-open'); |
| | |
| | | } |
| | | 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{ |
| | | component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.showErrorToast(component); |
| | | } else { |
| | | //component.set('v.errorMessage', '不能选择同样的产品'); |
| | | this.error('不能选择同样的产品'); |
| | | //this.showErrorToast(component); |
| | | } |
| | | |
| | | |
| | | }, |
| | | //hospitalLinkId 经销商医院的ID 医院人员复制的地方 |
| | | //hospitalLinkId 经销商医院的ID 拜访人复制的地方 |
| | | doctor_change: function (component, event, helper) { |
| | | |
| | | var doctorurpose = component.find('select_purpose_type').get('v.value'); |
| | | var doctor_value = component.find('select_doctor').get('v.value'); |
| | | var doctor_list = component.get('v.doctor_list'); |
| | | var flg = false; |
| | | for (var i = 0; i < doctor_list.length; i++) { |
| | | if (doctor_list[i].value == doctor_value) { |
| | | component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c); |
| | | flg = true; |
| | | break; |
| | | if (doctor_list) { |
| | | for (var i = 0; i < doctor_list.length; i++) { |
| | | if (doctor_list[i].value == doctor_value) { |
| | | if (doctorurpose == '科室会') { |
| | | // component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c); |
| | | } else { |
| | | component.set('v.doctor_title', doctor_list[i].Doctor_Division1__c); |
| | | } |
| | | flg = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (flg == false) { |
| | | component.set('v.doctor_title', ''); |
| | | } |
| | | }, |
| | | //SWAG-CF58C3 fy start 调用pi |
| | | set_aws_url: function (component, sobject) { |
| | | var action = component.get('c.getAwsurl'); |
| | | action.setParams({ |
| | | "sobj": sobject, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | 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); |
| | | } |
| | | else { |
| | | // component.set('v.errorMessage', 'AWS url/token error.'); |
| | | this.error('AWS url/token error.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | insert_agencycontact: function (component, token, newUrl, payload, agencyHospitalid, helper, hospitalName) { |
| | | |
| | | console.log('newUrl = ' + newUrl); |
| | | console.log('payload = ' + payload); |
| | | console.log('token = ' + token); |
| | | fetch(newUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': token |
| | | } |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((result) => { |
| | | console.log('result = ' + JSON.stringify(result)); |
| | | if (result.status == '0') { |
| | | $A.getCallback(function () { |
| | | helper.to_agencycontact(component, result, agencyHospitalid); |
| | | })(); |
| | | } else { |
| | | console.log('AWS status error:' + result) |
| | | 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.find('OppMessage').setError('AWS insert error.'); |
| | | }); |
| | | |
| | | }, |
| | | |
| | | to_agencycontact: function (component, result, agencyHospitalid) { |
| | | var action = component.get('c.saveAgencyContact'); |
| | | action.setParams({ |
| | | "name": result.object[0].name, |
| | | //"nameEncrypt" : result.object[0].nameEncrypt, //zhj 新方案改造 2023-12-21 |
| | | "type": result.object[0].type, |
| | | //"typeEncrypt" : result.object[0].typeEncrypt, //zhj 新方案改造 2023-12-21 |
| | | "doctorDivision1": result.object[0].doctorDivision1, |
| | | //"doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt, //zhj 新方案改造 2023-12-21 |
| | | "agencyHospitalid": agencyHospitalid, |
| | | "awsid": result.object[0].dataId, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var acMap = this.conv_selected(response.getReturnValue()); |
| | | console.log(acMap); |
| | | if (acMap.AgencyContactId != '') { |
| | | //确认事务 |
| | | var token = component.get('v.AWStoken'); |
| | | var confirmUrl = component.get('v.AWStransactionURL'); |
| | | |
| | | let data = Object.create(null); |
| | | data['isSuccess'] = 1; |
| | | data['sfRecordId'] = ''; |
| | | data['txId'] = result.txId; |
| | | |
| | | this.to_confirm(component, token, confirmUrl, JSON.stringify(data)); |
| | | } else if (acMap.errormsg != '') { |
| | | // component.set('v.errorMessage', acMap.errormsg); |
| | | this.error(acMap.errormsg); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } else { |
| | | //component.set('v.errorMessage', 'agency contact insert id error.'); |
| | | this.error('agency contact insert id error.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | } |
| | | else { |
| | | //component.set('v.errorMessage', 'agency contact insert error.'); |
| | | this.error('agency contact insert error.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | to_confirm: function (component, token, confirmUrl, payload, event) { |
| | | fetch(confirmUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': token |
| | | } |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((result) => { |
| | | 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'); |
| | | // this.success('.客户人员已创建。'); |
| | | // this.set_doctor_list(component); |
| | | |
| | | 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); |
| | | component.set('v.login', false); |
| | | this.set_doctor_list_edit(component); |
| | | } else { |
| | | //component.set('v.errorMessage', 'AWS confirm error.'); |
| | | this.error('AWS confirm error.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }).catch(error => { |
| | | // component.set('v.errorMessage', 'AWS confirm error.'); |
| | | this.error('AWS confirm error.'); |
| | | //this.showErrorToast(component); |
| | | 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) { |
| | | component.set('v.login', true); |
| | | var action = component.get('c.getDoctorList'); |
| | | action.setParams({ |
| | | "hospital_id": hospital_id, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = this.conv_selected(response.getReturnValue()); |
| | | var default_doctor = component.get('v.default_select_doctor_id'); |
| | | if (default_doctor != '' && res.length > 0) { |
| | | var doctor_title = ''; |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].value == default_doctor) { |
| | | res[i].selected = true; |
| | | doctor_title = res[i].Doctor_Division1__c; |
| | | } else { |
| | | res[i].selected = false; |
| | | if (doctor_value == '科室会') { |
| | | component.set('v.loginEdit', true); |
| | | this.set_doctor_list2(component); |
| | | } else { |
| | | component.set('v.loginEdit', true); |
| | | var action = component.get('c.getDoctorList'); |
| | | action.setParams({ |
| | | "hospital_id": hospital_id, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | ; |
| | | var res = this.conv_selected(response.getReturnValue()); |
| | | //fy |
| | | var setdoctorlisthos = component.get('v.setdoctorlisthos'); |
| | | if (setdoctorlisthos) { |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.setdoctorlisthos', false); |
| | | } |
| | | //fy |
| | | 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; |
| | | doctor_title = res[i].Doctor_Division1__c; |
| | | } 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); |
| | | 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) { |
| | | 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) { |
| | | 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.loginEdit', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } |
| | | } else { |
| | | let awsids = []; |
| | | for (var i = 0; i < res.length; i++) { |
| | | 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) { |
| | | 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.loginEdit', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } |
| | | // component.find('select_doctor').set('v.options', res); |
| | | if (res.length > 0) { |
| | | component.set('v.doctor_title', res[0].Doctor_Division1__c); |
| | | } |
| | | } |
| | | component.find('select_doctor').set('v.options', res); |
| | | component.set('v.doctor_title', doctor_title); |
| | | } 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.loginEdit', false); |
| | | } |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.doctor_list', res); |
| | | component.set('v.login', false); |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'set_doctor_list failed.'); |
| | | this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | else { |
| | | // component.set('v.errorMessage', 'set_doctor_list failed.'); |
| | | this.error('set_doctor_list failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | } |
| | | |
| | | } else { |
| | | if (doctor_value == '科室会') { |
| | | this.set_doctor_list2(component); |
| | | } else { |
| | | component.find('select_doctor').set('v.options', ''); |
| | | } |
| | | } |
| | | component.set('v.loginEdit', false); |
| | | },//fy 20220414 |
| | | set_doctor_list_edit: 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 == '科室会') { |
| | | component.set('v.loginEdit', true); |
| | | this.set_doctor_list2(component); |
| | | } else { |
| | | component.set('v.loginEdit', true); |
| | | var action = component.get('c.getDoctorList'); |
| | | action.setParams({ |
| | | "hospital_id": hospital_id, |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = this.conv_selected(response.getReturnValue()); |
| | | //fy |
| | | var setdoctorlisthos = component.get('v.setdoctorlisthos'); |
| | | if (setdoctorlisthos) { |
| | | component.set('v.default_select_doctor_id', ''); |
| | | component.set('v.setdoctorlisthos', false); |
| | | } |
| | | //fy |
| | | 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; |
| | | doctor_title = res[i].Doctor_Division1__c; |
| | | } 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); |
| | | 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) { |
| | | 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) { |
| | | 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.loginEdit', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } |
| | | } else { |
| | | let awsids = []; |
| | | for (var i = 0; i < res.length; i++) { |
| | | 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) { |
| | | 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.loginEdit', false); |
| | | }, staticResourceAgencyContact.token); |
| | | } |
| | | // 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.loginEdit', false); |
| | | } |
| | | else { |
| | | // component.set('v.errorMessage', 'set_doctor_list failed.'); |
| | | this.error('set_doctor_list failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | } |
| | | |
| | | } else { |
| | | if (doctor_value == '科室会') { |
| | | this.set_doctor_list2(component); |
| | | } else { |
| | | component.find('select_doctor').set('v.options', ''); |
| | | } |
| | | } |
| | | }, |
| | | 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(); |
| | | |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].selected == 'true') { |
| | | res[i].selected = true; |
| | | } else { |
| | | res[i].selected = false; |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | component.set('v.loginEdit', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action1); |
| | | }, |
| | | productcategoryChange1: function (component, event, helper) { |
| | | var product_category_id = component.find('select_Product1').get('v.value'); |
| | |
| | | var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined; |
| | | var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined; |
| | | if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) { |
| | | component.set('v.errorMessage', '不能选择同样的产品区分'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', '不能选择同样的产品区分'); |
| | | this.error('不能选择同样的产品区分'); |
| | | //this.showErrorToast(component); |
| | | component.find('select_Product1').set('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.errorMessage', '不能选择同样的产品区分'); |
| | | this.error('不能选择同样的产品区分'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.UseProduct2_TEXT', ''); |
| | | } |
| | | }, |
| | | productcategoryChange3: function (component, event, helper) { |
| | |
| | | var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined; |
| | | var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined; |
| | | if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) { |
| | | component.set('v.errorMessage', '不能选择同样的产品区分'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', '不能选择同样的产品区分'); |
| | | this.error('不能选择同样的产品区分'); |
| | | //this.showErrorToast(component); |
| | | component.find('select_Product3').set('v.value', ''); |
| | | } |
| | | }, |
| | |
| | | return obj; |
| | | }, |
| | | set_selected: function (component, aura_id_name, value) { |
| | | ; |
| | | var select_tmp = component.find(aura_id_name).get('v.options'); |
| | | if (select_tmp) { |
| | | for (var i = 0; i < select_tmp.length; i++) { |
| | |
| | | }, |
| | | //弹出 成功提示 |
| | | showSuccessToast: function (component) { |
| | | |
| | | $A.util.removeClass(component.find('successDiv'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('successDiv'), 'slds-hide'); |
| | |
| | | }, |
| | | //弹出 成功提示 |
| | | showSuccessToast01: function (component) { |
| | | |
| | | $A.util.removeClass(component.find('successDiv01'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('successDiv01'), 'slds-hide'); |
| | |
| | | }, |
| | | //弹出 错误提示 |
| | | showErrorToast: function (component) { |
| | | |
| | | $A.util.removeClass(component.find('errorDiv'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('errorDiv'), 'slds-hide'); |
| | | }), |
| | | 3000 |
| | | ); |
| | | }, |
| | | //弹出 错误提示 |
| | | showErrorToast01: function (component) { |
| | | |
| | | $A.util.removeClass(component.find('errorDiv01'), 'slds-hide'); |
| | | window.setTimeout($A.getCallback(function () { |
| | | $A.util.addClass(component.find('errorDiv01'), 'slds-hide'); |
| | | }), |
| | | 6000 |
| | | ); |
| | | }, |
| | | error: function (message) { |
| | |
| | | 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); |
| | | this.set_doctor_list_edit(component, event, helper); |
| | | }, |
| | | createCancel: function (component, event, helper) { |
| | | component.set('v.truthy', false); |
| | | var modal_newAC = component.find('modal_newAC') |
| | | $A.util.addClass(modal_newAC, 'disp_none'); |
| | | component.find('OppMessage').setError(''); |
| | | }, |
| | | //科室赋值 |
| | | setOpportunity_cfilter: function (component) { |
| | |
| | | if (opportunity_cfilter != '' && opportunity_cfilter != null) { |
| | | opportunity_cfilter += ' AND '; |
| | | } |
| | | // fy Department_Cateogy_text__c |
| | | opportunity_cfilter += 'Department_Cateogy__c=' + '\'' + Department_Cateogy__c + '\''; |
| | | // opportunity_cfilter += 'Department_Cateogy_text__c=' + '\'' + Department_Cateogy__c + '\''; |
| | | } |
| | | component.set('v.opportunity_cfilter', opportunity_cfilter); |
| | | }, |
| | |
| | | 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)); |
| | | var allTextLines = data.split(/\r\n|\n/); |
| | |
| | | var filecontentdata; |
| | | var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">"; |
| | | content += "<thead><tr class=\"slds-text-title--caps\">"; |
| | | content += '<th scope=\"col"\>' + '行号' + '</th>'; |
| | | content += '<th scope=\"col"\ style=\"width:100px">' + '行号' + '</th>'; |
| | | for (i = 0; i < headers.length; i++) { |
| | | content += '<th scope=\"col"\>' + headers[i] + '</th>'; |
| | | if (headers[i] == '产品1同类耗材科室月使用量') { |
| | | content += '<th scope=\"col"\ style=\"width:250px"\>' + headers[i] + '</th>'; |
| | | } else { |
| | | content += '<th scope=\"col"\ style=\"width:200px"\>' + headers[i] + '</th>'; |
| | | } |
| | | } |
| | | content += "</tr></thead>"; |
| | | for (var i = 1; i < allTextLines.length; i++) { |
| | |
| | | }; |
| | | reader.readAsDataURL(file); |
| | | }, |
| | | |
| | | // fy 调用pi改造的 获取url 和 token的方法 |
| | | search_contact_url: function (component, sobject, callback) { |
| | | var action = component.get("c.getAwsurl"); |
| | | action.setParams({ |
| | | sobj: sobject |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var result = response.getReturnValue(); |
| | | if (callback) callback(result); |
| | | } |
| | | else { |
| | | //component.set('v.errorMessage', 'AWS url/token error.'); |
| | | this.error('AWS url/token error.'); |
| | | //this.showErrorToast01(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | // fy 调用pi改造的 获取.客户人员的方法 |
| | | search_core: function (token, searchUrl, payload, callback, component) { |
| | | console.log('searchUrl = ' + searchUrl); |
| | | fetch(searchUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': token |
| | | } |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then((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.error('AWS search error.'); |
| | | //this.showErrorToast01(component); |
| | | component.set('v.login', false); |
| | | }); |
| | | }, |
| | | saveRecords: function (component, event, helper) { |
| | | component.set('v.login', true); |
| | | //component.set('v.login', true); |
| | | component.set('v.modal_import_spinner', true); |
| | | //fy 导入 202200506 start |
| | | var action1 = component.get("c.processDataAWSId"); |
| | | action1.setParams({ |
| | | fileData: component.get("v.fileContentData"), |
| | | }); |
| | | action1.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state === "SUCCESS") { |
| | | |
| | | var ress = response.getReturnValue(); |
| | | if (ress) { |
| | | var valur = ress.split('error1'); |
| | | if (valur.length <= 1) { |
| | | var res = JSON.parse(response.getReturnValue()); |
| | | |
| | | var dataArr = new Array(); |
| | | var dataMap = new Map(); |
| | | res.forEach(item => { |
| | | 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); |
| | | } |
| | | }); |
| | | |
| | | let obj = Object.create(null); |
| | | obj['dataIds'] = dataArr; |
| | | var payload = JSON.stringify(obj); |
| | | 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) => { |
| | | console.log('result = ' + JSON.stringify(result)); |
| | | if (result.status == '0') { |
| | | if (result.object != null && result.object.length != 0) { |
| | | //component.set('v.login', true); |
| | | component.set('v.modal_import_spinner', true); |
| | | this.saveRecordsEditFile(component, dataMap, result.object, helper); |
| | | } else { |
| | | //component.set('v.errorMessage', 'AWS 查询数据为空 '); |
| | | this.error('AWS 查询数据为空 '); |
| | | //this.showErrorToast01(component); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | } else { |
| | | //component.set('v.errorMessage', 'AWS search status : ' + result.status); |
| | | this.error('AWS search status : ' + result.status); |
| | | //this.showErrorToast01(component); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | }, component); |
| | | }); |
| | | } else { |
| | | //component.set('v.errorMessage', valur[1] + '\n' + "请修改后重新上传"); |
| | | this.error(valur[1] + '\n' + "请修改后重新上传"); |
| | | //this.showErrorToast01(component); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | $A.enqueueAction(action1); |
| | | // var action = component.get("c.processData"); |
| | | // var fieldsList = ['Name', 'Phone', 'AccountNumber']; //Please write your code dynamic fields |
| | | // var filedata =component.get("v.fileContentData"); |
| | | // action.setParams({ |
| | | // fileData: filedata, |
| | | // sobjectName: 'Account', //Any object |
| | | // fields: fieldsList |
| | | // }); |
| | | // action.setCallback(this, function (response) { |
| | | // var state = response.getState(); |
| | | // if (state === "SUCCESS") { |
| | | // var res = response.getReturnValue(); |
| | | // var res1 = ''; |
| | | // if (res != 'success') { |
| | | // var ress = res.split('='); |
| | | // console.log(ress); |
| | | // for (var i = 0; i < ress.length; i++) { |
| | | // res1 += ress[i].substr(7) + '\n'; |
| | | // } |
| | | // console.log("==" + res1); |
| | | // component.set('v.errorMessage', res1 + "请修改后重新上传"); |
| | | // this.showErrorToast01(component); |
| | | // 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); |
| | | // } |
| | | // } |
| | | // else if (state === "INCOMPLETE") { |
| | | // component.set('v.login', false); |
| | | // } |
| | | // else if (state === "ERROR") { |
| | | // var errors = response.getError(); |
| | | // if (errors) { |
| | | // if (errors[0] && errors[0].message) { |
| | | // console.log("Error message: " + |
| | | // errors[0].message); |
| | | // component.set('v.login', false); |
| | | // } |
| | | // } else { |
| | | // console.log("Unknown error"); |
| | | // component.set('v.login', false); |
| | | // } |
| | | // } |
| | | // }); |
| | | // $A.enqueueAction(action); |
| | | |
| | | }, |
| | | saveRecordsEditFile: function (component, dataMap, searchData, helper) { |
| | | var searchDataMap = new Map(); |
| | | for (var i = 0; i < searchData.length; i++) { |
| | | if (searchData[i].name != null) { |
| | | 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'; |
| | | |
| | | 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 { |
| | | if (filelist[5] != '医生' && filelist[5] != '医生+护士') {//&&filelist[5]!='医生+护士' |
| | | 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 { |
| | | error += 'error1 第' + i + '行数据拜访人AWS不存在'; |
| | | } |
| | | } else { |
| | | if (filelist[5] != '医生' && filelist[5] != '医生+护士') {//&&filelist[5]!='医生+护士' |
| | | error += 'error1 第' + i + '行数据拜访人不存在'; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | fileStr += filelist.toString(); |
| | | fileStr += '\n'; |
| | | } |
| | | } |
| | | |
| | | if (error != '') { |
| | | console.log('zhj error = ' + error); |
| | | let errorArray = error.split('error1'); |
| | | let errorDatas = []; |
| | | let errorDataRow = []; |
| | | |
| | | var fileContentData = component.get("v.fileContentData").split('\n'); |
| | | console.log('fileContentData = ' + JSON.stringify(fileContentData)) |
| | | console.log('errorArray = ' + JSON.stringify(errorArray)) |
| | | for (var i in errorArray) { |
| | | // if (errorArray[i] != '') { |
| | | // let errorData = {} |
| | | // errorData.errorRow = errorArray[i].trim().substring(1, 2); |
| | | // errorData.errorInfo = errorArray[i].trim().substring(5); |
| | | // errorDatas.push(errorData); |
| | | // } |
| | | if (errorArray[i] != '') { |
| | | let errorData = {} |
| | | let index = errorDataRow.indexOf(errorArray[i].trim().substring(1, 2)); |
| | | if (index == -1) { |
| | | errorData.errorRow = errorArray[i].trim().substring(1, 2); |
| | | errorDataRow.push(errorData.errorRow); |
| | | errorData.errorInfo = errorArray[i].trim().substring(5); |
| | | if(errorData.errorInfo == '拜访人AWS不存在'){ |
| | | errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[5] + '不存在'; |
| | | } |
| | | errorDatas.push(errorData); |
| | | } else { |
| | | if(errorArray[i].trim().substring(5) == '拜访人AWS不存在'){ |
| | | errorData[index].errorInfo = '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '不存在'; |
| | | }else{ |
| | | errorDatas[index].errorInfo += '; ' + errorArray[i].trim().substring(5); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var fileContentData = component.get("v.fileContentData").split('\n'); |
| | | console.log('fileContentData = ' + JSON.stringify(fileContentData)) |
| | | let errorColumns = [ |
| | | { label: '错误行', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 }, |
| | | { label: '错误信息', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true } |
| | | ]; |
| | | for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) { |
| | | let initialWidth = 180; |
| | | if (fileContentData[0].split(',')[i] == '产品1同类耗材科室月使用量' || fileContentData[0].split(',')[i] == '使用产品1(产品型号)') { |
| | | initialWidth = 250; |
| | | } |
| | | errorColumns.push({ |
| | | label: fileContentData[0].split(',')[i], |
| | | fieldName: 'field' + i, |
| | | type: 'text', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: initialWidth |
| | | }); |
| | | } |
| | | |
| | | for (var i = 0; i < errorDatas.length; i++) { |
| | | let data = fileContentData[errorDatas[i].errorRow]; |
| | | console.log('data = ' + JSON.stringify(data)); |
| | | if (data) { |
| | | for (var j = 0; j < data.split(',').length; j++) { |
| | | let label = 'field' + j; |
| | | errorDatas[i][label] = data.split(',')[j]; |
| | | } |
| | | } |
| | | } |
| | | console.log('errorDatas =' + JSON.stringify(errorDatas)) |
| | | component.set('v.errorColumns', errorColumns); |
| | | component.set('v.errorData', errorDatas); |
| | | component.set("v.showErrorInfo", true); |
| | | |
| | | console.log('error = ' + error); |
| | | //component.set('v.errorMessage', error); |
| | | this.error(error); |
| | | //this.showErrorToast01(component); |
| | | console.log('error=' + error); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | return; |
| | | } |
| | | |
| | | console.log('fileStr=' + fileStr); |
| | | $A.getCallback(function () { |
| | | |
| | | helper.ImportMethod(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"); |
| | | action.setParams({ |
| | | fileData: component.get("v.fileContentData"), |
| | | fileData: fileStr, |
| | | sobjectName: 'Account', //Any object |
| | | fields: fieldsList |
| | | }); |
| | |
| | | if (res != 'success') { |
| | | var ress = res.split('='); |
| | | console.log(ress); |
| | | let errorDatas = []; |
| | | let errorDataRow = []; |
| | | var fileContentData = component.get("v.fileContentData").split('\n'); |
| | | console.log('fileContentData[1].split(,)[5] = ' + fileContentData[1].split(',')[5]) |
| | | |
| | | for (var i = 0; i < ress.length; i++) { |
| | | res1 += ress[i].substr(7) + '\n'; |
| | | if (ress[i] != '') { |
| | | let errorData = {} |
| | | let index = errorDataRow.indexOf(ress[i].substr(7).substring(1, 2)); |
| | | if (index == -1) { |
| | | errorData.errorRow = ress[i].substr(7).substring(1, 2); |
| | | errorDataRow.push(errorData.errorRow); |
| | | errorData.errorInfo = ress[i].substr(7).substring(5); |
| | | if(errorData.errorInfo == '拜访人不存在'){ |
| | | console.log('errorData.errorRow = ' + errorData.errorRow) |
| | | errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[5] + '不存在'; |
| | | } |
| | | errorDatas.push(errorData); |
| | | } else { |
| | | |
| | | if(ress[i].substr(7).substring(5) == '拜访人不存在'){ |
| | | errorDatas[index].errorInfo += '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '不存在'; |
| | | }else{ |
| | | errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | var fileContentData = component.get("v.fileContentData").split('\n'); |
| | | let errorColumns = [ |
| | | { label: '错误行', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 }, |
| | | { label: '错误信息', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true } |
| | | ]; |
| | | for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) { |
| | | let initialWidth = 180; |
| | | if (fileContentData[0].split(',')[i] == '产品1同类耗材科室月使用量' || fileContentData[0].split(',')[i] == '使用产品1(产品型号)') { |
| | | initialWidth = 250; |
| | | } |
| | | errorColumns.push({ |
| | | label: fileContentData[0].split(',')[i], |
| | | fieldName: 'field' + i, |
| | | type: 'text', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: initialWidth |
| | | }); |
| | | } |
| | | |
| | | for (var i = 0; i < errorDatas.length; i++) { |
| | | let data = fileContentData[errorDatas[i].errorRow]; |
| | | console.log('data = ' + JSON.stringify(data)); |
| | | for (var j = 0; j < data.split(',').length; j++) { |
| | | let label = 'field' + j; |
| | | errorDatas[i][label] = data.split(',')[j]; |
| | | } |
| | | } |
| | | component.set('v.errorColumns', errorColumns); |
| | | component.set('v.errorData', errorDatas); |
| | | component.set("v.showErrorInfo", true); |
| | | |
| | | console.log("==" + res1); |
| | | component.set('v.errorMessage', res1 + "请修改后重新上传"); |
| | | this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | //component.set('v.errorMessage', res1 + "请修改后重新上传"); |
| | | this.error(res1 + "请修改后重新上传"); |
| | | //this.showErrorToast01(component); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } else { |
| | | component.set('v.successMessage', '导入成功'); |
| | | this.showSuccessToast01(component); |
| | | component.set("v.showMain", true); |
| | | component.set('v.login', false); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | this.doinit(component, event, helper); |
| | | } |
| | | } |
| | | else if (state === "INCOMPLETE") { |
| | | component.set('v.login', false); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | |
| | | if (errors[0] && errors[0].message) { |
| | | console.log("Error message: " + |
| | | errors[0].message); |
| | | component.set('v.login', false); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | } else { |
| | | console.log("Unknown error"); |
| | | component.set('v.login', false); |
| | | //component.set('v.login', false); |
| | | component.set('v.modal_import_spinner', false); |
| | | } |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | |
| | | },//全角转半角 |
| | | ToCDB: function (str) { |
| | | var tmp = ""; |
| | | for (var i = 0; i < str.length; i++) { |
| | | if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) { |
| | | tmp += String.fromCharCode(str.charCodeAt(i) - 65248); |
| | | } |
| | | else { |
| | | tmp += String.fromCharCode(str.charCodeAt(i)); |
| | | } |
| | | } |
| | | return tmp |
| | | }, |
| | | //导出的CSV文件 |
| | | convertArrayOfObjectsToCSV: function (component, objectRecords) { |
| | |
| | | } |
| | | 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', 'WarlockClassification__c', 'ProductCcategory__c', 'productCategories__c','warlocksNumber__c','WorkMark__c']; |
| | | thkeys = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录', '医院人员','产品分类(第三分类)', '使用产品1(产品型号)', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','术士分类','已采用其他品牌','其他品牌产品类别','产品用量','工作标记'] |
| | | 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.Name; |
| | | csvStringResult += objectRecords[i].UseProduct1__r.Asset_Model_No__c; |
| | | } else if (skey == 'UseProduct2__c') { |
| | | csvStringResult += objectRecords[i].UseProduct2__r.Name; |
| | | csvStringResult += objectRecords[i].UseProduct2__r.Asset_Model_No__c; |
| | | } else if (skey == 'UseProduct3__c') { |
| | | csvStringResult += objectRecords[i].UseProduct3__r.Name; |
| | | } else if (skey == 'EffectProgress__c'){ |
| | | csvStringResult += objectRecords[i].EffectProgress__r.EffectProgress__c; |
| | | }else if (skey == 'WarlockClassification__c'){ |
| | | csvStringResult += objectRecords[i].WarlockClassification__r.WarlockClassification__c; |
| | | }else if(skey == 'ProductCcategory__c'){ |
| | | csvStringResult += objectRecords[i].ProductCcategory__r.ProductCcategory__c; |
| | | }else if(skey == 'productCategories__c'){ |
| | | csvStringResult += objectRecords[i].productCategories__r.productCategories__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 = ['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 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++) { |
| | | content += '<th scope=\"col"\>' + headers[i] + '</th>'; |
| | | //content += '<th scope=\"col"\ style=\"width:200px">' + headers[i] + '</th>'; |
| | | if (headers[i] == '产品1同类耗材科室月使用量') { |
| | | content += '<th scope=\"col"\ style=\"width:250px"\>' + headers[i] + '</th>'; |
| | | } else { |
| | | content += '<th scope=\"col"\ style=\"width:200px"\>' + headers[i] + '</th>'; |
| | | } |
| | | } |
| | | content += "</tr></thead>"; |
| | | for (var i = 0; i < objectRecords.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') { |
| | |
| | | } else if (skey == 'doctor2__c') { |
| | | content += '<td>' + objectRecords[i].doctor2__r.Name + '</td>'; |
| | | } else if (skey == 'UseProduct1__c') { |
| | | content += '<td>' + objectRecords[i].UseProduct1__r.Name + '</td>'; |
| | | content += '<td>' + objectRecords[i].UseProduct1__r.Asset_Model_No__c + '</td>'; |
| | | } else if (skey == 'UseProduct2__c') { |
| | | content += '<td>' + objectRecords[i].UseProduct2__r.Name + '</td>'; |
| | | content += '<td>' + objectRecords[i].UseProduct2__r.Asset_Model_No__c + '</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.EffectProgress__c + '</td>'; |
| | | }else if (skey == 'WarlockClassification__c'){ |
| | | content += '<td>' + objectRecords[i].WarlockClassification__r.WarlockClassification__c + '</td>'; |
| | | }else if (skey == 'ProductCcategory__c'){ |
| | | content += '<td>' + objectRecords[i].ProductCcategory__r.ProductCcategory__c + '</td>'; |
| | | }else if (skey == 'productCategories__c'){ |
| | | content += '<td>' + objectRecords[i].productCategories__r.productCategories__c + '</td>'; |
| | | }else{ |
| | | content += '<td>' + objectRecords[i].UseProduct3__r.Asset_Model_No__c + '</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); |
| | | } |
| | | else { |
| | | component.set('v.errorMessage', 'newlyBuild failed.'); |
| | | this.showErrorToast(component); |
| | | //component.set('v.errorMessage', 'newlyBuild failed.'); |
| | | this.error('newlyBuild failed.'); |
| | | //this.showErrorToast(component); |
| | | component.set('v.login', false); |
| | | } |
| | | }); |
| | |
| | | } |
| | | }, |
| | | //科室同类耗材验证必须输入数字 |
| | | 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{ |
| | | component.set('v.errorMessage', '必须输入数字!'); |
| | | this.showErrorToast(component); |
| | | 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.error('产品1同类耗材科室月使用量必须输入数字!'); |
| | | //this.showErrorToast(component); |
| | | } |
| | | }else{ |
| | | component.set('v.errorMessage', '最多输入14为数字!'); |
| | | this.showErrorToast(component); |
| | | } else { |
| | | //component.set('v.errorMessage', '产品1同类耗材科室月使用量最多输入14位数字!'); |
| | | this.error('产品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{ |
| | | component.set('v.errorMessage', '必须输入数字!'); |
| | | this.showErrorToast(component); |
| | | if (sc != null) { |
| | | if (sc.length <= 14) { |
| | | if (sc.replace(/\D/gi, "")) { |
| | | component.set("v.select_warlocksNumber", sc); |
| | | } else { |
| | | //component.set('v.errorMessage', '产品用量必须输入数字!'); |
| | | this.error('产品用量必须输入数字!'); |
| | | //this.showErrorToast(component); |
| | | } |
| | | }else{ |
| | | component.set('v.errorMessage', '最多输入14为数字!'); |
| | | this.showErrorToast(component); |
| | | } else { |
| | | //component.set('v.errorMessage', '产品用量最多输入14位数字!'); |
| | | this.error('产品用量最多输入14位数字!'); |
| | | //this.showErrorToast(component); |
| | | } |
| | | } |
| | | }, |
| | | //工作会记录 |
| | | selectPurposeType: function (component,event,helper) { |
| | | selectPurposeType: function (component, event, helper) { |
| | | |
| | | var doctor_value = component.find('select_purpose_type').get('v.value'); |
| | | alert(doctor_value); |
| | | if(doctor_value != ''){ |
| | | var action = component.get('c.selectPurposeTypes'); |
| | | action.setParams({ |
| | | 'doctor_value': doctor_value |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_EffectProgress').set("v.options", JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $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 |
| | | }); |
| | | 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) { |
| | | var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value'); |
| | | if(select_ProductCcategory != ''){ |
| | | var result = component.find('result'); |
| | | $A.util.removeClass(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) { |
| | | var result = component.find('result'); |
| | | $A.util.removeClass(result, 'disp_none'); |
| | | // alert(doctor_value); |
| | | if (doctor_value != '科室会') { |
| | | component.find('new_con').set('v.disabled', false); |
| | | } else { |
| | | component.find('select_productCategories').set('v.value', ''); |
| | | var result = component.find('result'); |
| | | $A.util.addClass(result, 'disp_none'); |
| | | this.select_ProductCcategory(component); |
| | | component.find('new_con').set('v.disabled', true); |
| | | } |
| | | if (doctor_value != '') { |
| | | this.set_doctor_list_edit(component); |
| | | var action = component.get('c.selectPurposeTypes'); |
| | | action.setParams({ |
| | | 'doctor_value': doctor_value |
| | | }); |
| | | action.setCallback(this, function (response) { |
| | | var state = response.getState(); |
| | | if (state == 'SUCCESS') { |
| | | var res = response.getReturnValue(); |
| | | component.find('select_EffectProgress').set("v.options", JSON.parse(JSON.stringify(res))); |
| | | } |
| | | }); |
| | | $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 |
| | | }); |
| | | 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) { |
| | | 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 { |
| | | |
| | | component.find('select_productCategories').set('v.value', ''); |
| | | var result = component.find('result'); |
| | | $A.util.addClass(result, 'disp_none'); |
| | | this.select_ProductCcategory(component); |
| | | } |
| | | }, |
| | | //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) { |
| | | action.setParams(para); |
| | | } |
| | | if (callback) { |
| | | action.setCallback(this, function (data) { |
| | | callback(data); |
| | | }); |
| | | } |
| | | |
| | | $A.enqueueAction(action); |
| | | }, |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | |
| | | //zhj 导出错误信息 2023-05-16 start |
| | | exportErrorInfoHelper: function (component) { |
| | | var errorData = component.get('v.errorData'); |
| | | var errorColumns = component.get('v.errorColumns'); |
| | | |
| | | var datas = []; |
| | | let errorColumnsArray = []; |
| | | for (var i in errorColumns) { |
| | | errorColumnsArray.push(errorColumns[i].label); |
| | | } |
| | | datas.push(errorColumnsArray); |
| | | //datas.push(errorColumns); |
| | | |
| | | for (var i in errorData) { |
| | | let data = []; |
| | | data.push(errorData[i].errorRow) |
| | | data.push(errorData[i].errorInfo) |
| | | for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) { |
| | | data.push(errorData[i]['field' + j]) |
| | | } |
| | | datas.push(data); |
| | | } |
| | | |
| | | console.log('datas = ' + JSON.stringify(datas)); |
| | | var csv = this.convertToCSV(component, datas); |
| | | console.log('csv = ' + JSON.stringify(csv)) |
| | | this.downloadCSV(component, csv); |
| | | }, |
| | | |
| | | convertToCSV: function (component, data) { |
| | | console.log('enter convertToCSV') |
| | | console.log('data = ' + data); |
| | | var csv = ''; |
| | | for (var i = 0; i < data.length; i++) { |
| | | var row = data[i]; |
| | | console.log('row = ' + JSON.stringify(row)); |
| | | for (var j = 0; j < row.length; j++) { |
| | | var val = ''; |
| | | val = row[j] === null ? '' : row[j].toString(); |
| | | console.log('val = ' + val); |
| | | if (val.indexOf(',') !== -1 || val.indexOf('"') !== -1 || val.indexOf('\n') !== -1) { |
| | | //val = '"' + val.replace(/"/g,'""') + '"'; |
| | | } |
| | | if (j > 0) { |
| | | csv += ','; |
| | | } |
| | | csv += val; |
| | | } |
| | | csv += '\n'; |
| | | } |
| | | return csv; |
| | | }, |
| | | |
| | | downloadCSV: function (component, csv) { |
| | | var link = document.createElement('a'); |
| | | var bom = "\uFEFF"; |
| | | link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv); |
| | | link.download = 'data.csv'; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | }, |
| | | error: function (message) { |
| | | // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap'); |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | | |
| | | toastEvent.setParams({ |
| | | "title": "错误!", |
| | | "message": message, |
| | | "type": "error", |
| | | //"duration" : "sticky" |
| | | }); |
| | | toastEvent.fire(); |
| | | }, |
| | | //zhj 导出错误信息 2023-05-16 end |
| | | }) |