From 2f183a6b0a83ec3f7d35375d5d25d200efc2a3e1 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期二, 19 四月 2022 18:46:18 +0800
Subject: [PATCH] 20220419FixIssue
---
force-app/main/default/pages/NewAndEditReport.page | 78 ++++++++++++++++++++++++++++++++------
1 files changed, 65 insertions(+), 13 deletions(-)
diff --git a/force-app/main/default/pages/NewAndEditReport.page b/force-app/main/default/pages/NewAndEditReport.page
index bd565c3..d9e1f19 100644
--- a/force-app/main/default/pages/NewAndEditReport.page
+++ b/force-app/main/default/pages/NewAndEditReport.page
@@ -111,13 +111,22 @@
}
}
//鎵嬫湳鍒嗙被1
- result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:'';
- //鎵嬫湳鍒嗙被2
- result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:'';
- //鐩殑2
- if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){
- result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value;
+ if(api_id_map['Technical_Category1__c']){
+ result.Technical_Category1__c = document.getElementById(api_id_map['Technical_Category1__c']).value!='_\x01_'?document.getElementById(api_id_map['Technical_Category1__c']).value:'';
}
+ //result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:'';
+ //鎵嬫湳鍒嗙被2
+ if(api_id_map['Technical_Category2__c']){
+ result.Technical_Category2__c = document.getElementById(api_id_map['Technical_Category2__c']).value!='_\x01_'?document.getElementById(api_id_map['Technical_Category2__c']).value:'';
+ }
+ //result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:'';
+ //鐩殑2
+ if(api_id_map['Purpose2__c']){
+ result.Purpose2__c = document.getElementById(api_id_map['Purpose2__c']).value;
+ }
+ // if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){
+ // result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value;
+ // }
//瀵屾枃鏈璧嬪��
if(getCKEinstance('Customer_sigh_photo__c')){
result.Customer_sigh_photo__c = getCKEinstance('Customer_sigh_photo__c').getData()
@@ -226,6 +235,33 @@
return blankRequiredFields;
}
+ var GetEleByClass = function(class_name){
+ let eles = document.getElementsByClassName(class_name);
+ if(eles.length > 0) return eles[0];
+ return null;
+ }
+
+ var GetEleApiName = function(ele){
+ for(let ci in ele.classList){
+ let c = ele.classList[ci];
+ if(c.indexOf('{!ApiPrefix}'+'_')>-1){
+ return c.replace('{!ApiPrefix}'+'_','');
+ }
+ }
+ return '';
+ }
+
+ function IsFormTag(tag_name){
+ if (!tag_name) {
+ return false;
+ }
+ return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
+ }
+
+ function IsFormElement(e){
+ return IsFormTag(e.tagName);
+ }
+
//4.鑾峰彇瑕佸姞瀵嗙殑瀛楁
function getPIPayload(reportJson) {
let reportPayloadList = [];
@@ -254,7 +290,7 @@
//5.鏂板缓鎴栫紪杈�
function ProcessPI(reportJson, payloadForNewPI) {
blockme();
- if ({!isNewMode} || {!isCloneMode}) {
+ if ({!isNewMode} || {!isCloneMode} || !'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
NewPIToAWS(reportJson, payloadForNewPI)
}else {
UpdatePIToAWS(reportJson, payloadForNewPI)
@@ -491,7 +527,7 @@
payloadJson.age_Encrypted__c = result.object[0].ageEncrypt;
payloadJson.Medical_History_Encrypted__c = result.object[0].medicalHistoryEncrypt;
payloadJson.sex_Encrypted__c = result.object[0].sexEncrypt;
- if (isNewMode || {!isCloneMode}) {
+ if (isNewMode || {!isCloneMode}||!'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
payloadJson.AWS_Data_Id__c = result.object[0].dataId;
delete payloadJson.OwnerId;
} else {
@@ -577,7 +613,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="saveReportProcess('Save')" />
<input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveReportProcess('SaveAndNew')" />
<apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -600,8 +636,9 @@
<!--Each section has layoutFields, let's iterate them as well-->
<apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
- <apex:inputField html-title="{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" styleClass="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
- required="{!layoutField.isRequired}" />
+ <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+ <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" required="{!layoutField.isRequired}" />
+ <apex:outputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" />
<apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
</apex:pageblocksectionitem>
</apex:repeat>
@@ -609,6 +646,18 @@
</apex:pageBlockSection>
</apex:repeat>
<script>
+ var init_nodes = document.getElementsByClassName("PIBackApi");
+ var api_id_map={};
+ for(let ei in init_nodes){
+ let e = init_nodes[ei];
+ if(IsFormElement(e)){
+ if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
+ api_id_map[GetEleApiName(e)] = e.id;
+ }
+
+ }
+ }
+ console.log(api_id_map);
sfdcPage.appendToOnloadQueue(function () {
//鍒ゆ柇鏄惁涓哄彧璇婚�夐」
var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -650,7 +699,10 @@
document.querySelector("[data-id='Loaner_request_no1__c']").value = '{!no1Name}'
document.getElementById(document.querySelector("[data-id='Loaner_request_no1__c']").id + '_lkid').value = '{!no1Id}'
}
-
+
+ document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
+
let previous_value = {};
jQuery(".lookupInput input").each(function(i,e){
let je =jQuery(e);
@@ -706,7 +758,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="saveReportProcess('Save')" />
<input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveReportProcess('SaveAndNew')" />
<apex:commandButton action="{!cancel}" value="鍙栨秷" />
--
Gitblit v1.9.1