Li Jun
2022-04-13 5c01ebbfddb6b8674430b47c22977bea2e350084
force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page
@@ -1,10 +1,3 @@
<!--
  @description       :
  @author            : ChangeMeIn@UserSettingsUnder.SFDoc
  @group             :
  @last modified on  : 04-02-2022
  @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
-->
<apex:page standardController="Consum_Apply_Equipment_Set_Detail__c" extensions="NewConsumApplyEquipSetDetailController" id="page">
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
@@ -57,7 +50,7 @@
            payloadJson.Trial_User__c = r.object[0].trialUser;
            payloadJson.Trial_User_Encrypt__c = r.object[0].trialUserEncrypt;
            payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
            if (isNewMode) {
            if (isNewMode || {!isCloneMode}) {
                payloadJson.AWS_Data_Id__c = r.object[0].dataId;
            } else {
                payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
@@ -69,8 +62,7 @@
        // New Or Edit
        function ProcessPI(consumApplyJson, payloadForNewPI) {
            blockme();
            if ({!isNewMode
            }) {
            if ({!isNewMode} || {!isCloneMode}) {
                NewPIToAWS(consumApplyJson, payloadForNewPI)
            }else {
                UpdatePIToAWS(consumApplyJson, payloadForNewPI)
@@ -280,16 +272,26 @@
            <script>
                //Append Page
                sfdcPage.appendToOnloadQueue(function () {
                    //判断是否为只读选项
                    var layoutSections = JSON.parse('{!layoutSectionsStr}');
                    for (let m = 0; m < layoutSections.length; m++) {
                        let layoutSection = layoutSections[m].layoutFields;
                        for (let n = 0; n < layoutSection.length; n++) {
                            let layoutField = layoutSection[n];
                            if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
                                document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField);
                        for (let m = 0; m < layoutSections.length; m++) {
                            let layoutSection = layoutSections[m].layoutFields;
                            for (let n = 0; n < layoutSection.length; n++) {
                                let layoutField = layoutSection[n];
                                if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
                                    let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']");
                                    e.disabled = !(layoutField.editableField);
                                    if (!(layoutField.editableField)) {
                                        if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') {
                                            e.parentNode.classList.add("disabledbutton");
                                        }
                                        if (e.tagName == 'DIV') {
                                            e.classList.add("disabledbutton");
                                        }
                                    }
                                }
                            }
                        }
                    }
                    //2. Query AWS Data by dataId 
                    console.log('Mode for consumApply Page:' + {!isNewMode});
                    if (!{!isNewMode}) {
@@ -298,36 +300,37 @@
                    };
                    document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
                    jQuery(".lookupInput").each(function(i,e){
                        let je =jQuery(e).find('input');
                        je.attr("readonly","");
                        je.css("background","unset");
                    //zhj 2022/04/11 start
                    // jQuery(".lookupInput").each(function(i,e){
                    //     let je =jQuery(e).find('input');
                    //     je.attr("readonly","");
                    //     je.css("background","unset");
                        
                        let dataid = je.attr('data-id');
                        if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return;
                        jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">');
                    })
                    //     let dataid = je.attr('data-id');
                    //     if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return;
                    //     jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">');
                    // })
                    
                    jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){
                        this.className = "closeIconOn";
                    });
                    // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){
                    //     this.className = "closeIconOn";
                    // });
                    
                    jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){
                        this.className = "closeIcon"
                    });
                    // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){
                    //     this.className = "closeIcon"
                    // });
                    
                    jQuery(".lookupInput").on("click","img[generate]",function(e){
                        let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id");
                        let input = document.getElementById(id);
                        if(input){
                            input.value = '';
                            let hidden = document.getElementById(id+'_lkid');
                            if(hidden){
                                hidden.value = '';
                            }
                        }
                    });
                    // jQuery(".lookupInput").on("click","img[generate]",function(e){
                    //     let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id");
                    //     let input = document.getElementById(id);
                    //     if(input){
                    //         input.value = '';
                    //         let hidden = document.getElementById(id+'_lkid');
                    //         if(hidden){
                    //             hidden.value = '';
                    //         }
                    //     }
                    // });
                    //zhj 2022/04/11 end
                });
            </script>
            <div class="pbBottomButtons">