From 8badb57ea2c82557850ad5b39281c3e8714eb119 Mon Sep 17 00:00:00 2001
From: liuyan <liuyan@prec-tech.com>
Date: 星期四, 24 十一月 2022 10:08:31 +0800
Subject: [PATCH] 科室信息漏传SPO问题
---
force-app/main/default/pages/NewRentalApply.page | 125 +++++++++++++++++++++++++++++++++--------
1 files changed, 99 insertions(+), 26 deletions(-)
diff --git a/force-app/main/default/pages/NewRentalApply.page b/force-app/main/default/pages/NewRentalApply.page
index 10321bc..df81066 100644
--- a/force-app/main/default/pages/NewRentalApply.page
+++ b/force-app/main/default/pages/NewRentalApply.page
@@ -3,7 +3,7 @@
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<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;
@@ -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,16 +57,59 @@
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;
} else {
payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
}
- debugger
+ if('{!rtTypeId}'){
+ payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421
+ }
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 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");
+ }
+ }
function ProcessPI(rentalApplyJson, payloadForNewPI) {
blockme();
if ({!isNewMode} || {!isCloneMode}) {
@@ -97,8 +141,8 @@
}
return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
}
-
- function IsFormElement(e){
+
+ function IsFormElement(e){
return IsFormTag(e.tagName);
}
@@ -141,15 +185,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;
@@ -177,20 +223,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';
@@ -203,9 +250,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;
@@ -235,7 +286,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 == '') {
@@ -251,6 +304,7 @@
//Base Process
function saveRentalApplyProcess(saveMode) {
+ EditButton(true);
redirectMode = saveMode;
console.log('redirectMode' + redirectMode);
hiddenErrorMsgNode();
@@ -284,6 +338,7 @@
errorMsgNode.innerText = errorMsg;
errorMsgNode.className = 'pbError';
unblockUI();
+ EditButton(false);
}
//Hide Error Message
@@ -391,7 +446,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="鍙栨秷" />
@@ -412,8 +467,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>
@@ -429,7 +488,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);
@@ -463,7 +529,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
@@ -471,11 +539,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);
@@ -535,7 +608,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