From ba1c90575c47f9cb5c2ce0a20da90d3b1739b5fa Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期二, 26 四月 2022 11:47:45 +0800 Subject: [PATCH] 0425 Commit --- force-app/main/default/pages/NewAndEditUserFaultInfo.page | 72 +++++++++++++++++++++++++----------- 1 files changed, 50 insertions(+), 22 deletions(-) diff --git a/force-app/main/default/pages/NewAndEditUserFaultInfo.page b/force-app/main/default/pages/NewAndEditUserFaultInfo.page index 0d9d2bf..a49f57d 100644 --- a/force-app/main/default/pages/NewAndEditUserFaultInfo.page +++ b/force-app/main/default/pages/NewAndEditUserFaultInfo.page @@ -61,7 +61,7 @@ } //payloadJson.AWS_Data_Id__c = r.object[0].dataId; - payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; + // payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; if (isNewMode) { payloadJson.AWS_Data_Id__c = r.object[0].dataId; } else { @@ -167,18 +167,18 @@ function validateFieldValueFormate() { let error_msg = ''; - let textEmail = "[data-id='Email']"; - let textPhone = "[data-id='UFPhone__c']"; - //Email - let email = document.querySelector(textEmail); - if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ - error_msg += ';閭欢鏍煎紡閿欒'; - } - let phone = document.querySelector(textPhone); + // let textEmail = "[data-id='Email']"; + // let textPhone = "[data-id='UFPhone__c']"; + // //Email + // let email = document.querySelector(textEmail); + // if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ + // error_msg += ';閭欢鏍煎紡閿欒'; + // } + // let phone = document.querySelector(textPhone); - if(false && phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ - error_msg += ';鐢佃瘽鍙风爜閿欒'; - } + // if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + // error_msg += ';鐢佃瘽鍙风爜閿欒'; + // } for(let e of document.getElementsByTagName('select')){ for(let op of e.options){ @@ -433,15 +433,15 @@ let baseUrl = "/apex/SearchContactPage"; let suffixUrl = ""; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; - if (field = 'CONTACT__c') { + if (field == 'CONTACT__c') { if (document.querySelector("[data-id='COMPANY__c']")) { let accountNodeId = document.querySelector("[data-id='COMPANY__c']").id + '_lkid'; accountValue = document.getElementById(accountNodeId).value; } console.log('COMPANY__c accountValue ' + accountValue); if(accountValue !='000000000000000'){ - - suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value; + suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { newSearchContactWindow.focus(); @@ -451,7 +451,8 @@ alertErrorMessage('璇疯緭鍏OMPANY !'); } } else { - suffixUrl = "?contactId="+contactNodeId; + let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value; + suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { newSearchContactWindow.focus(); @@ -503,7 +504,7 @@ <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2> </td> - <td class="pbButton" id="topButtonRow"> + <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;"> <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" /> <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" /> <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" /> @@ -525,8 +526,14 @@ <!--Each section has layoutFields, let's iterate them as well--> <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> - <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" - required="{!layoutField.isRequired}" /> + <!-- <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + required="{!layoutField.isRequired}" /> --> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" + required="{!layoutField.isRequired}" /> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" + required="{!layoutField.isRequired}" /> + <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" + /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> </apex:repeat> @@ -543,6 +550,25 @@ } console.log(api_id_map); 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) { + 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"); + } + } + } + } + } //1. Set Last Name label //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕'; //2. Query AWS Data by dataId @@ -554,8 +580,10 @@ //Replace Vlookup Field replaceSearchContactLookup(); //3. Set Readonly Attribute - document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); - document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); + // document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); + // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); + document.getElementById('topButtonRow').style = ''; + document.getElementById('bottomButtonRow').style = ''; }); </script> <div class="pbBottomButtons"> @@ -564,7 +592,7 @@ <tr> <td class="pbTitle"> <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> </td> - <td class="pbButtonb" id="bottomButtonRow"> + <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;"> <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" /> <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" /> <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" /> -- Gitblit v1.9.1