From 47efcaa6a55e4b397442616f8b24d672afddefd8 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期五, 08 四月 2022 17:13:48 +0800
Subject: [PATCH] SWAG-CC58ME
---
force-app/main/default/pages/NewAndEditAgencyContact.page | 132 ++++++++++++++++++++++++++++++++++---------
1 files changed, 104 insertions(+), 28 deletions(-)
diff --git a/force-app/main/default/pages/NewAndEditAgencyContact.page b/force-app/main/default/pages/NewAndEditAgencyContact.page
index 639f9dc..346569a 100644
--- a/force-app/main/default/pages/NewAndEditAgencyContact.page
+++ b/force-app/main/default/pages/NewAndEditAgencyContact.page
@@ -81,7 +81,8 @@
let arr = data.object[f].split(';');
// 缁欓殣钘忕殑select璧嬪��
- for(let op of ele.options){
+ for(let opi in ele.options){
+ let op = ele.options[opi]
op.selected = arr.indexOf(op.value)>-1;
}
@@ -136,7 +137,8 @@
}
var GetEleApiName = function(ele){
- for(let c of ele.classList){
+ for(let ci in ele.classList){
+ let c = ele.classList[ci]
if(c.indexOf(config.ApiPrefix+'_')>-1){
return c.replace(config.ApiPrefix+'_','');
}
@@ -167,8 +169,10 @@
error_msg += ';鐢佃瘽鍙风爜閿欒';
}
- for(let e of document.getElementsByTagName('select')){
- for(let op of e.options){
+ for(let ei in document.getElementsByTagName('select')){
+ let e = e.options[ei];
+ for(let opi in e.options){
+ let op = e.options[opi];
if(op.value == "*****" && op.selected){
error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」';
}
@@ -207,9 +211,9 @@
v = ele.value;
}
- if(v && v != "000000000000000"){
+ // if(v && v != "000000000000000"){
result[field_api_name] = v;
- }
+ // }
}
} else if (ele.type == 'checkbox') {
@@ -301,14 +305,15 @@
//1. Get Sobject Information from Form
let sobjJson = getSobjectInformation();
//2. Validate the Sobject field value formate, for example the email formate or phone formate
-
- let validationResultMessage = validateFieldValueFormate();
- console.log(validationResultMessage);
- if (validationResultMessage) {
- //Popup error message. - To Do After POC
- alertErrorMessage(validationResultMessage);
- return
- }
+ //updated by Lijun0325 Start
+ //let validationResultMessage = validateFieldValueFormate();
+ //console.log(validationResultMessage);
+ // if (validationResultMessage) {
+ // //Popup error message. - To Do After POC
+ // alertErrorMessage(validationResultMessage);
+ // return
+ // }
+ //updated by Lijun0325 End
// Check Required Field
let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson);
if (checkRequiredFieldMsgResult) {
@@ -357,7 +362,8 @@
console.log(accountValue);
if(true || accountValue !='000000000000000'){
let baseUrl = "/apex/SearchContactPage";
- let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue;
+ let searchContactKeyWord = document.querySelector("[data-id='Contact__c']").value;
+ let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord;
let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no';
newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam);
if (window.focus) {
@@ -399,18 +405,13 @@
let sfId = document.getElementById(document.querySelector("[data-id='Contact__c']").id + '_lkid').value;
let contactsInfo = JSON.parse('{!LookUpOverrideFieldsMapJson}');
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- fetch(url, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- 'pi-token': staticResources.token
+
+ AWSService.query(staticResourcesContact.queryUrl,dataId,function(result){
+ if(result.object){
+ document.querySelector("[data-id='Contact__c']").value = result.object.lastName;
}
- }).then((data) => {
- return data.json();
- }).then((result) => {
- document.querySelector("[data-id='Contact__c']").value = result.object.lastName;
- })
+
+ },staticResources.token);
}
</script>
@@ -477,6 +478,10 @@
</apex:repeat>
<script>
sfdcPage.appendToOnloadQueue(function () {
+
+ //Replace Vlookup Field
+ replaceSearchContactLookup();
+
//1. Set Last Name label
//document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕';
//2. Query AWS Data by dataId
@@ -484,10 +489,81 @@
if (!{!isNewMode}) {
blockme();
QuerySobjectFromAWS();
+ }else{
+ let ot = jQuery('input[data-id="OwnerId"]');
+ let oi = document.getElementById(ot.attr("id")+'_lkid');
+ ot.val('{!CurrentUserName}');
+ ot.attr("readonly","");
+ ot.css("background","unset");
+ ot.css("border","0");
+ ot.css("outline","0");
+
+ if(oi){
+ oi.value = '{!CurrentUserId}'
+ }
+ }
+ jQuery('a[data-id="OwnerId"]').remove();
+
+ /*
+ jQuery(".lookupInput").each(function(i,e){
+ let je =jQuery(e).find('input');
+ je.attr("readonly","");
+ je.css("background","unset");
+
+ let dataid = je.attr('data-id');
+ if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return;
+ jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">');
+ })
+
+ jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){
+ this.className = "closeIconOn";
+ });
+
+ jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){
+ this.className = "closeIcon"
+ });
+
+ jQuery(".lookupInput").on("click","img[generate]",function(e){
+ let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id");
+ let input = document.getElementById(id);
+ if(input){
+ input.value = '';
+ let hidden = document.getElementById(id+'_lkid');
+ if(hidden){
+ hidden.value = '';
+ }
+ }
+ });*/
+ let previous_value = {};
+ jQuery(".lookupInput input").each(function(i,e){
+ let je =jQuery(e);
+
+ let dataid = je.attr('data-id');
+ if(['Contact__c'].indexOf(dataid) < 0) return;
+
+ jQuery(e).focus(function(){
+ previous_value[this.id] = this.value;
+ })
+
+ jQuery(e).change(function(){
+ if (previous_value[this.id] != jQuery(this).val()) {
+ document.getElementById(this.id+'_lkid').value = '';
+ }
+ })
+ })
+
+ 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) {
+ document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField);
+ }
+ }
}
- //Replace Vlookup Field
- replaceSearchContactLookup();
+
});
</script>
<div class="pbBottomButtons">
--
Gitblit v1.9.1