From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 15:10:02 +0800 Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte --- force-app/main/default/pages/NewAndEditQIS.page | 67 ++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 15 deletions(-) diff --git a/force-app/main/default/pages/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page index 5e63772..5cdc25e 100644 --- a/force-app/main/default/pages/NewAndEditQIS.page +++ b/force-app/main/default/pages/NewAndEditQIS.page @@ -1,6 +1,6 @@ <apex:page standardController="QIS_Report__c" extensions="NewAndEditQISController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> - <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> + <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> @@ -41,7 +41,7 @@ return JSON.stringify(leadPayloadList); }, insertOrUpdateBack:function(payloadJson, r, isNewMode){ - + debugger for(let f in config.AWSToSobjectMap){ if(r.object[0].hasOwnProperty(f)){ payloadJson[config.AWSToSobjectMap[f]] = r.object[0][f]; @@ -67,6 +67,9 @@ 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; }, @@ -122,9 +125,11 @@ updateMethod:"NewAndEditQISController.saveQISReport", insertMethod:"NewAndEditQISController.saveQISReport" } - + console.log('config.AWSToSobjectMap = ' + JSON.stringify(config.AWSToSobjectMap)); + console.log('config.AWSToSobjectEncryptedMap = ' + JSON.stringify(config.AWSToSobjectEncryptedMap)); AWSService.sfSessionId = '{!GETSESSIONID()}'; var staticResources = JSON.parse('{!staticResource}'); + var staticResourcesV2 = JSON.parse('{!staticResourcesV2}'); var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}'); var fieldAPIToLabelMap = JSON.parse('{!fieldAPIToLabelMapStr}'); console.log('{!staticResource}'); @@ -135,6 +140,19 @@ NewPIToAWS(sobjJson, payloadForNewPI) }else { UpdatePIToAWS(sobjJson, payloadForNewPI) + } + } + + 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"); } } @@ -254,9 +272,9 @@ } else { result[field_api_name] = ele.value; //鍏抽棴QIS鐞嗙敱涓烘棤鏃� - if(field_api_name == 'Cancel_QIS_Reason__c' && ele.value == '_\x01_'){ - result[field_api_name] = ''; - } + // if(field_api_name == 'Cancel_QIS_Reason__c' && ele.value == '_\x01_'){ + // result[field_api_name] = ''; + // } } // let e1 = document.getElementById(api_id_map[field_api_name]); @@ -336,21 +354,27 @@ let obj = JSON.parse(payloadForNewPI); obj[0].dataId = '{!AWSDataId}'; let payloadForNewPIJson = JSON.stringify(obj); - AWSService.update(staticResources.updateUrl, sobjJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack,redirectCallBack); - + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start + //AWSService.update(staticResources.updateUrl, sobjJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack,redirectCallBack); + AWSService.update(staticResourcesV2.updateUrl, sobjJson, payloadForNewPIJson, controllerSaveMethod, staticResourcesV2.token, staticResources.transactionUrl, false, insertOrUpdateBack,redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end } function NewPIToAWS(sobjJson, payloadForNewPI) { let controllerSaveMethod = config.insertMethod; - AWSService.insert(staticResources.newUrl, sobjJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack,redirectCallBack); - + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start + //AWSService.insert(staticResources.newUrl, sobjJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack,redirectCallBack); + AWSService.insert(staticResourcesV2.newUrl, sobjJson, payloadForNewPI, controllerSaveMethod, staticResourcesV2.token, staticResources.transactionUrl, true, insertOrUpdateBack,redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end } function checkRequiredFieldMsg(formData) { let blankRequiredFields = ''; for(i = 0;i<requiredFieldAPIList.length;i++){ - if(formData[requiredFieldAPIList[i]]){ + if(formData[requiredFieldAPIList[i]] && (VLookUpFields.indexOf(requiredFieldAPIList[i]) == -1)){ + continue; + }else if((VLookUpFields.indexOf(requiredFieldAPIList[i]) != -1) && formData[requiredFieldAPIList[i]] != '000000000000000'){ continue; }else{ if(blankRequiredFields == ''){ @@ -364,6 +388,7 @@ return blankRequiredFields; } function saveSobjectProcess(save_and_new) { + EditButton(true); if(save_and_new){ config.SaveAndNew = true; @@ -403,6 +428,7 @@ let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; + EditButton(false); } function hiddenErrorMsgNode() { let errorMsgNode = document.getElementById("page:form:block:msgContent"); @@ -441,7 +467,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}" /> @@ -463,8 +489,12 @@ <!--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="{!QIS_Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" - required="{!layoutField.isRequired}" /> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!QIS_Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" + required="{!layoutField.isRequired}" /> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!QIS_Report__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="{!QIS_Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" + /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> </apex:repeat> @@ -484,6 +514,11 @@ } console.log(api_id_map); sfdcPage.appendToOnloadQueue(function () { + jQuery('option').each(function(i,e){ + if(e.value == '_\x01_'){ + e.value = ''; + } + }) //鍒ゆ柇鏄惁涓哄彧璇婚�夐」 var layoutSections = JSON.parse('{!layoutSectionsStr}'); for (let m = 0; m < layoutSections.length; m++) { @@ -524,6 +559,8 @@ oi.value = '{!CurrentUserId}' } } + document.getElementById('topButtonRow').style = ''; +聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = ''; }); </script> <div class="pbBottomButtons"> @@ -532,7 +569,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