binxie
2023-06-20 f62ffbeb0ce6d67b56c0d409d7b93574a0070452
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
@@ -5,63 +5,42 @@
      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;
          console.log("select_ah:" + select_ah);
          let agencyHosp = component.get("v.record");
          agencyHosp.Agency_Hospital__c = select_ah;
                    component.set('v.record.Agency_Hospital__c', select_ah);
          // alert(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v.values')));
          console.log("flag0");
          if ($A.get("$Browser.formFactor") == "DESKTOP") {
            console.log("flag1");
            var values = [
              {
                type: "Agency_Hospital_Link__c",
                    if ($A.get("$Browser.formFactor") == 'DESKTOP') {
                        var values = [{
                            type: 'Agency_Hospital_Link__c',
                id: select_ah,
                label: select_ah_name,
                icon: {
                  url: "/img/icon/t4v35/custom/custom24_120.png",
                  backgroundColor: "dc71d1",
                  alt: "Agency_Hospital_Link__c"
                                url:'/img/icon/t4v35/custom/custom24_120.png',
                                backgroundColor:'dc71d1',
                                alt:'Agency_Hospital_Link__c'
                }
              }
            ];
            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);
            }
                        }];
                        component.find('input-hos').get("v.body")[0].set('v.values', values);
          } else {
            console.log("flag2");
            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);
                        component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
            }
          }
        } 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();
        }
      });
      $A.enqueueAction(action);
