From 614b1b648eceb33e325ed7cf8d8cb6a7a71b9ddc Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 11:28:13 +0800
Subject: [PATCH] backup0626

---
 force-app/main/default/aura/CreateTarget/CreateTargetHelper.js |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
index e28ad09..b46d9ab 100644
--- a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
+++ b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
@@ -8,14 +8,18 @@
             action.setParams({"recordId": recordId});
             action.setCallback(this, function(response) {
             var state = response.getState();
+            console.log("state1:"+state);
                 if(state === "SUCCESS") {
                     var ah = response.getReturnValue();
                     var select_ah = ah.Id;
                     var select_ah_name = ah.Name;
-                    
-                    component.set('v.record.Agency_Hospital__c', select_ah);
+                    // component.set('v.record.Agency_Hospital__c', select_ah);
+                    //add by Deloitte 2023-6-8
+                    let agencyHosp = component.get('v.record');
+                    agencyHosp.Agency_Hospital__c = select_ah;
                     // alert(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v.values')));
                     if ($A.get("$Browser.formFactor") == 'DESKTOP') {
+                        console.log("flag1");
                         var values = [{
                             type: 'Agency_Hospital_Link__c',
                             id: select_ah,
@@ -26,9 +30,17 @@
                                 alt:'Agency_Hospital_Link__c'
                             }
                         }];
-                        component.find('input-hos').get("v.body")[0].set('v.values', values);
+                        // component.find('input-hos').get("v.body")[0].set('v.values', values);
+                        //add by Deloitte 2023-6-8
+                        if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
+                            component.find('input-hos').get("v.body")[0].set('v.values', values);
+                        }                       
                     } else {
-                        component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
+                        // component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
+                        //add by Deloitte 2023-6-8
+                        if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
+                            component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
+                        }                            
                     }
                     
                 } else if (state === "ERROR") {
@@ -49,6 +61,7 @@
         var action = component.get("c.getProductList");
         action.setCallback(this, function(response) {
             var state = response.getState();
+            console.log("state2:"+state);
             if(state === "SUCCESS") {
                 var opts = response.getReturnValue();
                 // alert(JSON.stringify(opts["GI"]));
@@ -96,6 +109,13 @@
             }
         });
         $A.enqueueAction(action);
+
+        var modal_window = component.find('modal_window');
+        var modal_bg = component.find('modal_bg');
+
+        if ($A.util.hasClass(modal_window, 'disp_none') && !component.get("v.recordId")) {
+            $A.get('e.force:refreshView').fire();
+        }
     },
 
 	toggle_report : function(component, event, helper) {

--
Gitblit v1.9.1