From 639b0139b5713badf37e67b4fe7b9d3b3a592163 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期一, 09 五月 2022 13:38:24 +0800 Subject: [PATCH] fixRequiredFieldValidation0509 --- force-app/main/default/pages/NewConsumApply.page | 39 ++++++++++++++++++++++++++++++++++----- 1 files changed, 34 insertions(+), 5 deletions(-) diff --git a/force-app/main/default/pages/NewConsumApply.page b/force-app/main/default/pages/NewConsumApply.page index 588c175..5eb258d 100644 --- a/force-app/main/default/pages/NewConsumApply.page +++ b/force-app/main/default/pages/NewConsumApply.page @@ -10,7 +10,7 @@ <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> - <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> + <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> <style> .disabledbutton { pointer-events: none; @@ -26,6 +26,19 @@ var VLookUpFields = new Set(['Loaner_medical_Staff__c', 'Hospital__c', 'Strategic_dept__c', 'Account__c', 'QIS_number__c', 'OPDPlan__c', 'Campaign__c', 'Rental_Apply__c', 'Shipment_address__c', 'Dealer__c', 'Old_Consum_Apply__c', 'DeliverySlip__c', 'OwnerId', 'OPD__c']); var userVLookUpFields = ['Person_In_Charge__c', 'applyUser__c', 'CC_EmailUser__c', 'Assign_Person__c', 'Consum_Assistant__c', 'Consum_Assistant2__c', 'Consum_Assistant3__c', 'SalesManager__c', 'ZongjianApprovalManager__c', 'BuchangApprovalManagerSales__c', 'TongkuoZongjian__c']; var redirectMode = 'Save'; + + function EditButton(isDisabled){ + var topele = document.getElementById('topButtonRow'); + var bottomele = document.getElementById('bottomButtonRow'); + + if (isDisabled) { + topele.classList.add("disabledbutton"); + bottomele.classList.add("disabledbutton"); + }else { + topele.classList.remove("disabledbutton"); + bottomele.classList.remove("disabledbutton"); + } + } //Redirect Required Parameter var redirectCallBack = function redirectCallBack(sfId,errorMessage) { @@ -62,8 +75,12 @@ payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; if (isNewMode || {!isCloneMode}) { payloadJson.AWS_Data_Id__c = r.object[0].dataId; + delete payloadJson.OwnerId; } else { payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; + } + if('{!rtTypeId}'){ + payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421 } return payloadJson; } @@ -216,7 +233,9 @@ function checkRequiredFieldMsg(formData) { let blankRequiredFields = ''; for (i = 0; i < requiredFieldAPIList.length; i++) { - if (formData[requiredFieldAPIList[i]]) { + if (formData[requiredFieldAPIList[i]] && !VLookUpFields.has(requiredFieldAPIList[i])) { + continue; + }else if(VLookUpFields.has(requiredFieldAPIList[i]) && formData[requiredFieldAPIList[i]] != '000000000000000'){ continue; } else { if (blankRequiredFields == '') { @@ -232,6 +251,8 @@ //Base Process function saveConsumApplyProcess(saveMode) { + EditButton(true); + redirectMode = saveMode; console.log('redirectMode' + redirectMode); hiddenErrorMsgNode(); @@ -265,6 +286,7 @@ errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; unblockUI(); + EditButton(false); } //Hide Error Message @@ -380,7 +402,7 @@ <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> <h2 class="mainTitle">鑰楁潗澶囧搧鐢宠缂栬緫</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="淇濆瓨" onclick="saveConsumApplyProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> @@ -401,8 +423,12 @@ <!--Each section has layoutFields, let's iterate them as well--> <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> - <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" /> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__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="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" + /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> </apex:repeat> @@ -455,6 +481,9 @@ //Replace Vlookup Field replaceSearchContactLookup(); document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); + + document.getElementById('topButtonRow').style = ''; +聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = ''; let previous_value = {}; jQuery(".lookupInput input").each(function(i,e){ @@ -512,7 +541,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="淇濆瓨" onclick="saveConsumApplyProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> -- Gitblit v1.9.1