buli
2023-07-14 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7
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();
    },