From e19c35a6d99fd792106d925ae03e8ae3cef3f6b3 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 20 四月 2022 16:44:06 +0800
Subject: [PATCH] Insert log issue
---
force-app/main/default/pages/NewRentalApply.page | 99 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 76 insertions(+), 23 deletions(-)
diff --git a/force-app/main/default/pages/NewRentalApply.page b/force-app/main/default/pages/NewRentalApply.page
index 658a126..62eb087 100644
--- a/force-app/main/default/pages/NewRentalApply.page
+++ b/force-app/main/default/pages/NewRentalApply.page
@@ -42,6 +42,7 @@
document.querySelector("[data-id='Phone_number__c']").value = data.object.phoneNumber;
document.querySelector("[data-id='direct_shippment_address__c']").value = data.object.directShippmentAddress;
unblockUI();
+ enableButtonStatus();//Add by Li Jun 20220418
};
//Check If Insert Or Update
@@ -56,6 +57,10 @@
payloadJson.Phone_Number_Encrypt__c = r.object[0].phoneNumberEncrypt;
payloadJson.Direct_Shippment_Address_Encrypt__c = r.object[0].directShippmentAddressEncrypt;
payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
+ if('{!rtTypeId}'){
+ payloadJson.RecordTypeId = '{!rtTypeId}';//Add by Li Jun for Record Type Issue 20220419
+ }
+
if (isNewMode || {!isCloneMode}) {
payloadJson.AWS_Data_Id__c = r.object[0].dataId;
delete payloadJson.OwnerId;
@@ -65,7 +70,30 @@
debugger
return payloadJson;
}
+ //Add Button status start 20220418
+ function enableButton(obj) {
+ obj.classList.remove("btnDisabled");
+ }
+ function disableButton(obj) {
+ obj.classList.add("btnDisabled");
+ }
+
+ function disableButtonStatus() {
+ let btnList = document.getElementsByClassName('btn');
+ for (let i = 0; i < btnList.length; i++) {
+ disableButton(btnList[i]);
+ }
+ }
+
+ function enableButtonStatus() {
+ let btnList = document.getElementsByClassName('btn');
+ for (let i = 0; i < btnList.length; i++) {
+ enableButton(btnList[i]);
+ }
+ }
+ disableButtonStatus();
+ //Add Button status end 20220418
// New Or Edit
function ProcessPI(rentalApplyJson, payloadForNewPI) {
blockme();
@@ -98,8 +126,8 @@
}
return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
}
-
- function IsFormElement(e){
+
+ function IsFormElement(e){
return IsFormTag(e.tagName);
}
@@ -142,15 +170,17 @@
// }
// result.HP_received_sign_rich__c = CKEDITOR.instances["page:form:block:j_id34:12:j_id35:j_id36:1:j_id37:textAreaDelegate_HP_received_sign_rich__c"].getData();
// if(document.querySelector("[aria-describedby = 'cke_71']")){
- // result. Extension_List_RentalApply__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
+ // result. Extension_List_RentalApply__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
// }
for (let index = 0; index < nodelist.length; index++) {
if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) {
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)){
+ 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;
@@ -178,20 +208,21 @@
}
}
}
- if(document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']")!=null){
- result.demo_purpose2__c = document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']").value;
+ if(api_id_map['demo_purpose2__c']){
+ result.demo_purpose2__c = document.getElementById(api_id_map['demo_purpose2__c']).value!='_\x01_'?document.getElementById(api_id_map['demo_purpose2__c']).value:'';
}
- if(document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']")!=null){
- result.ToAgency__c = document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']").value;
+ if(api_id_map['ToAgency__c']){
+ result.ToAgency__c = document.getElementById(api_id_map['ToAgency__c']).value!='_\x01_'?document.getElementById(api_id_map['ToAgency__c']).value:'';
}
//document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']").disabled =true; // Commented By Li Jun 20220304
- if(document.querySelector("[id='page:form:block:j_id34:13:j_id35:j_id36:1:j_id37']")!=null){
- result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:13:j_id35:j_id36:1:j_id37']").value;
- }else{
- if(document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']")!=null){
- result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']").value;
- }
+ if(api_id_map['Loaner_cancel_reason__c']){
+ result.Loaner_cancel_reason__c = document.getElementById(api_id_map['Loaner_cancel_reason__c']).value!='_\x01_'?document.getElementById(api_id_map['Loaner_cancel_reason__c']).value:'';
}
+ // else{
+ // if(document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']")!=null){
+ // result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']").value;
+ // }
+ // }
// //鏍煎紡鍖栨椂闂�
// if(result.HP_received_sign_day__c){
// result.HP_received_sign_day__c = result.HP_received_sign_day__c.replace(/\//g, '-')+':00';
@@ -204,9 +235,13 @@
if(e){
result.Extension_List_RentalApply__c = e.getData();
}
- if(document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:13:j_id37' + '_lkid')!=null){
+ if(document.getElementById(api_id_map['Office_Assistant1__c'] + '_lkid')!=null){
// result.ToAgency__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:18:j_id37').value;
- result.Office_Assistant1__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:13:j_id37' + '_lkid').value;
+ result.Office_Assistant1__c = document.getElementById(api_id_map['Office_Assistant1__c'] + '_lkid').value;
+ }
+ if(document.getElementById(api_id_map['Office_Assistant2__c'] + '_lkid')!=null){
+ // result.ToAgency__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:18:j_id37').value;
+ result.Office_Assistant2__c = document.getElementById(api_id_map['Office_Assistant2__c'] + '_lkid').value;
}
console.log(JSON.stringify(result));
return result;
@@ -392,7 +427,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="saveRentalApplyProcess('Save')" />
<input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRentalApplyProcess('SaveAndNew')" />
<apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -413,8 +448,12 @@
<!--Each section has layoutFields, let's iterate them as well-->
<apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
- <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+ <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_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="{!Rental_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="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+ />
<apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
</apex:pageblocksectionitem>
</apex:repeat>
@@ -430,7 +469,14 @@
if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
api_id_map[GetEleApiName(e)] = e.id;
}
-
+ }else{
+ let eid = jQuery(e).find(".lookupInput input").attr("id")
+ if(eid){
+ eid += '_lkid';
+ if(document.getElementById(eid)){
+ api_id_map[GetEleApiName(e)] = eid;
+ }
+ }
}
}
console.log(api_id_map);
@@ -464,7 +510,9 @@
var onlyReadFields = ['ExtensionStatus__c','ExtensionApplicationTime_Initial__c','ExtensionApprovalTime_Initial__c','ExtensionApplicationTime_Final__c','ExtensionApprovalTime_Final__c','ExtensionSuccessTimes__c','ZongjianApprovalManager__c','BuchangApprovalManager__c','JingliApprovalManager__c','BuchangApprovalManagerSales__c','SalesManager__c'];
console.log(onlyReadFields);
for(let i=0;i<onlyReadFields.length;i++){
- document.querySelector('[data-id='+onlyReadFields[i]+']').parentNode.remove();
+ if(document.querySelector('[data-id='+onlyReadFields[i]+']')){
+ document.querySelector('[data-id='+onlyReadFields[i]+']').parentNode.remove();
+ }
}
//2. Query AWS Data by dataId
@@ -472,11 +520,16 @@
if (!{!isNewMode}) {
blockme();
QueryRentalApplyFromAWS();
+ }else{
+ enableButtonStatus();//Add by Li Jun 20220418
};
//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){
let je =jQuery(e);
@@ -536,7 +589,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="saveRentalApplyProcess('Save')" />
<input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRentalApplyProcess('SaveAndNew')" />
<apex:commandButton action="{!cancel}" value="鍙栨秷" />
--
Gitblit v1.9.1