@@ -70,168 +49,112 @@
    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"]));
        component
          .find("select_GI1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GI2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GI3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI1").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI2").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI3").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GS1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GS2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GS3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS1").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS2").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS3").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GYN1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_GYN2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_GYN3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN1").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN2").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN3").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_URO1")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_URO2")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_URO3")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO1").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO2").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO3").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_ENT1")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_ENT2")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_ENT3")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT1").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT2").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT3").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_OTH1")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_OTH2")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_OTH3")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH1").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH2").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH3").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_ET1")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_ET2")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_ET3")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET1").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET2").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET3").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_BF1")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
        component
          .find("select_BF2")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
        component
          .find("select_BF3")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF1").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF2").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF3").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
      } 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();
      }
    });
    $A.enqueueAction(action);
  },
  toggle_report: function (component, event, helper) {
    var modal_window = component.find("modal_window");
    var modal_bg = component.find("modal_bg");
    $A.util.toggleClass(modal_window, "disp_none");
    $A.util.toggleClass(modal_bg, "disp_none");
        var modal_window = component.find('modal_window');
        var modal_bg = component.find('modal_bg');
        $A.util.toggleClass(modal_window, 'disp_none');
        $A.util.toggleClass(modal_bg, 'disp_none');
    if (
      $A.util.hasClass(modal_window, "disp_none") &&
      !component.get("v.recordId")
    ) {
      $A.get("e.force:refreshView").fire();
        if ($A.util.hasClass(modal_window, 'disp_none') && !component.get("v.recordId")) {
            $A.get('e.force:refreshView').fire();
    }
  },
  productcategoryChange: function (component, event, helper, dept, index) {
    var cmpId = "select_" + dept;
        var cmpId = 'select_'+dept;
    var myId;
    var o1Id;
    var o2Id;
    if (index == 1) {
      myId = cmpId + "1";
      o1Id = cmpId + "2";
      o2Id = cmpId + "3";
            myId = cmpId + '1';
            o1Id = cmpId + '2';
            o2Id = cmpId + '3';
    } else if (index == 2) {
      myId = cmpId + "2";
      o1Id = cmpId + "1";
      o2Id = cmpId + "3";
            myId = cmpId + '2';
            o1Id = cmpId + '1';
            o2Id = cmpId + '3';
    } else {
      myId = cmpId + "3";
      o1Id = cmpId + "1";
      o2Id = cmpId + "2";
            myId = cmpId + '3';
            o1Id = cmpId + '1';
            o2Id = cmpId + '2';
    }
    var product_category_id = component.find(myId).get("v.value");
    var pcId1 = component.find(o1Id).get("v.value");
    var pcId2 = component.find(o2Id).get("v.value");
    var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
    var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
    var p0bool =
      product_category_id != "" &&
      product_category_id != null &&
      product_category_id != undefined;
    if (
      (p1bool && p0bool && product_category_id == pcId1) ||
      (p2bool && p0bool && product_category_id == pcId2)
    ) {
      this.warning("不能选择同样的产品区分");
      component.find(myId).set("v.value", "");
        var product_category_id = component.find(myId).get('v.value');
        var pcId1 = component.find(o1Id).get('v.value');
        var pcId2 = component.find(o2Id).get('v.value');
        var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
        var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
        var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
        if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
            this.warning('不能选择同样的产品区分');
            component.find(myId).set('v.value','');
    }
  },
  selectHos: function (component, event, helper) {
    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") {
        var amountMap = response.getReturnValue();
        var GIProduct_Category1 = "";
        var GIProduct_Category2 = "";
        var GIProduct_Category3 = "";
        var GIAim_Price__c1 = "";
        var GIAim_Price__c2 = "";
        var GIAim_Price__c3 = "";
                var GIProduct_Category1 = '';
                var GIProduct_Category2 = '';
                var GIProduct_Category3 = '';
                var GIAim_Price__c1 = '';
                var GIAim_Price__c2 = '';
                var GIAim_Price__c3 = '';
        if (amountMap.GI.length > 0) {
          GIProduct_Category1 = amountMap.GI[0].Product_Category__c;
          if (amountMap.GI.length > 1) {
@@ -243,23 +166,23 @@
          GIAim_Price__c1 = amountMap.GI[0].Aim_Price__c;
          GIAim_Price__c2 = amountMap.GI[1].Aim_Price__c;
          GIAim_Price__c3 = amountMap.GI[2].Aim_Price__c;
          console.warn(
            GIAim_Price__c1 + "-" + GIAim_Price__c2 + "-" + GIAim_Price__c3
          );
        }
        component.find("select_GI1").set("v.value", GIProduct_Category1);
        component.find("select_GI2").set("v.value", GIProduct_Category2);
        component.find("select_GI3").set("v.value", GIProduct_Category3);
        component.find("select_GI4_1").set("v.value", GIAim_Price__c1);
        component.find("select_GI4_2").set("v.value", GIAim_Price__c2);
        component.find("select_GI4_3").set("v.value", GIAim_Price__c3);
                    console.warn(GIAim_Price__c1+"-"+GIAim_Price__c2+"-"+GIAim_Price__c3);
        var ETProduct_Category1 = "";
        var ETProduct_Category2 = "";
        var ETProduct_Category3 = "";
        var ETAim_Price__c1 = "";
        var ETAim_Price__c2 = "";
        var ETAim_Price__c3 = "";
                }
                component.find('select_GI1').set('v.value',GIProduct_Category1);
                component.find('select_GI2').set('v.value',GIProduct_Category2);
                component.find('select_GI3').set('v.value',GIProduct_Category3);
                component.find('select_GI4_1').set('v.value',GIAim_Price__c1);
                component.find('select_GI4_2').set('v.value',GIAim_Price__c2);
                component.find('select_GI4_3').set('v.value',GIAim_Price__c3);
                var ETProduct_Category1 = '';
                var ETProduct_Category2 = '';
                var ETProduct_Category3 = '';
                var ETAim_Price__c1 = '';
                var ETAim_Price__c2 = '';
                var ETAim_Price__c3 = '';
        if (amountMap.ET.length > 0) {
          ETProduct_Category1 = amountMap.ET[0].Product_Category__c;
          if (amountMap.ET.length > 1) {
@@ -272,19 +195,20 @@
          ETAim_Price__c2 = amountMap.ET[1].Aim_Price__c;
          ETAim_Price__c3 = amountMap.ET[2].Aim_Price__c;
        }
        component.find("select_ET1").set("v.value", ETProduct_Category1);
        component.find("select_ET2").set("v.value", ETProduct_Category2);
        component.find("select_ET3").set("v.value", ETProduct_Category3);
        component.find("select_ET4_1").set("v.value", ETAim_Price__c1);
        component.find("select_ET4_2").set("v.value", ETAim_Price__c2);
        component.find("select_ET4_3").set("v.value", ETAim_Price__c3);
                component.find('select_ET1').set('v.value',ETProduct_Category1);
                component.find('select_ET2').set('v.value',ETProduct_Category2);
                component.find('select_ET3').set('v.value',ETProduct_Category3);
                component.find('select_ET4_1').set('v.value',ETAim_Price__c1);
                component.find('select_ET4_2').set('v.value',ETAim_Price__c2);
                component.find('select_ET4_3').set('v.value',ETAim_Price__c3);
        var BFProduct_Category1 = "";
        var BFProduct_Category2 = "";
        var BFProduct_Category3 = "";
        var BFAim_Price__c1 = "";
        var BFAim_Price__c2 = "";
        var BFAim_Price__c3 = "";
                var BFProduct_Category1 = '';
                var BFProduct_Category2 = '';
                var BFProduct_Category3 = '';
                var BFAim_Price__c1 = '';
                var BFAim_Price__c2 = '';
                var BFAim_Price__c3 = '';
        if (amountMap.BF.length > 0) {
          BFProduct_Category1 = amountMap.BF[0].Product_Category__c;
          if (amountMap.BF.length > 1) {
@@ -297,20 +221,22 @@
          BFAim_Price__c2 = amountMap.BF[1].Aim_Price__c;
          BFAim_Price__c3 = amountMap.BF[2].Aim_Price__c;
        }
        component.find("select_BF1").set("v.value", BFProduct_Category1);
        component.find("select_BF2").set("v.value", BFProduct_Category2);
        component.find("select_BF3").set("v.value", BFProduct_Category3);
        component.find("select_BF4_1").set("v.value", BFAim_Price__c1);
        component.find("select_BF4_2").set("v.value", BFAim_Price__c2);
        component.find("select_BF4_3").set("v.value", BFAim_Price__c3);
                component.find('select_BF1').set('v.value',BFProduct_Category1);
                component.find('select_BF2').set('v.value',BFProduct_Category2);
                component.find('select_BF3').set('v.value',BFProduct_Category3);
                component.find('select_BF4_1').set('v.value',BFAim_Price__c1);
                component.find('select_BF4_2').set('v.value',BFAim_Price__c2);
                component.find('select_BF4_3').set('v.value',BFAim_Price__c3);
        var OTHProduct_Category1 = "";
        var OTHProduct_Category2 = "";
        var OTHProduct_Category3 = "";
        var OTHAim_Price__c1 = "";
        var OTHAim_Price__c2 = "";
        var OTHAim_Price__c3 = "";
                var OTHProduct_Category1 = '';
                var OTHProduct_Category2 = '';
                var OTHProduct_Category3 = '';
                var OTHAim_Price__c1 = '';
                var OTHAim_Price__c2 = '';
                var OTHAim_Price__c3 = '';
        if (amountMap.OTH.length > 0) {
          OTHProduct_Category1 = amountMap.OTH[0].Product_Category__c;
          if (amountMap.OTH.length > 1) {
            OTHProduct_Category2 = amountMap.OTH[1].Product_Category__c;
@@ -322,19 +248,19 @@
          OTHAim_Price__c2 = amountMap.OTH[1].Aim_Price__c;
          OTHAim_Price__c3 = amountMap.OTH[2].Aim_Price__c;
        }
        component.find("select_OTH1").set("v.value", OTHProduct_Category1);
        component.find("select_OTH2").set("v.value", OTHProduct_Category2);
        component.find("select_OTH3").set("v.value", OTHProduct_Category3);
        component.find("select_OTH4_1").set("v.value", OTHAim_Price__c1);
        component.find("select_OTH4_2").set("v.value", OTHAim_Price__c2);
        component.find("select_OTH4_3").set("v.value", OTHAim_Price__c3);
                component.find('select_OTH1').set('v.value',OTHProduct_Category1);
                component.find('select_OTH2').set('v.value',OTHProduct_Category2);
                component.find('select_OTH3').set('v.value',OTHProduct_Category3);
                component.find('select_OTH4_1').set('v.value',OTHAim_Price__c1);
                component.find('select_OTH4_2').set('v.value',OTHAim_Price__c2);
                component.find('select_OTH4_3').set('v.value',OTHAim_Price__c3);
        var GSProduct_Category1 = "";
        var GSProduct_Category2 = "";
        var GSProduct_Category3 = "";
        var GSPAim_Price__c1 = "";
        var GSPAim_Price__c2 = "";
        var GSPAim_Price__c3 = "";
                var GSProduct_Category1 = '';
                var GSProduct_Category2 = '';
                var GSProduct_Category3 = '';
                var GSPAim_Price__c1 = '';
                var GSPAim_Price__c2 = '';
                var GSPAim_Price__c3 = '';
        if (amountMap.GS.length > 0) {
          GSProduct_Category1 = amountMap.GS[0].Product_Category__c;
          if (amountMap.GS.length > 1) {
@@ -347,20 +273,21 @@
          GSPAim_Price__c2 = amountMap.GS[1].Aim_Price__c;
          GSPAim_Price__c3 = amountMap.GS[2].Aim_Price__c;
        }
        component.find("select_GS1").set("v.value", GSProduct_Category1);
        component.find("select_GS2").set("v.value", GSProduct_Category2);
        component.find("select_GS3").set("v.value", GSProduct_Category3);
        component.find("select_GS4_1").set("v.value", GSPAim_Price__c1);
        component.find("select_GS4_2").set("v.value", GSPAim_Price__c2);
        component.find("select_GS4_3").set("v.value", GSPAim_Price__c3);
                component.find('select_GS1').set('v.value',GSProduct_Category1);
                component.find('select_GS2').set('v.value',GSProduct_Category2);
                component.find('select_GS3').set('v.value',GSProduct_Category3);
                component.find('select_GS4_1').set('v.value',GSPAim_Price__c1);
                component.find('select_GS4_2').set('v.value',GSPAim_Price__c2);
                component.find('select_GS4_3').set('v.value',GSPAim_Price__c3);
        var UROProduct_Category1 = "";
        var UROProduct_Category2 = "";
        var UROProduct_Category3 = "";
        var UROAim_Price__c1 = "";
        var UROAim_Price__c2 = "";
        var UROAim_Price__c3 = "";
                var UROProduct_Category1 = '';
                var UROProduct_Category2 = '';
                var UROProduct_Category3 = '';
                var UROAim_Price__c1 = '';
                var UROAim_Price__c2 = '';
                var UROAim_Price__c3 = '';
        if (amountMap.URO.length > 0) {
          UROProduct_Category1 = amountMap.URO[0].Product_Category__c;
          if (amountMap.URO.length > 1) {
            UROProduct_Category2 = amountMap.URO[1].Product_Category__c;
@@ -372,20 +299,22 @@
          UROAim_Price__c2 = amountMap.URO[1].Aim_Price__c;
          UROAim_Price__c3 = amountMap.URO[2].Aim_Price__c;
        }
        component.find("select_URO1").set("v.value", UROProduct_Category1);
        component.find("select_URO2").set("v.value", UROProduct_Category2);
        component.find("select_URO3").set("v.value", UROProduct_Category3);
        component.find("select_URO4_1").set("v.value", UROAim_Price__c1);
        component.find("select_URO4_2").set("v.value", UROAim_Price__c2);
        component.find("select_URO4_3").set("v.value", UROAim_Price__c3);
                component.find('select_URO1').set('v.value',UROProduct_Category1);
                component.find('select_URO2').set('v.value',UROProduct_Category2);
                component.find('select_URO3').set('v.value',UROProduct_Category3);
                component.find('select_URO4_1').set('v.value',UROAim_Price__c1);
                component.find('select_URO4_2').set('v.value',UROAim_Price__c2);
                component.find('select_URO4_3').set('v.value',UROAim_Price__c3);
        var GYNProduct_Category1 = "";
        var GYNProduct_Category2 = "";
        var GYNProduct_Category3 = "";
        var GYNAim_Price__c1 = "";
        var GYNAim_Price__c2 = "";
        var GYNAim_Price__c3 = "";
                var GYNProduct_Category1 = '';
                var GYNProduct_Category2 = '';
                var GYNProduct_Category3 = '';
                var GYNAim_Price__c1 = '';
                var GYNAim_Price__c2 = '';
                var GYNAim_Price__c3 = '';
        if (amountMap.GYN.length > 0) {
          GYNProduct_Category1 = amountMap.GYN[0].Product_Category__c;
          if (amountMap.GYN.length > 1) {
            GYNProduct_Category2 = amountMap.GYN[1].Product_Category__c;
@@ -397,20 +326,22 @@
          GYNAim_Price__c2 = amountMap.GYN[1].Aim_Price__c;
          GYNAim_Price__c3 = amountMap.GYN[2].Aim_Price__c;
        }
        component.find("select_GYN1").set("v.value", GYNProduct_Category1);
        component.find("select_GYN2").set("v.value", GYNProduct_Category2);
        component.find("select_GYN3").set("v.value", GYNProduct_Category3);
        component.find("select_GYN4_1").set("v.value", GYNAim_Price__c1);
        component.find("select_GYN4_2").set("v.value", GYNAim_Price__c2);
        component.find("select_GYN4_3").set("v.value", GYNAim_Price__c3);
                component.find('select_GYN1').set('v.value',GYNProduct_Category1);
                component.find('select_GYN2').set('v.value',GYNProduct_Category2);
                component.find('select_GYN3').set('v.value',GYNProduct_Category3);
                component.find('select_GYN4_1').set('v.value',GYNAim_Price__c1);
                component.find('select_GYN4_2').set('v.value',GYNAim_Price__c2);
                component.find('select_GYN4_3').set('v.value',GYNAim_Price__c3);
        var ENTProduct_Category1 = "";
        var ENTProduct_Category2 = "";
        var ENTProduct_Category3 = "";
        var ENTAim_Price__c1 = "";
        var ENTAim_Price__c2 = "";
        var ENTAim_Price__c3 = "";
                var ENTProduct_Category1 = '';
                var ENTProduct_Category2 = '';
                var ENTProduct_Category3 = '';
                var ENTAim_Price__c1 = '';
                var ENTAim_Price__c2 = '';
                var ENTAim_Price__c3 = '';
        if (amountMap.ENT.length > 0) {
          ENTProduct_Category1 = amountMap.ENT[0].Product_Category__c;
          if (amountMap.ENT.length > 1) {
            ENTProduct_Category2 = amountMap.ENT[1].Product_Category__c;
@@ -422,18 +353,17 @@
          ENTAim_Price__c2 = amountMap.ENT[1].Aim_Price__c;
          ENTAim_Price__c3 = amountMap.ENT[2].Aim_Price__c;
        }
        component.find("select_ENT1").set("v.value", ENTProduct_Category1);
        component.find("select_ENT2").set("v.value", ENTProduct_Category2);
        component.find("select_ENT3").set("v.value", ENTProduct_Category3);
        component.find("select_ENT4_1").set("v.value", ENTAim_Price__c1);
        component.find("select_ENT4_2").set("v.value", ENTAim_Price__c2);
        component.find("select_ENT4_3").set("v.value", ENTAim_Price__c3);
                component.find('select_ENT1').set('v.value',ENTProduct_Category1);
                component.find('select_ENT2').set('v.value',ENTProduct_Category2);
                component.find('select_ENT3').set('v.value',ENTProduct_Category3);
                component.find('select_ENT4_1').set('v.value',ENTAim_Price__c1);
                component.find('select_ENT4_2').set('v.value',ENTAim_Price__c2);
                component.find('select_ENT4_3').set('v.value',ENTAim_Price__c3);
      }
    });
    $A.enqueueAction(action);
    console.log(
      JSON.stringify(component.find("input-hos").get("v.body")[0].get("v"))
    );
        console.log(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v')));
  },
  getOCMTerm: function () {
@@ -442,7 +372,7 @@
    var month = today.getMonth();
    if (month < 3) year -= 1;
    var thisYearOCMPeriod = String(year - 1867) + "P";
        var thisYearOCMPeriod = String(year - 1867) + 'P';
    return thisYearOCMPeriod;
  },
@@ -451,9 +381,11 @@
    var action = component.get("c.createSFTarget");
    // alert(component.get("v.GIAmount"));
    var p1_1 = component.find("select_GI4_1").get("v.value");
    var p1_2 = component.find("select_GI4_2").get("v.value");
    var p1_3 = component.find("select_GI4_3").get("v.value");
        var  p1_1 = component.find('select_GI4_1').get('v.value') ;
        var  p1_2 = component.find('select_GI4_2').get('v.value') ;
        var  p1_3 = component.find('select_GI4_3').get('v.value') ;
    if (p1_1 == undefined || p1_1 == "") {
      p1_1 = 0;
@@ -466,9 +398,9 @@
    }
    console.warn(p1_1 + "-" + p1_2 + "-" + p1_3);
    var p2_1 = component.find("select_ET4_1").get("v.value");
    var p2_2 = component.find("select_ET4_2").get("v.value");
    var p2_3 = component.find("select_ET4_3").get("v.value");
        var  p2_1 = component.find('select_ET4_1').get('v.value') ;
        var  p2_2 = component.find('select_ET4_2').get('v.value') ;
        var  p2_3 = component.find('select_ET4_3').get('v.value') ;
    if (p2_1 == undefined || p2_1 == "") {
      p2_1 = 0;
    }
@@ -479,9 +411,10 @@
      p2_3 = 0;
    }
    var p3_1 = component.find("select_BF4_1").get("v.value");
    var p3_2 = component.find("select_BF4_2").get("v.value");
    var p3_3 = component.find("select_BF4_3").get("v.value");
        var  p3_1 = component.find('select_BF4_1').get('v.value') ;
        var  p3_2 = component.find('select_BF4_2').get('v.value') ;
        var  p3_3 = component.find('select_BF4_3').get('v.value') ;
    if (p3_1 == undefined || p3_1 == "") {
      p3_1 = 0;
    }
@@ -492,9 +425,11 @@
      p3_3 = 0;
    }
    var p4_1 = component.find("select_OTH4_1").get("v.value");
    var p4_2 = component.find("select_OTH4_2").get("v.value");
    var p4_3 = component.find("select_OTH4_3").get("v.value");
        var  p4_1 = component.find('select_OTH4_1').get('v.value') ;
        var  p4_2 = component.find('select_OTH4_2').get('v.value') ;
        var  p4_3 = component.find('select_OTH4_3').get('v.value') ;
    if (p4_1 == undefined || p4_1 == "") {
      p4_1 = 0;
    }
@@ -505,9 +440,11 @@
      p4_3 = 0;
    }
    var p5_1 = component.find("select_GS4_1").get("v.value");
    var p5_2 = component.find("select_GS4_2").get("v.value");
    var p5_3 = component.find("select_GS4_3").get("v.value");
        var  p5_1 = component.find('select_GS4_1').get('v.value') ;
        var  p5_2 = component.find('select_GS4_2').get('v.value') ;
        var  p5_3 = component.find('select_GS4_3').get('v.value') ;
    if (p5_1 == undefined || p5_1 == "") {
      p5_1 = 0;
    }
@@ -518,9 +455,11 @@
      p5_3 = 0;
    }
    var p6_1 = component.find("select_URO4_1").get("v.value");
    var p6_2 = component.find("select_URO4_2").get("v.value");
    var p6_3 = component.find("select_URO4_3").get("v.value");
        var  p6_1 = component.find('select_URO4_1').get('v.value') ;
        var  p6_2 = component.find('select_URO4_2').get('v.value') ;
        var  p6_3 = component.find('select_URO4_3').get('v.value') ;
    if (p6_1 == undefined || p6_1 == "") {
      p6_1 = 0;
    }
@@ -531,9 +470,9 @@
      p6_3 = 0;
    }
    var p7_1 = component.find("select_GYN4_1").get("v.value");
    var p7_2 = component.find("select_GYN4_2").get("v.value");
    var p7_3 = component.find("select_GYN4_3").get("v.value");
        var  p7_1 = component.find('select_GYN4_1').get('v.value') ;
        var  p7_2 = component.find('select_GYN4_2').get('v.value') ;
        var  p7_3 = component.find('select_GYN4_3').get('v.value') ;
    if (p7_1 == undefined || p7_1 == "") {
      p7_1 = 0;
    }
@@ -544,9 +483,11 @@
      p7_3 = 0;
    }
    var p8_1 = component.find("select_ENT4_1").get("v.value");
    var p8_2 = component.find("select_ENT4_2").get("v.value");
    var p8_3 = component.find("select_ENT4_3").get("v.value");
        var  p8_1 = component.find('select_ENT4_1').get('v.value') ;
        var  p8_2 = component.find('select_ENT4_2').get('v.value') ;
        var  p8_3 = component.find('select_ENT4_3').get('v.value') ;
    if (p8_1 == undefined || p8_1 == "") {
      p8_1 = 0;
    }
