From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111

---
 force-app/main/default/pages/NewAndEditCase.page |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/pages/NewAndEditCase.page b/force-app/main/default/pages/NewAndEditCase.page
index 5c02f89..589b717 100644
--- a/force-app/main/default/pages/NewAndEditCase.page
+++ b/force-app/main/default/pages/NewAndEditCase.page
@@ -20,7 +20,8 @@
         var requiredAPIToChangedLabelMap = new Map();
         requiredAPIToChangedLabelMap.set('LastName', '{!PIPL_Name_Label}');
         console.log('{!contactsInfo}');
-        var VLookUpFields = new Set(['Account__c', 'ContactId', 'Asset__c', 'prod__c', 'Competitor_info__c', 'AccountId', 'Field1_staff__c','OwnerId']);
+        //var VLookUpFields = new Set(['Account__c', 'ContactId', 'Asset__c', 'prod__c', 'Competitor_info__c', 'AccountId', 'Field1_staff__c','OwnerId']);
+        var VLookUpFields = {! VLookUpFieldsJson};
         //鍒ゆ柇insert or update
         function ProcessPI(caseJson, payloadForNewPI) {
             blockme();
@@ -131,15 +132,25 @@
                 }
             } 
             for (let index = 0; index < nodelist.length; index++) {
-                if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) {
+                let tag_name = nodelist[index].tagName.toLowerCase();
+                if(tag_name == 'div'){
+                    console.log(nodelist[index])
+                }
+                if (VLookUpFields.indexOf(nodelist[index].getAttribute("data-id")) >= 0) {
                     console.log(nodelist[index].id.indexOf('lkwgt'));
                     if (nodelist[index].id.indexOf('lkwgt') == -1) {
                         let vlookUpNodeId = nodelist[index].id + '_lkid';
-                        if (nodelist[index].tagName.toLowerCase() == 'div') {
+                        if (tag_name == 'div') {
                             vlookUpNodeId = nodelist[index].id.substring(0,nodelist[index].id.length-4) + '_lkid';
                         }
-                        let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value;
-                        result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue;
+                        let vlookUpNodeValue = document.getElementById(vlookUpNodeId);
+                        let v = '';
+                        if(vlookUpNodeValue){
+                            v = vlookUpNodeValue.value;
+                        }else{
+                            v = nodelist[index].value;
+                        }
+                        result[nodelist[index].getAttribute("data-id")] = v;
                     }
                 } else if (nodelist[index].type == 'checkbox') {
                     result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked;
@@ -236,9 +247,9 @@
         function checkRequiredFieldMsg(formData) {
             let blankRequiredFields = '';
             for (i = 0; i < requiredFieldAPIList.length; i++) {
-                if (formData[requiredFieldAPIList[i]] && !VLookUpFields.has(requiredFieldAPIList[i])) {
+                if (formData[requiredFieldAPIList[i]] && (VLookUpFields.indexOf(requiredFieldAPIList[i]) == -1)) {
                     continue;
-                }else if(VLookUpFields.has(requiredFieldAPIList[i]) && formData[requiredFieldAPIList[i]] != '000000000000000'){
+                }else if((VLookUpFields.indexOf(requiredFieldAPIList[i]) != -1) && formData[requiredFieldAPIList[i]] != '000000000000000'){
                     continue;
                 } else {
                     let fieldAPIValue = requiredFieldAPIList[i]
@@ -461,6 +472,17 @@
                             if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
                                 let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']");
                                 e.disabled = !(layoutField.editableField);
+                                // update 20220621 By Chen Yanan Start
+                                if(e.tagName == 'TEXTAREA' && layoutField.fieldAPI!= 'Staff_manual__c'){
+                                    console.log('add element');
+                                    e.cols = "75";
+                                    e.rows = "6";
+                                } else if(e.tagName == 'TEXTAREA' && layoutField.fieldAPI == 'Staff_manual__c'){
+                                    console.log('add element');
+                                    e.cols = "40";
+                                    e.rows = "2";
+                                }
+                                // update 20220621 By Chen Yanan End
                                 /*
                                 if (!(layoutField.editableField)) {
                                     if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') {

--
Gitblit v1.9.1