| | |
| | | ({ |
| | | doinit : function(component, event, helper) { |
| | | this.report_date_list(component, event, helper, 5); |
| | | |
| | | component.set('v.login',true); |
| | | var action = component.get('c.getalldata'); |
| | | action.setCallback(this,function(response){ |
| | |
| | | component.set('v.fieldsmap',res.fieldsMap); |
| | | component.set('v.allselectlist',res.allselectlist); |
| | | component.set('v.doclist',res.doclist); |
| | | component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c)); |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | // component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c)); |
| | | this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c); |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | component.find('select_department').set('v.options', this.conv_selected(res.allselectlist.Department_Cateogy__c)); |
| | | component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.Purpose_Type__c)); |
| | | component.find('select_result').set('v.options', this.conv_selected(res.allselectlist.Result__c)); |
| | |
| | | component.set('v.selected_agency_person', res.allselectlist.AgencyPerson__c[0].label); |
| | | component.set('v.dialog_type', '新建'); |
| | | component.set('v.awsurl', res.awsurl);// 20220222 PI改造 by Bright |
| | | component.set('v.contactawsurl', res.contactawsurl);// 20220222 PI改造 by Bright |
| | | |
| | | this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value')); |
| | | |
| | |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | search_contact : function(component, event, helper, resobj) { |
| | | let contactData = Object.create(null); |
| | | var dataArr = new Array(); |
| | | for (let i = 0; i < resobj.length; i++) { |
| | | if (resobj[i].awsid != null && resobj[i].awsid != ''){ |
| | | contactData[resobj[i].awsid] = resobj[i]; |
| | | dataArr.push(resobj[i].awsid); |
| | | } |
| | | } |
| | | let obj= Object.create(null); |
| | | obj['dataIds'] = dataArr; |
| | | var payload = JSON.stringify(obj); |
| | | this.search_contact_url(component, 'Contact', (result)=>{ |
| | | var token = result.token; |
| | | var searchUrl = result.searchUrl; |
| | | this.search_core(token,searchUrl,payload,(result)=>{ |
| | | if(result.status == '0'){ |
| | | if(result.object != null){ |
| | | this.to_contact_list(result,contactData,component); |
| | | }else{ |
| | | component.set('v.login',false); |
| | | } |
| | | }else{ |
| | | this.error('AWS search status : ' + result.status); |
| | | component.set('v.login',false); |
| | | } |
| | | },component); |
| | | |
| | | }); |
| | | }, |
| | | |
| | | to_contact_list : function(result,retMap,component) { |
| | | var resls = result.object; |
| | | var res = []; |
| | | var space = {}; |
| | | space['label'] = ''; |
| | | space['selected'] = true; |
| | | space['value'] = ''; |
| | | res.push(space); |
| | | |
| | | for (var i = 0; i < resls.length; i++) { |
| | | var t = {}; |
| | | t['label'] = resls[i].lastName; |
| | | t['selected'] = false; |
| | | t['Doctor_Division1__c'] = resls[i].doctorDivision1; |
| | | t['value'] = retMap[resls[i].dataId].value; |
| | | res.push(t); |
| | | } |
| | | component.find('select_agency_person').set('v.options',res); |
| | | component.set('v.allselectlistAgencyPerson',res); |
| | | component.set('v.login',false); |
| | | }, |
| | | |
| | | 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{ |
| | | this.error('AWS url/token error.'); |
| | | component.set('v.login',false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action); |
| | | }, |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | |
| | | select_department : function(component, event, helper) { |
| | | var dc = component.find("select_department").get("v.value"); |
| | |
| | | |
| | | // 20220222 PI改造 by Bright--start |
| | | let dataIds = []; |
| | | let dataIds1 = []; |
| | | let mm = {}; |
| | | let b = false; |
| | | let b1 = false; |
| | | for (const rep of res.reports) { |
| | | if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c) { |
| | | dataIds.push(rep.doctor2__r.AWS_Data_Id__c); |
| | | } |
| | | |
| | | if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c) { |
| | | dataIds1.push(rep.Person_In_Charge2__r.AWS_Data_Id__c); |
| | | } |
| | | } |
| | | let Foo = null; |
| | | Foo = function(){ |
| | | if(b && b1){ |
| | | for (const rep of res.reports) { |
| | | if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)) { |
| | | rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c]; |
| | | } |
| | | if (rep.Person_In_Charge2__r && rep.Person_In_Charge2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.Person_In_Charge2__r.AWS_Data_Id__c)) { |
| | | rep.Person_In_Charge2__r.awsdata = mm[rep.Person_In_Charge2__r.AWS_Data_Id__c]; |
| | | } |
| | | } |
| | | |
| | | $A.getCallback(()=>component.set('v.reports', res.reports))(); |
| | | }else{ |
| | | console.log('b='+b + ',b1='+b1+',continue'); |
| | | setTimeout(Foo,100); |
| | | } |
| | | } |
| | | |
| | | if(dataIds.length > 0){ |
| | | let awsurl = component.get('v.awsurl'); |
| | | helper.search_agency_contact_core(awsurl.token,awsurl.searchUrl,JSON.stringify({ |
| | | helper.search_core(awsurl.token,awsurl.searchUrl,JSON.stringify({ |
| | | "dataIds":dataIds |
| | | }),(result)=>{ |
| | | if(result.status == '0'){ |
| | | let mm = {}; |
| | | |
| | | for (const m of result.object) { |
| | | mm[m.dataId] = m; |
| | | } |
| | | for (const rep of res.reports) { |
| | | if (rep.doctor2__r && rep.doctor2__r.AWS_Data_Id__c && mm.hasOwnProperty(rep.doctor2__r.AWS_Data_Id__c)) { |
| | | rep.doctor2__r.awsdata = mm[rep.doctor2__r.AWS_Data_Id__c]; |
| | | } |
| | | } |
| | | component.set('v.reports', res.reports); |
| | | b = true; |
| | | Foo(); |
| | | }else{ |
| | | this.error('AWS search status : ' + result.status); |
| | | } |
| | | },component); |
| | | }else{ |
| | | b = true; |
| | | } |
| | | |
| | | |
| | | |
| | | if(dataIds1.length > 0){ |
| | | let contactawsurl = component.get('v.contactawsurl'); |
| | | helper.search_core(contactawsurl.token,contactawsurl.searchUrl,JSON.stringify({ |
| | | "dataIds":dataIds1 |
| | | }),(result)=>{ |
| | | if(result.status == '0'){ |
| | | |
| | | for (const m of result.object) { |
| | | mm[m.dataId] = m; |
| | | } |
| | | b1 = true; |
| | | Foo(); |
| | | }else{ |
| | | this.error('AWS search status : ' + result.status); |
| | | } |
| | | },component); |
| | | }else{ |
| | | b1 = true; |
| | | } |
| | | // 20220222 PI改造 by Bright--end |
| | | |
| | |
| | | }, |
| | | |
| | | get_agency_person_name : function(component, agency_person_value) { |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | var allselectlist = component.get('v.allselectlist.AgencyPerson__c'); |
| | | // var allselectlist = component.get('v.allselectlistAgencyPerson'); |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | var new_label = ''; |
| | | for (var i = 0; i < allselectlist.length; i++) { |
| | | if (agency_person_value == allselectlist[i].value) { |
| | |
| | | var name = component.get('v.selected_agency_person'); |
| | | var ret = this.create_report_header(component, name, select_agency, select_date); |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | this.set_aws_url(component) |
| | | this.set_aws_url(component,'Agency_Contact__c') |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | }, |
| | | |
| | |
| | | component.find('save_button').set('v.disabled', true); |
| | | |
| | | var Report_Date__c = component.get('v.data.Report_Date__c'); |
| | | alert('Report_Date__c'+Report_Date__c); |
| | | // alert('Report_Date__c'+Report_Date__c); |
| | | var Person_In_Charge2__c = ""; |
| | | var Submit_date__c = ""; |
| | | if (component.get('v.mode') == 'edit') { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = component.get('v.select_report_data').Submit_date__c; |
| | | alert('Submit_date__c'+Submit_date__c); |
| | | // alert('Submit_date__c'+Submit_date__c); |
| | | |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | |
| | | } else { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = this.get_date_string(component.find('select_date').get('v.value')); |
| | | alert('Submit_date__c'+Submit_date__c); |
| | | // alert('Submit_date__c'+Submit_date__c); |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | | Person_In_Charge2__c = component.find('select_agency_person').get('v.value'); |
| | |
| | | if (!Department_Cateogy__c) { error.push("科室 不存在"); } |
| | | if (!doctor2__c) { error.push("拜访人 不存在"); } |
| | | if (!Purpose_Type__c) { error.push("活动区分 不存在"); } |
| | | if (!SupportNeeds__c) { error.push("支援需求 不存在"); } |
| | | // if (!SupportNeeds__c) { error.push("支援需求 不存在"); } |
| | | if (!Opportunity__c) { Opportunity__c = ""; } |
| | | if (!Product_Category1__c) { error.push("产品区分1 不存在"); } |
| | | if (Purpose_Type__c && (Purpose_Type__c.substr(-3) == 'SIS' || Purpose_Type__c.substr(-3) == 'OPD')) { |
| | |
| | | if (component.get('v.mode') == 'edit') { |
| | | var Agency_Report__c = component.get('v.select_report_data').Id; |
| | | var action = component.get('c.editAgencyReport'); |
| | | alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c); |
| | | debugger |
| | | // alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c); |
| | | action.setParams({ |
| | | "Agency_Report_Id" : Agency_Report__c, |
| | | "Department_Cateogy" : Department_Cateogy__c, |
| | |
| | | /* Save (New & Copy) */ |
| | | |
| | | var action = component.get('c.saveAgencyReport'); |
| | | debugger; |
| | | // alert(SupportNeeds__c); |
| | | action.setParams({ |
| | | "Department_Cateogy" : Department_Cateogy__c, |
| | | "Purpose_Type" : Purpose_Type__c, |
| | |
| | | searchHos : function(component, event, helper) { |
| | | var hospital_name = event.getParam("value"); |
| | | var action = component.get("c.getHospitalList"); |
| | | debugger; |
| | | action.setParams({"hospital_name": hospital_name}); |
| | | |
| | | action.setCallback(this, function(response) { |
| | |
| | | }, |
| | | |
| | | selectHos : function(component, event, helper) { |
| | | debugger |
| | | var hospital_list = component.find('hospital_list'); |
| | | $A.util.removeClass(hospital_list, 'slds-is-open'); |
| | | var accname = event.currentTarget.dataset.accname; |
| | |
| | | } |
| | | }, |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | set_aws_url : function(component) { |
| | | set_aws_url : function(component,sobject) { |
| | | var action = component.get('c.getAwsurl'); |
| | | action.setParams({ |
| | | "sobj" : "Agency_Contact__c", |
| | | "sobj" : sobject, |
| | | }); |
| | | action.setCallback(this,function(response){ |
| | | var state = response.getState(); |
| | |
| | | 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{ |
| | |
| | | if (key == 'sre') {continue;} |
| | | dataArr.push(key); |
| | | } |
| | | if(dataArr.length == 0){ |
| | | component.set('v.login',false); |
| | | this.warning('没有找到符合条件的客户人员'); |
| | | return; |
| | | } |
| | | let obj= Object.create(null); |
| | | obj['dataIds'] = dataArr; |
| | | var data = JSON.stringify(obj); |
| | |
| | | }, |
| | | |
| | | search_agency_contact : function(token,searchUrl,payload,retMap,component) { |
| | | this.search_agency_contact_core(token,searchUrl,payload,(result)=>{ |
| | | this.search_core(token,searchUrl,payload,(result)=>{ |
| | | if(result.status == '0'){ |
| | | this.to_doctor_list(result,retMap,component); |
| | | }else{ |
| | |
| | | // component.set('v.login',false); |
| | | // }); |
| | | }, |
| | | search_agency_contact_core : function(token,searchUrl,payload,callback,component) { |
| | | search_core : function(token,searchUrl,payload,callback,component) { |
| | | fetch(searchUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | |
| | | saveRecords : function(component,event){ |
| | | component.set('v.login',true); |
| | | var action = component.get("c.processData"); |
| | | debugger; |
| | | var selectDate = component.find('select_date').get('v.value'); |
| | | var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic fields |
| | | var sss=component.get("v.fileContentData"); |
| | | action.setParams({ |
| | | fileData : component.get("v.fileContentData"), |
| | | //selectDateselectDate :component.find('select_date').get('v.value'), |
| | |
| | | } |
| | | columnDivider = ','; |
| | | lineDivider = '\n'; |
| | | keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c']; |
| | | thkeys = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果'] |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c']; |
| | | thkeys = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果','支援需求'] |
| | | csvStringResult = ''; |
| | | csvStringResult += thkeys.join(columnDivider); |
| | | csvStringResult += lineDivider; |
| | |
| | | csvStringResult += '"'+ objectRecords[i].Product_Category2__r.Name+'"'; |
| | | }else if(skey == 'Product_Category3__c'){ |
| | | csvStringResult += '"'+ objectRecords[i].Product_Category3__r.Name+'"'; |
| | | }else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | csvStringResult += '"'+ objectRecords[i].SupportNeeds__c+'"'; |
| | | }else{ |
| | | csvStringResult += '"'+ objectRecords[i][skey]+'"'; |
| | | } |
| | |
| | | return csvStringResult; |
| | | }, |
| | | 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','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c']; |
| | | var headers = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果'] |
| | | console.log('进入showexceportdate'+objectRecords);//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | var keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c']; |
| | | var headers = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果','支援需求'] |
| | | var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">"; |
| | | content += "<thead><tr class=\"slds-text-title--caps\">"; |
| | | for(i=0;i<headers.length; i++){ |
| | |
| | | content += '<td>'+ objectRecords[i].Product_Category2__r.Name+'</td>'; |
| | | }else if(skey == 'Product_Category3__c'){ |
| | | content += '<td>'+ objectRecords[i].Product_Category3__r.Name+'</td>'; |
| | | }else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | content += '<td>'+ objectRecords[i].SupportNeeds__c+'</td>'; |
| | | }else{ |
| | | content += '<td>'+ objectRecords[i][skey]+'</td>'; |
| | | } |
| | |
| | | // var data = this.search(searchUrl,data,token); |
| | | // return data;searchUrl,requestSearchPayload,token |
| | | // }, |
| | | |
| | | }) |