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/NewAndEditReport.page | 110 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 81 insertions(+), 29 deletions(-)
diff --git a/force-app/main/default/pages/NewAndEditReport.page b/force-app/main/default/pages/NewAndEditReport.page
index 16baa76..42ed130 100644
--- a/force-app/main/default/pages/NewAndEditReport.page
+++ b/force-app/main/default/pages/NewAndEditReport.page
@@ -72,7 +72,6 @@
result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked;
} else if (nodelist[index].type == 'select-multiple') {
//nodelist[index].getAttribute("data-id")
- let multiple = nodelist[index].getAttribute("data-id");
//let targets = document.querySelector("[data-id=" + multiple + "]").nextSibling.children[0].children[1].children[2].innerText;
//Before Update By Li Jun 20220411
// let targets = document.querySelector("[data-id=" + multiple + "]").parentNode.children[2].children[0].children[1].children[2].children[0].innerText;
@@ -82,6 +81,7 @@
//Before Update By Li Jun 20220411
//After Update By Li Jun 20220411 Start
+ let multiple = nodelist[index].getAttribute("data-id");
let targets = document.querySelector("[data-id=" + multiple + "]").options;
let selValues = [];
for(i=0; i < targets.length; i++){
@@ -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()
@@ -174,24 +183,24 @@
function validateFieldValueFormate() {
//VOC_Informer_Contact__c,Caller_phone_c__c
let error_msg = '';
- let textEmail = "[data-id=' Follow_staff_email__c']";
- let textPhone1 = "[data-id='VOC_Informer_Contact__c']";
- let textPhone2 = "[data-id='Caller_phone_c__c']";
- //Email
- let email = document.querySelector(textEmail);
- if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){
- error_msg += ';瀵瑰簲鑰�(閭)鏍煎紡閿欒';
- }
+ // let textEmail = "[data-id=' Follow_staff_email__c']";
+ // let textPhone1 = "[data-id='VOC_Informer_Contact__c']";
+ // let textPhone2 = "[data-id='Caller_phone_c__c']";
+ // //Email
+ // let email = document.querySelector(textEmail);
+ // if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){
+ // error_msg += ';瀵瑰簲鑰�(閭)鏍煎紡閿欒';
+ // }
- let phone1 = document.querySelector(textPhone1);
- if(phone1 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone1.value)){
- error_msg += ';淇℃伅鎻愪緵浜鸿仈绯绘柟寮忥紙鐢佃瘽锛夊彿鐮侀敊璇�';
- }
+ // let phone1 = document.querySelector(textPhone1);
+ // if(phone1 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone1.value)){
+ // error_msg += ';淇℃伅鎻愪緵浜鸿仈绯绘柟寮忥紙鐢佃瘽锛夊彿鐮侀敊璇�';
+ // }
- let phone2 = document.querySelector(textPhone2);
- if(phone2 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone2.value)){
- error_msg += ';鑱旂郴鐢佃瘽鍙风爜閿欒';
- }
+ // let phone2 = document.querySelector(textPhone2);
+ // if(phone2 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone2.value)){
+ // error_msg += ';鑱旂郴鐢佃瘽鍙风爜閿欒';
+ // }
for(let e of document.getElementsByTagName('select')){
for(let op of e.options){
@@ -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,8 +527,9 @@
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 {
payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
}
@@ -576,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="鍙栨秷" />
@@ -599,7 +636,7 @@
<!--Each section has layoutFields, let's iterate them as well-->
<apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
- <apex:inputField html-data-id="{!layoutField.fieldAPI}" styleClass="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+ <apex:inputField html-title="{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
required="{!layoutField.isRequired}" />
<apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
</apex:pageblocksectionitem>
@@ -608,6 +645,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}');
@@ -649,7 +698,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);
@@ -705,7 +757,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