From 36d15f189de2e83ce2576715dac30c3c260388dd Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:47:50 +0800
Subject: [PATCH] fixconflict

---
 force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js |  141 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 141 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
index 6377482..3fece7c 100644
--- a/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
+++ b/force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
@@ -69,6 +69,7 @@
         let myTableDiv = document.getElementById('QueryResult');
         let table = document.createElement('TABLE');
         table.border = '1';
+<<<<<<< HEAD
         table.id = 'table';
         table.setAttribute(
             'class',
@@ -79,6 +80,15 @@
         let headerTR = document.createElement('TR');
         headerTR.setAttribute('class', 'slds-line-height_reset');
         let colsHeader = ['濮撳悕', '鍖婚櫌', '鍖荤敓鍖哄垎(鑱屽姟)', '鍒嗙被'];
+=======
+        table.id = 'customTable';
+        table.setAttribute('class','slds-table slds-table_cell-buffer slds-table_bordered');
+        let tableBody = document.createElement('TBODY');
+        table.appendChild(tableBody);
+        let headerTR = document.createElement('TR');
+        headerTR.setAttribute('class','slds-line-height_reset');
+        let colsHeader = [' ','濮撳悕','鍖婚櫌', '鍖荤敓鍖哄垎(鑱屽姟)','鍒嗙被'];
+>>>>>>> LEXCommunityLiJun
         tableBody.appendChild(headerTR);
         for (let i = 0; i < colsHeader.length; i++) {
             let td = document.createElement('TH');
@@ -92,6 +102,29 @@
             let tr = document.createElement('TR');
             tableBody.appendChild(tr);
             let contactInfoTemp = contactInfoList[i];
+<<<<<<< HEAD
+=======
+            
+            //鍐嶅姞涓�鍒楅�夋嫨button
+            debugger
+            let td = document.createElement('TD');
+            td.width = '75';
+            td.id = contactsInfo[contactInfoTemp.AWSDataId].Id;
+            console.log('contactInfoTemp = ' + JSON.stringify(contactInfoTemp))
+            // 鍒涘缓鎸夐挳鍏冪礌
+            var button = document.createElement('button');
+            button.classList.add('slds-button','slds-button_neutral');
+            button.id = contactInfoTemp.sfRecordId != null ? contactInfoTemp.sfRecordId : '';
+            // 璁剧疆鎸夐挳鐨勬枃鏈唴瀹�
+            var buttonText = document.createTextNode('閫夋嫨');
+            button.appendChild(buttonText);
+            button.addEventListener("click", function (obj) {
+                that.redirectToParentPage(component, event, helper, obj);
+            });
+            button.value = contactInfoTemp[cols[0]] != null ? contactInfoTemp[cols[0]] : ''
+            td.appendChild(button);
+            tr.appendChild(td);
+>>>>>>> LEXCommunityLiJun
             for (let j = 0; j < cols.length; j++) {
                 let td = document.createElement('TD');
                 td.width = '75';
@@ -106,6 +139,7 @@
                     }
                 } else {
                     td.id = contactInfoTemp.sfRecordId;
+<<<<<<< HEAD
                 }
                 td.appendChild(
                     document.createTextNode(
@@ -124,14 +158,29 @@
                         );
                     });
                 }
+=======
+                }              
+                td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:''));
+                // if (cols[j] == 'Name') {
+                //     td.addEventListener("click", function (obj) {
+                //         that.redirectToParentPage(component, event, helper,obj);
+                //     });
+                // }
+>>>>>>> LEXCommunityLiJun
                 tr.appendChild(td);
             }
         }
+        that.resetTable();
         myTableDiv.appendChild(table);
         component.find('button').set('v.disabled', false);
     },
+<<<<<<< HEAD
     redirectToParentPage: function (component, event, helper, obj) {
         let agencyContactName = obj.currentTarget.innerText;
+=======
+    redirectToParentPage : function(component, event, helper,obj){
+        let agencyContactName = obj.currentTarget.value;
+>>>>>>> LEXCommunityLiJun
         let id = obj.currentTarget.id;
         component.set('v.ac_name', agencyContactName);
         let layout = component.get('v.layout');
@@ -146,6 +195,7 @@
         }
         component.set('v.isModalOpen', false);
     },
+<<<<<<< HEAD
     resetTable: function () {
         let queryResult = document.getElementById('QueryResult');
         let table = document.getElementsByTagName('table');
@@ -156,6 +206,20 @@
             for (var i = 1; i < table.length; i++) {
                 queryResult.removeChild(table[i]);
             }
+=======
+    resetTable : function(){
+        // let queryResult = document.getElementById('QueryResult');
+        // let table = document.getElementById('customTable');
+        // console.log('table:' + table);
+        // if(table.length > 1){
+        //     for(var i=1;i<table.length;i++){
+        //         queryResult.removeChild(table[i])
+        //     }
+        // }
+        let customTable = document.getElementById('customTable');
+        if(customTable){
+            customTable.parentNode.removeChild(customTable);
+>>>>>>> LEXCommunityLiJun
         }
     },
     preparePayloadForSearchAgencyContact: function (component, event, helper) {
@@ -192,6 +256,7 @@
                     });
                     return;
                 }
