From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 15:10:02 +0800 Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte --- force-app/main/default/pages/NewRepair.page | 382 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 304 insertions(+), 78 deletions(-) diff --git a/force-app/main/default/pages/NewRepair.page b/force-app/main/default/pages/NewRepair.page index e3f4b2a..822db24 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-17-2022 + @last modified on : 03-30-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> @@ -10,7 +10,7 @@ <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> - <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> + <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> <style> .disabledbutton { pointer-events: none; @@ -19,38 +19,65 @@ </style> <script> //Initial Required Information + var staticResourceContact = JSON.parse('{!staticResourceContact}'); + var staticResourceAddress = JSON.parse('{!staticResourceAddress}'); var staticResources = JSON.parse('{!staticResource}'); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start + var staticResourcesV2 = JSON.parse('{!staticResourceV2}'); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}'); var fieldAPIToLabelMap = JSON.parse('{!fieldAPIToLabelMapStr}'); - var VLookUpFields = new Set(['Delivered_Product__c','Hospital__c','Department_Class__c','Account__c','Dealer__c','Incharge_Staff_Contact__c','Maintenance_Contract__c','VM_Maintenance_Contract__c','Repair_Quotation_Id__c','RepairSubOrder__c','On_Call_ID__c','QIS_ID__c','InsReport__c','NFM108_Receipt__c','Rental_Apply_Equipment_Set_Detail__c']); - var userVLookUpFields = ['Incharge_Staff__c','Repair_Authenticator__c','OCSM_RC_CordingUser__c','OSH_Affirmant__c','OSHRAConfirmUser__c']; + //var VLookUpFields = new Set(['Source_QIS__c', 'AC_PAED__c', 'RC_PAED__c', 'Delivered_Product__c','Maintenance_Contract_Asset_Estimate__c','Asset__c','TransferApplyDetail__c','Hospital__c','Department_Class__c','Account__c','Dealer__c','Incharge_Staff_Contact__c','Maintenance_Contract__c','Repair_Alternative_ProductList_c__c','VM_Maintenance_Contract__c','Repair_Quotation_Id__c','RepairSubOrder__c','On_Call_ID__c','QIS_ID__c','InsReport__c','NFM108_Receipt__c','Rental_Apply_Equipment_Set_Detail__c']); + var VLookUpFields = {! VLookUpFieldsJson}; + var userVLookUpFields = ['Incharge_Staff__c','Repair_Authenticator__c','OCSM_RC_CordingUser__c','OSH_Affirmant__c','OSHRAConfirmUser__c', 'Repair_Determine_result_ConfirmationUser__c', 'ZongjianApprovalManager__c', 'BuchangApprovalManager__c', 'JingliApprovalManager__c', 'Repair_complete_asset_final_check_staff__c', '']; var redirectMode = 'Save'; //Redirect Required Parameter var redirectCallBack = function redirectCallBack(sfId, errorMessage) { - if (sfId) { - if (redirectMode == 'Save') { - window.open('/' + sfId, '_self'); - } else if (redirectMode == 'SaveAndNew') { - window.open('/setup/ui/recordtypeselect.jsp?ent=' + '{!sobjectId}' + '&retURL=/' + '{!sobjectPrefix}' + '/o&save_new_url=/' + '{!sobjectPrefix}' + '/e?retURL=%2F' + '{!sobjectPrefix}' + '%2Fo', '_self'); - } - } else { - // alert(errorMessage); + if(sfId){ + Visualforce.remoting.Manager.invokeAction( + 'NewRepairController.EncryptUpdate', // example + sfId, + function (result, event) { + console.log(result); + if(result.message){ + alert(result.message); + } + if (redirectMode == 'Save') { + window.open('/' + sfId, '_self'); + } else if (redirectMode == 'SaveAndNew') { + window.open('/setup/ui/recordtypeselect.jsp?ent=' + '{!sobjectId}' + '&retURL=/' + '{!sobjectPrefix}' + '/o&save_new_url=/' + '{!sobjectPrefix}' + '/e?retURL=%2F' + '{!sobjectPrefix}' + '%2Fo', '_self'); + } + + }, + { escape: true } + ); + + }else{ 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 - var queryBack = function queryBack(data) { - console.log('data = ' + data); - 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; - unblockUI(); - }; + // var queryBack = function queryBack(data) { + // console.log('data = ' + data); + // 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; + // unblockUI(); + // }; //Check If Insert Or Update var insertOrUpdateBack = function insertOrUpdateBack(payloadJson, result, isNewMode) { @@ -65,19 +92,21 @@ payloadJson.address_ZipCode__c = r.object[0].addressZipCode; payloadJson.Detailed_Address__c = r.object[0].detailedAddress; payloadJson.RepairApplicant__c = r.object[0].repairApplicant; - payloadJson.Address_Contacts_Encrypt__c = r.object[0].addressContactsEncrypt; - payloadJson.Address_Contacts_Name_Encrypt__c = r.object[0].addressContactsNameEncrypt; - payloadJson.Address_Telephone_Encrypt__c = r.object[0].addressTelephoneEncrypt; - payloadJson.Address_ZipCode_Encrypt__c = r.object[0].addressZipCodeEncrypt; - payloadJson.Detailed_Address_Encrypt__c = r.object[0].detailedAddressEncrypt; - payloadJson.Repair_Applicant_Encrypt__c = r.object[0].repairApplicantEncrypt; + // payloadJson.Address_Contacts_Encrypt__c = r.object[0].addressContactsEncrypt; + // payloadJson.Address_Contacts_Name_Encrypt__c = r.object[0].addressContactsNameEncrypt; + // payloadJson.Address_Telephone_Encrypt__c = r.object[0].addressTelephoneEncrypt; + // payloadJson.Address_ZipCode_Encrypt__c = r.object[0].addressZipCodeEncrypt; + // payloadJson.Detailed_Address_Encrypt__c = r.object[0].detailedAddressEncrypt; + // payloadJson.Repair_Applicant_Encrypt__c = r.object[0].repairApplicantEncrypt; payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; if (isNewMode) { payloadJson.AWS_Data_Id__c = r.object[0].dataId; } else { payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; } - debugger + if('{!rtTypeId}'){ + payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421 + } return payloadJson; } @@ -125,12 +154,25 @@ let nodelist = document.querySelectorAll("[data-id]"); let result = {} 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'; - let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; - result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + if (tag_name == 'div') { + vlookUpNodeId = nodelist[index].id.substring(0,nodelist[index].id.length-4) + '_lkid'; + } + 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; @@ -150,22 +192,109 @@ } } for (let i = 0; i < userVLookUpFields.length; i++) { - let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; - console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); - if(userVlookUpNodeValue!='000000000000000'){ - result[userVLookUpFields[i]] = userVlookUpNodeValue; + if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ + // let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; + 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:j_id30: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; + } + //鏈慨鐞嗗綊杩樼悊鐢� + if(api_id_map['Return_Without_Repair_Reason__c']){ + result.Return_Without_Repair_Reason__c = document.getElementById(api_id_map['Return_Without_Repair_Reason__c']).value!='_\x01_'?document.getElementById(api_id_map['Return_Without_Repair_Reason__c']).value:''; + } console.log(JSON.stringify(result)); return result; } + + 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"); + } + } //Query from AWS function QueryRepairFromAWS() { AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } + + var queryBack = function queryBack(data) { + console.log(data); + if(document.querySelector("[data-id='address_Contacts__c']")) + document.querySelector("[data-id='address_Contacts__c']").value = data.object.addressContacts; + if(document.querySelector("[data-id='address_Contacts_Name__c']")) + document.querySelector("[data-id='address_Contacts_Name__c']").value = data.object.addressContactsName; + if(document.querySelector("[data-id='address_Telephone__c']")) + document.querySelector("[data-id='address_Telephone__c']").value = data.object.addressTelephone; + if(document.querySelector("[data-id='address_ZipCode__c']")) + document.querySelector("[data-id='address_ZipCode__c']").value = data.object.addressZipCode; + if(document.querySelector("[data-id='Detailed_Address__c']")) + document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress; + if(document.querySelector("[data-id='RepairApplicant__c']")) + 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); + if(document.querySelector("[data-id='address_Contacts__c']")) + document.querySelector("[data-id='address_Contacts__c']").value = data.object.lastName; + }; + var queryBackDecrypt = function queryBack(data) { + if(document.querySelector("[data-id='Detailed_Address__c']")) + document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress; + if(document.querySelector("[data-id='address_ZipCode__c']")) + document.querySelector("[data-id='address_ZipCode__c']").value = data.object.zipCode; + if(document.querySelector("[data-id='address_Telephone__c']")) + document.querySelector("[data-id='address_Telephone__c']").value = data.object.telephone; + AWSService.query(staticResourceContact.queryUrl, '{!ContactAWSDataId}', queryBackContact, staticResourceContact.token); + } //Update Sensitive Information to AWS function UpdatePIToAWS(repairJson, payloadForNewPI) { @@ -173,20 +302,28 @@ let obj = JSON.parse(payloadForNewPI); obj[0].dataId = '{!AWSDataId}'; let payloadForNewPIJson = JSON.stringify(obj); - AWSService.update(staticResources.updateUrl, repairJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack, redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start + //AWSService.update(staticResources.updateUrl, repairJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack, redirectCallBack); + AWSService.update(staticResourcesV2.updateUrl, repairJson, payloadForNewPIJson, controllerSaveMethod, staticResourcesV2.token, staticResources.transactionUrl, false, insertOrUpdateBack, redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end } //Insert Sensitive Information to AWS function NewPIToAWS(repairJson, payloadForNewPI) { let controllerSaveMethod = '{!$RemoteAction.NewRepairController.saveRepair}'; - AWSService.insert(staticResources.newUrl, repairJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 start + //AWSService.insert(staticResources.newUrl, repairJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack); + AWSService.insert(staticResourcesV2.newUrl, repairJson, payloadForNewPI, controllerSaveMethod, staticResourcesV2.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack); + //zhj MEBG鏂版柟妗堟敼閫� 2022-11-29 end } //Check Required Fields 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 == '') { @@ -202,6 +339,7 @@ //Base Process function saveRepairProcess(saveMode) { + EditButton(true); redirectMode = saveMode; console.log('redirectMode' + redirectMode); hiddenErrorMsgNode(); @@ -230,16 +368,17 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; unblockUI(); + EditButton(false); } //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -265,11 +404,7 @@ <div class="ptBreadcrumb"></div> </div> <apex:form id="form"> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block"> <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -278,7 +413,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="saveRepairProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRepairProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> @@ -287,14 +422,24 @@ </tbody> </table> </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> + </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> <!--Each section has layoutFields, let's iterate them as well--> <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> - <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" /> + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__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="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" + /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> </apex:repeat> @@ -302,6 +447,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}'); @@ -310,7 +477,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"); + } + } } } } @@ -319,38 +495,88 @@ 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"); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + document.getElementById('topButtonRow').style = ''; +聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = ''; + + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + 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 = ''; + if(['Incharge_Staff_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 = ''; } + }) + }) + + //缁翠慨涓績 + if('{!workLocationSelect}' != ''){ + let wlNode = document.getElementById(api_id_map['work_location_select__c']); + if(wlNode){ + wlNode.removeAttribute("disabled") + var o = new Option() + o.text = '{!workLocationSelect}' + wlNode.options.add(o) + wlNode.value = '{!workLocationSelect}' } - }); + } + + //濡傛灉浠庢姤淇瓙鍗曡繃鏉ワ紝闇�瑕佽В瀵嗘姤淇汉 + if('{!RepairSubOrderAWSDataId}' != ''){ + EditButton(true);//add by Li Jun 20220428 By Li Jun + blockme();//add by Li Jun 20220428 By Li Jun + var staticResourceRepairSubOrder = JSON.parse('{!staticResourceRepairSubOrder}'); + let queryBackRepairSubOrder = function queryBackRepairSubOrder(data) { + if(document.querySelector("[data-id='RepairApplicant__c']")) + document.querySelector("[data-id='RepairApplicant__c']").value = data.object.repairApplicantName; + unblockUI();//add by Li Jun 20220428 By Li Jun + EditButton(false);//add by Li Jun 20220428 By Li Jun + }; + debugger; + AWSService.query(staticResourceRepairSubOrder.queryUrl, '{!RepairSubOrderAWSDataId}', queryBackRepairSubOrder, staticResourceRepairSubOrder.token); + } + + // 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 = ''; + // } + // } + // }); }); </script> <div class="pbBottomButtons"> @@ -359,7 +585,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="saveRepairProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRepairProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> -- Gitblit v1.9.1