From fc8a8cea62e5d248834482a1ade9db6ab0758bf2 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期日, 24 四月 2022 18:55:04 +0800 Subject: [PATCH] 20220424FixIssue --- force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page | 85 +++++++++++++++++++++++++++++++++++++----- 1 files changed, 74 insertions(+), 11 deletions(-) diff --git a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page index 044e42b..c3f05b4 100644 --- a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page +++ b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page @@ -11,6 +11,7 @@ } </style> <script> + AWSService.sfSessionId = '{!GETSESSIONID()}'; //Initial Required Information var staticResources = JSON.parse('{!staticResource}'); var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}'); @@ -48,22 +49,23 @@ console.log('Result from AWS' + JSON.stringify(r)); console.log('payloadJson=' + JSON.stringify(payloadJson)); payloadJson.Trial_User__c = r.object[0].trialUser; - payloadJson.Trail_User_Encrypt__c = r.object[0].trialUserEncrypt; + 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}'; } - debugger + if('{!rtTypeId}'){ + payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421 + } return payloadJson; } // New Or Edit function ProcessPI(consumApplyJson, payloadForNewPI) { blockme(); - if ({!isNewMode - }) { + if ({!isNewMode} || {!isCloneMode}) { NewPIToAWS(consumApplyJson, payloadForNewPI) }else { UpdatePIToAWS(consumApplyJson, payloadForNewPI) @@ -97,8 +99,10 @@ console.log(nodelist[index].id.indexOf('lkwgt')); if (nodelist[index].id.indexOf('lkwgt') == -1) { let vlookUpNodeId = nodelist[index].id + '_lkid'; - let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; - result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + if(document.getElementById(vlookUpNodeId)!=null){ + let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; + result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + } } } else if (nodelist[index].type == 'checkbox') { result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked; @@ -124,6 +128,7 @@ result[userVLookUpFields[i]] = userVlookUpNodeValue; } } + result.Consum_Apply_Equipment_Set__c = document.querySelector('[data-id=Consum_Apply_Equipment_Set__c]').textContent; console.log(JSON.stringify(result)); return result; } @@ -244,7 +249,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="鍙栨秷" /> @@ -259,8 +264,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_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply_Equipment_Set_Detail__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_Equipment_Set_Detail__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_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" + /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> </apex:repeat> @@ -270,13 +279,67 @@ <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) { + 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}) { blockme(); QueryConsumApplyFromAWS(); }; - document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); + //document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); + + document.getElementById('topButtonRow').style = ''; +聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = ''; + //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;">'); + // }) + + // 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 = ''; + // } + // } + // }); + //zhj 2022/04/11 end }); </script> <div class="pbBottomButtons"> @@ -285,7 +348,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