@@ -557,109 +498,57 @@
      p8_3 = 0;
    }
    action.setParams({
      hospitalId: component.get("v.record.Agency_Hospital__c"),
      GIProduct: [
        component.find("select_GI1").get("v.value"),
        component.find("select_GI2").get("v.value"),
        component.find("select_GI3").get("v.value"),
        p1_1,
        p1_2,
        p1_3
      ],
      ETProduct: [
        component.find("select_ET1").get("v.value"),
        component.find("select_ET2").get("v.value"),
        component.find("select_ET3").get("v.value"),
        p2_1,
        p2_2,
        p2_3
      ],
      BFProduct: [
        component.find("select_BF1").get("v.value"),
        component.find("select_BF2").get("v.value"),
        component.find("select_BF3").get("v.value"),
        p3_1,
        p3_2,
        p3_3
      ],
      OTHProduct: [
        component.find("select_OTH1").get("v.value"),
        component.find("select_OTH2").get("v.value"),
        component.find("select_OTH3").get("v.value"),
        p4_1,
        p4_2,
        p4_3
      ],
      GSProduct: [
        component.find("select_GS1").get("v.value"),
        component.find("select_GS2").get("v.value"),
        component.find("select_GS3").get("v.value"),
        p5_1,
        p5_2,
        p5_3
      ],
      UROProduct: [
        component.find("select_URO1").get("v.value"),
        component.find("select_URO2").get("v.value"),
        component.find("select_URO3").get("v.value"),
        p6_1,
        p6_2,
        p6_2
      ],
      GYNProduct: [
        component.find("select_GYN1").get("v.value"),
        component.find("select_GYN2").get("v.value"),
        component.find("select_GYN3").get("v.value"),
        p7_1,
        p7_2,
        p7_3
      ],
      ENTProduct: [
        component.find("select_ENT1").get("v.value"),
        component.find("select_ENT2").get("v.value"),
        component.find("select_ENT3").get("v.value"),
        p8_1,
        p8_2,
        p8_3
      ],
      OCMTerm: component.get("v.OCMTerm")
                      "hospitalId" : component.get("v.record.Agency_Hospital__c"),
                      "GIProduct" : [component.find('select_GI1').get('v.value'),component.find('select_GI2').get('v.value'),component.find('select_GI3').get('v.value'),p1_1,p1_2,p1_3],
                      "ETProduct" : [component.find('select_ET1').get('v.value'),component.find('select_ET2').get('v.value'),component.find('select_ET3').get('v.value'),p2_1, p2_2,p2_3 ],
                      "BFProduct" : [component.find('select_BF1').get('v.value'),component.find('select_BF2').get('v.value'),component.find('select_BF3').get('v.value'),p3_1 ,p3_2 ,p3_3 ],
                      "OTHProduct" : [component.find('select_OTH1').get('v.value'),component.find('select_OTH2').get('v.value'),component.find('select_OTH3').get('v.value'),p4_1,p4_2 ,p4_3],
                      "GSProduct" : [component.find('select_GS1').get('v.value'),component.find('select_GS2').get('v.value'),component.find('select_GS3').get('v.value'),p5_1,p5_2,p5_3],
                      "UROProduct" : [component.find('select_URO1').get('v.value'),component.find('select_URO2').get('v.value'),component.find('select_URO3').get('v.value'),p6_1,p6_2 ,p6_2 ],
                      "GYNProduct" : [component.find('select_GYN1').get('v.value'),component.find('select_GYN2').get('v.value'),component.find('select_GYN3').get('v.value'),p7_1,p7_2 ,p7_3 ],
                      "ENTProduct" : [component.find('select_ENT1').get('v.value'),component.find('select_ENT2').get('v.value'),component.find('select_ENT3').get('v.value'),p8_1 ,p8_2 ,p8_3],
                            "OCMTerm" : component.get("v.OCMTerm")
    });
    action.setCallback(this, function (response) {
      console.warn(response);
      var state = response.getState();
      if (state === "SUCCESS") {
        var modal_window = component.find("modal_window");
        var modal_bg = component.find("modal_bg");
        $A.util.toggleClass(modal_window, "disp_none");
        $A.util.toggleClass(modal_bg, "disp_none");
             var modal_window = component.find('modal_window');
              var modal_bg = component.find('modal_bg');
              $A.util.toggleClass(modal_window, 'disp_none');
              $A.util.toggleClass(modal_bg, 'disp_none');
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
          title: "成功",
          type: "success",
          message: "保存成功"
                    "title": "成功",
                    "type":"success",
                    "message": "保存成功"
        });
        toastEvent.fire();
        $A.get("e.force:refreshView").fire();
                $A.get('e.force:refreshView').fire();
      } 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();
      }
    });
    $A.enqueueAction(action);
@@ -668,10 +557,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();
  },
@@ -679,11 +568,12 @@
  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();
  }
});
    },
})