From 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85 Mon Sep 17 00:00:00 2001
From: GWY <guweiyi@prec-tech.com>
Date: 星期一, 30 五月 2022 16:15:26 +0800
Subject: [PATCH] 两个LS特殊条件在说明的增减
---
force-app/main/default/pages/NewAndEditUserFaultInfo.page | 97 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/force-app/main/default/pages/NewAndEditUserFaultInfo.page b/force-app/main/default/pages/NewAndEditUserFaultInfo.page
index 6f9aa94..33755f5 100644
--- a/force-app/main/default/pages/NewAndEditUserFaultInfo.page
+++ b/force-app/main/default/pages/NewAndEditUserFaultInfo.page
@@ -61,7 +61,7 @@
}
//payloadJson.AWS_Data_Id__c = r.object[0].dataId;
- payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
+ // payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
if (isNewMode) {
payloadJson.AWS_Data_Id__c = r.object[0].dataId;
} else {
@@ -137,6 +137,19 @@
UpdatePIToAWS(sobjJson, payloadForNewPI)
}
}
+
+ 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");
+ }
+ }
var GetEleByClass = function(class_name){
let eles = document.getElementsByClassName(class_name);
@@ -167,18 +180,18 @@
function validateFieldValueFormate() {
let error_msg = '';
- let textEmail = "[data-id='Email']";
- let textPhone = "[data-id='UFPhone__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 phone = document.querySelector(textPhone);
+ // let textEmail = "[data-id='Email']";
+ // let textPhone = "[data-id='UFPhone__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 phone = document.querySelector(textPhone);
- if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
- error_msg += ';鐢佃瘽鍙风爜閿欒';
- }
+ // if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
+ // error_msg += ';鐢佃瘽鍙风爜閿欒';
+ // }
for(let e of document.getElementsByTagName('select')){
for(let op of e.options){
@@ -223,9 +236,9 @@
v = ele.value;
}
- if(v && v != "000000000000000"){
+ //if(v && v != "000000000000000"){
result[field_api_name] = v;
- }
+ //}
}
} else if (ele.type == 'checkbox') {
@@ -295,7 +308,9 @@
function checkRequiredFieldMsg(formData) {
let blankRequiredFields = '';
for(i = 0;i<requiredFieldAPIList.length;i++){
- if(formData[requiredFieldAPIList[i]]){
+ if(formData[requiredFieldAPIList[i]] && (VLookUpFields.indexOf(requiredFieldAPIList[i]) == -1)){
+ continue;
+ }else if((VLookUpFields.indexOf(requiredFieldAPIList[i]) != -1) && formData[requiredFieldAPIList[i]] != '000000000000000'){
continue;
}else{
if(blankRequiredFields == ''){
@@ -310,6 +325,7 @@
}
function saveSobjectProcess(save_and_new) {
+ EditButton(true);
if(save_and_new){
config.SaveAndNew = true;
}
@@ -329,7 +345,7 @@
// Check Required Field
let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson);
if (checkRequiredFieldMsgResult) {
- alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult);
+ alertErrorMessage('{!$Label.Input_Required_Field_Msg}' + checkRequiredFieldMsgResult);
return
}
// //3. Prepare the payload for New PI API To AWS - To Do
@@ -348,6 +364,7 @@
let errorMsgNode = document.getElementById("page:form:block:msgContent");
errorMsgNode.innerText = errorMsg;
errorMsgNode.className = 'pbError';
+ EditButton(false);
}
function hiddenErrorMsgNode() {
let errorMsgNode = document.getElementById("page:form:block:msgContent");
@@ -433,15 +450,15 @@
let baseUrl = "/apex/SearchContactPage";
let suffixUrl = "";
let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no';
- if (field = 'CONTACT__c') {
+ if (field == 'CONTACT__c') {
if (document.querySelector("[data-id='COMPANY__c']")) {
let accountNodeId = document.querySelector("[data-id='COMPANY__c']").id + '_lkid';
accountValue = document.getElementById(accountNodeId).value;
}
console.log('COMPANY__c accountValue ' + accountValue);
if(accountValue !='000000000000000'){
-
- suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue;
+ let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value;
+ suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord;
newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam);
if (window.focus) {
newSearchContactWindow.focus();
@@ -451,7 +468,8 @@
alertErrorMessage('璇疯緭鍏OMPANY !');
}
} else {
- suffixUrl = "?contactId="+contactNodeId;
+ let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value;
+ suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord;
newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam);
if (window.focus) {
newSearchContactWindow.focus();
@@ -503,7 +521,7 @@
<img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
<h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></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="{!$Label.Save}" onclick="saveSobjectProcess()" />
<input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
<apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -525,8 +543,14 @@
<!--Each section has layoutFields, let's iterate them as well-->
<apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
- <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
- required="{!layoutField.isRequired}" />
+ <!-- <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+ required="{!layoutField.isRequired}" /> -->
+ <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
+ required="{!layoutField.isRequired}" />
+ <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!User_FaultInfo__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="{!User_FaultInfo__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+ />
<apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
</apex:pageblocksectionitem>
</apex:repeat>
@@ -543,6 +567,25 @@
}
console.log(api_id_map);
sfdcPage.appendToOnloadQueue(function () {
+ var layoutSections = JSON.parse('{!layoutSectionsStr}');
+ for (let m = 0; m < layoutSections.length; m++) {
+ let layoutSection = layoutSections[m].layoutFields;
+ for (let n = 0; n < layoutSection.length; n++) {
+ let layoutField = layoutSection[n];
+ if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
+ 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");
+ }
+ }
+ }
+ }
+ }
//1. Set Last Name label
//document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕';
//2. Query AWS Data by dataId
@@ -554,8 +597,10 @@
//Replace Vlookup Field
replaceSearchContactLookup();
//3. Set Readonly Attribute
- document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
- document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
+ // document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
+ // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
+ document.getElementById('topButtonRow').style = '';
+ document.getElementById('bottomButtonRow').style = '';
});
</script>
<div class="pbBottomButtons">
@@ -564,7 +609,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="{!$Label.Save}" onclick="saveSobjectProcess()" />
<input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
<apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
--
Gitblit v1.9.1