From 0ac2c8c62a4ba1b92bcae9f11f7f4d9c6f54875b Mon Sep 17 00:00:00 2001
From: 付煜 <fuyu3103346691@163.com>
Date: 星期四, 24 三月 2022 16:22:29 +0800
Subject: [PATCH] 删除关联关系
---
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 156 insertions(+), 19 deletions(-)
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
index 4fdf0b2..0f14b4b 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,7 +11,10 @@
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));
@@ -23,6 +25,7 @@
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'));
@@ -35,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");
@@ -99,32 +176,78 @@
// 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
@@ -179,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) {
@@ -456,7 +582,7 @@
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
},
@@ -543,13 +669,13 @@
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
@@ -557,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');
@@ -628,7 +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 (!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')) {
@@ -648,7 +774,8 @@
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,
@@ -716,6 +843,8 @@
/* 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,
@@ -992,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) {
@@ -1018,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;
@@ -1066,10 +1197,10 @@
}
},
// 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();
@@ -1077,6 +1208,7 @@
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{
@@ -1249,6 +1381,11 @@
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);
@@ -1256,7 +1393,7 @@
},
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{
@@ -1280,7 +1417,7 @@
// 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,
--
Gitblit v1.9.1