|  |  |  | 
|---|
|  |  |  | @description       : | 
|---|
|  |  |  | @author            : ChangeMeIn@UserSettingsUnder.SFDoc | 
|---|
|  |  |  | @group             : | 
|---|
|  |  |  | @last modified on  : 03-17-2022 | 
|---|
|  |  |  | @last modified on  : 03-23-2022 | 
|---|
|  |  |  | @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc | 
|---|
|  |  |  | --> | 
|---|
|  |  |  | <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> | 
|---|
|  |  |  | 
|---|
|  |  |  | //富文本 | 
|---|
|  |  |  | if(document.querySelector("[aria-describedby = 'cke_34']")){ | 
|---|
|  |  |  | result.HP_received_sign_rich__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (let index = 0; index < nodelist.length; index++) { | 
|---|
|  |  |  | if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { | 
|---|
|  |  |  | console.log(nodelist[index].id.indexOf('lkwgt')); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (let i = 0; i < userVLookUpFields.length; i++) { | 
|---|
|  |  |  | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; | 
|---|
|  |  |  | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); | 
|---|
|  |  |  | if(userVlookUpNodeValue!='000000000000000'){ | 
|---|
|  |  |  | result[userVLookUpFields[i]] = userVlookUpNodeValue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ | 
|---|
|  |  |  | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; | 
|---|
|  |  |  | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); | 
|---|
|  |  |  | if(userVlookUpNodeValue!='000000000000000'){ | 
|---|
|  |  |  | result[userVLookUpFields[i]] = userVlookUpNodeValue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //格式化时间 | 
|---|
|  |  |  | if(result.pickup_time__c){ | 
|---|
|  |  |  | result.pickup_time__c = result.pickup_time__c.replace(/\//g, '-')+':00'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(result.HP_received_sign_rich__c == '<br>'){ | 
|---|
|  |  |  | result.HP_received_sign_rich__c = ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log(JSON.stringify(result)); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //Alert Error Message | 
|---|
|  |  |  | function alertErrorMessage(errorMsg) { | 
|---|
|  |  |  | let errorMsgNode = document.getElementById("page:form:msgContent"); | 
|---|
|  |  |  | let errorMsgNode = document.getElementById("page:form:block:msgContent"); | 
|---|
|  |  |  | errorMsg = '错误:无效数据。' + '\n' + errorMsg; | 
|---|
|  |  |  | errorMsgNode.innerText = errorMsg; | 
|---|
|  |  |  | errorMsgNode.className = 'pbError'; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //Hide Error Message | 
|---|
|  |  |  | function hiddenErrorMsgNode() { | 
|---|
|  |  |  | let errorMsgNode = document.getElementById("page:form:msgContent"); | 
|---|
|  |  |  | let errorMsgNode = document.getElementById("page:form:block:msgContent"); | 
|---|
|  |  |  | errorMsgNode.innerText = ''; | 
|---|
|  |  |  | errorMsgNode.className = ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | let accountNodeId = document.querySelector("[data-id='Account__c']").id + '_lkid'; | 
|---|
|  |  |  | accountValue = document.getElementById(accountNodeId).value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let searchContactKeyWord = document.querySelector("[data-id='Loaner_medical_Staff__c']").value; | 
|---|
|  |  |  | console.log(accountValue); | 
|---|
|  |  |  | if(accountValue !='000000000000000'){ | 
|---|
|  |  |  | let baseUrl = "/apex/SearchContactPage"; | 
|---|
|  |  |  | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; | 
|---|
|  |  |  | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; | 
|---|
|  |  |  | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; | 
|---|
|  |  |  | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); | 
|---|
|  |  |  | if (window.focus) { | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <apex:form id="form"> | 
|---|
|  |  |  | <apex:inputHidden value="{!contactId}" id="contactId"/> | 
|---|
|  |  |  | <!-- Error Msg--> | 
|---|
|  |  |  | <apex:outputPanel id="errorMsg"> | 
|---|
|  |  |  | <apex:pageMessages id="msgContent" escape="false" /> | 
|---|
|  |  |  | </apex:outputPanel> | 
|---|
|  |  |  | <apex:pageblock > | 
|---|
|  |  |  | <apex:pageblock id="block"> | 
|---|
|  |  |  | <div class="pbHeader"> | 
|---|
|  |  |  | <table cellspacing="0" cellpadding="0" border="0"> | 
|---|
|  |  |  | <tbody> | 
|---|
|  |  |  | 
|---|
|  |  |  | </tr> | 
|---|
|  |  |  | </tbody> | 
|---|
|  |  |  | </table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- Error Msg--> | 
|---|
|  |  |  | <div style="text-align: center;"> | 
|---|
|  |  |  | <apex:outputPanel id="errorMsg"> | 
|---|
|  |  |  | <apex:pageMessages id="msgContent" escape="false" /> | 
|---|
|  |  |  | </apex:outputPanel> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- Iterate the layoutSections, which is a list of sections --> | 
|---|
|  |  |  | <apex:repeat value="{!layoutSections}" var="layoutSection"> | 
|---|
|  |  |  | 
|---|
|  |  |  | replaceSearchContactLookup(); | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let previous_value = {}; | 
|---|
|  |  |  | jQuery(".lookupInput input").each(function(i,e){ | 
|---|
|  |  |  | let je =jQuery(e); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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("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 = ''; | 
|---|
|  |  |  | if(['Loaner_medical_Staff__c'].indexOf(dataid) < 0) return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | jQuery(e).focus(function(){ | 
|---|
|  |  |  | previous_value[this.id] = this.value; | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | jQuery(e).change(function(){ | 
|---|
|  |  |  | if (previous_value[this.id] != jQuery(this).val()) { | 
|---|
|  |  |  | document.getElementById(this.id+'_lkid').value = ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 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;">'); | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 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("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 = ''; | 
|---|
|  |  |  | //         } | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <div class="pbBottomButtons"> | 
|---|