From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 14:56:14 +0800 Subject: [PATCH] lex community --- force-app/main/default/aura/CreateTarget/CreateTargetHelper.js | 66 ++++++++++++++++++++------------- 1 files changed, 40 insertions(+), 26 deletions(-) diff --git a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js index e28ad09..89aea61 100644 --- a/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js +++ b/force-app/main/default/aura/CreateTarget/CreateTargetHelper.js @@ -5,17 +5,22 @@ component.set("v.button_text", "缂栬緫"); var recordId = component.get("v.recordId"); var action = component.get("c.getHospital"); - action.setParams({"recordId": recordId}); + 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 agency = component.get("v.record"); + agency.Agency_Hospital__c = select_ah; + // component.set("v.record", agency); // 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 +31,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 +62,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"])); @@ -87,9 +101,9 @@ var errors = response.getError(); var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "閿欒", - "type":"error", - "message": errors[0].message + title: "閿欒", + type:"error", + message: errors[0].message }); toastEvent.fire(); @@ -144,7 +158,7 @@ var accid = component.get("v.record.Agency_Hospital__c"); var action = component.get("c.getDeptAmount"); - action.setParams({ "hospitalId" : accid }); + action.setParams({ hospitalId : accid }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { @@ -524,9 +538,9 @@ var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "鎴愬姛", - "type":"success", - "message": "淇濆瓨鎴愬姛" + title: "鎴愬姛", + type:"success", + message: "淇濆瓨鎴愬姛" }); toastEvent.fire(); @@ -534,18 +548,18 @@ } else if (state === "INCOMPLETE") { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "鏈畬鎴�!", - "type":"error", - "message": "鏈畬鎴�" + title: "鏈畬鎴�!", + type:"error", + message: "鏈畬鎴�" }); toastEvent.fire(); } else if (state === "ERROR") { var errors = response.getError(); var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "閿欒", - "type":"error", - "message": errors[0].message + title: "閿欒", + type:"error", + message: errors[0].message }); toastEvent.fire(); @@ -557,10 +571,10 @@ warning : function(message) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "璀﹀憡!", - "message": message, - "type":"warning", - "duration" : "10000" + title: "璀﹀憡!", + message: message, + type:"warning", + duration : "10000" }); toastEvent.fire(); }, @@ -568,10 +582,10 @@ error : function(message) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ - "title": "閿欒!", - "message": message, - "type":"error", - "duration" : "10000" + title: "閿欒!", + message: message, + type:"error", + duration : "10000" }); toastEvent.fire(); }, -- Gitblit v1.9.1