From fb04e7c01d119c60632b4298d18fd93f3ccb3d79 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期三, 06 四月 2022 10:32:05 +0800 Subject: [PATCH] 20220405DeployProduction --- force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js | 591 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 562 insertions(+), 29 deletions(-) diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js index 781172b..080fb50 100644 --- a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js +++ b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js @@ -1,7 +1,6 @@ ({ 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){ @@ -12,13 +11,21 @@ component.set('v.fieldsmap',res.fieldsMap); component.set('v.allselectlist',res.allselectlist); component.set('v.doclist',res.doclist); + // 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.find('select_stageName').set('v.options', this.conv_selected(res.allselectlist.StageName__c)); + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // component.find('SupportNeeds__c').set('v.options', this.conv_selected(res.allselectlist.SupportNeeds__c)); + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end 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')); @@ -31,6 +38,80 @@ }); $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"); @@ -46,6 +127,7 @@ } } if (dc != '' || purpose_type != '') { + var action = component.get('c.getProductList'); action.setParams({ "dc" : dc, @@ -53,8 +135,8 @@ }); action.setCallback(this,function(response){ var state = response.getState(); - alert(state); if(state == 'SUCCESS'){ + var res = response.getReturnValue(); component.find('select_Product1').set("v.options", JSON.parse(JSON.stringify(res))); component.find('select_Product2').set("v.options", JSON.parse(JSON.stringify(res))); @@ -91,6 +173,84 @@ if(state == 'SUCCESS'){ var res = response.getReturnValue(); component.set('v.reports', res.reports); + + // 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_core(awsurl.token,awsurl.searchUrl,JSON.stringify({ + "dataIds":dataIds + }),(result)=>{ + if(result.status == '0'){ + + for (const m of result.object) { + mm[m.dataId] = m; + } + 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 + component.set('v.report_count', res.reports.length); // 鏇存柊淇濆瓨寰屻伄select_data鐢� @@ -142,7 +302,10 @@ }, 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) { @@ -201,7 +364,6 @@ if (select_data['Department_Cateogy__c'] != '') { this.set_selected(component, 'select_department', select_data['Department_Cateogy__c']); } - // 鎷滆浜� component.set('v.default_select_doctor_id', select_data['doctor2__c']); this.set_doctor_list(component); @@ -273,9 +435,9 @@ if (reportDate != null) { component.set('v.data.Report_Date__c', reportDate); } - - component.set('v.edit_copy_select_report_id', ""); - } + + component.set('v.edit_copy_select_report_id', ""); + } } } else { // CLOSE @@ -419,6 +581,9 @@ component.set('v.selected_date', select_date); 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,'Agency_Contact__c') + // PIPL update Yin Mingjie 21/02/2022 end }, copy_button : function(component, event, helper) { @@ -488,16 +653,29 @@ }, save_report : function(component, event, helper) { + + // 20220222 PI鏀归�� by Bright--start + let doctor2Name = ''; + let visitortitle = ''; + for(let op of component.find('select_doctor').get('v.options')){ + if (op.selected) { + doctor2Name = op.label; + visitortitle = op.Doctor_Division1__c; + } + } + // 20220222 PI鏀归�� by Bright--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 @@ -505,7 +683,7 @@ } 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'); @@ -524,6 +702,10 @@ // 娲诲姩鍖哄垎 Purpose_Type__c var Purpose_Type__c = component.find('select_purpose_type').get('v.value'); + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // 鏀彺闇�姹� SupportNeeds__c + // var SupportNeeds__c = component.find('SupportNeeds__c').get('v.value'); + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end // 璇环 Opportunity__c var Opportunity__c = component.get('v.data.Opportunity__c'); @@ -572,6 +754,7 @@ if (!Department_Cateogy__c) { error.push("绉戝 涓嶅瓨鍦�"); } if (!doctor2__c) { error.push("鎷滆浜� 涓嶅瓨鍦�"); } if (!Purpose_Type__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')) { @@ -591,10 +774,15 @@ if (component.get('v.mode') == 'edit') { var Agency_Report__c = component.get('v.select_report_data').Id; var action = component.get('c.editAgencyReport'); + debugger + // alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c); action.setParams({ "Agency_Report_Id" : Agency_Report__c, "Department_Cateogy" : Department_Cateogy__c, "Purpose_Type" : Purpose_Type__c, + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // "SupportNeedsc" : SupportNeeds__c, + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end "Agency_Report_Header" : Agency_Report_Header__c, "Agency_Hospital" : Agency_Hospital__c, "Person_In_Charge2" : Person_In_Charge2__c, @@ -655,9 +843,14 @@ /* 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, + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // "SupportNeedsc" : SupportNeeds__c, + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end "Agency_Report_Header" : Agency_Report_Header__c, "Agency_Hospital" : Agency_Hospital__c, "Person_In_Charge2" : Person_In_Charge2__c, @@ -701,6 +894,10 @@ // Save&New鏅傘伄銈︺偅銉炽儔銈﹀唴銉囥兗銈夸竴瑕� if (res.length > 0) { + // 20220222 PI鏀归�� by Bright--start + res[0].doctor2NameOrigin = doctor2Name; + res[0].visitorTitleOrigin = visitortitle; + // 20220222 PI鏀归�� by Bright--end reports_now[reports_now_count] = res[0]; reports_now.sort(function(a,b) { @@ -789,10 +986,10 @@ var ret_obj = []; var now = new Date(); for (var i = 0; i < count; i++) { - + var start_day = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() + 1 - (i * 7))); var end_day = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (7 - now.getDay()) - (i * 7)); - + var start_day_show = new Date(now.getFullYear(), now.getMonth(), (now.getDate() - now.getDay() - (i * 7))); var end_day_show = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()) - (i * 7)); var date_text = start_day.getFullYear() + '/' + (start_day.getMonth() + 1) + '/' + start_day.getDate() + '~' + end_day.getFullYear() + '/' + (end_day.getMonth() + 1) + '/' + end_day.getDate(); @@ -924,6 +1121,7 @@ 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) { @@ -950,6 +1148,7 @@ }, 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; @@ -979,7 +1178,6 @@ var result = component.find('result'); $A.util.addClass(result, 'disp_none'); } - this.select_department(component, null, null); }, @@ -998,7 +1196,144 @@ component.set('v.doctor_title', ''); } }, - + // PIPL update Yin Mingjie 21/02/2022 start + 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{ + this.error('AWS url/token error.'); + component.set('v.login',false); + } + }); + $A.enqueueAction(action); + }, + + insert_agencycontact : function(component,token,newUrl,payload,agencyHospitalid,helper) { + + AWSService.insert(newUrl,payload,function(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); + component.find('OppMessage').setError('AWS insert error.'); + } + },token); + /* + fetch(newUrl, { + method: 'POST', + body: payload, + headers: { + 'Content-Type': 'application/json', + 'pi-token': token + } + }).then((data) => { + return data.json(); + }).then((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); + 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, + "type" : result.object[0].type, + "typeEncrypt" : result.object[0].typeEncrypt, + "doctorDivision1" : result.object[0].doctorDivision1, + "doctorDivision1Encrypt" : result.object[0].doctorDivision1Encrypt, + "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 != ''){ + this.error(acMap.errormsg); + component.set('v.login',false); + }else { + this.error('agency contact insert id error.'); + component.set('v.login',false); + } + } + else{ + this.error('agency contact insert error.'); + component.set('v.login',false); + } + }); + $A.enqueueAction(action); + }, + + to_confirm : function(component,token,confirmUrl,payload) { + 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); + }else { + this.error('AWS confirm error.'); + component.set('v.login',false); + } + }).catch(error => { + this.error('AWS confirm error.'); + component.set('v.login',false); + }); + }, + // PIPL update Yin Mingjie 21/02/2022 end + set_doctor_list : function(component) { var hospital_id = component.get('v.hospitalLinkId'); if (hospital_id) { @@ -1010,8 +1345,10 @@ action.setCallback(this,function(response){ var state = response.getState(); if(state == 'SUCCESS'){ - var res = this.conv_selected(response.getReturnValue()); - + var retMap = this.conv_selected(response.getReturnValue()); + // PIPL update Yin Mingjie 21/02/2022 start + this.AWS_search(retMap,component); + /* var default_doctor = component.get('v.default_select_doctor_id'); if (default_doctor != '' && res.length > 0) { var doctor_title = ''; @@ -1036,6 +1373,8 @@ component.set('v.default_select_doctor_id', ''); component.set('v.doctor_list', res); component.set('v.login',false); + */ + // PIPL update Yin Mingjie 21/02/2022 end } else{ this.error('set_doctor_list failed.'); @@ -1045,6 +1384,116 @@ $A.enqueueAction(action); } }, + + // PIPL update Yin Mingjie 21/02/2022 start + AWS_search : function(retMap,component) { + var token = retMap.sre.token; + var searchUrl = retMap.sre.searchUrl; + + var dataArr = new Array(); + for (const key in retMap) { + 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); + this.search_agency_contact(token,searchUrl,data,retMap,component); + }, + + search_agency_contact : function(token,searchUrl,payload,retMap,component) { + this.search_core(token,searchUrl,payload,(result)=>{ + if(result.status == '0'){ + this.to_doctor_list(result,retMap,component); + }else{ + this.error('AWS search status : ' + result.status); + component.set('v.login',false); + } + },component); + // fetch(searchUrl, { + // method: 'POST', + // body: payload, + // headers: { + // 'Content-Type': 'application/json', + // 'pi-token': token + // } + // }).then((data) => { + // return data.json(); + // }).then((result) => { + + // }).catch(error => { + // this.error('AWS search error.'); + // component.set('v.login',false); + // }); + }, + search_core : function(token,searchUrl,payload,callback,component) { + 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 => { + this.error('AWS search error.'); + component.set('v.login',false); + }); + }, + + to_doctor_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].name; + t['selected'] = false; + t['Doctor_Division1__c'] = resls[i].doctorDivision1; + t['value'] = retMap[resls[i].dataId].value; + res.push(t); + } + + 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; + } + } + + 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.login',false); + }, + // PIPL update Yin Mingjie 21/02/2022 end // stageNameChange : function(component, event, helper) { // var options = component.find('input-oppstage').get("v.body")[0].get('v.options'); @@ -1318,8 +1767,8 @@ this.set_doctor_list(component); }, - createCancel : function(component, event, helper) { - component.set('v.truthy', false); + createCancel : function(component, event, helper) { + component.set('v.truthy', false); var modal_newAC = component.find('modal_newAC') $A.util.addClass(modal_newAC, 'disp_none'); }, @@ -1432,15 +1881,16 @@ component.set('v.login',true); var action = component.get("c.processData"); var selectDate = component.find('select_date').get('v.value'); - var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic fields + var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic + var sss=component.get("v.fileContentData"); action.setParams({ - fileData : component.get("v.fileContentData"), - //selectDateselectDate :component.find('select_date').get('v.value'), - sobjectName:'Account', //Any object - fields:fieldsList - + fileData : component.get("v.fileContentData"), + //selectDateselectDate :component.find('select_date').get('v.value'), + sobjectName:'Account', //Any object + fields:fieldsList + - }); + }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { @@ -1494,6 +1944,7 @@ } columnDivider = ','; lineDivider = '\n'; + //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�' 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','娲诲姩鍖哄垎','缁撴灉'] csvStringResult = ''; @@ -1523,7 +1974,11 @@ csvStringResult += '"'+ objectRecords[i].Product_Category2__r.Name+'"'; }else if(skey == 'Product_Category3__c'){ csvStringResult += '"'+ objectRecords[i].Product_Category3__r.Name+'"'; - }else{ + } + // else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // csvStringResult += '"'+ objectRecords[i].SupportNeeds__c+'"'; + // } + else{ csvStringResult += '"'+ objectRecords[i][skey]+'"'; } counter++; @@ -1537,8 +1992,7 @@ return csvStringResult; }, showExportDate : function(component,objectRecords){ - console.log('杩涘叆showexceportdate'+objectRecords); - alert(777); + console.log('杩涘叆showexceportdate'+objectRecords);//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start ,'SupportNeeds__c' ,'鏀彺闇�姹�' 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','娲诲姩鍖哄垎','缁撴灉'] var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">"; @@ -1571,7 +2025,11 @@ 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{ + } + // else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start + // content += '<td>'+ objectRecords[i].SupportNeeds__c+'</td>'; + // } + else{ content += '<td>'+ objectRecords[i][skey]+'</td>'; } } // inner for loop close @@ -1602,7 +2060,47 @@ 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 awsurl = component.get('v.awsurl'); + + AWSService.search(awsurl.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; + res[ri].visitor_title__c = m[res[ri].doctor2__r.AWS_Data_Id__c].doctorDivision1; + + } + } + } + helper.showExportDate(component, res); + + component.set('v.login', false); + }, awsurl.token); + }else{ + helper.showExportDate(component, res); + } + } + + component.set('v.reports_date', res); }else{ @@ -1643,4 +2141,39 @@ $A.util.addClass(modalimport, 'disp_none'); $A.util.addClass(modalimportbg,'disp_none'); } + + // searchAgencyContact : function(res) { + // var agencyContacts = []; + // for (let idx = 0; idx < res.length; idx++) { + // agencyContacts.push(res[idx].awsid); + // } + // var action = component.get('c.getAWStoken'); + // action.setCallback(this,function(response){ + // var state = response.getState(); + // console.log('state : ' + state); + // if(state === 'SUCCESS') { + // console.log('get name : ' + action.getName()); + // } + // else if(state === 'INCOMPLETE') { + // console.log('incomplete state'); + // } else if(state === 'ERROR') { + // if (errors) { + // if (errors[0] && errors[0].message) { + // console.log("Error message: " + + // errors[0].message); + // } + // } else { + // console.log("Unknown error"); + // } + // } + // }); + // $A.enqueueAction(action); + // // var requestSearchPayload = new Map(); + // // requestSearchPayload.set("dataIds",agencyContacts); + // var data = '{"dataIds": ["944233643042144256", "943645353649897473"]}'; + // var token = 'eyJhbGciOiJIUzUxMiJ9.eyJjcmVhdGVkIjoxNjQ0NzY4MTIwNjc2LCJhcHBpZCI6IjZMeml6Y1JmN2g4eUx4MjgiLCJleHAiOjE2NDk5NTIxMjB9.6vORDP8BRaf_beCt4SEXrl3DEuYZ3owotkUqh27r8YhfmKDDWrv_NpVVpjTPeFjvzlQqaJMcFobZeAmPxpmq2A'; + // var searchUrl = 'https://52.83.101.205/api/agencycontact/search'; + // var data = this.search(searchUrl,data,token); + // return data;searchUrl,requestSearchPayload,token + // }, }) \ No newline at end of file -- Gitblit v1.9.1