From ac719375874fd50fad5a11f8e04ac3329081bd0b Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期五, 08 四月 2022 22:58:44 +0800
Subject: [PATCH] Fix Weekly Report
---
force-app/main/default/pages/NewRepair.page | 110 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 92 insertions(+), 18 deletions(-)
diff --git a/force-app/main/default/pages/NewRepair.page b/force-app/main/default/pages/NewRepair.page
index bc80e27..3cafc75 100644
--- a/force-app/main/default/pages/NewRepair.page
+++ b/force-app/main/default/pages/NewRepair.page
@@ -2,7 +2,7 @@
@description :
@author : ChangeMeIn@UserSettingsUnder.SFDoc
@group :
- @last modified on : 03-23-2022
+ @last modified on : 03-30-2022
@last modified by : ChangeMeIn@UserSettingsUnder.SFDoc
-->
<apex:page standardController="Repair__c" extensions="NewRepairController" id="page">
@@ -40,6 +40,15 @@
// alert(errorMessage);
alertErrorMessage(errorMessage);
}
+ }
+ function GetEleApiName(ele){
+ for(let ci in ele.classList){
+ let c = ele.classList[ci];
+ if(c.indexOf('PIBackApi_')>-1){
+ return c.replace('PIBackApi_','');
+ }
+ }
+ return '';
}
//Query Required Parameter
@@ -156,20 +165,52 @@
for (let i = 0; i < userVLookUpFields.length; i++) {
if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){
// let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value;
- let userVlookUpNodeValue = jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').val()
- console.log('userVlookUpNodeValue:'+userVlookUpNodeValue);
- if(userVlookUpNodeValue!='000000000000000'){
- result[userVLookUpFields[i]] = userVlookUpNodeValue;
+ let e = document.getElementById(jQuery('[data-id="'+userVLookUpFields[i]+'"] .lookupInput input').attr('id')+'_lkid');
+ //let userVlookUpNodeValue = jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').val()
+ // console.log('userVlookUpNodeValue:'+e.value);
+ if(e && e.value!='000000000000000'){
+ result[userVLookUpFields[i]] = e.value;
}
}
}
- result.work_location_select__c = document.querySelector("[id='page:form:block:j_id34:1:j_id35:j_id36:18:j_id37']").value;
+ // result.work_location_select__c = document.querySelector("[id='page:form:block:j_id34:1:j_id35:j_id36:18:j_id37']").value;
// result.ProblemDescription__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
/*
if(result.engineerSendDate__c){
result.engineerSendDate__c = result.engineerSendDate__c.replace(/\//g, '-')+':00';
}
*/
+ let e = null;
+ e = document.getElementById(jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.Incharge_Staff__c = e.value;
+ }
+
+ e = document.getElementById(api_id_map['work_location_select__c']);
+ if(e){
+ result.work_location_select__c = e.value;
+ }
+ e = document.getElementById(jQuery('[data-id="OCSM_RC_CordingUser__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.OCSM_RC_CordingUser__c = e.value;
+ }
+
+ e = document.getElementById(jQuery('[data-id="OSH_Affirmant__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.OSH_Affirmant__c = e.value;
+ }
+ e = document.getElementById(jQuery('[data-id="OSHRAConfirmUser__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.OSHRAConfirmUser__c = e.value;
+ }
+ e = document.getElementById(jQuery('[data-id="Repair_Authenticator__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.Repair_Authenticator__c = e.value;
+ }
+ e = document.getElementById(jQuery('[data-id="Repair_Determine_result_ConfirmationUser__c"] .lookupInput input').attr('id')+'_lkid');
+ if(e){
+ result.Repair_Determine_result_ConfirmationUser__c = e.value;
+ }
console.log(JSON.stringify(result));
return result;
}
@@ -181,22 +222,22 @@
var queryBack = function queryBack(data) {
console.log(data);
- document.querySelector("[data-id='address_Contacts__c']").innerHTML = data.object.addressContacts;
- document.querySelector("[data-id='address_Contacts_Name__c']").innerHTML = data.object.addressContactsName;
- document.querySelector("[data-id='address_Telephone__c']").innerHTML = data.object.addressTelephone;
- document.querySelector("[data-id='address_ZipCode__c']").innerHTML = data.object.addressZipCode;
- document.querySelector("[data-id='Detailed_Address__c']").innerHTML = data.object.detailedAddress;
- document.querySelector("[data-id='RepairApplicant__c']").innerHTML = data.object.repairApplicant;
+ document.querySelector("[data-id='address_Contacts__c']").value = data.object.addressContacts;
+ document.querySelector("[data-id='address_Contacts_Name__c']").value = data.object.addressContactsName;
+ document.querySelector("[data-id='address_Telephone__c']").value = data.object.addressTelephone;
+ document.querySelector("[data-id='address_ZipCode__c']").value = data.object.addressZipCode;
+ document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress;
+ document.querySelector("[data-id='RepairApplicant__c']").value = data.object.repairApplicant;
AWSService.query(staticResourceAddress.queryUrl, '{!DecryptAWSDataId}', queryBackDecrypt, staticResourceAddress.token);
};
var queryBackContact = function queryBack(data) {
console.log(data);
- document.querySelector("[data-id='address_Contacts__c']").innerHTML = data.object.lastName;
+ document.querySelector("[data-id='address_Contacts__c']").value = data.object.lastName;
};
var queryBackDecrypt = function queryBack(data) {
- document.querySelector("[data-id='Detailed_Address__c']").innerHTML = data.object.detailedAddress;
- document.querySelector("[data-id='address_ZipCode__c']").innerHTML = data.object.zipCode;
- document.querySelector("[data-id='address_Telephone__c']").innerHTML = data.object.telephone;
+ document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress;
+ document.querySelector("[data-id='address_ZipCode__c']").value = data.object.zipCode;
+ document.querySelector("[data-id='address_Telephone__c']").value = data.object.telephone;
AWSService.query(staticResourceContact.queryUrl, '{!ContactAWSDataId}', queryBackContact, staticResourceContact.token);
}
@@ -337,6 +378,28 @@
</apex:pageBlockSection>
</apex:repeat>
<script>
+ 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);
+ }
+ 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;
+ }
+
+ }
+ }
+
//Append Page
sfdcPage.appendToOnloadQueue(function () {
var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -345,7 +408,16 @@
for (let n = 0; n < layoutSection.length; n++) {
let layoutField = layoutSection[n];
if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
- document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField);
+ let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']");
+ e.disabled = !(layoutField.editableField);
+ if (!(layoutField.editableField)) {
+ if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') {
+ e.parentNode.classList.add("disabledbutton");
+ }
+ if (e.tagName == 'DIV') {
+ e.classList.add("disabledbutton");
+ }
+ }
}
}
}
@@ -354,8 +426,10 @@
if (!{!isNewMode}) {
blockme();
QueryRepairFromAWS();
+ unblockUI();
};
- document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+ if(document.querySelector("[data-id='OwnerId']") != null)
+ document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
let previous_value = {};
jQuery(".lookupInput input").each(function(i,e){
--
Gitblit v1.9.1