+                component.set('v.showSpinner',true);
                 let searchPayload = new Object();
                 let searchAgencyContactName = component.get('v.searchKeyWord');
                 searchPayload.dataIds = rv.Data;
@@ -249,6 +314,7 @@
                                 agencyHospitalId: agencyHospitalId,
                                 accountId: accountId
                             });
+<<<<<<< HEAD
                             searchAgencyContacts.setCallback(
                                 this,
                                 function (response) {
@@ -314,6 +380,68 @@
                                                                     ];
                                                             }
                                                         }
+=======
+                            component.set('v.showSpinner',false);
+                            return
+                        }
+                        for(var i=0;i<data.object.length;i++){
+                            if(data.object[i].dataId){
+                                let contactInfo = new Object();
+                                //闇�瑕佷慨鏀�
+                                contactInfo.Name = data.object[i].name;
+                                contactInfo.AgencyHospital = '';
+                                contactInfo.DoctorDivision1 = data.object[i].doctorDivision1;
+                                contactInfo.AWSDataId = data.object[i].dataId;
+                                contactInfo.Type = data.object[i].type;
+                                contactInfo.pi = true;
+                                awsDataIds.push(contactInfo.AWSDataId);
+                                contactInfo.sfRecordId = '';
+                                contactInfoList.push(contactInfo);
+                            }                    
+                        }
+                        //let AWSIdToSFIdMapValue = {};
+                        debugger
+                        var searchAgencyContacts = component.get('c.searchAgencyContacts');
+                        searchAgencyContacts.setParams({
+                            "awsAgencyContactIds" : JSON.stringify(awsDataIds),
+                            "agencyHospitalId" : agencyHospitalId,
+                            "accountId" : accountId                            
+                        });
+                        // 寤惰繜鎵ц涓�娈典唬鐮�
+                        setTimeout(function() {
+                            // 闇�瑕佸欢杩熸墽琛岀殑浠g爜
+                           // 鍒涘缓涓�涓紶鏍囩偣鍑讳簨浠�
+                            var event = new MouseEvent('click', {
+                                bubbles: true,
+                                cancelable: true,
+                                view: window
+                            });
+                            
+                            // 瑙﹀彂鍏冪礌鐨勭偣鍑讳簨浠�
+                            var element = document.getElementById('NewAgencyContact');
+                            for(var i = 0;i<100;i++){
+                                element.dispatchEvent(event);
+                            }
+                        }, 1000); // 寤惰繜 1000 姣锛堝嵆 1 绉掞級
+                        searchAgencyContacts.setCallback(that,function(response){
+                            var state = response.getState();
+                            if(state == 'SUCCESS'){
+                                var rv = response.getReturnValue();
+                                if(rv.IsSuccess){
+                                    let contactsInfo = '';
+                                    if(rv.Data){
+                                        contactsInfo = JSON.parse(rv.Data.replace(/(&quot\;)/g,"\""));
+                                        if(Object.keys(contactsInfo).length>0){
+                                            for(let i=0;i<contactInfoList.length;i++){
+                                                let contactFromSF = contactsInfo[contactInfoList[i]['AWSDataId']];
+                                                if(contactFromSF){
+                                                    contactInfoList[i].sfRecordId = contactFromSF['Id'];
+                                                    if(contactFromSF['Agency_Hospital__r']){
+                                                         contactInfoList[i].AgencyHospital = contactFromSF['Agency_Hospital__r']['Name'];
+                                                    }
+                                                    if(contactFromSF['Department_Class__r']){
+                                                        contactInfoList[i].AgencyHospital = contactFromSF['Department_Class__r']['Parent']['Name'];
+>>>>>>> LEXCommunityLiJun
                                                     }
                                                 }
                                             }
@@ -327,6 +455,7 @@
                                             );
                                         }
                                     }
+<<<<<<< HEAD
                                 }
                             );
                             $A.enqueueAction(searchAgencyContacts);
@@ -334,6 +463,18 @@
                     },
                     token
                 );
+=======
+                                    that.refreshTable(component, event, helper,cols,contactInfoList,contactsInfo);
+                                    component.set('v.showSpinner',false);
+                                }
+                            }
+                        });
+                        $A.enqueueAction(searchAgencyContacts);
+                    }else{
+                        component.set('v.showSpinner',false);
+                    }
+                },token);
+>>>>>>> LEXCommunityLiJun
             }
         });
         $A.enqueueAction(action);

--
Gitblit v1.9.1