From 6ea917ffd94638d96d2a64316e0c971985ca47d6 Mon Sep 17 00:00:00 2001 From: 涂煌豪 <tuhuanghao@prec-tech.com> Date: 星期二, 24 五月 2022 13:25:48 +0800 Subject: [PATCH] 修改客户人员更新逻辑 --- force-app/main/default/pages/NewOnCall.page | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page index a87e0a6..2b17d5b 100644 --- a/force-app/main/default/pages/NewOnCall.page +++ b/force-app/main/default/pages/NewOnCall.page @@ -3,7 +3,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; @@ -37,8 +37,10 @@ var queryBack = function queryBack(data) { console.log('data = ' + data); //document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").value = data.object.callerPhone; - document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone; //20220404 By Chen Yanan - document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP; + if(document.getElementById(api_id_map['Caller_phone__c'])) + document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone; //20220404 By Chen Yanan + if(document.querySelector("[data-id='Responsible_Person_HP__c']")) + document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP; unblockUI(); }; @@ -59,6 +61,9 @@ delete payloadJson.OwnerId; } else { payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; + } + if('{!sfRecordIdForEdit}'){ + payloadJson.Id = '{!sfRecordIdForEdit}'; } if('{!rtTypeId}'){ payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421 @@ -146,14 +151,16 @@ //Insert Sensitive Information to AWS function NewPIToAWS(onCallJson, payloadForNewPI) { let controllerSaveMethod = '{!$RemoteAction.OnCallController.saveOnCall}'; - AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack); + AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl,{!isNewMode}, insertOrUpdateBack, redirectCallBack); } //Check Required Fields 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 == '') { @@ -239,8 +246,8 @@ } return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; } - - function IsFormElement(e){ + + function IsFormElement(e){ return IsFormTag(e.tagName); } </script> -- Gitblit v1.9.1